From 4c1c8ae3af04c499f43b68ae943f0290ce8370e3 Mon Sep 17 00:00:00 2001 From: eggy Date: Sun, 19 Oct 2025 15:33:02 +0800 Subject: [PATCH] chore: upgrade to nuxt 4 --- app/data/navItems.ts | 7 +++ app/data/projects.ts | 129 ++++++++++++++++++++++++++++++++++++++ app/data/siteRevisions.ts | 13 ++++ app/data/specialTags.ts | 3 + app/data/tagInfo.ts | 79 +++++++++++++++++++++++ app/shared/github.d.ts | 116 ++++++++++++++++++++++++++++++++++ app/shared/metadata.ts | 44 +++++++++++++ app/shared/types.d.ts | 28 +++++++++ 8 files changed, 419 insertions(+) create mode 100644 app/data/navItems.ts create mode 100644 app/data/projects.ts create mode 100644 app/data/siteRevisions.ts create mode 100644 app/data/specialTags.ts create mode 100644 app/data/tagInfo.ts create mode 100644 app/shared/github.d.ts create mode 100644 app/shared/metadata.ts create mode 100644 app/shared/types.d.ts diff --git a/app/data/navItems.ts b/app/data/navItems.ts new file mode 100644 index 0000000..a1c7e38 --- /dev/null +++ b/app/data/navItems.ts @@ -0,0 +1,7 @@ +export const navItems = [ + { href: "/#about", title: "About" }, + { href: "/blog", title: "Blog" }, + { href: "/stories", title: "Stories" }, +]; + +export default navItems; diff --git a/app/data/projects.ts b/app/data/projects.ts new file mode 100644 index 0000000..14bcb96 --- /dev/null +++ b/app/data/projects.ts @@ -0,0 +1,129 @@ +export type Language = + | "python" + | "javascript" + | "java" + | "typescript" + | "vue" + | "react" + | "markdown" + | "flutter" + | "android" + | "rust" + | "golang"; +export interface Project { + name: string; + href: string; + img?: string; + description?: string; + longDescription?: string; + langs: Language[]; + license?: "AGPL-3.0" | "GPL-3.0" | "MIT" | "LGPL-3.0"; + type: "web" | "tool" | "embedded" | "service"; +} + +export const projects: Project[] = [ + { + name: "Mandown", + href: "https://github.com/potatoeggy/mandown", + description: + "A comic downloader and converter to CBZ / EPUB / PDF for my Kobo.", + longDescription: "Available via CLI and a Qt GUI!", + langs: ["python"], + license: "AGPL-3.0", + img: "mandown.webp", + type: "tool", + }, + { + name: "Noveldown", + href: "https://github.com/potatoeggy/noveldown", + langs: ["python"], + license: "LGPL-3.0", + description: + "A webnovel downloader and EPUB converter for my Kobo, with lots of metadata!", + longDescription: "Heavily borrows Mandown's design.", + type: "tool", + }, + { + name: "Jeopardy", + href: "https://github.com/potatoeggy/jeopardy", + img: "jeopardy.webp", + langs: ["typescript", "vue"], + license: "AGPL-3.0", + description: "Kahoot-inspired Jeopardy! game, including Final Jeopardy!", + longDescription: "Created for Bayview's Computer Club.", + type: "web", + }, + { + name: "Primoprod", + href: "https://github.com/potatoeggy/primoprod", + img: "primoprod.webp", + langs: ["typescript", "vue"], + license: "AGPL-3.0", + description: + "A game simulator to increase productivity with quests and gambling.", + longDescription: "My first project with a JS framework!", + type: "web", + }, + { + name: "PillowⓇ", + href: "https://github.com/potatoeggy/ece198", + description: + "A water quality statistics aggregator written for the STM32 microcontroller with a display and keypad.", + langs: ["rust"], + license: "GPL-3.0", + type: "embedded", + img: "pillow.webp", + }, + { + name: "Napbot", + href: "https://github.com/potatoeggy/napbot", + langs: ["python"], + license: "AGPL-3.0", + description: + "A Discord music bot with synchronised lyrics, originally a sleep tracking bot to encourage sleeping.", + img: "napbot.webp", + type: "service", + }, + { + name: "AutoFicFare", + href: "https://github.com/potatoeggy/autoficfare", + langs: ["python"], + license: "GPL-3.0", + description: + "Automatically update fanfiction in a Calibre database to instantly update them on your Kobo.", + type: "tool", + }, +]; + +const unreleasedProjects: Project[] = [ + { + name: "Aleister", + href: "https://github.com/potatoeggy/aleister", + langs: ["rust"], + license: "AGPL-3.0", + type: "service", + }, + { + name: "Aoto", + href: "https://github.com/potatoeggy/aoto", + langs: ["golang", "typescript", "react"], + license: "AGPL-3.0", + type: "web", + }, + { + name: "Kobink", + href: "https://github.com/potatoeggy/kobink", + langs: ["rust"], + license: "AGPL-3.0", + type: "service", + }, + { + name: "GBARR", + href: "https://github.com/potatoeggy/gbarr", + langs: ["rust"], + license: "GPL-3.0", + type: "embedded", + }, +]; + +export default projects; diff --git a/app/data/siteRevisions.ts b/app/data/siteRevisions.ts new file mode 100644 index 0000000..c06399b --- /dev/null +++ b/app/data/siteRevisions.ts @@ -0,0 +1,13 @@ +interface SiteRevision { + title: string; + url: string; +} + +export const revisions: SiteRevision[] = [ + { + title: "Nuxt 3 (2022)", + url: "https://eggipelago.com", + }, + { title: "Eleventy (2021)", url: "https://2021.eggipelago.com" }, + { title: "Vanilla (2019-2020)", url: "https://2020.eggipelago.com" }, +]; diff --git a/app/data/specialTags.ts b/app/data/specialTags.ts new file mode 100644 index 0000000..386f030 --- /dev/null +++ b/app/data/specialTags.ts @@ -0,0 +1,3 @@ +export const SpecialTags: string[] = [ + "featured", +]; \ No newline at end of file diff --git a/app/data/tagInfo.ts b/app/data/tagInfo.ts new file mode 100644 index 0000000..5087224 --- /dev/null +++ b/app/data/tagInfo.ts @@ -0,0 +1,79 @@ +export interface TagData { + name?: string; + description?: string; +} + +export const tagInfo: Record = { + barin: { + name: "Barin", + description: + "Welcome to Barin — a world in constant conflict between productivity and procrastination.", + }, + bsscc: { + name: "BSSCC", + description: "Posts related to Bayview's Computer Club.", + }, + ibia: { + name: "Ibia", + description: + "A Kurious child struggles to fight the misinformation brought by the Six Goddesses of the Subjects.", + }, + misc: { name: "Miscellaneous" }, + poetry: { + name: "Poetry", + description: + "Poetry is interesting in that there is a lot of implied stuff that is normally said directly in prose.", + }, + primoprod: { + name: "Primoprod", + description: + 'Reports following the development of Primoprod.', + }, + tech: { name: "Technology" }, + unstagnation: { + name: "Unstagnation Short", + description: + "A collection of very short stories written to do something productive during June–August 2020 and August 2021.", + }, + albatross: { + name: "The FOSS Albatross", + description: + 'Articles about free and open source software. Also available on Medium.', + }, + birds: { + name: "Bird Family", + description: + "A large, loving family of birds who have found in each other a kindred soul for eternal suffering.", + }, + birdseye: { + name: "Bird's-Eye View", + description: "What's the world like to a pair of human-watching bluebirds?", + }, + uoft: { + name: "University of Teyvat", + description: "A Genshin Impact university AU.", + }, + nanowrimo: { + name: "NaNoWriMo", + description: + "Story snippets written during National Novel Writing Month as part of a larger work.", + }, + skyprojections: { + name: "Projections in the Sky", + description: "Dreams or reality — what is the difference?", + }, + featured: { + name: "Featured", + description: "Works that are less rambly and more actually good!", + }, + "monoceros (novel)": { + name: "Monoceros (novel)", + description: "A coffee shop where six students meet and become friends.", + }, + "emma the narwhal": { + name: "Emma the Narwhal", + description: + 'A mystery-betrayal story written by April Evans in Monoceros (novel).', + }, +}; +export default tagInfo; diff --git a/app/shared/github.d.ts b/app/shared/github.d.ts new file mode 100644 index 0000000..42b6ac3 --- /dev/null +++ b/app/shared/github.d.ts @@ -0,0 +1,116 @@ +// i know i can import one but +// i can't find one so here we are + +export interface GithubUser { + id: number; + login: string; + display_login: string; + gravatar_id: string; + url: string; + avatar_url: string; +} + +export interface GithubRepo { + id: number; + name: string; + url: string; +} + +export interface GithubCommit { + sha: string; + author: { + email: string; + name: string; + }; + message: string; + distinct: boolean; + url: string; +} + +export interface GithubPullRequest { + url: string; + id: number; + node_id: string; + html_url: string; + diff_url: string; + patch_url: string; + issue_url: string; + number: number; + state: string; + locked: boolean; + title: string; + body: string; + created_at: string; + updated_at: string; + closed_at: string | null; + merged_at: string | null; + merge_commit_sha: string | null; + draft: boolean; + // there's more but i don't wanna +} + +export interface GithubRelease { + url: string; + assets_url: string; + upload_url: string; + html_url: string; + id: number; + // author: AUTHOR + node_id: string; + tag_name: string; + target_commitish: string; + name: string; + draft: boolean; + prerelease: boolean; + created_at: string; + published_at: string; + tarball_url: string; + zipball_url: string; + body: string; + short_description_html: string; + is_short_description_html_truncated: boolean; +} + +export interface GithubCommitEventPayload { + push_id: number; + size: number; + distinct_size: number; + ref: string; + head: string; + before: string; +} + +export interface GithubPullRequestEventPayload { + action: string; + number: number; + pull_request: GithubPullRequest; +} + +export interface GithubReleaseEventPayload { + action: string; + release: GithubRelease; + public: boolean; + created_at: string; +} + +export interface GithubEvent { + id: string; + type: "PushEvent" | "CreateEvent" | "ReleaseEvent" | "PullRequestEvent"; + actor: GithubUser; + repo: GithubRepo; + payload: + | GithubCommitEventPayload + | GithubPullRequestEventPayload + | GithubReleaseEventPayload; + public: boolean; + created_at: string; +} + +export interface GithubPushEvent extends GithubEvent { + type: "PushEvent"; + payload: GithubCommitEventPayload; +} + +export interface GithubCreateEvent {} + +export interface GithubReleaseEvent {} diff --git a/app/shared/metadata.ts b/app/shared/metadata.ts new file mode 100644 index 0000000..0cf1d0e --- /dev/null +++ b/app/shared/metadata.ts @@ -0,0 +1,44 @@ +import type { AnyParsedContent } from "./types"; +import readingTime from "reading-time"; +import dayjs from "dayjs"; +import utc from "dayjs/plugin/utc.js"; + +dayjs.extend(utc); + +function countWords(str: string) { + let words = 0; + for (const c of str) { + if (c === " " || c === "/") { + words++; + } + } + return words; +} + +function search(obj: Record, results: string[] = []) { + if (obj.value) { + results.push(obj.value); + } + + if (obj.children) { + for (const el of obj.children) { + search(el, results); + } + } + return results; +} + +export function calcReadingTime(doc: AnyParsedContent) { + let body: string[] = search(doc.body); + return readingTime(body.join(" ")); +} + +export function getPrettyDate(doc: AnyParsedContent) { + const date = dayjs(doc.date).utc(); + return date.format("DD MMM YYYY"); +} + +export function getUtcDate(doc: AnyParsedContent) { + const date = dayjs(doc.date).utc(); + return date.format("YYYY-MM-DD"); +} diff --git a/app/shared/types.d.ts b/app/shared/types.d.ts new file mode 100644 index 0000000..25f2176 --- /dev/null +++ b/app/shared/types.d.ts @@ -0,0 +1,28 @@ +import type { ParsedContent } from "@nuxt/content/dist/runtime/types"; + +interface ReadingTime { + text: string; + minutes: number; + time: number; + words: number; +} + +interface BlogParsedContent extends ParsedContent { + date: Date; + title: string; + tags: string[]; + description?: string; + readingTime: ReadingTime; + nopreview?: boolean; +} + +interface StoryParsedContent extends ParsedContent { + date: Date; + title: string; + tags: string[]; + description?: string; + readingTime: ReadingTime; + nopreview?: boolean; +} + +type AnyParsedContent = BlogParsedContent | StoryParsedContent;