From 384d1d10373974edb18478407e5c5367a8d89cc3 Mon Sep 17 00:00:00 2001 From: Filipe Medeiros Date: Sun, 3 Dec 2023 14:38:04 +0100 Subject: [PATCH] library is done --- frontend/src/content/config.ts | 20 ++-- .../library/en/doughnut-economics.yaml | 7 ++ .../library/en/limits-to-growth-30.yaml | 11 ++ .../content/library/en/mission-economy.yaml | 10 ++ .../library/pt/doughnut-economics.yaml | 7 ++ .../library/pt/limits-to-growth-30.yaml | 12 ++ .../content/library/pt/mission-economy.yaml | 11 ++ frontend/src/env.d.ts | 1 + frontend/src/pages/biblioteca/index.astro | 113 +++++++++--------- frontend/src/pages/library/index.astro | 32 ++--- 10 files changed, 139 insertions(+), 85 deletions(-) create mode 100644 frontend/src/content/library/en/doughnut-economics.yaml create mode 100644 frontend/src/content/library/en/limits-to-growth-30.yaml create mode 100644 frontend/src/content/library/en/mission-economy.yaml create mode 100644 frontend/src/content/library/pt/doughnut-economics.yaml create mode 100644 frontend/src/content/library/pt/limits-to-growth-30.yaml create mode 100644 frontend/src/content/library/pt/mission-economy.yaml diff --git a/frontend/src/content/config.ts b/frontend/src/content/config.ts index 3e94084..139e443 100644 --- a/frontend/src/content/config.ts +++ b/frontend/src/content/config.ts @@ -1,11 +1,15 @@ -// 1. Import utilities from `astro:content` -import { defineCollection } from 'astro:content'; -// 2. Define your collection(s) -const blogCollection = defineCollection({ - /* ... */ +import { defineCollection, z } from 'astro:content'; + +const libraryCollection = defineCollection({ + type: 'data', + schema: z.object({ + title: z.string(), + checkedOut: z.boolean(), + link: z.string().url(), + description: z.string().optional(), + }), }); -// 3. Export a single `collections` object to register your collection(s) -// This key should match your collection directory name in "src/content" + export const collections = { - blog: blogCollection, + library: libraryCollection, }; diff --git a/frontend/src/content/library/en/doughnut-economics.yaml b/frontend/src/content/library/en/doughnut-economics.yaml new file mode 100644 index 0000000..fa0953b --- /dev/null +++ b/frontend/src/content/library/en/doughnut-economics.yaml @@ -0,0 +1,7 @@ +title: 'Doughnut Economics: Seven Ways to Think Like a 21st-Century Economist' +checkedOut: true +link: 'https://www.kobo.com/ie/en/ebook/doughnut-economics' +description: > + I loved it and highly recommend it! It's a book about economics, but a very unorthodox one. + It has a degrowth side to it, but it's a great read for any person that wants a breath of + fresh air in the field of economics. diff --git a/frontend/src/content/library/en/limits-to-growth-30.yaml b/frontend/src/content/library/en/limits-to-growth-30.yaml new file mode 100644 index 0000000..468e418 --- /dev/null +++ b/frontend/src/content/library/en/limits-to-growth-30.yaml @@ -0,0 +1,11 @@ +title: 'Limits to Growth: The 30-Year Update' +checkedOut: true +link: 'https://www.kobo.com/ie/en/ebook/limits-to-growth-1' +description: > + This book completely solidified my urge to study political economics and + system dynamics. It takes on a realistic but duly urgent approach about the problems + that haunted the world at the beginning of the 21st century and that, unfortunately, + still do. The authors present clear solutions but, above all, a new way of thinking + about what it means to live in a society and the potential the human being has to build + a new global community with well-being and Nature preservation at the core, based + on empirical data when possible. diff --git a/frontend/src/content/library/en/mission-economy.yaml b/frontend/src/content/library/en/mission-economy.yaml new file mode 100644 index 0000000..1f2ae93 --- /dev/null +++ b/frontend/src/content/library/en/mission-economy.yaml @@ -0,0 +1,10 @@ +title: 'Mission Economy: A Moonshot Guide to Changing Capitalism' +checkedOut: true +link: 'https://www.kobo.com/us/en/ebook/mission-economy-1' +description: > + I've read about half of the book (maybe a bit more, if you don't count references, etc). + I can't say I was impressed. The book tries to use the case of Nasa's Apolo XIII project + to explore how the Srare can and should be a leader in society, guiding investment, picking + strategic areas, taking tisks for the common good, etc. However, I felt lost in the middle + of the analogy, not being able to make a clear connection to its more general implications. + I still haven't finished the book. One day I'll try again. diff --git a/frontend/src/content/library/pt/doughnut-economics.yaml b/frontend/src/content/library/pt/doughnut-economics.yaml new file mode 100644 index 0000000..f98b4bf --- /dev/null +++ b/frontend/src/content/library/pt/doughnut-economics.yaml @@ -0,0 +1,7 @@ +title: 'Economia Donut: Sete Formas de Pensar Como um Economista no Século XXI' +checkedOut: true +link: 'https://www.wook.pt/ebook/economia-donut-kate-raworth/21400895' +description: > + 'Adorei e recomendo vivamente! É um livro sobre economia, mas muito pouco ortodoxo. + Tem uma faceta decrescentista, mas é uma ótima leitura para qualquer pessoa que queira + uma lufada de ar fresco no tópico de economia.' diff --git a/frontend/src/content/library/pt/limits-to-growth-30.yaml b/frontend/src/content/library/pt/limits-to-growth-30.yaml new file mode 100644 index 0000000..ac78055 --- /dev/null +++ b/frontend/src/content/library/pt/limits-to-growth-30.yaml @@ -0,0 +1,12 @@ +title: 'Limites do Crescimento: A Atualização de 30 Anos' +checkedOut: true +link: 'https://www.scribd.com/document/422266661/Limites-Do-Crescimento-A-Atualizacao-de-30-Anos' +description: > + Este livro solidificou por completo a minha vontade de estudar economia política + e dinâmica de sistemas. É uma abordagem realista mas devidamente urgente sobre os + problemas que assolavam o mundo no início do século XXI e que, muito infelizmente, + ainda continuam presentes. As autoras apresentam soluções claras, mas, acima de tudo, + uma nova maneira de pensar sobre o que é viver em sociedade e o potencial que o ser humano + tem para construir uma comunidade global com o bem-estar e a preservação da Natureza em + primeiro lugar, baseadas em dados empíricos sempre que possível. PS: Não consegui encontrar + um link melhor para a versão portuguesa do livro, desculpem! diff --git a/frontend/src/content/library/pt/mission-economy.yaml b/frontend/src/content/library/pt/mission-economy.yaml new file mode 100644 index 0000000..23cd86d --- /dev/null +++ b/frontend/src/content/library/pt/mission-economy.yaml @@ -0,0 +1,11 @@ +title: 'Economia de Missão: Um guia ousado e inovador para mudar o capitalismo' +checkedOut: true +link: 'https://www.wook.pt/ebook/economia-de-missao-mariana-mazzucato/25383261' +description: > + Já li cerca de metade do livro (talvez mais, se excluir referências, etc). + Não posso dizer que fiquei impressionado. O livro tenta usar o caso do projeto Apolo XIII + da NASA para explorar como o Estado pode e deve ser um líder na sociedade, guiando + investimentos, escolhendo áreas estratégicas, tomando riscos pelo bem comum, etc. + No entanto, sinto que fiquei perdido no meio da analogia, sem conseguir fazer uma + ligação clara às suas implicações mais gerais. Ainda não acabei o livro. + Um dia terei de voltar. diff --git a/frontend/src/env.d.ts b/frontend/src/env.d.ts index f964fe0..acef35f 100644 --- a/frontend/src/env.d.ts +++ b/frontend/src/env.d.ts @@ -1 +1,2 @@ +/// /// diff --git a/frontend/src/pages/biblioteca/index.astro b/frontend/src/pages/biblioteca/index.astro index 475682b..3a63eb3 100644 --- a/frontend/src/pages/biblioteca/index.astro +++ b/frontend/src/pages/biblioteca/index.astro @@ -1,65 +1,62 @@ --- -import client from "../../lib/cms/client"; -import { forLibraryPage } from "../../lib/cms/queries/libraryItems"; -import ButtonLink from "../../components/ButtonLink.astro"; -import CardLink from "../../components/CardLink.astro"; -import PageTitle from "../../components/PageTitle.astro"; -import Layout from "../../layouts/Layout.astro"; +import ButtonLink from '../../components/ButtonLink.astro'; +import CardLink from '../../components/CardLink.astro'; +import PageTitle from '../../components/PageTitle.astro'; +import Layout from '../../layouts/Layout.astro'; +import { getCollection } from 'astro:content'; -const libraryItems: { - description: string; - checkedOut: boolean; - link: string; - title: string; -}[] = await client.fetch(forLibraryPage, { - lang: "pt_PT", -}); +const libraryItems = await getCollection('library', ({ id }) => + id.startsWith('pt'), +); --- -
- Biblioteca -

- Livros, artigos, etc. que já li e que recomendo - ou que quero ler num futuro próximo. Se um item tiver uma marca "", siginifca que eu já o li, vi, etc. -

-
-
    - { - libraryItems.map(({ title, description, link, checkedOut }) => ( - - - {title} - -

    {description}

    - {checkedOut && ( - - )} -
    - )) - } -
- - - +
+ Biblioteca +

+ Livros, artigos, etc. que já li e que + recomendo ou que quero ler num futuro próximo. Se um item tiver uma marca + "", siginifca que eu já o li, vi, etc. +

+
+
    + { + libraryItems.map(({ data: { title, description, link, checkedOut } }) => ( + +
    +
    +

    + {title} +

    + {checkedOut && } +
    +

    {description}

    +
    +
    + )) + } +
+ + +
diff --git a/frontend/src/pages/library/index.astro b/frontend/src/pages/library/index.astro index 9600c5f..0d65f87 100644 --- a/frontend/src/pages/library/index.astro +++ b/frontend/src/pages/library/index.astro @@ -1,19 +1,13 @@ --- -import client from "../../lib/cms/client"; -import { forLibraryPage } from "../../lib/cms/queries/libraryItems"; -import ButtonLink from "../../components/ButtonLink.astro"; -import CardLink from "../../components/CardLink.astro"; -import PageTitle from "../../components/PageTitle.astro"; -import Layout from "../../layouts/Layout.astro"; +import ButtonLink from '../../components/ButtonLink.astro'; +import CardLink from '../../components/CardLink.astro'; +import PageTitle from '../../components/PageTitle.astro'; +import Layout from '../../layouts/Layout.astro'; +import { getCollection } from 'astro:content'; -const libraryItems: { - description: string; - checkedOut: boolean; - link: string; - title: string; -}[] = await client.fetch(forLibraryPage, { - lang: "en_EN", -}); +const libraryItems = await getCollection('library', ({ id }) => + id.startsWith('en'), +); --- Library

- Books, articles, etc. that I've read and recommend - or that I want to check out in the near future. If an item has a checkmark - "", that means I've read it, - listened to it, + Books, articles, etc. that I've read and + recommend or that I want to check out in the near future. If an item has a + checkmark "", that means I've read + it, listened to it, etc.

    { - libraryItems.map(({ title, description, link, checkedOut }) => ( + libraryItems.map(({ data: { title, description, link, checkedOut } }) => ( {title}