From 0857f02cfec998ebcd997fa9b1e2e8579a2d7ef2 Mon Sep 17 00:00:00 2001 From: pancakes Date: Tue, 23 Apr 2024 22:43:13 +1000 Subject: [PATCH] Reimplement base site --- package-lock.json | 64 ++++ package.json | 3 +- src/data/links.json | 26 ++ src/lib/components/ArticleHeader.svelte | 38 ++ src/lib/components/DateTime.svelte | 31 ++ src/lib/components/Footer.svelte | 30 ++ src/lib/components/Navbar.svelte | 92 +++++ src/lib/pages.js | 29 ++ src/routes/+error.svelte | 14 + src/routes/+layout.svelte | 28 ++ src/routes/+page.svelte | 212 ++++++++++- src/routes/[slug]/+page.js | 12 + src/routes/[slug]/+page.svelte | 17 + src/routes/style.css | 359 ++++++++++++++++++ static/assets/buttons/css.jpg | Bin 0 -> 2360 bytes static/assets/buttons/emulate.gif | Bin 0 -> 2354 bytes static/assets/buttons/fediverse.gif | Bin 0 -> 1127 bytes static/assets/buttons/getfirefox.gif | Bin 0 -> 1786 bytes static/assets/buttons/kattgutte.D3vLs2tl.png | Bin 0 -> 6537 bytes static/assets/buttons/micro.png | Bin 0 -> 1220 bytes static/assets/buttons/pancakes.png | Bin 0 -> 2827 bytes static/assets/buttons/paws.png | Bin 0 -> 1758 bytes static/assets/buttons/scp.png | Bin 0 -> 6779 bytes .../assets/buttons/team_fortress_get_it.gif | Bin 0 -> 3998 bytes static/assets/buttons/ublock.png | Bin 0 -> 1780 bytes static/assets/buttons/valid-html5.gif | Bin 0 -> 1807 bytes static/assets/buttons/wii.png | Bin 0 -> 1193 bytes static/assets/buttons/wontwork.png | Bin 0 -> 1109 bytes static/assets/buttons/xenia.gif | Bin 0 -> 1692 bytes .../assets/fonts/FiraCode-VF/FiraCode-VF.woff | Bin 0 -> 138576 bytes .../fonts/FiraCode-VF/FiraCode-VF.woff2 | Bin 0 -> 113088 bytes static/assets/fonts/FiraGO/FiraGO-Bold.woff | Bin 0 -> 341708 bytes static/assets/fonts/FiraGO/FiraGO-Bold.woff2 | Bin 0 -> 258112 bytes .../fonts/FiraGO/FiraGO-BoldItalic.woff | Bin 0 -> 354752 bytes .../fonts/FiraGO/FiraGO-BoldItalic.woff2 | Bin 0 -> 265536 bytes .../assets/fonts/FiraGO/FiraGO-ExtraBold.woff | Bin 0 -> 339748 bytes .../fonts/FiraGO/FiraGO-ExtraBold.woff2 | Bin 0 -> 256848 bytes .../fonts/FiraGO/FiraGO-ExtraBoldItalic.woff | Bin 0 -> 354268 bytes .../fonts/FiraGO/FiraGO-ExtraBoldItalic.woff2 | Bin 0 -> 265876 bytes .../fonts/FiraGO/FiraGO-ExtraLight.woff | Bin 0 -> 339704 bytes .../fonts/FiraGO/FiraGO-ExtraLight.woff2 | Bin 0 -> 255032 bytes .../fonts/FiraGO/FiraGO-ExtraLightItalic.woff | Bin 0 -> 352644 bytes .../FiraGO/FiraGO-ExtraLightItalic.woff2 | Bin 0 -> 262500 bytes static/assets/fonts/FiraGO/FiraGO-Italic.woff | Bin 0 -> 348104 bytes .../assets/fonts/FiraGO/FiraGO-Italic.woff2 | Bin 0 -> 258920 bytes static/assets/fonts/FiraGO/FiraGO-Light.woff | Bin 0 -> 339336 bytes static/assets/fonts/FiraGO/FiraGO-Light.woff2 | Bin 0 -> 255312 bytes .../fonts/FiraGO/FiraGO-LightItalic.woff | Bin 0 -> 351788 bytes .../fonts/FiraGO/FiraGO-LightItalic.woff2 | Bin 0 -> 262424 bytes static/assets/fonts/FiraGO/FiraGO-Medium.woff | Bin 0 -> 340680 bytes .../assets/fonts/FiraGO/FiraGO-Medium.woff2 | Bin 0 -> 259140 bytes .../fonts/FiraGO/FiraGO-MediumItalic.woff | Bin 0 -> 354484 bytes .../fonts/FiraGO/FiraGO-MediumItalic.woff2 | Bin 0 -> 265924 bytes .../assets/fonts/FiraGO/FiraGO-Regular.woff | Bin 0 -> 332860 bytes .../assets/fonts/FiraGO/FiraGO-Regular.woff2 | Bin 0 -> 250752 bytes .../assets/fonts/FiraGO/FiraGO-SemiBold.woff | Bin 0 -> 340580 bytes .../assets/fonts/FiraGO/FiraGO-SemiBold.woff2 | Bin 0 -> 258084 bytes .../fonts/FiraGO/FiraGO-SemiBoldItalic.woff | Bin 0 -> 354832 bytes .../fonts/FiraGO/FiraGO-SemiBoldItalic.woff2 | Bin 0 -> 265692 bytes static/assets/icons/codeberg.png | Bin 0 -> 2551 bytes static/assets/icons/fediverse.png | Bin 0 -> 16597 bytes static/assets/icons/pronouns_cc.png | Bin 0 -> 15713 bytes static/assets/icons/youtube.png | Bin 0 -> 7778 bytes static/assets/neocat_shocked.png | Bin 0 -> 13532 bytes .../assets/project/scp_pages/screenshot.png | Bin 0 -> 68668 bytes static/favicon.png | Bin 1571 -> 55173 bytes svelte.config.js | 13 +- 67 files changed, 962 insertions(+), 6 deletions(-) create mode 100644 src/data/links.json create mode 100644 src/lib/components/ArticleHeader.svelte create mode 100644 src/lib/components/DateTime.svelte create mode 100644 src/lib/components/Footer.svelte create mode 100644 src/lib/components/Navbar.svelte create mode 100644 src/lib/pages.js create mode 100644 src/routes/+error.svelte create mode 100644 src/routes/+layout.svelte create mode 100644 src/routes/[slug]/+page.js create mode 100644 src/routes/[slug]/+page.svelte create mode 100644 src/routes/style.css create mode 100644 static/assets/buttons/css.jpg create mode 100644 static/assets/buttons/emulate.gif create mode 100644 static/assets/buttons/fediverse.gif create mode 100644 static/assets/buttons/getfirefox.gif create mode 100644 static/assets/buttons/kattgutte.D3vLs2tl.png create mode 100644 static/assets/buttons/micro.png create mode 100644 static/assets/buttons/pancakes.png create mode 100644 static/assets/buttons/paws.png create mode 100644 static/assets/buttons/scp.png create mode 100644 static/assets/buttons/team_fortress_get_it.gif create mode 100644 static/assets/buttons/ublock.png create mode 100644 static/assets/buttons/valid-html5.gif create mode 100644 static/assets/buttons/wii.png create mode 100644 static/assets/buttons/wontwork.png create mode 100644 static/assets/buttons/xenia.gif create mode 100644 static/assets/fonts/FiraCode-VF/FiraCode-VF.woff create mode 100644 static/assets/fonts/FiraCode-VF/FiraCode-VF.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-Bold.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-Bold.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-BoldItalic.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-BoldItalic.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-ExtraBold.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-ExtraBold.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-ExtraBoldItalic.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-ExtraBoldItalic.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-ExtraLight.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-ExtraLight.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-ExtraLightItalic.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-ExtraLightItalic.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-Italic.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-Italic.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-Light.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-Light.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-LightItalic.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-LightItalic.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-Medium.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-Medium.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-MediumItalic.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-MediumItalic.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-Regular.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-Regular.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-SemiBold.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-SemiBold.woff2 create mode 100644 static/assets/fonts/FiraGO/FiraGO-SemiBoldItalic.woff create mode 100644 static/assets/fonts/FiraGO/FiraGO-SemiBoldItalic.woff2 create mode 100644 static/assets/icons/codeberg.png create mode 100644 static/assets/icons/fediverse.png create mode 100644 static/assets/icons/pronouns_cc.png create mode 100644 static/assets/icons/youtube.png create mode 100755 static/assets/neocat_shocked.png create mode 100644 static/assets/project/scp_pages/screenshot.png mode change 100644 => 100755 static/favicon.png diff --git a/package-lock.json b/package-lock.json index c638336..9605ccf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "@types/eslint": "^8.56.0", "eslint": "^8.56.0", "eslint-plugin-svelte": "^2.35.1", + "mdsvex": "^0.11.0", "svelte": "^4.2.7", "svelte-check": "^3.6.0", "tslib": "^2.4.1", @@ -434,6 +435,12 @@ "integrity": "sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA==", "dev": true }, + "node_modules/@types/unist": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.10.tgz", + "integrity": "sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==", + "dev": true + }, "node_modules/@ungap/structured-clone": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", @@ -1555,6 +1562,21 @@ "integrity": "sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==", "dev": true }, + "node_modules/mdsvex": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/mdsvex/-/mdsvex-0.11.0.tgz", + "integrity": "sha512-gJF1s0N2nCmdxcKn8HDn0LKrN8poStqAicp6bBcsKFd/zkUBGLP5e7vnxu+g0pjBbDFOscUyI1mtHz+YK2TCDw==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.3", + "prism-svelte": "^0.4.7", + "prismjs": "^1.17.1", + "vfile-message": "^2.0.4" + }, + "peerDependencies": { + "svelte": ">=3 <5" + } + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -1909,6 +1931,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prism-svelte": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/prism-svelte/-/prism-svelte-0.4.7.tgz", + "integrity": "sha512-yABh19CYbM24V7aS7TuPYRNMqthxwbvx6FF/Rw920YbyBWO3tnyPIqRMgHuSVsLmuHkkBS1Akyof463FVdkeDQ==", + "dev": true + }, + "node_modules/prismjs": { + "version": "1.29.0", + "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz", + "integrity": "sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==", + "dev": true, + "engines": { + "node": ">=6" + } + }, "node_modules/punycode": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", @@ -2434,6 +2471,19 @@ "node": ">=14.17" } }, + "node_modules/unist-util-stringify-position": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-2.0.3.tgz", + "integrity": "sha512-3faScn5I+hy9VleOq/qNbAd6pAx7iH5jYBMS9I1HgQVijz/4mv5Bvw5iw1sC/90CODiKo81G/ps8AJrISn687g==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.2" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", @@ -2449,6 +2499,20 @@ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "dev": true }, + "node_modules/vfile-message": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-2.0.4.tgz", + "integrity": "sha512-DjssxRGkMvifUOJre00juHoP9DPWuzjxKuMDrhNbk2TdaYYBNMStsNhEOt3idrtI12VQYM/1+iM0KOzXi4pxwQ==", + "dev": true, + "dependencies": { + "@types/unist": "^2.0.0", + "unist-util-stringify-position": "^2.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/unified" + } + }, "node_modules/vite": { "version": "5.2.10", "resolved": "https://registry.npmjs.org/vite/-/vite-5.2.10.tgz", diff --git a/package.json b/package.json index 8969290..0a86605 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "@types/eslint": "^8.56.0", "eslint": "^8.56.0", "eslint-plugin-svelte": "^2.35.1", + "mdsvex": "^0.11.0", "svelte": "^4.2.7", "svelte-check": "^3.6.0", "tslib": "^2.4.1", @@ -25,4 +26,4 @@ "vite": "^5.0.3" }, "type": "module" -} \ No newline at end of file +} diff --git a/src/data/links.json b/src/data/links.json new file mode 100644 index 0000000..7cfbc55 --- /dev/null +++ b/src/data/links.json @@ -0,0 +1,26 @@ +[ + { + "href": "https://codeberg.org/pancakes", + "icon": "codeberg.png", + "name": "Codeberg", + "username": "@pancakes" + }, + { + "href": "https://cats.city/@pancakes", + "icon": "fediverse.png", + "name": "Fediverse", + "username": "@pancakes@cats.city" + }, + { + "href": "https://pronouns.cc/@pancakes", + "icon": "pronouns_cc.png", + "name": "pronouns.cc", + "username": "@pancakes" + }, + { + "href": "https://youtube.com/@trypancakes", + "icon": "youtube.png", + "name": "YouTube", + "username": "@trypancakes" + } +] \ No newline at end of file diff --git a/src/lib/components/ArticleHeader.svelte b/src/lib/components/ArticleHeader.svelte new file mode 100644 index 0000000..02a7730 --- /dev/null +++ b/src/lib/components/ArticleHeader.svelte @@ -0,0 +1,38 @@ + + + + {#if $page.data.header} + + {/if} + + +
+ {#if $page.data.header} + header + {/if} + +

{$page.data.title}

+

{$page.data.description}

+ + {#if $page.data.published} +

+ + Published: + + {#if $page.data.edited} + • Last edited: + + {/if} + +

+ {/if} +
+ + diff --git a/src/lib/components/DateTime.svelte b/src/lib/components/DateTime.svelte new file mode 100644 index 0000000..2453329 --- /dev/null +++ b/src/lib/components/DateTime.svelte @@ -0,0 +1,31 @@ + + + diff --git a/src/lib/components/Footer.svelte b/src/lib/components/Footer.svelte new file mode 100644 index 0000000..72f3594 --- /dev/null +++ b/src/lib/components/Footer.svelte @@ -0,0 +1,30 @@ + + + + + diff --git a/src/lib/components/Navbar.svelte b/src/lib/components/Navbar.svelte new file mode 100644 index 0000000..618f076 --- /dev/null +++ b/src/lib/components/Navbar.svelte @@ -0,0 +1,92 @@ + + +Skip to main content + + + diff --git a/src/lib/pages.js b/src/lib/pages.js new file mode 100644 index 0000000..1d55517 --- /dev/null +++ b/src/lib/pages.js @@ -0,0 +1,29 @@ +export function getPages() { + const paths = import.meta.glob("/src/data/pages/*.md", { eager: true }); + + const pages = []; + for (const path in paths) { + const file = paths[path] + const slug = path.split('/').at(-1)?.replace('.md', '') + + if (file && typeof file === 'object' && 'metadata' in file && slug) { + const metadata = file.metadata + + // hopefully this will get my attention + if (!metadata.title) throw `${slug} doesn't have a title`; + if (!metadata.description) throw `${slug} doesn't have a description`; + + pages.push({ ...metadata, slug }); + } + } + + const byTitle = pages.filter((page) => !page.published).sort((a, b) => a.title > b.title); + const byDate = pages.filter((page) => page.published).sort((a, b) => { + const aDate = Date.parse(a.published); + const bDate = Date.parse(b.published); + if (aDate == bDate) return a.title > b.title; + aDate < bDate; + }); + + return byTitle.concat(byDate); +} \ No newline at end of file diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte new file mode 100644 index 0000000..f53fe06 --- /dev/null +++ b/src/routes/+error.svelte @@ -0,0 +1,14 @@ + + + + {$page.status} | pancakes + + + +
+

{$page.status}

+

{$page.error.message}

+ neocat shocked +
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte new file mode 100644 index 0000000..60bb40b --- /dev/null +++ b/src/routes/+layout.svelte @@ -0,0 +1,28 @@ + + + + + {$page.data.title ? $page.data.title + " | pancakes" : "pancakes"} + + + + + + + + + + + + + + +