diff --git a/astro.config.mjs b/astro.config.mjs index 6befd58..e9a6363 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -3,8 +3,13 @@ import preact from '@astrojs/preact' import mdx from '@astrojs/mdx' +import yaml from '@rollup/plugin-yaml' + // https://astro.build/config export default defineConfig({ + vite: { + plugins: [yaml()], + }, server: { port: 3000, }, @@ -14,5 +19,5 @@ export default defineConfig({ }, }, integrations: [preact(), mdx()], - output: 'static' + output: 'static', }) diff --git a/bun.lockb b/bun.lockb index a767dd5..bd805e6 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index ea1b46c..3f3d964 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ }, "devDependencies": { "@astrojs/mdx": "^3.1.7", + "@rollup/plugin-yaml": "^4.1.2", "@types/katex": "^0.16.7", "jsdom": "^24.1.1", "linkedom": "^0.18.4", diff --git a/src/assets/macchinisti/francesco-baldino.jpg b/src/assets/macchinisti/francesco-baldino.jpg deleted file mode 100644 index 3120cbe..0000000 Binary files a/src/assets/macchinisti/francesco-baldino.jpg and /dev/null differ diff --git a/src/assets/macchinisti/illya-serdyuk.jpg b/src/assets/macchinisti/illya-serdyuk.jpg deleted file mode 100644 index 3120cbe..0000000 Binary files a/src/assets/macchinisti/illya-serdyuk.jpg and /dev/null differ diff --git a/src/components/Bubble.astro b/src/components/Bubble.astro index 14179fa..625c2bc 100644 --- a/src/components/Bubble.astro +++ b/src/components/Bubble.astro @@ -14,7 +14,8 @@ const ICONS_MAP = { type Props = { image: ImageMetadata fullName: string - date: string + entranceDate: number + exitDate?: number description: string social?: { github?: string @@ -24,13 +25,13 @@ type Props = { } } -const { image, fullName, date, description, social } = Astro.props +const { image, fullName, entranceDate, exitDate, description, social } = Astro.props ---
{fullName.toLowerCase()}
{fullName}
-
{date}
+
{entranceDate}—{exitDate ?? 'Presente'}
{description}
{ social && ( diff --git a/src/components/Header.astro b/src/components/Header.astro index 11753a0..ea04268 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -1,17 +1,36 @@ +--- +const links = [ + { href: '/utenti', text: 'Utenti' }, + // { href: '/macchinisti', text: 'Macchinisti' }, + // { href: '/appunti', text: 'Appunti' }, + { href: '/notizie', text: 'Notizie' }, + { href: '/guide', text: 'Guide' }, + { href: '/storia', text: 'Storia' }, + // { href: '/login', text: 'Login' }, +] +--- +
+ + + + + + +
+ +
diff --git a/src/data/current-macchinisti.json b/src/data/current-macchinisti.json deleted file mode 100644 index a6c2695..0000000 --- a/src/data/current-macchinisti.json +++ /dev/null @@ -1,47 +0,0 @@ -[ - { - "fullName": "Antonio De Lucreziis", - "dateIn": "2019", - "dateOut": "", - "description": "Description here", - "github": "https://github.com/adelucreziis", - "website": "", - "linkedin": "" - }, - { - "fullName": "Luca Lombardo", - "dateIn": "2024", - "dateOut": "", - "description": "Algoritmi e Strutture Dati Bla Bla", - "github": "https://github.com/lukefleed", - "website": "https://lukefleex.xyz", - "linkedin": "https://www.linkedin.com/in/l-lombardo/" - }, - { - "fullName": "Francesco Minnocci", - "dateIn": "2022", - "dateOut": "", - "description": "Ho una laurea(?)", - "github": "https://github.com/BachoSeven", - "website": "https://bachoseven.com", - "linkedin": "" - }, - { - "fullName": "Francesco Baldino", - "dateIn": "2022", - "dateOut": "", - "description": "Bla Bla", - "github": "", - "website": "", - "linkedin": "" - }, - { - "fullName": "Illya Serdyuk", - "dateIn": "2019", - "dateOut": "", - "description": "Bla Bla", - "github": "", - "website": "", - "linkedin": "" - } - ] diff --git a/src/data/macchinisti.yaml b/src/data/macchinisti.yaml new file mode 100644 index 0000000..40154b6 --- /dev/null +++ b/src/data/macchinisti.yaml @@ -0,0 +1,35 @@ +- fullName: Antonio De Lucreziis + entranceDate: 2019 + description: | + Appassionato di geometria computazionale, parser, teoria dei linguaggi di programmazione. + social: + github: https://github.com/aziis98 + website: https://poisson.phc.dm.unipi.it/~delucreziis/ + +- fullName: Luca Lombardo + entranceDate: 2024 + description: Algoritmi e Strutture Dati bla bla + social: + github: https://github.com/lukefleed + website: https://lukefleex.xyz + linkedin: https://www.linkedin.com/in/l-lombardo/ + +- fullName: Francesco Minnocci + entranceDate: 2022 + description: Ho una laurea (?), bla bla tastiere meccaniche + social: + github: https://github.com/BachoSeven + website: https://bachoseven.com + +- fullName: Francesco Baldino + entranceDate: 2022 + description: Bla bla Star Wars + +- fullName: Illya Serdyuk + entranceDate: 2020 + description: Bla bla Void Linux + +- fullName: Francesco Manicastri + entranceDate: 2022 + exitDate: 2024 + description: Bla bla Keenan Crane diff --git a/src/data/past-macchinisti.json b/src/data/past-macchinisti.json deleted file mode 100644 index bfe72e2..0000000 --- a/src/data/past-macchinisti.json +++ /dev/null @@ -1,11 +0,0 @@ -[ - { - "fullName": "Francesco Manicastri", - "dateIn": "2022", - "dateOut": "2024", - "description": "Geometria bla bla", - "github": "", - "website": "", - "linkedin": "" - } - ] \ No newline at end of file diff --git a/src/files.d.ts b/src/files.d.ts new file mode 100644 index 0000000..bdad603 --- /dev/null +++ b/src/files.d.ts @@ -0,0 +1,17 @@ +declare module '*.yaml' { + const value: any // Add type definitions here if desired + export default value +} + +declare module '@/data/macchinisti.yaml' { + type Macchinista = { + fullName: string + entranceDate: number + exitDate?: number + description: string + social: Record + } + + const value: Macchinista[] + export default value +} diff --git a/src/pages/macchinisti.astro b/src/pages/macchinisti.astro index 37aa630..7d6eb9d 100644 --- a/src/pages/macchinisti.astro +++ b/src/pages/macchinisti.astro @@ -4,28 +4,31 @@ import Header from '../components/Header.astro' import Footer from '../components/Footer.astro' import Bubble from '../components/Bubble.astro' -import currentMacchinisti from '../data/current-macchinisti.json' -import pastMacchinisti from '../data/past-macchinisti.json' +import macchinisti from '@/data/macchinisti.yaml' +macchinisti.sort((a, b) => b.entranceDate - a.entranceDate) // Import all images from assets folder -const images = import.meta.glob('@/assets/macchinisti/*.{jpg,jpeg,png,gif}', { - eager: true -}) +const images: Record = Object.fromEntries( + await Promise.all( + Object.entries(import.meta.glob('@/assets/macchinisti/*')).map(async ([path, module]) => [ + path.split('/').pop()!.split('.')[0], + // @ts-ignore + (await module()).default, + ]) + ) +) -// Sort by dateIn -const sortedCurrent = currentMacchinisti.sort((a, b) => parseInt(a.dateIn) - parseInt(b.dateIn)) -const sortedPast = pastMacchinisti.sort((a, b) => parseInt(a.dateIn) - parseInt(b.dateIn)) +console.log(macchinisti) +console.log(images) -// Define a fallback image metadata -const fallbackImage = { default: 'assets/macchinisti/fallback.jpg' } +const currentMacchinisti = macchinisti.filter(macchinista => !macchinista.exitDate) +const pastMacchinisti = macchinisti.filter(macchinista => macchinista.exitDate) -// Function to get image for a macchinista -const getImage = (fullName: string) => { - const imageName = fullName.toLowerCase().replaceAll(' ', '-') - const imageModule = Object.entries(images).find(([path]) => - path.includes(imageName) - )?.[1] - return imageModule || fallbackImage +const getMacchinistaPicture = (fullName: string): ImageMetadata => { + const macchinistaId = fullName.toLowerCase().replace(/\s+/g, '-') + console.log(macchinistaId) + + return images[macchinistaId] ?? images['fallback'] } --- @@ -40,43 +43,40 @@ const getImage = (fullName: string) => {
- {sortedCurrent.map(async (macchinista) => ( - - ))} + { + currentMacchinisti.map(macchinista => ( + + )) + }
-
Ex Macchinisti
+
Deus Ex Macchinisti

Gli vogliamo molto bene, hanno fatto grandi cose!

- {sortedPast.map(async (macchinista) => ( - - ))} + { + pastMacchinisti.map(macchinista => ( + + )) + }