From 82e08a679bac7922ac2ed00ee3e438a36c0266a5 Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Sat, 23 Dec 2023 17:25:05 +0100 Subject: [PATCH] now working --- package.json | 5 +- src/app.postcss | 10 +- src/lib/utils.ts | 28 +++--- src/routes/+layout.svelte | 58 ++++++----- src/routes/+layout.ts | 1 + src/routes/api/guides/+server.ts | 5 +- src/routes/contacts/+page.svelte.md | 11 ++- src/routes/guides/+page.svelte | 11 ++- src/routes/guides/+page.ts | 5 +- src/routes/guides/[slug]/+page.svelte | 6 +- src/routes/guides/[slug]/+page.ts | 10 +- src/routes/guides/guides.svelte | 10 +- src/routes/guides/one.md | 7 -- src/routes/guides/proposer_guide.md | 31 ++++++ src/routes/guides/three.md | 7 -- src/routes/guides/two.md | 7 -- src/routes/reseaux/+page.svelte.md | 2 +- vite.config.ts | 1 - yarn.lock | 132 +++++++++++++++++++++++++- 19 files changed, 248 insertions(+), 99 deletions(-) delete mode 100644 src/routes/guides/one.md create mode 100644 src/routes/guides/proposer_guide.md delete mode 100644 src/routes/guides/three.md delete mode 100644 src/routes/guides/two.md diff --git a/package.json b/package.json index 611c812..f1d4a96 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "devDependencies": { "@sveltejs/adapter-auto": "^2.0.0", - "@sveltejs/adapter-static": "^2.0.3", + "@sveltejs/adapter-static": "^3.0.1", "@sveltejs/kit": "^1.20.4", "@tailwindcss/typography": "^0.5.9", "@types/node": "^20.8.10", @@ -29,6 +29,7 @@ }, "type": "module", "dependencies": { - "marked": "^9.1.5" + "marked": "^9.1.5", + "vite-plugin-markdown": "^2.1.0" } } diff --git a/src/app.postcss b/src/app.postcss index 5a4a9a6..52b1c64 100644 --- a/src/app.postcss +++ b/src/app.postcss @@ -9,13 +9,13 @@ @apply text-xl; } li { - @apply list-disc text-xl py-1; + @apply list-disc text-xl py-1 ml-8; } h1 { @apply text-3xl border-b-2 dark:border-b-white border-b-gray-400 py-2 font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-orange-300 to-orange-200; } h2 { - @apply text-2xl border-b-2 dark:border-b-white border-b-gray-400 py-2 font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-orange-300 to-orange-200; + @apply text-2xl border-b-2 dark:border-b-white border-b-gray-400 py-2 font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-orange-300 to-orange-200 mb-4 mt-4; } h3 { @apply text-2xl bg-white text-right underline py-2 font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-orange-200 to-orange-300 pr-4; @@ -23,6 +23,12 @@ h4 { @apply text-2xl text-right underline py-2 font-extrabold text-transparent bg-clip-text bg-gradient-to-r from-orange-200 to-orange-300 pr-4; } + pre { + @apply bg-base-300 border-white border-l-2 my-4 px-2 py-2 pl-4 + } + ul { + @apply my-2 + } } @tailwind components; @tailwind utilities; diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 68e0ef3..81c9b9b 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -6,19 +6,19 @@ export const shuffleArray = (array: any[]) => { }; export const fetchMarkdownGuides = async () => { -const allPostFiles = import.meta.glob('/src/routes/guides/*.md'); -const iterablePostFiles = Object.entries(allPostFiles); + const allGuideFiles = import.meta.glob('/src/routes/guides/*.md'); + const iterableGuideFiles = Object.entries(allGuideFiles); + // Also return the content + const allGuides = await Promise.all( + iterableGuideFiles.map(async ([path, resolver]) => { + const { metadata } = await (resolver() as Promise<{ metadata: any }>); + const guidePath = path.slice(11, -3); + return { + meta: metadata, + path: guidePath, + }; + }) + ); -const allPosts = await Promise.all( - iterablePostFiles.map(async ([path, resolver]) => { - const { metadata } = await (resolver() as Promise<{ metadata: any }>); - const postPath = path.slice(11, -3); - return { - meta: metadata, - path: postPath - }; - }) -); - - return allPosts; + return allGuides; }; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 50745c6..5d93a95 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -38,14 +38,14 @@ ? 'flex' : 'hidden'}" > - Évènements - Membres - Outils - Guides - Réseaux - Ressources - Presse - Contact + Évènements + Membres + Outils + Guides + Réseaux + Ressources + Presse + Contact @@ -66,31 +66,31 @@ @@ -101,10 +101,8 @@ diff --git a/src/routes/+layout.ts b/src/routes/+layout.ts index e69de29..c8cacf0 100644 --- a/src/routes/+layout.ts +++ b/src/routes/+layout.ts @@ -0,0 +1 @@ +export const prerender = true; \ No newline at end of file diff --git a/src/routes/api/guides/+server.ts b/src/routes/api/guides/+server.ts index d49673f..2838a14 100644 --- a/src/routes/api/guides/+server.ts +++ b/src/routes/api/guides/+server.ts @@ -4,9 +4,10 @@ import { json } from '@sveltejs/kit'; export const GET = async () => { const allPosts = await fetchMarkdownGuides(); - const sortedPosts = allPosts.sort((a, b) => { + const sortedGuides = allPosts.sort((a, b) => { return new Date(b.meta.date).getTime() - new Date(a.meta.date).getTime(); }); - return json(sortedPosts); + console.log(sortedGuides) + return json(sortedGuides); }; diff --git a/src/routes/contacts/+page.svelte.md b/src/routes/contacts/+page.svelte.md index 05f365a..e10e884 100644 --- a/src/routes/contacts/+page.svelte.md +++ b/src/routes/contacts/+page.svelte.md @@ -7,4 +7,13 @@ # Contact - +[Livecoding.fr](https://livecoding.fr) n'est ni un collectif ni une organisation. L'objectif de ce site est uniquement de centraliser l'information et de donner plus de visibilité à la scène live coding francophone. Pour discuter et rencontre des _live coders_ francophones, voici quelques liens : + +
+ +- [Cookie Collective](https://discord.gg/VZQGhUC) (Discord) : Discord du collectif parisien Cookie Collective, rassemble beaucoup de _live coders_. +- [Creative Code Lyon](https://discord.gg/zwjmAaeEAH) (Discord) : Discord du groupe _Creative Code Lyon_ pour l'est/sud-est de la France. +- [TOPLAP](https://discord.gg/jtYGAsUggT) (Discord) : Collectif international [TOPLAP](https://toplap.org), avec des sections francophones. +- Mais aussi, contacter individuellement des artistes et _performers_. + +
diff --git a/src/routes/guides/+page.svelte b/src/routes/guides/+page.svelte index 986338a..5f3933e 100644 --- a/src/routes/guides/+page.svelte +++ b/src/routes/guides/+page.svelte @@ -1,14 +1,17 @@ - -

Articles

+

Guides

-

Pour proposer un article, référez-vous à l'article Proposer un article. Nous acceptons toutes les collaborations.

+ + +

Articles publiés