Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7b8a351c1 | ||
|
|
fb8e42f632 | ||
|
|
9e157a4fa3 | ||
|
|
8b6be36f7a | ||
|
|
9ddbad4674 | ||
|
|
480259a4eb | ||
|
|
ab6cd7c162 | ||
|
|
bbb76eaa31 | ||
|
|
6de79d25e4 | ||
|
|
3fef5d378e | ||
|
|
ac545c4668 | ||
|
|
d86f78fead | ||
|
|
7d3ba2337b | ||
|
|
00a4ef96f6 |
No files matched your search
@@ -23,3 +23,7 @@ settings.json
|
||||
|
||||
# macOS-specific files
|
||||
.DS_Store
|
||||
|
||||
#Cline
|
||||
.clinerules
|
||||
.cline
|
||||
@@ -8,7 +8,7 @@ My website follows a robust deployment workflow:
|
||||
|
||||
1. **Development**: I develop content and code locally using Gitea as my Git hosting solution
|
||||
2. **Auto-push**: Changes are automatically pushed from Gitea to GitHub via configured webhooks
|
||||
3. **Hosting**: The site is hosted on Appwrite, which provides a scalable and secure hosting environment
|
||||
3. **Hosting**: The site is hosted on self-hosted infrastructure, which provides a scalable and secure hosting environment
|
||||
4. **Delivery**: NGINX reverse proxy handles routing and serves content with optimal performance
|
||||
|
||||
This pipeline ensures that my website is always up-to-date with the latest changes while leveraging modern hosting technologies.
|
||||
@@ -21,13 +21,78 @@ This website is built using Astro with the following key components:
|
||||
- **Projects**: Showcasing my various projects and contributions
|
||||
- **Work Experience**: Professional background and career history
|
||||
- **Legal**: Privacy policy and terms of service
|
||||
- **System status**: The footer light is powered by Uptime Kuma (see below)
|
||||
|
||||
## System Status Footer
|
||||
|
||||
The "All systems normal" light in the footer reflects the public Uptime Kuma
|
||||
status page at [uptime.spaghet.io/status/public](https://uptime.spaghet.io/status/public).
|
||||
|
||||
- `src/lib/status.ts` fetches Uptime Kuma's public status-page and heartbeat
|
||||
APIs server-side, reduces them to one state (`up`, `degraded`, `down`,
|
||||
`maintenance`, `unknown`) and caches the result in-process.
|
||||
- `src/pages/api/status.ts` exposes that small snapshot to the browser. Uptime
|
||||
Kuma sends no CORS headers outside dev mode and its heartbeat payload is
|
||||
~200 KB, so the browser never talks to it directly.
|
||||
- `src/components/SystemStatus.astro` renders the light server-side (correct on
|
||||
first paint and with JS disabled) and then refreshes it every minute, pausing
|
||||
while the tab is hidden.
|
||||
|
||||
Optional environment variables (all have working defaults):
|
||||
|
||||
| Variable | Default | Purpose |
|
||||
| --- | --- | --- |
|
||||
| `STATUS_PAGE_URL` | `https://uptime.spaghet.io` | Uptime Kuma origin |
|
||||
| `STATUS_PAGE_SLUG` | `public` | Status page slug |
|
||||
| `STATUS_WATCH_GROUPS` | *(all groups)* | Comma-separated group names that drive the light, e.g. `"Critical Services,Database Services"` |
|
||||
| `STATUS_CACHE_TTL_SECONDS` | `60` | Server-side cache lifetime |
|
||||
| `STATUS_TIMEOUT_SECONDS` | `4` | Upstream request timeout |
|
||||
| `STATUS_STALE_AFTER_SECONDS` | `900` | Treat the light as unknown once beats stop arriving |
|
||||
|
||||
|
||||
## Theme and Colour Tokens
|
||||
|
||||
The site has one colour system, in `src/styles/global.css`. Components never hard-code
|
||||
a hex and, in almost every case, never need a `dark:` colour variant.
|
||||
|
||||
- **`@theme`** declares semantic tokens (`page`, `surface`, `wash`, `ink`, `ink-muted`,
|
||||
`accent`, `link`, `link-hover`, `edge`, `line`, `chip`, `chip-ink`, `code-bg`, `focus`,
|
||||
`status-*`). Tailwind generates `bg-page`, `text-ink`, `border-edge`, … from them.
|
||||
- **`html.dark`** re-declares the same names with cooked-longer values. Because Tailwind
|
||||
emits the utilities as `var(--color-*)` references, flipping the class on `<html>`
|
||||
recolours the whole site from the same class list.
|
||||
- **`--color-spaghetti-*`, `--color-marinara*`, `--color-meatball*`, `--color-parmesan`**
|
||||
are the raw ingredient palette. They feed the hero sky and gradients; they are *not*
|
||||
for text, because the pastels fall to 1.1–1.5:1 on the cream plate.
|
||||
|
||||
Rules that keep it from drifting again:
|
||||
|
||||
1. Add a token, don't add a `dark:` variant. A component class list should read the same
|
||||
in both modes.
|
||||
2. Keep colour rules inside `@layer`. Unlayered CSS outranks every Tailwind layer, which
|
||||
is how `.dark .text-spaghetti-brown` used to silently beat `dark:` utilities and put
|
||||
cream-on-cream text on the hero button (1.18:1).
|
||||
3. Never target a Tailwind utility class (e.g. `.border-black/15`) with an unlayered
|
||||
override — it fires in both modes.
|
||||
4. Prose colours go through `--tw-prose-*` only. The `html .prose` prefix in `global.css`
|
||||
is load-bearing: the typography plugin emits its defaults into the same layer but
|
||||
later, so at equal specificity it would win and articles would render slate.
|
||||
|
||||
Contrast is held to WCAG AA: 4.5:1 for body text and links, 3:1 for large text and
|
||||
interactive borders. Light mode is a warm cream plate with white cards; dark mode is a
|
||||
warm espresso plate (`#140C08`) with raised cards, so the marinara-and-meatball night sky
|
||||
has something warm to sit on.
|
||||
|
||||
Code blocks use dual Shiki themes (`light-plus` / `everforest-dark`, chosen by measuring
|
||||
every bundled theme's tokens against the site's own code backgrounds) with the
|
||||
`--shiki-light` / `--shiki-dark` swap in `global.css`.
|
||||
|
||||
## Technologies Used
|
||||
|
||||
- **Framework**: Astro (Static site generation)
|
||||
- **Styling**: Tailwind CSS
|
||||
- **TypeScript**: Type-safe development
|
||||
- **Deployment**: Gitea → GitHub → Appwrite → NGINX reverse proxy
|
||||
- **Deployment**: Gitea → GitHub → Self-hosted infrastructure → NGINX reverse proxy
|
||||
|
||||
## Getting Started
|
||||
|
||||
|
||||
@@ -1,34 +1,47 @@
|
||||
import { defineConfig, envField } from "astro/config"
|
||||
import { defineConfig } from "astro/config"
|
||||
import mdx from "@astrojs/mdx"
|
||||
import sitemap from "@astrojs/sitemap"
|
||||
import tailwind from "@astrojs/tailwind"
|
||||
import solidJs from "@astrojs/solid-js"
|
||||
import node from "@astrojs/node"
|
||||
import tailwindcss from "@tailwindcss/vite"
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
site: "https://spaghet.io",
|
||||
integrations: [mdx(), sitemap(), solidJs(), tailwind({ applyBaseStyles: false })],
|
||||
integrations: [mdx(), sitemap(), solidJs()],
|
||||
output: "server",
|
||||
adapter: node({ mode: "ssr" }),
|
||||
env: {
|
||||
schema: {
|
||||
VITE_APPWRITE_ENDPOINT: envField.string({ context: "server", access: "public" }),
|
||||
VITE_APPWRITE_PROJECT_ID: envField.string({ context: "server", access: "public" }),
|
||||
VITE_APPWRITE_BUCKET_ID: envField.string({ context: "server", access: "public" }),
|
||||
VITE_APPWRITE_DATABASE_ID: envField.string({ context: "server", access: "public" }),
|
||||
VITE_APPWRITE_BLOG_COLLECTION_ID: envField.string({ context: "server", access: "public" }),
|
||||
VITE_APPWRITE_PROJECTS_COLLECTION_ID: envField.string({ context: "server", access: "public" }),
|
||||
VITE_APPWRITE_WORK_COLLECTION_ID: envField.string({ context: "server", access: "public" }),
|
||||
VITE_APPWRITE_LEGAL_COLLECTION_ID: envField.string({ context: "server", access: "public" }),
|
||||
PUBLIC_APPWRITE_ENDPOINT: envField.string({ context: "client", access: "public" }),
|
||||
PUBLIC_APPWRITE_PROJECT_ID: envField.string({ context: "client", access: "public" }),
|
||||
PUBLIC_APPWRITE_BUCKET_ID: envField.string({ context: "client", access: "public" }),
|
||||
PUBLIC_APPWRITE_DATABASE_ID: envField.string({ context: "client", access: "public" }),
|
||||
PUBLIC_APPWRITE_BLOG_COLLECTION_ID: envField.string({ context: "client", access: "public" }),
|
||||
PUBLIC_APPWRITE_PROJECTS_COLLECTION_ID: envField.string({ context: "client", access: "public" }),
|
||||
PUBLIC_APPWRITE_WORK_COLLECTION_ID: envField.string({ context: "client", access: "public" }),
|
||||
PUBLIC_APPWRITE_LEGAL_COLLECTION_ID: envField.string({ context: "client", access: "public" }),
|
||||
}
|
||||
markdown: {
|
||||
shikiConfig: {
|
||||
// Two themes plus `defaultColor: false` makes Shiki emit every token as a
|
||||
// `--shiki-light` / `--shiki-dark` pair instead of a hard-coded `color:`.
|
||||
// global.css then picks one per mode, so a light-mode reader no longer
|
||||
// gets a dark gray code block (the old `.prose pre { #1f2937 !important }`
|
||||
// hack) and a dark-mode reader no longer gets cream-on-cream.
|
||||
//
|
||||
// Chosen by measuring every bundled theme's token colours against the
|
||||
// site's own `code-bg` surfaces, not by eye: the previous vitesse pair
|
||||
// bottomed out at 1.04:1 (light) and 1.28:1 (dark) — punctuation was
|
||||
// effectively invisible. `light-plus` reaches ~3.5:1 on white and
|
||||
// `everforest-dark` ~5.6:1 on the espresso block, and everforest's warm
|
||||
// red/green/amber palette sits inside the pasta colours rather than
|
||||
// fighting them.
|
||||
themes: { light: "light-plus", dark: "everforest-dark" },
|
||||
defaultColor: false,
|
||||
},
|
||||
},
|
||||
vite: {
|
||||
plugins: [tailwindcss()],
|
||||
optimizeDeps: {
|
||||
// Client-island deps that are not reachable from the SSR entry graph are
|
||||
// discovered mid-session, which makes Vite re-optimize and bump the browserHash.
|
||||
// Every already-served island module then 504s with "Outdated Optimize Dep",
|
||||
// hydration aborts, and the Solid lists on /blog, /projects and /search stay
|
||||
// empty. Pre-declaring them bundles them at startup so the hash never changes
|
||||
// underneath a page. Keep this list in sync with the imports of every
|
||||
// src/components/*.tsx island (solid-js, @lib/utils -> clsx + tailwind-merge,
|
||||
// @lib/search -> fuse.js).
|
||||
include: ["solid-js", "solid-js/web", "clsx", "tailwind-merge", "fuse.js"],
|
||||
},
|
||||
}
|
||||
})
|
||||
@@ -6,39 +6,40 @@
|
||||
"dev": "dotenv -e .env -- astro dev",
|
||||
"dev:network": "dotenv -e .env -- astro dev --host",
|
||||
"start": "dotenv -e .env -- astro dev",
|
||||
"build": "astro check && astro build",
|
||||
"build": "export RAYON_NUM_THREADS=1 TOKIO_WORKER_THREADS=1; astro check && astro build",
|
||||
"preview": "dotenv -e .env -- astro preview",
|
||||
"preview:network": "dotenv -e .env -- astro dev --host",
|
||||
"astro": "astro",
|
||||
"test": "export RAYON_NUM_THREADS=1 TOKIO_WORKER_THREADS=1; vitest run",
|
||||
"test:watch": "export RAYON_NUM_THREADS=1 TOKIO_WORKER_THREADS=1; vitest",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint . --fix"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/check": "^0.5.6",
|
||||
"@astrojs/mdx": "^4.3.3",
|
||||
"@astrojs/node": "^9.4.1",
|
||||
"@astrojs/rss": "^4.0.5",
|
||||
"@astrojs/sitemap": "^3.5.0",
|
||||
"@astrojs/solid-js": "^5.1.0",
|
||||
"@astrojs/tailwind": "^6.0.2",
|
||||
"@astrojs/check": "^0.9.10",
|
||||
"@astrojs/mdx": "^8.0.3",
|
||||
"@astrojs/node": "^11.1.7",
|
||||
"@astrojs/rss": "^4.0.19",
|
||||
"@astrojs/sitemap": "^3.7.4",
|
||||
"@astrojs/solid-js": "^7.0.2",
|
||||
"@solidjs/testing-library": "^0.8.10",
|
||||
"@tailwindcss/typography": "^0.5.10",
|
||||
"astro": "^5.13.0",
|
||||
"@tailwindcss/vite": "^4.3.3",
|
||||
"astro": "^7.3.8",
|
||||
"clsx": "^2.1.0",
|
||||
"fuse.js": "^7.0.0",
|
||||
"notenv": "^2.0.3",
|
||||
"npm": "^11.5.2",
|
||||
"rehype-stringify": "^10.0.1",
|
||||
"remark": "^15.0.1",
|
||||
"remark-rehype": "^11.1.2",
|
||||
"sharp": "^0.33.2",
|
||||
"sharp": "^0.35.5",
|
||||
"solid-js": "^1.8.15",
|
||||
"tailwind-merge": "^2.2.1",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"tailwind-merge": "^3.7.0",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.3.3",
|
||||
"vitest": "^3.2.4",
|
||||
"appwrite": "^18.2.0"
|
||||
"typescript": "^6.0.3",
|
||||
"vite": "^8.3.4",
|
||||
"vitest": "^5.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dotenv-cli": "^10.0.0"
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
|
||||
<image width="36" height="36" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAaYAAAGmCAYAAAA3cSADAAAgAElEQVR4nOydB7wkZZX2n6rqnG4Oc++dyOREGMIMSbKICIooiHENKPqt6xo/XcO6frprDgsqiq7ZdRV1QQQRyVEGGJicw507N9/u27G60vv9zlvV3dV974yDgjMD5++vvR2qq9+qHurpc97nPQdgGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZhGIZh/laUIz2AFzqJ9u5Y71UfeFekb353UFNDxf7tu0vbn3xy5M9/fKQwMWod6fExDMMcbbAwPY/Eu/pSs/7P176YXnD2tZFwEIlYDOFgEIqiiKhV3FF85Jb/GvvDD2/e+9Ad2470WBmGYY4WWJieB9oXn9jVdum1b3VOvey9GVvrLpR0WLYFIYCgpiGViCMZiyEVj0FT4BiP/ParO274wL/lB3Znj/TYGYZhjjQsTM8hnStOm9n95k99Qix9yesMgUTZMJAtFFEqG7BsW94EqZNHNBxGSzKJ1qYkEqoYzdz6zY/v+M7Hv2/pRU7xMQzzooWF6Tkg1toRPu7dX/yIeuZVH7GgxEiAinoZpXIZhmnBtKxphamKoiAVi2FWdydimYEHtnzwoldl+3eMH4ljYRiGOdJoR3oAxzKhaFyZf/U/XdD74R/ebC9cfZUlECQhMgwTluPAdhz3r23Ddmw4zjSiVMoBWgBl08LYZBZWJDV7ztXve1NTAHvH1j2w6UgcF8MwzJGEhemvJNk7t+mEr//pJnHm1V+wQrEuKUimKaMiRwgpRoZtw6w8Z08jShUGtgH9WyAUFXkliOFMLhE76YIrWqGvy2x8jI0RDMO8qGBhepYoioLZF7/+7Hn/ftsd5eaes8uGqVDazhYCDkVIJEiWBd0woJcNGJYNWzhe0nSazKkWAJo6AVV1BerAdgijjMmyqerzT3tFqv/pP5VG+geOwKEyDMMcEXiO6VnQvXB5R9ebP/0ZnHLp2yxbBPK6LuePVMuEk0/DzIzAyE7AKBVhBCKwSXBS7YBa0X/hnnJRuT8No/uAvRuAchFQVHRZ6R8P//cX3/R3PEyGYZgjSuBID+BYYdFr33N2y9u/8POSEupJ53KY2LsD2q4noA7ugDPWD2ukH8ZoP+x8Bk65BDgOEAgALT3AktOBVZcAx50EaEFXlBQSqGnEqWMW0DIDGNoFDO8GRjauOxLHyzAMc6TgiOkvoAVD6sr3fflaXPD2rxRMO3pg4xMo3PxlKBvvg+JFQsIowTH06YWmAglR3xLgZe8GTjhfRkO1oGn69ymOg+4d931z8kef/EBxYlR/Hg6PYRjmqIOF6RD0nXh618z3Xn9jsXfF5aPjYxj55Vdg3XaDm2b7ayGBWn4u8LpPAS3dvrSeMr1AKQq67OyWpqdu+crIrTf9PDMymP9bjolhGOZoh4VpGsjgcOp1/3pp8IoP3Zi21J7+3TuR/dY/As/c/Wx3dPAoqrkbuPY/gTkrfZokfF/J1PfNDhqbxR03fiZ//69unhgdNp79kTEMwxz9sDA1oKgqTn7fF9+Ol//Tt8ZyhcDA3l0wvvF2YOcTh7+PcAzNl/0j9EACJs05DWyG2PIQRHGyfsNYE3DdN4HjTq659sjBdwhxotcWRYx9XQ//6MP33/TFX/xNB8swDHMUwnZxH5FESj3549//mHHOW748lMkG9g8Owb7pn4EtDz2r/SROuxTOwtNhqhEoyTaoPYugLlgN5MYgMkO1Dc0ysOE+4IQLgHiz96QnSoo46O+GcUtr6u9ZdcWK08/tDY7sWJcdGeQaewzDvGBgYfJItHUGT/r8b27MLr/og6OTWXU0k4G483vAfT+p31ALQm3vgygXvOimHiUUQfsV70e2aNRSc6QvwTDUOcdDDO8Ecr5qQ0YJ2LseOO1yQNFqWqR4qUAAqm1BsU0IrWaiFFCU4WjHqsBZV729b/GKjtbi8KaJoQEWKIZhjnlYmACEEyltyb/+/Ju5BWe8PV/SMZHNwRnth/ODDwNGzQwXXXgy2l/3MQROfBmsjnkQI7sBvd6LED/pIuhdiyGqouVLyykalGQrnG2P1g+AoqhkGzD3eJ+V3BW0VqeEppEdwNA+2NkMRDQBBILVt5YsJzzRPHuNs/pV7zr15FWdwZFdT02MjhSev7PFMAzz/PKiF6ZYa0dw2b/f8p3S/DVvK5Io5fIQ9L/f3QBn+1rAseV24eNORPJV70emYMI0TCDRCnXhasAqQ4z1uyaHQAjJS9+NkqX4oqV6t51iFOBMlxrcvxU48zVAIFx9a8CxkBrZibHhEViWBUUvQJ0chdM6Qy7apT0HxocgDB16MBrcG5+5OnXOVW9as2xBeWzDY+t0Xbf/nueSYRjmuUA90gM4kiS6+mKLPvvbn5XmnvIPumkiUyjIskJicgxi/d0Qttt9QglGkLrkWmQm81IzhPd/SiAC7fTXQnvpu2WKTwlFoSVafKIkvI1dgRK5UVj3/2R6p97kMPDEHbXHAui2skiPjlUf0z4UsywFiuhMJaEYOpTxQah7NkPJZbCnIDpv7734Gy3/cfej3edccVYlHcgwDHOs8KIVplhLe3DJF37/M3PeyVdajg29XJbVv2UB1g33w04PV+eQ4ktOQ1F4kQyJiuegE54AqT0LobT1StedNbizGiW5kiDfBFEuwn78Fje6Ohhrb6uKVlKUYQzug+2JYyUj6MCBSDTLRoMin4HlCIhQVI5VG9gBrX8LoBew246eOHTVv9+Dd97webR0x57n08kwDPOc8aIUpmhrZ3jxv9/6Y7178eXUH4naVFB1cJoXoqrg1lN/hKPXpmkCXbPd9J3irnGS0ZK/KKuiQbT1ybvZp+91BU1u4L1um7C3Pgix68lDD2z3024bDABtpTGkxyfcuSYPUcjA7pkPVVXRHgtjbGC/Z5JQIQIhiFAE0EsI7FoPdWAnuf40rDzvw/iXWzcqL7vuDVo4wiWoGIY56nnRzTHFWjtCiz9/+8+N2ce/hqIjwzJlLyRqfW5aNgy9BOfXnwdKNVOD1rsITsdcn8lOcWeNqpZuBcIoAnvWQeTTUKj0UDAMJz8Be2Az7K0PuZZzsocfCtsETrgQanMXQmP90AtFL/gSgGPBDoWABaswo70Nk/17UC6V6tfk0saaJoVKLUxCHXeLkotUWzMWr7mi99K3XtETVfZag7t266XSVEshwzDMUcCLSpjCyabAss//7nvFmSuupiZ+bndZt6usSe0q6PHkKHD7t6umB8IqZKF0zIZSXWuEajpPapOw4RTT7iJcU5eWcGfXExAb7gbIgTeyB7AOs1DD4jUQPQthU1pxcrwigbAL4xAnXIhgOIpmTWC0f5+bJiTRkilHURsWtdDQAlBsG2pmFEpmRAplNpjsHJ+35vVdF1x9uVqc3K7v2bTnoFXOGYZhjhAvGmEKxRKB47921/ezvSveaNmO2+7csuScEhkeSKDoOYcu4nf/qL7qQikLZ+vDEIPbqG0tlFS7rBBBa5ns9ACcXWshNj8I5NPe9jmgkJZRjto+G9qSs6CsvNCNtLKjdaI3hcWnA3OWwwon4DR3SLu6MPJw5p8EpFoxq6MNB7ZuglPZh+vEkAVfpYhVhk3Rk1dkVjVKUNMjUPIZiHAMmWCiW1927hswZ0Uvdj/9IIqTXCCWYZijhheFZSsQCmPZZ3755eLS897vRkqmbHsuEZCN/EplA2WjDHNoD8SnLnLbVhwEpWUGlDknyHVMYmzftEVdU2tegeTqy1EORJHL5iHIpKAIiNw4nPV/grPj8SlroCTX/Btw5lXeB6Hm6iNDRCyKWLmAkf693tyTI0VOETbgiJqYVlx/woFimVBMXbr5Knk/p6UT9ox5QDgKWOYoHvj5Z/Hbr3wLRonr7zEMc8R5UURMC6/9zFvsM6/5D8u2Feosa8hICTKFRzfbsWXEJNNnpuFGTIeKavQ8xNAOWcFLine truncated
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 128 128">
|
||||
<path d="M50.4 78.5a75.1 75.1 0 0 0-28.5 6.9l24.2-65.7c.7-2 1.9-3.2 3.4-3.2h29c1.5 0 2.7 1.2 3.4 3.2l24.2 65.7s-11.6-7-28.5-7L67 45.5c-.4-1.7-1.6-2.8-2.9-2.8-1.3 0-2.5 1.1-2.9 2.7L50.4 78.5Zm-1.1 28.2Zm-4.2-20.2c-2 6.6-.6 15.8 4.2 20.2a17.5 17.5 0 0 1 .2-.7 5.5 5.5 0 0 1 5.7-4.5c2.8.1 4.3 1.5 4.7 4.7.2 1.1.2 2.3.2 3.5v.4c0 2.7.7 5.2 2.2 7.4a13 13 0 0 0 5.7 4.9v-.3l-.2-.3c-1.8-5.6-.5-9.5 4.4-12.8l1.5-1a73 73 0 0 0 3.2-2.2 16 16 0 0 0 6.8-11.4c.3-2 .1-4-.6-6l-.8.6-1.6 1a37 37 0 0 1-22.4 2.7c-5-.7-9.7-2-13.2-6.2Z" />
|
||||
<style>
|
||||
path { fill: #000; }
|
||||
@media (prefers-color-scheme: dark) {
|
||||
path { fill: #FFF; }
|
||||
}
|
||||
</style>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 749 B |
|
After Width: | Height: | Size: 586 B |
|
After Width: | Height: | Size: 44 KiB |
@@ -1,16 +1,20 @@
|
||||
|
||||
// Light-mode "particles" are grains of parmesan over the cream plate, not
|
||||
// hard black dots: #000 at 1-2px reads as dirt and fights the pasta palette.
|
||||
// Tinted with the ink token's hue and kept low-contrast on purpose.
|
||||
function generateParticles(n) {
|
||||
let value = `${getRandom(2560)}px ${getRandom(2560)}px #000`;
|
||||
let value = `${getRandom(2560)}px ${getRandom(2560)}px #C9B49B`;
|
||||
for (let i = 2; i <= n; i++) {
|
||||
value += `, ${getRandom(2560)}px ${getRandom(2560)}px #000`;
|
||||
value += `, ${getRandom(2560)}px ${getRandom(2560)}px #C9B49B`;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// Dark-mode stars: parmesan and cream over espresso (#140C08), not pure black.
|
||||
function generateStars(n) {
|
||||
let value = `${getRandom(2560)}px ${getRandom(2560)}px #fff`;
|
||||
let value = `${getRandom(2560)}px ${getRandom(2560)}px #FFF6E5`;
|
||||
for (let i = 2; i <= n; i++) {
|
||||
value += `, ${getRandom(2560)}px ${getRandom(2560)}px #fff`;
|
||||
value += `, ${getRandom(2560)}px ${getRandom(2560)}px #F5E6D3`;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
function changeTheme() {
|
||||
const element = document.documentElement
|
||||
const theme = element.classList.contains("dark") ? "light" : "dark"
|
||||
console.log("Changing theme to:", theme)
|
||||
|
||||
const css = document.createElement("style")
|
||||
|
||||
@@ -23,6 +24,8 @@ function changeTheme() {
|
||||
element.classList.remove("dark")
|
||||
}
|
||||
|
||||
console.log("Dark class present:", element.classList.contains("dark"))
|
||||
|
||||
window.getComputedStyle(css).opacity
|
||||
document.head.removeChild(css)
|
||||
localStorage.theme = theme
|
||||
@@ -50,17 +53,13 @@ function preloadTheme() {
|
||||
localStorage.theme = theme
|
||||
}
|
||||
|
||||
window.onload = () => {
|
||||
function initializeThemeButtons() {
|
||||
const headerThemeButton = document.getElementById("header-theme-button")
|
||||
const drawerThemeButton = document.getElementById("drawer-theme-button")
|
||||
headerThemeButton?.addEventListener("click", changeTheme)
|
||||
drawerThemeButton?.addEventListener("click", changeTheme)
|
||||
// Use event delegation to avoid duplicate listeners on navigation
|
||||
document.addEventListener("click", (event) => {
|
||||
const target = event.target.closest("#header-theme-button, #drawer-theme-button");
|
||||
if (target) {
|
||||
changeTheme();
|
||||
}
|
||||
|
||||
document.addEventListener("astro:after-swap", initializeThemeButtons)
|
||||
initializeThemeButtons()
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener("astro:after-swap", preloadTheme)
|
||||
|
||||
|
||||
@@ -24,7 +24,5 @@
|
||||
<path fill="#6366f1" d="M23.5 6.5C17.5 6.5 13.75 9.5 12.25 15.5C14.5 12.5 17.125 11.375 20.125 12.125C21.8367 12.5529 23.0601 13.7947 24.4142 15.1692C26.6202 17.4084 29.1734 20 34.75 20C40.75 20 44.5 17 46 11C43.75 14 41.125 15.125 38.125 14.375C36.4133 13.9471 35.1899 12.7053 33.8357 11.3308C31.6297 9.09158 29.0766 6.5 23.5 6.5ZM12.25 20C6.25 20 2.5 23 1 29C3.25 26 5.875 24.875 8.875 25.625C10.5867 26.0529 11.8101 27.2947 13.1642 28.6693C15.3702 30.9084 17.9234 33.5 23.5 33.5C29.5 33.5 33.25 30.5 34.75 24.5C32.5 27.5 29.875 28.625 26.875 27.875C25.1633 27.4471 23.9399 26.2053 22.5858 24.8307C20.3798 22.5916 17.8266 20 12.25 20Z"/>
|
||||
</symbol>
|
||||
|
||||
<!-- appwrite icon-->
|
||||
<symbol id="simple-icons--appwrite" viewBox="0 0 24 24"><path fill="currentColor" d="M24 17.291v5.29H10.557A10.58 10.58 0 0 1 0 12.715v-1.43c.048-.735.174-1.463.374-2.171C1.63 4.673 5.713 1.419 10.557 1.419s8.927 3.254 10.183 7.695h-5.749a5.28 5.28 0 0 0-4.434-2.404a5.28 5.28 0 0 0-4.434 2.404A5.23 5.23 0 0 0 5.267 12a5.27 5.27 0 0 0 1.66 3.848a5.27 5.27 0 0 0 3.63 1.443zm0-6.734v5.291h-9.813A5.28 5.28 0 0 0 15.848 12c0-.5-.07-.984-.199-1.443z"/></symbol>
|
||||
</defs>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 4.5 KiB |
@@ -74,6 +74,21 @@
|
||||
<path d="M12 5l7 7-7 7"/>
|
||||
</symbol>
|
||||
|
||||
<!-- resume (document with a folded corner and text lines) -->
|
||||
<symbol id="resume" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" viewBox="0 0 24 24">
|
||||
<path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/>
|
||||
<path d="M14 2v6h6"/>
|
||||
<path d="M8 13h5"/>
|
||||
<path d="M8 17h8"/>
|
||||
</symbol>
|
||||
|
||||
<!-- external-link (off-site nav items, e.g. Docs) -->
|
||||
<symbol id="external-link" viewBox="0 0 24 24" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5">
|
||||
<path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"/>
|
||||
<path d="M15 3h6v6"/>
|
||||
<path d="M10 14L21 3"/>
|
||||
</symbol>
|
||||
|
||||
<!-- globe -->
|
||||
<symbol id="globe" viewBox="0 0 16 16">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.268 14.0934C11.9051 13.4838 13.2303 12.2333 13.9384 10.6469C13.1192 10.7941 12.2138 10.9111 11.2469 10.9925C11.0336 12.2005 10.695 13.2621 10.268 14.0934ZM8 16C12.4183 16 16 12.4183 16 8C16 3.58172 12.4183 0 8 0C3.58172 0 0 3.58172 0 8C0 12.4183 3.58172 16 8 16ZM8.48347 14.4823C8.32384 14.494 8.16262 14.5 8 14.5C7.83738 14.5 7.67616 14.494 7.51654 14.4823C7.5132 14.4791 7.50984 14.4759 7.50647 14.4726C7.2415 14.2165 6.94578 13.7854 6.67032 13.1558C6.41594 12.5744 6.19979 11.8714 6.04101 11.0778C6.67605 11.1088 7.33104 11.125 8 11.125C8.66896 11.125 9.32395 11.1088 9.95899 11.0778C9.80021 11.8714 9.58406 12.5744 9.32968 13.1558C9.05422 13.7854 8.7585 14.2165 8.49353 14.4726C8.49016 14.4759 8.4868 14.4791 8.48347 14.4823ZM11.4187 9.72246C12.5137 9.62096 13.5116 9.47245 14.3724 9.28806C14.4561 8.87172 14.5 8.44099 14.5 8C14.5 7.55901 14.4561 7.12828 14.3724 6.71194C13.5116 6.52755 12.5137 6.37904 11.4187 6.27753C11.4719 6.83232 11.5 7.40867 11.5 8C11.5 8.59133 11.4719 9.16768 11.4187 9.72246ZM10.1525 6.18401C10.2157 6.75982 10.25 7.36805 10.25 8C10.25 8.63195 10.2157 9.24018 10.1525 9.81598C9.46123 9.85455 8.7409 9.875 8 9.875C7.25909 9.875 6.53877 9.85455 5.84749 9.81598C5.7843 9.24018 5.75 8.63195 5.75 8C5.75 7.36805 5.7843 6.75982 5.84749 6.18401C6.53877 6.14545 7.25909 6.125 8 6.125C8.74091 6.125 9.46123 6.14545 10.1525 6.18401ZM11.2469 5.00748C12.2138 5.08891 13.1191 5.20593 13.9384 5.35306C13.2303 3.7667 11.9051 2.51622 10.268 1.90662C10.695 2.73788 11.0336 3.79953 11.2469 5.00748ZM8.48347 1.51771C8.4868 1.52089 8.49016 1.52411 8.49353 1.52737C8.7585 1.78353 9.05422 2.21456 9.32968 2.84417C9.58406 3.42562 9.80021 4.12856 9.95899 4.92219C9.32395 4.89118 8.66896 4.875 8 4.875C7.33104 4.875 6.67605 4.89118 6.04101 4.92219C6.19978 4.12856 6.41594 3.42562 6.67032 2.84417C6.94578 2.21456 7.2415 1.78353 7.50647 1.52737C7.50984 1.52411 7.51319 1.52089 7.51653 1.51771C7.67615 1.50597 7.83738 1.5 8 1.5C8.16262 1.5 8.32384 1.50597 8.48347 1.51771ZM5.73202 1.90663C4.0949 2.51622 2.76975 3.7667 2.06159 5.35306C2.88085 5.20593 3.78617 5.08891 4.75309 5.00748C4.96639 3.79953 5.30497 2.73788 5.73202 1.90663ZM4.58133 6.27753C3.48633 6.37904 2.48837 6.52755 1.62761 6.71194C1.54392 7.12828 1.5 7.55901 1.5 8C1.5 8.44099 1.54392 8.87172 1.62761 9.28806C2.48837 9.47245 3.48633 9.62096 4.58133 9.72246C4.52807 9.16768 4.5 8.59133 4.5 8C4.5 7.40867 4.52807 6.83232 4.58133 6.27753ZM4.75309 10.9925C3.78617 10.9111 2.88085 10.7941 2.06159 10.6469C2.76975 12.2333 4.0949 13.4838 5.73202 14.0934C5.30497 13.2621 4.96639 12.2005 4.75309 10.9925Z"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 7.2 KiB |
@@ -1,42 +1,46 @@
|
||||
import { formatDate } from "@lib/utils"
|
||||
import type { BlogPost, Project } from "@lib/appwrite-service"
|
||||
import type { CardEntry } from "@lib/types"
|
||||
|
||||
type Props = {
|
||||
entry: BlogPost | Project | any
|
||||
entry: CardEntry
|
||||
collection?: string
|
||||
pill?: boolean
|
||||
}
|
||||
|
||||
export default function ArrowCard({entry, pill, collection}: Props) {
|
||||
// Search results carry their own `collection`; listing pages pass it in
|
||||
// as a prop. Both paths resolve to the same route shape.
|
||||
const resolvedCollection = "collection" in entry ? entry.collection : collection
|
||||
const id = "slug" in entry ? entry.slug : entry.id
|
||||
return (
|
||||
<a href={`/${collection === 'blog' ? 'blog' : 'projects'}/${entry.$id}`} class="group p-4 gap-3 flex items-center border border-spaghetti-brown rounded-lg hover:bg-spaghetti-red/5 hover:dark:bg-spaghetti-cream/10 dark:border-spaghetti-cream/20 transition-colors duration-300 ease-in-out">
|
||||
<div class="w-full group-hover:text-spaghetti-red group-hover:dark:text-spaghetti-cream blend">
|
||||
<a href={`/${resolvedCollection === 'blog' ? 'blog' : 'projects'}/${id}`} class="group p-4 gap-3 flex items-center border border-edge rounded-lg bg-surface hover:bg-wash transition-colors duration-300 ease-in-out">
|
||||
<div class="w-full group-hover:text-link blend">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
{pill &&
|
||||
<div class="text-sm capitalize px-2 py-0.5 rounded-full border border-black/15 dark:border-spaghetti-cream/20 bg-spaghetti-yellow/20 dark:bg-spaghetti-yellow/20 dark:text-spaghetti-cream">
|
||||
<div class="text-sm capitalize px-2 py-0.5 rounded-full border border-line bg-chip text-chip-ink">
|
||||
{collection === "blog" ? "post" : "project"}
|
||||
</div>
|
||||
}
|
||||
<div class="text-sm uppercase text-spaghetti-brown dark:text-spaghetti-yellow">
|
||||
<div class="text-sm uppercase text-accent">
|
||||
{formatDate(entry.date)}
|
||||
</div>
|
||||
</div>
|
||||
<div class="font-semibold mt-3 text-spaghetti-brown/80 dark:text-spaghetti-cream">
|
||||
<div class="font-semibold mt-3 text-ink">
|
||||
{entry.title}
|
||||
</div>
|
||||
|
||||
<div class="text-sm line-clamp-2 text-spaghetti-brown/80 dark:text-spaghetti-cream">
|
||||
<div class="text-sm line-clamp-2 text-ink-muted">
|
||||
{entry.summary}
|
||||
</div>
|
||||
<ul class="flex flex-wrap mt-2 gap-1">
|
||||
{entry.tags.map((tag:string) => (
|
||||
<li class="text-xs uppercase py-0.5 px-1 rounded bg-spaghetti-yellow/20 dark:bg-spaghetti-yellow/20 text-spaghetti-brown/80 dark:text-spaghetti-yellow">
|
||||
<li class="text-xs uppercase py-0.5 px-1 rounded bg-chip text-chip-ink">
|
||||
{tag}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="stroke-current group-hover:stroke-black group-hover:dark:stroke-spaghetti-yellow">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="stroke-current group-hover:stroke-link">
|
||||
<line x1="5" y1="12" x2="19" y2="12" class="scale-x-0 group-hover:scale-x-100 translate-x-4 group-hover:translate-x-1 transition-all duration-300 ease-in-out" />
|
||||
<polyline points="12 5 19 12 12 19" class="translate-x-0 group-hover:translate-x-1 transition-all duration-300 ease-in-out" />
|
||||
</svg>
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
import type { BlogPost } from "@lib/appwrite-service"
|
||||
import { createEffect, createSignal, For } from "solid-js"
|
||||
import ArrowCard from "@components/ArrowCard"
|
||||
import { cn } from "@lib/utils"
|
||||
|
||||
type Props = {
|
||||
tags: string[]
|
||||
data: BlogPost[] // Using Appwrite data instead of Astro content collections
|
||||
}
|
||||
|
||||
export default function Blog({ data, tags }: Props) {
|
||||
const [filter, setFilter] = createSignal(new Set<string>())
|
||||
const [posts, setPosts] = createSignal<BlogPost[]>([])
|
||||
|
||||
createEffect(() => {
|
||||
setPosts(data.filter((entry) => {
|
||||
// Filter by tags
|
||||
const tagMatch = Array.from(filter()).every((value) =>
|
||||
entry.tags.some((tag:string) =>
|
||||
tag.toLowerCase() === String(value).toLowerCase()
|
||||
)
|
||||
)
|
||||
|
||||
return tagMatch
|
||||
}))
|
||||
})
|
||||
|
||||
function toggleTag(tag: string) {
|
||||
setFilter((prev) =>
|
||||
new Set(prev.has(tag)
|
||||
? [...prev].filter((t) => t !== tag)
|
||||
: [...prev, tag]
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-6">
|
||||
<div class="col-span-3 sm:col-span-1">
|
||||
<div class="sticky top-24">
|
||||
<div class="text-sm font-semibold uppercase mb-2 text-spaghetti-brown/80 dark:text-spaghetti-cream">Filter</div>
|
||||
{/* Tag Filter */}
|
||||
<div class="mb-2">
|
||||
<div class="text-xs uppercase mb-1 text-spaghetti-brown/70">Tags</div>
|
||||
<ul class="flex flex-wrap sm:flex-col gap-1.5">
|
||||
<For each={tags}>
|
||||
{(tag) => (
|
||||
<li>
|
||||
<button onClick={() => toggleTag(tag)} class={cn("w-full px-2 py-1 rounded", "whitespace-nowrap overflow-hidden overflow-ellipsis", "flex gap-2 items-center", "bg-spaghetti-yellow/20 dark:bg-spaghetti-yellow/20", "hover:bg-spaghetti-yellow/30 hover:dark:bg-spaghetti-yellow/30", "transition-colors duration-300 ease-in-out", filter().has(tag) && "text-spaghetti-brown/80 dark:text-spaghetti-brown")}>
|
||||
<svg class={cn("size-5 fill-spaghetti-brown/50 dark:fill-spaghetti-brown/50", "transition-colors duration-300 ease-in-out", filter().has(tag) && "fill-spaghetti-brown dark:fill-spaghetti-brown")}>
|
||||
<use href={`/ui.svg#square`} class={cn(!filter().has(tag) ? "block" : "hidden")} />
|
||||
<use href={`/ui.svg#square-check`} class={cn(filter().has(tag) ? "block" : "hidden")} />
|
||||
</svg>
|
||||
{tag}
|
||||
</button>
|
||||
</li>
|
||||
)}
|
||||
</For>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2">
|
||||
<div class="flex flex-col">
|
||||
<div class="text-sm uppercase mb-2">
|
||||
SHOWING {posts().length} OF {data.length} POSTS
|
||||
</div>
|
||||
<ul class="flex flex-col gap-3">
|
||||
{posts().map((post) => (
|
||||
<li>
|
||||
<ArrowCard entry={post} collection={'blog'} />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -7,10 +7,10 @@ function CounterButton() {
|
||||
|
||||
return (
|
||||
<div class="flex gap-4 items-center">
|
||||
<button onClick={increment} class="px-3 py-1 border border-spaghetti-yellow/50 dark:border-spaghetti-yellow/50 hover:bg-spaghetti-yellow/20 dark:hover:bg-spaghetti-yellow/20 blend text-spaghetti-brown">
|
||||
<button onClick={increment} class="px-3 py-1 border border-edge hover:bg-chip hover:text-chip-ink blend text-ink">
|
||||
Increment
|
||||
</button>
|
||||
<div class="text-spaghetti-brown">
|
||||
<div class="text-ink">
|
||||
Clicked {count()} {count() === 1 ? "time" : "times"}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,35 +1,42 @@
|
||||
---
|
||||
import { SITE, LINKS } from "@consts"
|
||||
import { cn } from "@lib/utils"
|
||||
import { SITE, LINKS, RESUME } from "@consts"
|
||||
import { cn, ACTIVE_NAV_COLORS, isNavActive } from "@lib/utils"
|
||||
const { pathname } = Astro.url
|
||||
const subpath = pathname.match(/[^/]+/g)
|
||||
---
|
||||
|
||||
<div id="drawer" class="fixed inset-0 h-0 z-40 overflow-hidden flex flex-col items-center justify-center md:hidden bg-spaghetti-cream dark:bg-black transition-[height] duration-300 ease-in-out">
|
||||
<div id="drawer" class="fixed inset-0 h-0 z-40 overflow-hidden flex flex-col items-center justify-center md:hidden bg-page transition-[height] duration-300 ease-in-out">
|
||||
<nav class="flex flex-col items-center space-y-2">
|
||||
{
|
||||
LINKS.map((LINK) => (
|
||||
<a href={LINK.HREF} class={cn("flex items-center justify-center px-3 py-1 rounded-full", "text-current hover:text-black dark:hover:text-white", "hover:bg-spaghetti-yellow/20 dark:hover:bg-spaghetti-yellow/20", "transition-colors duration-300 ease-in-out", pathname === LINK.HREF || "/" + subpath?.[0] === LINK.HREF ? "pointer-events-none bg-spaghetti-red dark:bg-spaghetti-red text-spaghetti-brown dark:text-spaghetti-brown" : "")}>
|
||||
<a href={LINK.HREF} class={cn("flex items-center justify-center px-3 py-1 rounded-full", "text-ink hover:bg-wash hover:text-link", "transition-colors duration-300 ease-in-out", isNavActive(pathname, LINK.HREF) && "pointer-events-none", isNavActive(pathname, LINK.HREF) && ACTIVE_NAV_COLORS)}>
|
||||
{LINK.TEXT}
|
||||
</a>
|
||||
))
|
||||
}
|
||||
<!-- The header pill drops its label below `sm`, so the drawer is where the
|
||||
Résumé CTA keeps its text on mobile. -->
|
||||
<a href={RESUME.HREF} target="_blank" rel="noopener noreferrer" aria-label={`${RESUME.TEXT} for ${SITE.AUTHOR}, opens in a new tab`} class="flex items-center justify-center gap-1.5 px-3 py-1 rounded-full bg-chip text-chip-ink stroke-current border border-edge hover:bg-link hover:text-page hover:border-link transition-colors duration-300">
|
||||
<svg class="size-4 shrink-0" fill="none">
|
||||
<use href={`/ui.svg#${RESUME.ICON}`}></use>
|
||||
</svg>
|
||||
<span>{RESUME.TEXT}</span>
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<div class="flex gap-1 mt-5">
|
||||
<a href="/search" aria-label={`Search blog posts and projects on ${SITE.TITLE}`} class={cn("size-9 rounded-full p-2 items-center justify-center bg-transparent hover:bg-spaghetti-yellow/20 dark:hover:bg-spaghetti-yellow/20 stroke-current hover:stroke-black hover:dark:stroke-white border border-spaghetti-yellow/50 dark:border-spaghetti-yellow/50 transition-colors duration-300 ease-in-out", pathname === "/search" || "/" + subpath?.[0] === "search" ? "pointer-events-none bg-spaghetti-red dark:bg-spaghetti-red text-white dark:text-white" : "")}>
|
||||
<a href="/search" aria-label={`Search blog posts and projects on ${SITE.TITLE}`} class={cn("size-9 rounded-full p-2 items-center justify-center bg-transparent stroke-current border border-edge hover:bg-chip hover:text-chip-ink transition-colors duration-300 ease-in-out", isNavActive(pathname, "/search") && "pointer-events-none", isNavActive(pathname, "/search") && ACTIVE_NAV_COLORS)}>
|
||||
<svg class="size-full">
|
||||
<use href="/ui.svg#search"></use>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<a href="/rss.xml" target="_blank" aria-label={`Rss feed for ${SITE.TITLE}`} class="size-9 rounded-full p-2 items-center justify-center bg-transparent hover:bg-spaghetti-yellow/20 dark:hover:bg-spaghetti-yellow/20 stroke-current hover:stroke-black hover:dark:stroke-white border border-spaghetti-yellow/50 dark:border-spaghetti-yellow/50 transition-colors duration-300 ease-in-out">
|
||||
<a href="/rss.xml" target="_blank" aria-label={`Rss feed for ${SITE.TITLE}`} class="size-9 rounded-full p-2 items-center justify-center bg-transparent stroke-current border border-edge hover:bg-chip hover:text-chip-ink transition-colors duration-300 ease-in-out">
|
||||
<svg class="size-full">
|
||||
<use href="/ui.svg#rss"></use>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<button id="drawer-theme-button" aria-label={`Toggle light and dark theme`} class="size-9 rounded-full p-2 items-center justify-center bg-transparent hover:bg-spaghetti-yellow/20 dark:hover:bg-spaghetti-yellow/20 stroke-current hover:stroke-black hover:dark:stroke-white border border-spaghetti-yellow/50 dark:border-spaghetti-yellow/50 transition-colors duration-300 ease-in-out">
|
||||
<button id="drawer-theme-button" aria-label={`Toggle light and dark theme`} class="size-9 rounded-full p-2 items-center justify-center bg-transparent stroke-current border border-edge hover:bg-chip hover:text-chip-ink transition-colors duration-300 ease-in-out">
|
||||
<svg class="block dark:hidden size-full">
|
||||
<use href="/ui.svg#sun"></use>
|
||||
</svg>
|
||||
|
||||
@@ -0,0 +1,210 @@
|
||||
import { createEffect, createMemo, createSignal, onCleanup, onMount, For } from "solid-js"
|
||||
import ArrowCard from "@components/ArrowCard"
|
||||
import { cn } from "@lib/utils"
|
||||
import {
|
||||
collectTags,
|
||||
filterEntries,
|
||||
hasActiveFilters,
|
||||
parseFilterParams,
|
||||
tagCounts,
|
||||
writeFilterParams,
|
||||
DEFAULT_SORT,
|
||||
SORT_KEYS,
|
||||
SORT_LABELS,
|
||||
type FilterState,
|
||||
type ListEntry,
|
||||
type SortKey,
|
||||
} from "@lib/filters"
|
||||
|
||||
type Props = {
|
||||
entries: ListEntry[]
|
||||
collection: "blog" | "projects"
|
||||
/**
|
||||
* Filter state read from the incoming request URL. The island is SSR'd, so
|
||||
* seeding from `window.location` would render one list on the server and a
|
||||
* different one on hydration; the page passes the parsed request URL instead.
|
||||
*/
|
||||
initial?: FilterState
|
||||
}
|
||||
|
||||
/**
|
||||
* Shared tag + keyword + sort filter for the /blog and /projects listings.
|
||||
*
|
||||
* Both islands used to be byte-identical copies of each other, which is how
|
||||
* the AND-vs-OR semantics, the duplicate-case tags and the missing empty state
|
||||
* ended up duplicated too. One component, one place to fix.
|
||||
*/
|
||||
export default function FilteredList({ entries, collection, initial }: Props) {
|
||||
const [filter, setFilter] = createSignal<FilterState>(
|
||||
initial ?? { tags: [], query: "", sort: DEFAULT_SORT }
|
||||
)
|
||||
|
||||
const tags = createMemo(() => collectTags(entries))
|
||||
const counts = createMemo(() => tagCounts(entries, filter()))
|
||||
const visible = createMemo(() => filterEntries(entries, filter()))
|
||||
const filtered = createMemo(() => hasActiveFilters(filter()))
|
||||
|
||||
function toggleTag(key: string) {
|
||||
setFilter((prev) => ({
|
||||
...prev,
|
||||
tags: prev.tags.includes(key)
|
||||
? prev.tags.filter((tag) => tag !== key)
|
||||
: [...prev.tags, key],
|
||||
}))
|
||||
}
|
||||
|
||||
function reset() {
|
||||
setFilter({ tags: [], query: "", sort: DEFAULT_SORT })
|
||||
}
|
||||
|
||||
// Mirror state into the address bar so a filtered view survives a refresh and
|
||||
// can be shared, matching what the search island already does.
|
||||
const syncUrl = () => {
|
||||
if (typeof window === "undefined") return
|
||||
const url = new URL(window.location.href)
|
||||
writeFilterParams(url.searchParams, filter())
|
||||
window.history.replaceState({}, "", url.toString())
|
||||
}
|
||||
|
||||
createEffect(syncUrl)
|
||||
|
||||
// Restore filters when the user navigates with browser back/forward. Bound
|
||||
// only in onMount: this component is SSR'd, and `window` does not exist there.
|
||||
const onPopState = () =>
|
||||
setFilter(parseFilterParams(new URL(window.location.href).searchParams))
|
||||
|
||||
let popStateBound = false
|
||||
onMount(() => {
|
||||
window.addEventListener("popstate", onPopState)
|
||||
popStateBound = true
|
||||
})
|
||||
|
||||
onCleanup(() => {
|
||||
if (popStateBound) window.removeEventListener("popstate", onPopState)
|
||||
})
|
||||
|
||||
const noun = collection === "blog" ? "post" : "project"
|
||||
const plural = `${noun}s`
|
||||
|
||||
return (
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-6">
|
||||
<div class="col-span-3 sm:col-span-1">
|
||||
<div class="sticky top-24">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<div class="text-sm font-semibold uppercase mb-2 text-ink">Filter</div>
|
||||
{filtered() && (
|
||||
<button
|
||||
onClick={reset}
|
||||
class="text-xs uppercase text-link hover:text-link-hover underline underline-offset-2 mb-2 transition-colors duration-300 ease-in-out"
|
||||
>
|
||||
Clear all
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<label class="block text-xs uppercase mb-1 text-ink-muted" for="filter-q">
|
||||
Keyword
|
||||
</label>
|
||||
<input
|
||||
id="filter-q"
|
||||
type="search"
|
||||
value={filter().query}
|
||||
onInput={(e) => setFilter((prev) => ({ ...prev, query: e.currentTarget.value }))}
|
||||
placeholder={`Search ${plural}…`}
|
||||
autocomplete="off"
|
||||
spellcheck={false}
|
||||
class="w-full px-2.5 py-1.5 rounded outline-none text-ink bg-chip border border-edge focus:border-edge transition-colors duration-300 ease-in-out"
|
||||
/>
|
||||
|
||||
<label class="block text-xs uppercase mt-3 mb-1 text-ink-muted" for="filter-sort">
|
||||
Sort
|
||||
</label>
|
||||
<select
|
||||
id="filter-sort"
|
||||
value={filter().sort}
|
||||
onChange={(e) => setFilter((prev) => ({ ...prev, sort: e.currentTarget.value as SortKey }))}
|
||||
class="w-full px-2 py-1.5 rounded text-ink bg-chip border border-edge outline-none transition-colors duration-300 ease-in-out"
|
||||
>
|
||||
<For each={SORT_KEYS}>
|
||||
{/* `selected` is set explicitly because `<select value>` has no
|
||||
content attribute: SSR writes it as one, which browsers ignore,
|
||||
so a deep link like ?sort=az would render the wrong option
|
||||
selected until hydration. */}
|
||||
{(key) => <option value={key} selected={filter().sort === key}>{SORT_LABELS[key]}</option>}
|
||||
</For>
|
||||
</select>
|
||||
|
||||
<div class="mt-3">
|
||||
<div class="text-xs uppercase mb-1 text-ink-muted">Tags</div>
|
||||
<ul role="group" aria-label="Filter by tag" class="flex flex-wrap sm:flex-col gap-1.5">
|
||||
<For each={tags()}>
|
||||
{(tag) => {
|
||||
const selected = () => filter().tags.includes(tag.key)
|
||||
const count = () => counts().get(tag.key) ?? 0
|
||||
return (
|
||||
<li>
|
||||
<button
|
||||
onClick={() => toggleTag(tag.key)}
|
||||
aria-pressed={selected()}
|
||||
class={cn(
|
||||
"w-full px-2 py-1 rounded text-ink",
|
||||
"whitespace-nowrap overflow-hidden overflow-ellipsis",
|
||||
"flex gap-2 items-center",
|
||||
"border border-transparent hover:border-edge hover:bg-wash",
|
||||
"transition-colors duration-300 ease-in-out",
|
||||
selected() && "bg-chip text-chip-ink border-chip",
|
||||
count() === 0 && !selected() && "opacity-50"
|
||||
)}
|
||||
>
|
||||
<svg class={cn("size-5 shrink-0 fill-current opacity-60", "transition-colors duration-300 ease-in-out", selected() && "opacity-100")}>
|
||||
<use href={`/ui.svg#square`} class={cn(selected() ? "hidden" : "block")} />
|
||||
<use href={`/ui.svg#square-check`} class={cn(selected() ? "block" : "hidden")} />
|
||||
</svg>
|
||||
<span class="flex-1 text-left truncate">{tag.label}</span>
|
||||
<span class="text-xs tabular-nums opacity-70">{count()}</span>
|
||||
</button>
|
||||
</li>
|
||||
)
|
||||
}}
|
||||
</For>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-span-3 sm:col-span-2">
|
||||
<div class="flex flex-col">
|
||||
<div class="text-sm uppercase mb-2" aria-live="polite">
|
||||
SHOWING {visible().length} OF {entries.length} {plural.toUpperCase()}
|
||||
</div>
|
||||
|
||||
{visible().length === 0 ? (
|
||||
<div class="p-4 border border-edge rounded-lg bg-surface">
|
||||
<div class="font-semibold text-ink">No {plural} match these filters.</div>
|
||||
<div class="text-sm text-ink-muted mt-1">
|
||||
Tags are combined with OR, so a keyword that excludes everything is the usual
|
||||
culprit. Try shortening the keyword or clearing the filters.
|
||||
</div>
|
||||
<button
|
||||
onClick={reset}
|
||||
class="mt-3 px-2 py-1 rounded text-ink border border-edge hover:bg-wash transition-colors duration-300 ease-in-out"
|
||||
>
|
||||
Clear filters
|
||||
</button>
|
||||
</div>
|
||||
) : (
|
||||
<ul class="flex flex-col gap-3">
|
||||
<For each={visible()}>
|
||||
{(entry) => (
|
||||
<li>
|
||||
<ArrowCard entry={entry} collection={collection} />
|
||||
</li>
|
||||
)}
|
||||
</For>
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,20 +1,25 @@
|
||||
---
|
||||
import { SITE, SOCIALS } from "@consts"
|
||||
import Container from "@components/Container.astro"
|
||||
// Remove unused storage import
|
||||
import SystemStatus from "@components/SystemStatus.astro"
|
||||
import { getSystemStatus } from "@lib/status"
|
||||
|
||||
// Rendered server-side so the light is correct in the first paint (and with JS
|
||||
// off); SystemStatus then keeps it current from /api/status.
|
||||
const statusSnapshot = await getSystemStatus()
|
||||
---
|
||||
|
||||
<footer class="relative bg-white dark:bg-black">
|
||||
<footer class="relative bg-page">
|
||||
<div class="animate">
|
||||
<section class="py-5">
|
||||
<Container size="md">
|
||||
<div class="flex items-center justify-center sm:justify-end">
|
||||
<button id="back-to-top" aria-label="Back to top of page" class="group flex w-fit p-1.5 gap-1.5 text-sm items-center border rounded hover:bg-black/5 hover:dark:bg-white/10 border-black/15 dark:border-white/20 transition-colors duration-300 ease-in-out">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="stroke-current group-hover:stroke-black group-hover:dark:stroke-white rotate-90">
|
||||
<button id="back-to-top" aria-label="Back to top of page" class="group flex w-fit p-1.5 gap-1.5 text-sm items-center border rounded border-edge hover:bg-chip hover:text-chip-ink transition-colors duration-300 ease-in-out">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="stroke-current rotate-90">
|
||||
<line x1="19" y1="12" x2="5" y2="12" class="scale-x-0 group-hover:scale-x-100 translate-x-3 group-hover:translate-x-0 transition-all duration-300 ease-in-out" />
|
||||
<polyline points="12 19 5 12 12 5" class="translate-x-1 group-hover:translate-x-0 transition-all duration-300 ease-in-out" />
|
||||
</svg>
|
||||
<div class="w-full group-hover:text-black group-hover:dark:text-white transition-colors duration-300 ease-in-out">
|
||||
<div class="w-full transition-colors duration-300 ease-in-out">
|
||||
Back to top
|
||||
</div>
|
||||
</button>
|
||||
@@ -22,39 +27,33 @@ import Container from "@components/Container.astro"
|
||||
</Container>
|
||||
</section>
|
||||
|
||||
<section class=" py-5 overflow-hidden whitespace-nowrap border-t border-black/10 dark:border-white/25">
|
||||
<section class=" py-5 overflow-hidden whitespace-nowrap border-t border-line">
|
||||
<Container size="md">
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||
<div class="flex flex-col items-center sm:items-start">
|
||||
<a href="/" class="flex gap-1 w-fit font-semibold text-current hover:text-black dark:hover:text-white transition-colors duration-300 ease-in-out">
|
||||
<img src="/api/assets/689d265e0036955a618d" alt="Logo" class="size-6" />
|
||||
<a href="/" class="flex gap-1 w-fit font-semibold text-ink transition-colors duration-300 ease-in-out hover:text-link">
|
||||
<img src="/images/logo.png" alt="Logo" class="size-6" />
|
||||
{SITE.TITLE}
|
||||
</a>
|
||||
</div>
|
||||
<div class="flex gap-2 justify-center sm:justify-end items-center">
|
||||
<span class="relative flex h-3 w-3">
|
||||
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-green-300"></span>
|
||||
<span class="relative inline-flex rounded-full h-3 w-3 bg-green-500"></span>
|
||||
</span>
|
||||
All systems normal
|
||||
</div>
|
||||
<SystemStatus snapshot={statusSnapshot} />
|
||||
</div>
|
||||
</Container>
|
||||
</section>
|
||||
|
||||
<section class=" py-5 overflow-hidden whitespace-nowrap border-t border-black/10 dark:border-white/25">
|
||||
<section class=" py-5 overflow-hidden whitespace-nowrap border-t border-line">
|
||||
<Container size="md">
|
||||
<div class="h-full grid grid-cols-1 sm:grid-cols-2 gap-3">
|
||||
<div class="order-2 sm:order-1 flex flex-col items-center justify-center sm:items-start">
|
||||
<div class="legal">
|
||||
<a href="/legal/terms" class="text-spaghetti-red hover:text-spaghetti-brown dark:hover:text-spaghetti-brown transition-colors duration-300 ease-in-out">
|
||||
<a href="/legal/terms-of-service" class="text-link hover:text-link-hover transition-colors duration-300 ease-in-out">
|
||||
Terms
|
||||
</a> |
|
||||
<a href="/legal/privacy" class="text-spaghetti-red hover:text-spaghetti-brown dark:hover:text-spaghetti-brown transition-colors duration-300 ease-in-out">
|
||||
<a href="/legal/privacy-policy" class="text-link hover:text-link-hover transition-colors duration-300 ease-in-out">
|
||||
Privacy
|
||||
</a>
|
||||
</div>
|
||||
<div class="text-sm mt-2 text-spaghetti-brown">
|
||||
<div class="text-sm mt-2 text-ink-muted">
|
||||
© {new Date().getFullYear()} | All rights reserved
|
||||
</div>
|
||||
</div>
|
||||
@@ -67,9 +66,9 @@ import Container from "@components/Container.astro"
|
||||
href={SOCIAL.HREF}
|
||||
target="_blank"
|
||||
aria-label={`${SITE.TITLE} on ${SOCIAL.NAME}`}
|
||||
class="group size-10 rounded-full p-2 items-center justify-center hover:bg-black/5 dark:hover:bg-white/20 blend"
|
||||
class="group size-10 rounded-full p-2 items-center justify-center hover:bg-chip blend"
|
||||
>
|
||||
<svg class="size-full fill-current group-hover:fill-black group-hover:dark:fill-white blend">
|
||||
<svg class="size-full fill-current group-hover:fill-chip-ink blend">
|
||||
<use href={`/social.svg#${SOCIAL.ICON}`} />
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
---
|
||||
import { SITE, LINKS } from "@consts"
|
||||
import { cn } from "@lib/utils"
|
||||
const { pathname } = Astro.url
|
||||
const subpath = pathname.match(/[^/]+/g)
|
||||
import { SITE, LINKS, RESUME } from "@consts"
|
||||
import { cn, ACTIVE_NAV_COLORS, isNavActive } from "@lib/utils"
|
||||
import Container from "@components/Container.astro"
|
||||
const { pathname } = Astro.url
|
||||
---
|
||||
|
||||
<header id="header" class="fixed top-0 w-full h-16 z-50 ">
|
||||
<Container size="md">
|
||||
<!-- `lg`, not `md`: the header row has to fit the brand, five nav pills and the icon cluster
|
||||
on one line. In a 768px container the Résumé pill pushed the cluster onto the nav's last
|
||||
item (measured 1px of clearance at every width >= 800). The content column below stays
|
||||
`md`; only the header bar is wider. -->
|
||||
<Container size="lg">
|
||||
<div class="relative h-full w-full">
|
||||
<div class="absolute left-0 top-1/2 -translate-y-1/2 flex gap-1 font-semibold">
|
||||
<a href="/" class="flex gap-1 text-current hover:text-spaghetti-brown dark:hover:text-spaghetti-brown transition-colors duration-300 ease-in-out">
|
||||
<img src='/api/assets/689d265e0036955a618d' alt="Logo" class="size-6" />
|
||||
<a href="/" class="flex gap-1 text-ink transition-colors duration-300 ease-in-out hover:text-link">
|
||||
<img src='/images/logo.png' alt="Logo" class="size-6" />
|
||||
<div>
|
||||
{SITE.TITLE}
|
||||
</div>
|
||||
@@ -22,7 +25,7 @@ import Container from "@components/Container.astro"
|
||||
<nav class="hidden md:flex items-center justify-center text-sm gap-1">
|
||||
{
|
||||
LINKS.map((LINK) => (
|
||||
<a href={LINK.HREF} class={cn("h-8 rounded-full px-3 text-current", "flex items-center justify-center", "transition-colors duration-300 ease-in-out", pathname === LINK.HREF || "/" + subpath?.[0] === LINK.HREF ? "bg-spaghetti-red dark:bg-spaghetti-cream text-black dark:text-spaghetti-brown" : "hover:bg-spaghetti-red/5 dark:hover:bg-spaghetti-red/20 hover:text-black dark:hover:text-white")}>
|
||||
<a href={LINK.HREF} class={cn("h-8 rounded-full px-3 text-ink", "flex items-center justify-center", "transition-colors duration-300 ease-in-out", isNavActive(pathname, LINK.HREF) ? ACTIVE_NAV_COLORS : "hover:bg-wash hover:text-link")}>
|
||||
{LINK.TEXT}
|
||||
</a>
|
||||
))
|
||||
@@ -31,19 +34,19 @@ import Container from "@components/Container.astro"
|
||||
</div>
|
||||
|
||||
<div class="buttons absolute right-0 top-1/2 -translate-y-1/2 flex gap-1">
|
||||
<a href="/search" aria-label={`Search blog posts and projects on ${SITE.TITLE}`} class={cn("hidden md:flex", "size-9 rounded-full p-2 items-center justify-center", "bg-transparent hover:bg-spaghetti-yellow dark:hover:bg-spaghetti-yellow", "stroke-current hover:stroke-black hover:dark:stroke-white", "border border-black/10 dark:border-white/25", "transition-colors duration-300 ease-in-out", pathname === "/search" || "/" + subpath?.[0] === "/search" ? "pointer-events-none bg-spaghetti-red dark:bg-spaghetti-red text-spaghetti-brown dark:text-spaghetti-brown" : "")}>
|
||||
<a href="/search" aria-label={`Search blog posts and projects on ${SITE.TITLE}`} class={cn("hidden md:flex", "size-9 rounded-full p-2 items-center justify-center", "bg-transparent stroke-current", "border border-edge", "hover:bg-chip hover:text-chip-ink", "transition-colors duration-300 ease-in-out", isNavActive(pathname, "/search") && "pointer-events-none", isNavActive(pathname, "/search") && ACTIVE_NAV_COLORS)}>
|
||||
<svg class="size-full">
|
||||
<use href="/ui.svg#search"></use>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<a href="/rss.xml" target="_blank" aria-label={`Rss feed for ${SITE.TITLE}`} class={cn("hidden md:flex", "size-9 rounded-full p-2 items-center justify-center", "bg-transparent hover:bg-spaghetti-yellow dark:hover:bg-spaghetti-yellow", "stroke-current hover:stroke-black hover:dark:stroke-white", "border border-black/10 dark:border-white/25", "transition-colors duration-300 ease-in-out")}>
|
||||
<a href="/rss.xml" target="_blank" aria-label={`Rss feed for ${SITE.TITLE}`} class={cn("hidden md:flex", "size-9 rounded-full p-2 items-center justify-center", "bg-transparent stroke-current", "border border-edge", "hover:bg-chip hover:text-chip-ink", "transition-colors duration-300 ease-in-out")}>
|
||||
<svg class="size-full">
|
||||
<use href="/ui.svg#rss"></use>
|
||||
</svg>
|
||||
</a>
|
||||
|
||||
<button id="header-theme-button" aria-label={`Toggle light and dark theme`} class={cn("hidden md:flex", "size-9 rounded-full p-2 items-center justify-center", "bg-transparent hover:bg-spaghetti-yellow dark:hover:bg-spaghetti-yellow", "stroke-current hover:stroke-black hover:dark:stroke-white", "border border-black/10 dark:border-white/25", "transition-colors duration-300 ease-in-out")}>
|
||||
<button id="header-theme-button" aria-label={`Toggle light and dark theme`} class={cn("hidden md:flex", "size-9 rounded-full p-2 items-center justify-center", "bg-transparent stroke-current", "border border-edge", "hover:bg-chip hover:text-chip-ink", "transition-colors duration-300 ease-in-out")}>
|
||||
<svg class="size-full block dark:hidden">
|
||||
<use href="/ui.svg#sun"></use>
|
||||
</svg>
|
||||
@@ -52,7 +55,18 @@ import Container from "@components/Container.astro"
|
||||
</svg>
|
||||
</button>
|
||||
|
||||
<button id="header-drawer-button" aria-label={`Toggle drawer open and closed`} class={cn("flex md:hidden", "size-9 rounded-full p-2 items-center justify-center", "bg-spaghetti-red dark:bg-spaghetti-red", "stroke-current hover:stroke-black hover:dark:stroke-white text-spaghetti-brown dark:text-spaghetti-brown", "border border-black/10 dark:border-white/25", "transition-colors duration-300 ease-in-out")}>
|
||||
<!-- Résumé sits right of the theme toggle: the pill is the widest item in the
|
||||
cluster, so leading with it pushed the nav pills together. Below `lg` it
|
||||
collapses to a 36px icon-only circle to leave the nav room; the drawer
|
||||
carries the labelled link. -->
|
||||
<a href={RESUME.HREF} target="_blank" rel="noopener noreferrer" aria-label={`${RESUME.TEXT} for ${SITE.AUTHOR}, opens in a new tab`} class={cn("flex shrink-0 items-center justify-center gap-1.5 h-9 w-9 rounded-full lg:w-auto lg:pl-2.5 lg:pr-3 text-sm font-semibold", "bg-chip text-chip-ink stroke-current", "border border-edge", "hover:bg-link hover:text-page hover:border-link", "transition-colors duration-300 ease-in-out")}>
|
||||
<svg class="size-5 shrink-0 lg:size-4" fill="none">
|
||||
<use href={`/ui.svg#${RESUME.ICON}`}></use>
|
||||
</svg>
|
||||
<span class="hidden lg:inline">{RESUME.TEXT}</span>
|
||||
</a>
|
||||
|
||||
<button id="header-drawer-button" aria-label={`Toggle drawer open and closed`} class={cn("flex md:hidden", "size-9 rounded-full p-2 items-center justify-center", ACTIVE_NAV_COLORS, "stroke-current", "border border-edge", "transition-colors duration-300 ease-in-out")}>
|
||||
<svg id="drawer-open" class="size-full">
|
||||
<use href="/ui.svg#menu"></use>
|
||||
</svg>
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
/**
|
||||
* MeatballShower.astro
|
||||
* This component creates shooting meatballs that are appended to the galaxy on interval.
|
||||
* Each streak is a trail of marinara with a meatball at the head. Meatballs are removed from
|
||||
* the document after the animation is completed.
|
||||
* There are four (4) shower containers, one for each diagonal direction.
|
||||
*/
|
||||
---
|
||||
|
||||
<div id="meatballs">
|
||||
<!-- rotations defined in global.css -->
|
||||
<div class="shower ur" />
|
||||
<div class="shower dr" />
|
||||
<div class="shower dl" />
|
||||
<div class="shower ul" />
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const sauceVariants = ["v1", "v2", "v3"];
|
||||
|
||||
function randomInt(min: number, max: number) {
|
||||
return Math.round(Math.random() * (max - min) + min);
|
||||
}
|
||||
|
||||
function createMeatball () {
|
||||
// create a meatball with a randomized size and sauce pattern
|
||||
let meatball = document.createElement("div");
|
||||
const sauceVariant = sauceVariants[Math.floor(Math.random() * sauceVariants.length)];
|
||||
meatball.setAttribute("class", `meatball ${sauceVariant}`);
|
||||
meatball.style.left = Math.round(Math.random() * window.innerWidth) + "px";
|
||||
meatball.style.top = Math.round(Math.random() * window.innerHeight) + "px";
|
||||
|
||||
// the ball and its marinara trail are smaller on phones
|
||||
const isSmall = window.innerWidth < 768;
|
||||
meatball.style.setProperty("--ball-size", `${randomInt(isSmall ? 7 : 9, isSmall ? 10 : 14)}px`);
|
||||
meatball.style.setProperty("--trail-length", `${randomInt(isSmall ? 22 : 30, isSmall ? 34 : 45)}vh`);
|
||||
meatball.style.setProperty("--trail-width", `${randomInt(isSmall ? 9 : 12, isSmall ? 14 : 18)}px`);
|
||||
|
||||
// the marinara trail, the meatball at its head, and the droplets flung behind it
|
||||
for (const layer of ["trail", "ball", "splatter"]) {
|
||||
const el = document.createElement("span");
|
||||
el.setAttribute("class", layer);
|
||||
meatball.append(el);
|
||||
}
|
||||
|
||||
// append the meatball to a random shower (direction)
|
||||
const showers = document.querySelectorAll("#meatballs .shower");
|
||||
if (showers.length > 0) {
|
||||
const random = Math.floor(Math.random() * showers.length);
|
||||
const shower = showers[random];
|
||||
shower.append(meatball);
|
||||
}
|
||||
|
||||
// remove the meatball after the animation duration
|
||||
setTimeout(() => {
|
||||
meatball.remove();
|
||||
}, 3500);
|
||||
}
|
||||
|
||||
// Create meatballs on interval on 1.5 seconds
|
||||
setInterval(createMeatball, 1500);
|
||||
</script>
|
||||
@@ -1,42 +0,0 @@
|
||||
---
|
||||
/**
|
||||
* Meteors.astro
|
||||
* This component creates meteors that are appended to the galaxy on interval.
|
||||
* Meteors are removed from the document after the animation is completed.
|
||||
* There are four (4) meteor shower containers, one for each diagonal direction.
|
||||
*/
|
||||
---
|
||||
|
||||
<div id="meteors">
|
||||
<!-- rotations defined in base.css & tailwind.config.mjs -->
|
||||
<div class="shower ur" />
|
||||
<div class="shower dr" />
|
||||
<div class="shower dl" />
|
||||
<div class="shower ul" />
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function createMeteor () {
|
||||
// create a meteor
|
||||
let meteor = document.createElement("div");
|
||||
meteor.setAttribute("class", "meteor");
|
||||
meteor.style.left = Math.round(Math.random() * window.innerWidth) + "px";
|
||||
meteor.style.top = Math.round(Math.random() * window.innerHeight) + "px";
|
||||
|
||||
// append the meteor to a random meteor shower (direction)
|
||||
const showers = document.querySelectorAll(".shower");
|
||||
if (showers.length > 0) {
|
||||
const random = Math.floor(Math.random() * showers.length);
|
||||
const shower = showers[random];
|
||||
shower.append(meteor);
|
||||
}
|
||||
|
||||
// remove the meteor after the animation duration
|
||||
setTimeout(() => {
|
||||
meteor.remove();
|
||||
}, 3500);
|
||||
}
|
||||
|
||||
// Create meteors on interval on two (2) seconds
|
||||
setInterval(createMeteor, 1500);
|
||||
</script>
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
/**
|
||||
* ParmesanFlecks.astro
|
||||
* This component creates flecks of parmesan that twinkle in the night sky and are appended to
|
||||
* the galaxy on interval. Flecks are removed from the document after the animation is completed.
|
||||
* The svg below is just a template for the script to clone and append to the galaxy.
|
||||
*/
|
||||
---
|
||||
|
||||
<svg
|
||||
id="parmesan-fleck"
|
||||
class="template"
|
||||
width="149"
|
||||
height="149"
|
||||
viewBox="0 0 149 149"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="absolute left-full animate-twinkle"
|
||||
>
|
||||
<defs>
|
||||
<radialGradient id="fleck_glow_4_2" cx="74" cy="74" r="70" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#FFF6E5"/>
|
||||
<stop offset="0.45" stop-color="#F5E6D3"/>
|
||||
<stop offset="1" stop-color="#F5E6D3" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
</defs>
|
||||
<!-- the soft glow of the fleck catching the light -->
|
||||
<circle cx="74" cy="74" r="66" fill="url(#fleck_glow_4_2)" opacity="0.22"/>
|
||||
<!-- the grate's offcuts: one pale irregular shard, two smaller chips -->
|
||||
<path d="M48 40 L96 42 L108 76 L74 102 L44 84 L36 56 Z" fill="#FFF6E5"/>
|
||||
<path d="M110 28 L130 34 L124 54 L104 46 Z" fill="#F5E6D3" opacity="0.8"/>
|
||||
<path d="M28 96 L50 104 L42 124 L24 112 Z" fill="#F5E6D3" opacity="0.6"/>
|
||||
</svg>
|
||||
|
||||
<script is:inline>
|
||||
// Generate a parmesan fleck and append it to the galaxy, remove it after animation.
|
||||
function generateParmesanFleck() {
|
||||
const fleckTemplate = document.getElementById("parmesan-fleck")
|
||||
if (!fleckTemplate) { return; }
|
||||
// Clone the parmesan fleck template and set its attributes.
|
||||
const fleck = fleckTemplate.cloneNode(true);
|
||||
fleck.style.position = "absolute";
|
||||
fleck.style.left = Math.floor(Math.random() * window.innerWidth) + "px";
|
||||
fleck.style.top = Math.floor(Math.random() * (window.innerHeight/3)) + "px";
|
||||
fleck.style.width = (window.innerWidth < 768 ? Math.floor(Math.random() * (15 - 7.5 + 1) + 7.5) : Math.floor(Math.random() * (30 - 15 + 1) + 15)) + "px";
|
||||
fleck.style.height = fleck.style.width;
|
||||
fleck.classList.add("fleck");
|
||||
document.getElementById("galaxy").appendChild(fleck);
|
||||
|
||||
// Remove the fleck after the animation is completed.
|
||||
setTimeout(() => {
|
||||
fleck.remove();
|
||||
}, 2500);
|
||||
}
|
||||
|
||||
setInterval(generateParmesanFleck, 5000);
|
||||
</script>
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
import type { Project } from "@lib/appwrite-service"
|
||||
import { createEffect, createSignal, For } from "solid-js"
|
||||
import ArrowCard from "@components/ArrowCard"
|
||||
import { cn } from "@lib/utils"
|
||||
|
||||
type Props = {
|
||||
tags: string[]
|
||||
data: Project[] | any[]
|
||||
}
|
||||
|
||||
export default function Projects({ data, tags }: Props) {
|
||||
const [filter, setFilter] = createSignal(new Set<string>())
|
||||
const [projects, setProjects] = createSignal<Project[]>([])
|
||||
|
||||
createEffect(() => {
|
||||
setProjects(data.filter((entry) =>
|
||||
Array.from(filter()).every((value) =>
|
||||
entry.tags.some((tag:string) =>
|
||||
tag.toLowerCase() === String(value).toLowerCase()
|
||||
)
|
||||
)
|
||||
))
|
||||
})
|
||||
|
||||
function toggleTag(tag: string) {
|
||||
setFilter((prev) =>
|
||||
new Set(prev.has(tag)
|
||||
? [...prev].filter((t) => t !== tag)
|
||||
: [...prev, tag]
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-6">
|
||||
<div class="col-span-3 sm:col-span-1">
|
||||
<div class="sticky top-24">
|
||||
<div class="text-sm font-semibold uppercase mb-2 text-spaghetti-brown">Filter</div>
|
||||
<ul class="flex flex-wrap sm:flex-col gap-1.5">
|
||||
<For each={tags}>
|
||||
{(tag) => (
|
||||
<li>
|
||||
<button onClick={() => toggleTag(tag)} class={cn("w-full px-2 py-1 rounded", "whitespace-nowrap overflow-hidden overflow-ellipsis", "flex gap-2 items-center", "bg-spaghetti-yellow/20 dark:bg-spaghetti-yellow/20", "hover:bg-spaghetti-yellow/30 hover:dark:bg-spaghetti-yellow/30", "transition-colors duration-300 ease-in-out", filter().has(tag) && "text-spaghetti-brown dark:text-spaghetti-brown")}>
|
||||
<svg class={cn("size-5 fill-spaghetti-brown/50 dark:fill-spaghetti-brown/50", "transition-colors duration-300 ease-in-out", filter().has(tag) && "fill-spaghetti-brown dark:fill-spaghetti-brown")}>
|
||||
<use href={`/ui.svg#square`} class={cn(!filter().has(tag) ? "block" : "hidden")} />
|
||||
<use href={`/ui.svg#square-check`} class={cn(filter().has(tag) ? "block" : "hidden")} />
|
||||
</svg>
|
||||
{tag}
|
||||
</button>
|
||||
</li>
|
||||
)}
|
||||
</For>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-span-3 sm:col-span-2">
|
||||
<div class="flex flex-col">
|
||||
<div class="text-sm uppercase mb-2">
|
||||
SHOWING {projects().length} OF {data.length} PROJECTS
|
||||
</div>
|
||||
<ul class="flex flex-col gap-3">
|
||||
{projects().map((project) => (
|
||||
<li>
|
||||
<ArrowCard entry={project} collection={'projects'} />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,52 +1,105 @@
|
||||
import type { BlogPost, Project } from "@lib/appwrite-service"
|
||||
import { createEffect, createSignal, onCleanup } from "solid-js"
|
||||
import { createEffect, createSignal, onCleanup, onMount } from "solid-js"
|
||||
import ArrowCard from "@components/ArrowCard"
|
||||
import { searchContent } from "@lib/appwrite-service"
|
||||
import {
|
||||
createSearcher,
|
||||
partitionByCollection,
|
||||
runSearch,
|
||||
MIN_QUERY_LENGTH,
|
||||
type SearchEntry,
|
||||
} from "@lib/search"
|
||||
|
||||
type Props = {
|
||||
query?: string
|
||||
/** Slim searchable entries serialized by src/pages/search/index.astro */
|
||||
entries?: SearchEntry[]
|
||||
}
|
||||
|
||||
const QUERY_PARAM = "search"
|
||||
const DEBOUNCE_MS = 300
|
||||
|
||||
export default function Search(props: Props) {
|
||||
const [query, setQuery] = createSignal(props.query || "")
|
||||
const [results, setResults] = createSignal<{ posts: BlogPost[], projects: Project[] }>({ posts: [], projects: [] })
|
||||
const [results, setResults] = createSignal<{ posts: SearchEntry[]; projects: SearchEntry[] }>({ posts: [], projects: [] })
|
||||
const [searched, setSearched] = createSignal(false)
|
||||
const [loading, setLoading] = createSignal(false)
|
||||
const [error, setError] = createSignal<string | null>(null)
|
||||
|
||||
// Debounce timeout reference
|
||||
let debounceTimeout: NodeJS.Timeout | null = null
|
||||
// Build the fuzzy index once per hydration; keystrokes reuse it.
|
||||
const searcher = createSearcher(props.entries || [])
|
||||
|
||||
// Debounce timer reference (browser-safe type; `NodeJS.Timeout` leaks
|
||||
// Node types into a client component).
|
||||
let debounceTimer: ReturnType<typeof setTimeout> | null = null
|
||||
|
||||
/**
|
||||
* Mirror the active query into the URL so refresh, back/forward and sharing
|
||||
* all restore the same result set. `replaceState` keeps history tidy while
|
||||
* typing; explicit submits push a real entry.
|
||||
*/
|
||||
const syncUrl = (q: string, push = false) => {
|
||||
// Guard: this component is SSR'd, and history APIs are unavailable there.
|
||||
if (typeof window === "undefined") return
|
||||
const url = new URL(window.location.href)
|
||||
if (q.trim().length >= MIN_QUERY_LENGTH) {
|
||||
url.searchParams.set(QUERY_PARAM, q)
|
||||
} else {
|
||||
url.searchParams.delete(QUERY_PARAM)
|
||||
}
|
||||
if (push) {
|
||||
window.history.pushState({}, "", url.toString())
|
||||
} else {
|
||||
window.history.replaceState({}, "", url.toString())
|
||||
}
|
||||
}
|
||||
|
||||
// Use Appwrite SDK to search all data with debouncing
|
||||
createEffect(() => {
|
||||
if (query().length < 2) {
|
||||
const q = query()
|
||||
|
||||
if (q.trim().length < MIN_QUERY_LENGTH) {
|
||||
if (debounceTimer) clearTimeout(debounceTimer)
|
||||
setResults({ posts: [], projects: [] })
|
||||
setSearched(false)
|
||||
setLoading(false)
|
||||
setError(null)
|
||||
return
|
||||
}
|
||||
|
||||
// Clear previous timeout
|
||||
if (debounceTimeout) {
|
||||
clearTimeout(debounceTimeout)
|
||||
}
|
||||
if (debounceTimer) clearTimeout(debounceTimer)
|
||||
|
||||
// Set new debounce timeout
|
||||
debounceTimeout = setTimeout(() => {
|
||||
setLoading(true)
|
||||
searchContent(query())
|
||||
.then(searchResults => {
|
||||
setResults(searchResults)
|
||||
setError(null)
|
||||
})
|
||||
.catch(err => {
|
||||
console.error("Search error:", err)
|
||||
// Handle error gracefully - maybe show an error message to user
|
||||
setResults({ posts: [], projects: [] })
|
||||
setError("Search failed. Please try again.")
|
||||
})
|
||||
.finally(() => {
|
||||
setLoading(false)
|
||||
})
|
||||
}, 300) // 300ms debounce delay
|
||||
setLoading(true)
|
||||
debounceTimer = setTimeout(() => {
|
||||
try {
|
||||
const matched = runSearch(searcher, q)
|
||||
setResults(partitionByCollection(matched))
|
||||
setSearched(true)
|
||||
setError(null)
|
||||
// Keep the address bar in sync so the current results are shareable
|
||||
// and survive a refresh.
|
||||
syncUrl(q)
|
||||
} catch (err) {
|
||||
console.error("Search error:", err)
|
||||
setResults({ posts: [], projects: [] })
|
||||
setSearched(true)
|
||||
setError("Search failed. Please try again.")
|
||||
} finally {
|
||||
setLoading(false)
|
||||
}
|
||||
}, DEBOUNCE_MS)
|
||||
})
|
||||
|
||||
// Restore the query when the user navigates with browser back/forward.
|
||||
const onPopState = () => {
|
||||
setQuery(new URL(window.location.href).searchParams.get(QUERY_PARAM) || "")
|
||||
}
|
||||
|
||||
// IMPORTANT: this component is SSR'd (output: "server" + client:load). The
|
||||
// component body runs on the server AND Solid runs onCleanup during server
|
||||
// teardown, while onMount never runs on the server. So every browser-API
|
||||
// touchpoint must either live in onMount or be gated by `popStateBound`.
|
||||
let popStateBound = false
|
||||
onMount(() => {
|
||||
window.addEventListener("popstate", onPopState)
|
||||
popStateBound = true
|
||||
})
|
||||
|
||||
const onInput = (e: Event) => {
|
||||
@@ -56,21 +109,18 @@ export default function Search(props: Props) {
|
||||
|
||||
const handleSubmit = (e: Event) => {
|
||||
e.preventDefault()
|
||||
// Prevent page refresh by using client-side navigation
|
||||
if (query().length >= 2) {
|
||||
// Search will automatically trigger due to createEffect
|
||||
// Update URL without full page reload
|
||||
const newUrl = `${window.location.pathname}?search=${encodeURIComponent(query())}`
|
||||
window.history.pushState({}, "", newUrl)
|
||||
// Dispatch custom event to update search results (removed for now - not needed with createEffect)
|
||||
// Never let the browser do a full page reload; the createEffect re-runs
|
||||
// the search and syncUrl keeps the address bar shareable.
|
||||
if (query().trim().length >= MIN_QUERY_LENGTH) {
|
||||
syncUrl(query(), true)
|
||||
}
|
||||
}
|
||||
|
||||
// Cleanup debounce timeout on component unmount
|
||||
// Cleanup the debounce timer (safe on server) and the history listener,
|
||||
// which is only ever bound in the browser.
|
||||
onCleanup(() => {
|
||||
if (debounceTimeout) {
|
||||
clearTimeout(debounceTimeout)
|
||||
}
|
||||
if (debounceTimer) clearTimeout(debounceTimer)
|
||||
if (popStateBound) window.removeEventListener("popstate", onPopState)
|
||||
})
|
||||
|
||||
return (
|
||||
@@ -84,22 +134,37 @@ export default function Search(props: Props) {
|
||||
autocomplete="off"
|
||||
spellcheck={false}
|
||||
placeholder="What are you looking for?"
|
||||
class="w-full px-2.5 py-1.5 pl-10 rounded outline-none text-spaghetti-brown bg-spaghetti-yellow/20 dark:bg-spaghetti-yellow/20 border border-spaghetti-yellow/50 dark:border-spaghetti-yellow/50 focus:border-spaghetti-red focus:dark:border-spaghetti-red"
|
||||
class="w-full px-2.5 py-1.5 pl-10 rounded outline-none text-ink bg-chip border border-edge focus:border-link"
|
||||
/>
|
||||
<svg class="absolute size-6 left-1.5 top-1/2 -translate-y-1/2 stroke-current">
|
||||
<use href={`/ui.svg#search`}/>
|
||||
</svg>
|
||||
</form>
|
||||
{error() && <div class="mt-4 text-red-500">{error()}</div>}
|
||||
{error() && <div class="mt-4 text-status-down">{error()}</div>}
|
||||
{loading() && <div class="mt-4">Searching...<span class="ml-2 animate-spin">⏳</span></div>}
|
||||
{(query().length >= 2 && (results().posts.length > 0 || results().projects.length > 0)) && (
|
||||
{!loading() && !error() && !searched() && query().trim().length > 0 && query().trim().length < MIN_QUERY_LENGTH && (
|
||||
<div class="mt-4 text-sm uppercase text-ink-muted">
|
||||
Keep typing — search needs at least {MIN_QUERY_LENGTH} characters
|
||||
</div>
|
||||
)}
|
||||
{!loading() && !error() && searched() && results().posts.length + results().projects.length === 0 && (
|
||||
<div class="mt-12">
|
||||
<div class="text-sm uppercase mb-2">
|
||||
No results for {`'${query()}'`}
|
||||
</div>
|
||||
<div class="text-sm text-ink-muted">
|
||||
Try a shorter or more general keyword — titles, tags and summaries are all searchable.
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
{(searched() && (results().posts.length > 0 || results().projects.length > 0)) && (
|
||||
<div class="mt-12">
|
||||
<div class="text-sm uppercase mb-2">
|
||||
Found {results().posts.length + results().projects.length} results for {`'${query()}'`}
|
||||
</div>
|
||||
<div class="flex flex-col gap-6 mt-4">
|
||||
{results().posts.length > 0 && (
|
||||
<div class="border-t border-spaghetti-yellow/30 pt-4">
|
||||
<div class="border-t border-line pt-4">
|
||||
<div class="text-sm font-bold mb-2">Blog Posts</div>
|
||||
<ul class="flex flex-col gap-3">
|
||||
{results().posts.map(result => (
|
||||
@@ -111,7 +176,7 @@ export default function Search(props: Props) {
|
||||
</div>
|
||||
)}
|
||||
{results().projects.length > 0 && (
|
||||
<div class="border-t border-spaghetti-yellow/30 pt-4">
|
||||
<div class="border-t border-line pt-4">
|
||||
<div class="text-sm font-bold mb-2">Projects</div>
|
||||
<ul class="flex flex-col gap-3">
|
||||
{results().projects.map(result => (
|
||||
|
||||
@@ -8,11 +8,11 @@ type Props = {
|
||||
const { text, icon, href } = Astro.props
|
||||
---
|
||||
|
||||
<a href={href} target="_blank" class="w-fit px-3 py-2 group rounded border flex gap-2 items-center border-spaghetti-yellow/50 dark:border-spaghetti-yellow/50 hover:bg-spaghetti-yellow/20 hover:dark:bg-spaghetti-yellow/20 blend">
|
||||
<a href={href} target="_blank" class="w-fit px-3 py-2 group rounded border flex gap-2 items-center border-edge hover:bg-chip blend">
|
||||
<svg height={20} width={20}>
|
||||
<use href={`/stack.svg#${icon}`}></use>
|
||||
</svg>
|
||||
<span class="text-sm capitalize text-spaghetti-brown group-hover:text-spaghetti-brown blend">
|
||||
<span class="text-sm capitalize text-ink group-hover:text-chip-ink blend">
|
||||
{text}
|
||||
</span>
|
||||
</a>
|
||||
@@ -0,0 +1,172 @@
|
||||
---
|
||||
import type { StatusSnapshot } from "@lib/status"
|
||||
|
||||
interface Props {
|
||||
snapshot: StatusSnapshot
|
||||
}
|
||||
|
||||
const { snapshot } = Astro.props
|
||||
|
||||
// Refresh cadence for the browser. The server already caches Uptime Kuma for a
|
||||
// minute, so polling faster than that only adds requests without new signal.
|
||||
const REFRESH_MS = 60_000
|
||||
|
||||
function details(s: StatusSnapshot): string {
|
||||
const { total, up, down, pending, maintenance } = s.summary
|
||||
if (s.state === "unknown") {
|
||||
return s.reason === "stale"
|
||||
? "Uptime Kuma has not reported recently"
|
||||
: "Status could not be read"
|
||||
}
|
||||
const parts = [`${up}/${total} monitors up`]
|
||||
if (down > 0) parts.push(`${down} down`)
|
||||
if (pending > 0) parts.push(`${pending} pending`)
|
||||
if (maintenance > 0) parts.push(`${maintenance} in maintenance`)
|
||||
if (s.incidents > 0) parts.push(`${s.incidents} incident${s.incidents === 1 ? "" : "s"}`)
|
||||
return parts.join(", ")
|
||||
}
|
||||
|
||||
const state = snapshot.state
|
||||
const label = snapshot.label
|
||||
const detailsText = details(snapshot)
|
||||
---
|
||||
|
||||
<a
|
||||
href={snapshot.statusPageUrl}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
class="status group flex gap-2 justify-center sm:justify-end items-center text-ink-muted hover:text-ink"
|
||||
data-status-root
|
||||
data-status={state}
|
||||
data-refresh-ms={REFRESH_MS}
|
||||
data-checked-at={snapshot.checkedAt}
|
||||
aria-label={`System status: ${label}. ${detailsText}. Open status page`}
|
||||
title={detailsText}
|
||||
>
|
||||
<span class="relative flex h-3 w-3" aria-hidden="true">
|
||||
<span class="ping animate-ping absolute inline-flex h-full w-full rounded-full"></span>
|
||||
<span class="core relative inline-flex rounded-full h-3 w-3"></span>
|
||||
</span>
|
||||
<span data-status-label>{label}</span>
|
||||
</a>
|
||||
|
||||
<style>
|
||||
/* Colours hang off data-status so the client script only has to flip one
|
||||
attribute; Tailwind cannot generate classes built at runtime anyway. */
|
||||
.status {
|
||||
transition: color 300ms ease-in-out;
|
||||
}
|
||||
|
||||
.core {
|
||||
background-color: var(--color-status-ok);
|
||||
transition: background-color 300ms ease-in-out;
|
||||
}
|
||||
|
||||
.ping {
|
||||
background-color: var(--color-status-ok-ping);
|
||||
}
|
||||
|
||||
[data-status="degraded"] .core {
|
||||
background-color: var(--color-status-warn);
|
||||
}
|
||||
[data-status="degraded"] .ping {
|
||||
background-color: var(--color-status-warn-ping);
|
||||
}
|
||||
|
||||
[data-status="down"] .core {
|
||||
background-color: var(--color-status-down);
|
||||
}
|
||||
[data-status="down"] .ping {
|
||||
background-color: var(--color-status-down-ping);
|
||||
}
|
||||
|
||||
[data-status="maintenance"] .core {
|
||||
background-color: var(--color-status-maint);
|
||||
}
|
||||
[data-status="maintenance"] .ping {
|
||||
background-color: var(--color-status-maint-ping);
|
||||
}
|
||||
|
||||
[data-status="unknown"] .core {
|
||||
background-color: var(--color-status-unknown);
|
||||
}
|
||||
[data-status="unknown"] .ping {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.ping {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
const root = document.querySelector<HTMLElement>("[data-status-root]")
|
||||
const labelNode = root?.querySelector<HTMLElement>("[data-status-label]")
|
||||
|
||||
if (root && labelNode) {
|
||||
const refreshMs = Number(root.dataset.refreshMs) || 60_000
|
||||
let timer: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
const render = (snapshot: {
|
||||
state: string
|
||||
label: string
|
||||
summary?: { up: number; total: number }
|
||||
}) => {
|
||||
root.dataset.status = snapshot.state
|
||||
labelNode.textContent = snapshot.label
|
||||
const details = snapshot.summary
|
||||
? `${snapshot.summary.up}/${snapshot.summary.total} monitors up`
|
||||
: ""
|
||||
root.title = details || snapshot.label
|
||||
root.setAttribute(
|
||||
"aria-label",
|
||||
`System status: ${snapshot.label}. ${details}. Open status page`
|
||||
)
|
||||
}
|
||||
|
||||
const refresh = async () => {
|
||||
try {
|
||||
const response = await fetch("/api/status", {
|
||||
headers: { accept: "application/json" },
|
||||
cache: "default",
|
||||
})
|
||||
if (!response.ok) throw new Error(`status endpoint returned ${response.status}`)
|
||||
render(await response.json())
|
||||
} catch {
|
||||
// The site's own route failed (or Uptime Kuma is unreachable). Say so
|
||||
// rather than leaving a confident green light on a dead stack.
|
||||
root.dataset.status = "unknown"
|
||||
labelNode.textContent = "Status unavailable"
|
||||
}
|
||||
}
|
||||
|
||||
const start = () => {
|
||||
if (timer !== null) return
|
||||
timer = setInterval(refresh, refreshMs)
|
||||
}
|
||||
|
||||
const stop = () => {
|
||||
if (timer === null) return
|
||||
clearInterval(timer)
|
||||
timer = null
|
||||
}
|
||||
|
||||
// A background tab should not burn requests; refresh the moment it is seen.
|
||||
document.addEventListener("visibilitychange", () => {
|
||||
if (document.hidden) stop()
|
||||
else {
|
||||
void refresh()
|
||||
start()
|
||||
}
|
||||
})
|
||||
|
||||
// No immediate fetch when the server just rendered the state. Prerendered
|
||||
// routes (blog posts, legal pages) bake the build-time snapshot, so compare
|
||||
// timestamps and refresh straight away if what we were handed is old.
|
||||
const checkedAt = Date.parse(root.dataset.checkedAt ?? "")
|
||||
if (Number.isNaN(checkedAt) || Date.now() - checkedAt > refreshMs) void refresh()
|
||||
start()
|
||||
}
|
||||
</script>
|
||||
@@ -1,62 +0,0 @@
|
||||
---
|
||||
/**
|
||||
* TwinkleStars.astro
|
||||
* This component creates twinkling stars that are appended to the galaxy on interval.
|
||||
* Twinkle stars are removed from the document after the animation is completed.
|
||||
* The svg below is just a template for the script to clone and append to the galaxy.
|
||||
*/
|
||||
---
|
||||
|
||||
<svg
|
||||
id="twinkle-star"
|
||||
class="template"
|
||||
width="149"
|
||||
height="149"
|
||||
viewBox="0 0 149 149"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
class="absolute left-full animate-twinkle"
|
||||
>
|
||||
<circle cx="74" cy="74" r="11" fill="white"/>
|
||||
<rect y="141.421" width="200" height="10" transform="rotate(-45 0 141.421)" fill="url(#paint0_linear_4_2)"/>
|
||||
<rect x="7.07107" width="200" height="10" transform="rotate(45 7.07107 0)" fill="url(#paint1_linear_4_2)"/>
|
||||
<defs>
|
||||
<linearGradient id="paint0_linear_4_2" x1="0" y1="146.421" x2="200" y2="146.421" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#1E1E1E"/>
|
||||
<stop offset="0.445" stop-color="white"/>
|
||||
<stop offset="0.58721" stop-color="white"/>
|
||||
<stop offset="1" stop-color="#1E1E1E"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="paint1_linear_4_2" x1="7.07107" y1="5" x2="207.071" y2="5" gradientUnits="userSpaceOnUse">
|
||||
<stop stop-color="#1E1E1E"/>
|
||||
<stop offset="0.42" stop-color="white"/>
|
||||
<stop offset="0.555" stop-color="white"/>
|
||||
<stop offset="1" stop-color="#1E1E1E"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
</svg>
|
||||
|
||||
<script is:inline>
|
||||
// Generate a twinkle star and append it to the galaxy, remove it after animation.
|
||||
function generateTwinkleStar() {
|
||||
const twinkleStarTemplate = document.getElementById("twinkle-star")
|
||||
if (!twinkleStarTemplate) { return; }
|
||||
// Clone the twinkle star template and set its attributes.
|
||||
const twinkleStar = twinkleStarTemplate.cloneNode(true);
|
||||
twinkleStar.style.position = "absolute";
|
||||
twinkleStar.style.left = Math.floor(Math.random() * window.innerWidth) + "px";
|
||||
twinkleStar.style.top = Math.floor(Math.random() * (window.innerHeight/3)) + "px";
|
||||
twinkleStar.style.width = window.innerWidth < 768 ? Math.floor(Math.random() * (15 - 7.5 + 1) + 7.5) : Math.floor(Math.random() * (30 - 15 + 1) + 15) + "px";
|
||||
twinkleStar.style.height = twinkleStar.style.width;
|
||||
twinkleStar.classList.add("twinkle");
|
||||
document.getElementById("galaxy").appendChild(twinkleStar);
|
||||
|
||||
// Remove the twinkle star after the animation is completed.
|
||||
setTimeout(() => {
|
||||
twinkleStar.remove();
|
||||
}, 2500);
|
||||
}
|
||||
|
||||
setInterval(generateTwinkleStar, 5000);
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
// src/components/__tests__/list-islands.test.ts
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { renderToString } from "solid-js/web"
|
||||
import FilteredList from "@components/FilteredList"
|
||||
import type { FilterState, ListEntry } from "@lib/filters"
|
||||
|
||||
/**
|
||||
* Renders the shared listing island through solid-js/web's server renderer,
|
||||
* which is the same path Astro takes for `output: "server"` + `client:load`.
|
||||
*
|
||||
* The regression locked in here is that the list must exist in the SERVER HTML:
|
||||
* the original `createEffect` + signal version rendered "SHOWING 0 OF 3" with an
|
||||
* empty <ul>, so any hydration failure hid every entry. The second regression is
|
||||
* the case-duplicated tag list, which made /blog and /projects render two
|
||||
* checkboxes that did exactly the same thing.
|
||||
*/
|
||||
|
||||
function entry(id: string, tags: string[], overrides: Partial<ListEntry> = {}): ListEntry {
|
||||
return {
|
||||
id,
|
||||
title: `Entry ${id}`,
|
||||
summary: `Summary ${id}`,
|
||||
date: "2026-01-01T00:00:00.000Z",
|
||||
tags,
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
const posts: ListEntry[] = [
|
||||
entry("a", ["CSS", "Html"], { title: "Alpha", date: "2025-01-01T00:00:00.000Z" }),
|
||||
entry("b", ["CSS", "css"], { title: "Bravo", date: "2026-01-01T00:00:00.000Z" }),
|
||||
entry("c", ["html"], { title: "Charlie", date: "2025-06-01T00:00:00.000Z" }),
|
||||
]
|
||||
|
||||
/**
|
||||
* Solid's SSR output interleaves hydration markers around every dynamic value
|
||||
* (`SHOWING <!--$-->3<!--/--> OF …`). Stripping comments keeps the assertions
|
||||
* about real content instead of about marker placement.
|
||||
*/
|
||||
function render(props: {
|
||||
entries?: ListEntry[]
|
||||
collection?: "blog" | "projects"
|
||||
initial?: FilterState
|
||||
}): string {
|
||||
const html = renderToString(() =>
|
||||
FilteredList({
|
||||
entries: props.entries ?? posts,
|
||||
collection: props.collection ?? "blog",
|
||||
initial: props.initial,
|
||||
})
|
||||
)
|
||||
return html.replace(/<!--.*?-->/g, "")
|
||||
}
|
||||
|
||||
describe("FilteredList island (SSR render)", () => {
|
||||
it("should render every entry in the server HTML with no filter applied", () => {
|
||||
const html = render({})
|
||||
|
||||
expect(html).toContain("SHOWING 3 OF 3 POSTS")
|
||||
for (const item of posts) {
|
||||
expect(html).toContain(`href="/blog/${item.id}"`)
|
||||
}
|
||||
})
|
||||
|
||||
it("should not regress to an empty list when no initial state is passed", () => {
|
||||
// Guards the createEffect bug specifically: an untouched filter must show all.
|
||||
expect(render({})).not.toContain("SHOWING 0")
|
||||
})
|
||||
|
||||
it("should apply initial state server-side so a filtered deep link renders filtered", () => {
|
||||
const html = render({ initial: { tags: ["css"], query: "", sort: "newest" } })
|
||||
|
||||
expect(html).toContain("SHOWING 2 OF 3 POSTS")
|
||||
expect(html).toContain('href="/blog/a"')
|
||||
expect(html).toContain('href="/blog/b"')
|
||||
expect(html).not.toContain('href="/blog/c"')
|
||||
})
|
||||
|
||||
it("should render one checkbox per tag, deduped across spellings", () => {
|
||||
// `CSS`/`css` and `html`/`Html` collapse to two options, not four.
|
||||
const html = render({})
|
||||
|
||||
expect(html).toContain(">CSS</span>")
|
||||
expect(html).toContain(">Html</span>")
|
||||
expect(html.match(/aria-pressed/g)).toHaveLength(2)
|
||||
})
|
||||
|
||||
it("should show a per-tag count next to each option", () => {
|
||||
// css -> a, b; html -> a, c. Assert on the rendered counts rather than on
|
||||
// the exact class string so the test survives a restyle.
|
||||
const html = render({})
|
||||
const counts = [...html.matchAll(/<\/span><span[^>]*>(\d+)<\/span>/g)].map((m) => m[1])
|
||||
|
||||
expect(counts).toHaveLength(2)
|
||||
expect(counts.every((count) => count === "2")).toBe(true)
|
||||
})
|
||||
|
||||
it("should render the keyword input, sort select and live count region", () => {
|
||||
const html = render({})
|
||||
|
||||
expect(html).toContain('id="filter-q"')
|
||||
expect(html).toContain('id="filter-sort"')
|
||||
expect(html).toContain('aria-live="polite"')
|
||||
expect(html).toContain('role="group"')
|
||||
expect(html).toContain("Newest first")
|
||||
})
|
||||
|
||||
it("should sort by the requested key in the server HTML", () => {
|
||||
const html = render({ initial: { tags: [], query: "", sort: "az" } })
|
||||
expect(html.indexOf('href="/blog/a"')).toBeLessThan(html.indexOf('href="/blog/b"'))
|
||||
})
|
||||
|
||||
it("should render an empty state instead of a blank list when nothing matches", () => {
|
||||
const html = render({ initial: { tags: [], query: "zzzz", sort: "newest" } })
|
||||
|
||||
expect(html).toContain("SHOWING 0 OF 3 POSTS")
|
||||
expect(html).toContain("No posts match these filters.")
|
||||
expect(html).toContain("Clear filters")
|
||||
})
|
||||
|
||||
it("should offer Clear all only once a filter is active", () => {
|
||||
expect(render({})).not.toContain("Clear all")
|
||||
expect(render({ initial: { tags: ["css"], query: "", sort: "newest" } })).toContain("Clear all")
|
||||
})
|
||||
|
||||
it("should label the count PROJECTS for the projects collection", () => {
|
||||
const html = render({
|
||||
entries: [entry("x", ["react"]), entry("y", ["react", "rust"])],
|
||||
collection: "projects",
|
||||
})
|
||||
|
||||
expect(html).toContain("SHOWING 2 OF 2 PROJECTS")
|
||||
expect(html).toContain('href="/projects/x"')
|
||||
expect(html).toContain('href="/projects/y"')
|
||||
})
|
||||
|
||||
it("should render an empty collection without throwing", () => {
|
||||
// A collection where every entry is still a draft: no tags to list, nothing
|
||||
// to show, and the empty state must carry the panel.
|
||||
const html = render({ entries: [] })
|
||||
|
||||
expect(html).toContain("SHOWING 0 OF 0 POSTS")
|
||||
expect(html).toContain("No posts match these filters.")
|
||||
expect(html.match(/aria-pressed/g)).toBeNull()
|
||||
})
|
||||
|
||||
it("should render entries that carry no tags at all", () => {
|
||||
const html = render({ entries: [entry("solo", [])] })
|
||||
|
||||
expect(html).toContain("SHOWING 1 OF 1 POSTS")
|
||||
expect(html).toContain('href="/blog/solo"')
|
||||
})
|
||||
})
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Site, Page, Links, Socials } from "@types"
|
||||
import type { Site, Page, Links, Socials, Cta } from "@types"
|
||||
|
||||
// Global
|
||||
export const SITE: Site = {
|
||||
@@ -31,7 +31,21 @@ export const SEARCH: Page = {
|
||||
DESCRIPTION: "Search all posts and projects by keyword.",
|
||||
}
|
||||
|
||||
// Docs (external, the Wiki.js instance hosted at docs.spaghet.io). Declared
|
||||
// before LINKS because the Docs nav entry points at DOCS.HREF, and exported so
|
||||
// both navs can label their links. It is a Cta (like RESUME) because it carries
|
||||
// an icon; the nav entry itself is a plain Links row so it moves with the
|
||||
// desktop nav / mobile drawer switch for free.
|
||||
export const DOCS: Cta = {
|
||||
TEXT: "Docs",
|
||||
HREF: "https://docs.spaghet.io",
|
||||
ICON: "book-open",
|
||||
}
|
||||
|
||||
// Links
|
||||
//
|
||||
// Entries with EXTERNAL leave the site: they can never match Astro.url, so the
|
||||
// renderers must skip the active-pill styling and add rel="noopener noreferrer".
|
||||
export const LINKS: Links = [
|
||||
{
|
||||
TEXT: "Home",
|
||||
@@ -49,8 +63,22 @@ export const LINKS: Links = [
|
||||
TEXT: "Projects",
|
||||
HREF: "/projects",
|
||||
},
|
||||
{
|
||||
TEXT: DOCS.TEXT,
|
||||
HREF: DOCS.HREF,
|
||||
EXTERNAL: true,
|
||||
},
|
||||
]
|
||||
|
||||
// Résumé (external, hosted at resume.spaghet.io). Rendered as its own pill in
|
||||
// the header rather than added to LINKS: LINKS drives the nav list and its
|
||||
// active-page highlighting, and an off-site URL would never match a pathname.
|
||||
export const RESUME: Cta = {
|
||||
TEXT: "Résumé",
|
||||
HREF: "https://resume.spaghet.io/quinn/default",
|
||||
ICON: "resume",
|
||||
}
|
||||
|
||||
// Socials
|
||||
export const SOCIALS: Socials = [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import { defineCollection, z } from "astro:content"
|
||||
import { glob } from "astro/loaders"
|
||||
|
||||
const blog = defineCollection({
|
||||
loader: glob({ pattern: "**/*.md", base: "./src/content/blog" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
summary: z.string(),
|
||||
date: z.date(),
|
||||
tags: z.array(z.string()),
|
||||
draft: z.boolean().default(false),
|
||||
template: z.string().default("default"),
|
||||
featured: z.boolean().default(false),
|
||||
}),
|
||||
})
|
||||
|
||||
const projects = defineCollection({
|
||||
loader: glob({ pattern: "**/*.md", base: "./src/content/projects" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
summary: z.string(),
|
||||
date: z.date(),
|
||||
tags: z.array(z.string()),
|
||||
draft: z.boolean().default(false),
|
||||
demoUrl: z.string().optional(),
|
||||
repoUrl: z.string().optional(),
|
||||
}),
|
||||
})
|
||||
|
||||
const work = defineCollection({
|
||||
loader: glob({ pattern: "**/*.md", base: "./src/content/work" }),
|
||||
schema: z.object({
|
||||
company: z.string(),
|
||||
role: z.string(),
|
||||
dateStart: z.date(),
|
||||
dateEnd: z.date(),
|
||||
}),
|
||||
})
|
||||
|
||||
const legal = defineCollection({
|
||||
loader: glob({ pattern: "**/*.md", base: "./src/content/legal" }),
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
date: z.date(),
|
||||
}),
|
||||
})
|
||||
|
||||
export const collections = { blog, projects, work, legal }
|
||||
@@ -0,0 +1,76 @@
|
||||
---
|
||||
title: "Building My Personal Website: From Idea to Deployment"
|
||||
summary: "A journey through creating my personal portfolio site, from initial concept to deployment."
|
||||
date: 2025-08-12
|
||||
tags: ["Tutorial", "Astro", "Portfolio", "Hosting", "Docker", "Website"]
|
||||
draft: false
|
||||
template: "default"
|
||||
featured: false
|
||||
---
|
||||
|
||||
As someone who loves spaghetti and all things tech, I've always been fascinated by the perfect balance of structure and creativity. When it came time to create my personal website, I wanted to build something that reflected both my passion for technology and my love for well-organized systems.
|
||||
|
||||
## The Concept
|
||||
|
||||
I decided to use Astro as the foundation for my portfolio site because of its excellent performance and flexibility. The idea was to create a modern, responsive website that showcases my work and projects while demonstrating my technical skills through the implementation itself.
|
||||
|
||||
The site needed to be:
|
||||
- Fast and performant
|
||||
- Responsive across all devices
|
||||
- Easy to maintain and update
|
||||
- A reflection of my technical expertise
|
||||
|
||||
## Development Process
|
||||
|
||||
I started by setting up the basic structure using Astro's capabilities. The site features:
|
||||
|
||||
- A clean, modern design with dark/light mode support
|
||||
- Smooth animations and transitions for enhanced user experience
|
||||
- Integrated blog section for technical articles
|
||||
- Project showcase with detailed descriptions
|
||||
- Contact form with email integration
|
||||
- SEO optimization for better search engine visibility
|
||||
|
||||
## Deployment Strategy
|
||||
|
||||
This is where things get interesting. As someone running 2 Unraid servers with powerful hardware configurations (128GB RAM, 2 x E5 Xeon CPU, 200TB raw storage on NetApp arrays), I wanted to leverage my existing infrastructure for hosting this personal website.
|
||||
|
||||
### My Hosting Setup
|
||||
|
||||
I'm planning to host this site on my self-hosted infrastructure, which is part of my comprehensive Docker container ecosystem. The setup includes:
|
||||
|
||||
- A robust Docker infrastructure supporting PostgreSQL, MariaDB, MySQL, MongoDB, Redis, and Minio
|
||||
|
||||
## Deployment Challenges
|
||||
|
||||
While setting up the deployment, I've been working through some configuration challenges. Getting the infrastructure to behave properly has been a learning experience, but also a great opportunity to dive deep into the platform's capabilities.
|
||||
|
||||
The process has involved:
|
||||
- Understanding the API structure
|
||||
- Configuring proper database connections
|
||||
- Setting up authentication and user management
|
||||
- Ensuring proper security configurations
|
||||
|
||||
## Technical Details
|
||||
|
||||
The site leverages modern web development practices including:
|
||||
- Component-based architecture with React
|
||||
- Responsive design principles using Tailwind CSS
|
||||
- Performance optimization techniques
|
||||
- Integration with my existing Docker ecosystem
|
||||
|
||||
## Why This Approach?
|
||||
|
||||
I chose this approach because it reflects how I think about technology - structured, well-organized, and efficient. Just like a perfect bowl of spaghetti, everything has its place and works together seamlessly.
|
||||
|
||||
The experience of building and deploying this site has been both challenging and rewarding, showcasing my ability to work with complex systems while maintaining a clear focus on the end-user experience.
|
||||
|
||||
## Looking Forward
|
||||
|
||||
As I continue to develop this site, I plan to:
|
||||
- Add more technical articles about my Docker setups and infrastructure
|
||||
- Expand the blog section with detailed tutorials
|
||||
- Continue refining the user experience based on feedback
|
||||
- Document my journey of getting the deployment infrastructure to work properly
|
||||
|
||||
This project represents not just a portfolio, but also a demonstration of my approach to technology - structured yet creative, efficient yet elegant.
|
||||
@@ -0,0 +1,121 @@
|
||||
---
|
||||
title: "Spaghet.io Website Improvements: A Comprehensive UI/UX Overhaul"
|
||||
summary: "Detailed summary of all the UI/UX improvements made to the Spaghet.io website, including dark mode fixes, theme enhancements, and component updates."
|
||||
date: 2025-08-13
|
||||
tags: ["website", "ui", "ux", "improvements", "spaghetti"]
|
||||
draft: false
|
||||
template: "default"
|
||||
featured: false
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
This post documents a comprehensive UI/UX overhaul of my personal website, Spaghet.io. The changes were focused on improving visual consistency, fixing dark mode conflicts, and enhancing the overall user experience while maintaining our signature spaghetti-themed aesthetic.
|
||||
|
||||
## Goal of This Session
|
||||
|
||||
The primary objective was to enhance the website's visual design by:
|
||||
|
||||
- Resolving dark mode conflicts with prose elements
|
||||
- Ensuring consistent theme application across all components
|
||||
- Fixing text color issues in selected menu items and buttons
|
||||
- Making sure the spaghetti theme is consistently applied throughout the site
|
||||
|
||||
## Key Improvements Made
|
||||
|
||||
### 1. Fixed Dark Mode Conflicts with tw-prose Classes
|
||||
|
||||
**Problem:** The website had conflicts where prose elements (blog content) were not respecting our custom theme colors in dark mode, resulting in poor readability.
|
||||
|
||||
**Solution:** Updated tailwind.config.mjs to properly customize typography styles. Added CSS overrides in global.css to ensure spaghetti-themed colors are applied consistently in prose elements.
|
||||
|
||||
### 2. Enhanced Theme Consistency Across Components
|
||||
|
||||
**Problem:** Various components had inconsistent color usage, particularly in text and hover states.
|
||||
|
||||
**Solution:** Updated Header component to use proper text-spaghetti-brown colors for hover states. Fixed Footer component with consistent text-spaghetti-brown colors for legal links. Applied consistent theme classes throughout ArrowCard, Blog, Projects, StackCard, Search, Counter, and Drawer components.
|
||||
|
||||
### 3. Implemented Spaghetti-Themed Color Palette
|
||||
|
||||
**Color Scheme:**
|
||||
- Main color: #FDE68A (spaghetti-yellow)
|
||||
- Accent color: #FECACA (spaghetti-red)
|
||||
- Background: #FEF3C7 (spaghetti-cream)
|
||||
- Text: #78350F (spaghetti-brown)
|
||||
|
||||
### 4. Fixed Selected Menu Items and Buttons
|
||||
|
||||
**Problem:** Selected menu items and buttons had light red backgrounds with white text, which was inconsistent with our theme.
|
||||
|
||||
**Solution:** Updated Header navigation items to use text-spaghetti-brown instead of text-white for selected states. Updated Drawer navigation items to use text-spaghetti-brown instead of text-white for selected states. Updated Search button in header to use text-spaghetti-brown instead of text-white for selected states. Updated mobile drawer button to use text-spaghetti-brown instead of text-white for selected states.
|
||||
|
||||
### 5. Enhanced Hero Section with Spaghetti Theme
|
||||
|
||||
**Improvements:** Applied consistent text-spaghetti-brown colors throughout the hero section. Styled call-to-action buttons with spaghetti-red background and spaghetti-yellow borders. Maintained consistent theme application throughout the entire hero section.
|
||||
|
||||
## Technical Implementation Details
|
||||
|
||||
### CSS Customizations
|
||||
|
||||
The following changes were made to src/styles/global.css:
|
||||
|
||||
```css
|
||||
/* Override default prose styles to respect our theme */
|
||||
.prose {
|
||||
color: var(--spaghetti-brown);
|
||||
}
|
||||
|
||||
.prose a {
|
||||
color: var(--spaghetti-red);
|
||||
}
|
||||
|
||||
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
|
||||
color: var(--spaghetti-brown);
|
||||
}
|
||||
|
||||
/* Ensure dark mode respects our theme */
|
||||
.dark .prose {
|
||||
color: var(--spaghetti-brown);
|
||||
}
|
||||
|
||||
.dark .prose a {
|
||||
color: var(--spaghetti-red);
|
||||
}
|
||||
```
|
||||
|
||||
### Component Updates
|
||||
|
||||
All affected components were updated to use:
|
||||
- text-spaghetti-brown for text content
|
||||
- bg-spaghetti-red for selected states
|
||||
- border-spaghetti-yellow/50 for borders
|
||||
- Consistent hover effects with appropriate color transitions
|
||||
|
||||
## Before and After Comparison
|
||||
|
||||
### Navigation Menu
|
||||
- **Before:** Selected items had light red background (bg-spaghetti-red) with white text (text-white)
|
||||
- **After:** Selected items have light red background (bg-spaghetti-red) with dark brown text (text-spaghetti-brown)
|
||||
|
||||
### Prose Elements
|
||||
- **Before:** Default Tailwind prose styles were overriding our theme colors in dark mode
|
||||
- **After:** Custom CSS ensures consistent spaghetti-themed colors across all content
|
||||
|
||||
### Hero Section
|
||||
- **Before:** Inconsistent color usage throughout the hero section
|
||||
- **After:** Cohesive spaghetti theme with consistent text-spaghetti-brown colors for all content
|
||||
|
||||
## Future Improvements
|
||||
|
||||
While these changes have significantly improved the website's UI/UX, there are always opportunities for further enhancement:
|
||||
|
||||
- Implement more sophisticated animations and transitions
|
||||
- Add more interactive elements with our spaghetti theme
|
||||
- Continue refining the dark mode experience
|
||||
- Explore additional theme variations that maintain the spaghetti aesthetic
|
||||
|
||||
## Conclusion
|
||||
|
||||
These improvements represent a significant step forward in creating a consistent, visually appealing, and user-friendly website that truly embodies the spirit of spaghetti - structured, well-organized, and satisfying to use. The site now maintains a cohesive design language while providing an enhanced user experience across all device sizes and themes.
|
||||
|
||||
The changes ensure that our signature spaghetti theme is consistently applied throughout the entire website, from navigation elements to content presentation, creating a unified and memorable user experience.
|
||||
@@ -0,0 +1,310 @@
|
||||
---
|
||||
title: "Running AI From My Own Computers: Two Servers, Two Very Different Jobs"
|
||||
summary: "How I split my home servers into one that stores everything and one that thinks — in plain language, with the numbers, the mistakes I made, and how you could start the same thing much smaller."
|
||||
date: 2026-11-03
|
||||
tags: ["Homelab", "Unraid", "Storage", "Backup", "Docker", "Local AI", "NVIDIA"]
|
||||
draft: false
|
||||
template: "default"
|
||||
featured: true
|
||||
---
|
||||
|
||||
## The problem I wanted to solve
|
||||
|
||||
I want to run AI tools on my own computers. Not because it is cheaper — it usually
|
||||
isn't, once you count the hardware and the electricity — but because half of what I want
|
||||
to search through is my own paperwork: tax documents, contracts, notes, old projects, my
|
||||
family's photo library. Uploading all of that to someone else's server just to ask one
|
||||
question about it is not a trade I want to make by default.
|
||||
|
||||
The goal, in one sentence:
|
||||
|
||||
> Ask questions about my own files, and get an answer from a program running inside my
|
||||
> own house.
|
||||
|
||||
## Why that turned out to be hard
|
||||
|
||||
This single sentence needs two opposite kinds of machine.
|
||||
|
||||
**Holding a lot of data safely** wants big, cheap, slow hard drives, and protection
|
||||
against those drives dying.
|
||||
|
||||
**Thinking fast** wants enormous amounts of very expensive, very fast memory, plus a
|
||||
graphics card.
|
||||
|
||||
A computer that is excellent at both does not exist at a sane price. It would either cost
|
||||
a great deal or be bad at one of the two jobs. So I stopped trying to build one and split
|
||||
the jobs across two machines:
|
||||
|
||||
- **MarvinBlade** — the machine that *remembers*. It holds the files and runs the
|
||||
everyday services.
|
||||
- **SpaghetAI** — the machine that *thinks*. It holds memory and graphics power for the
|
||||
AI work, and almost no storage of its own.
|
||||
|
||||
Neither one does its job without the other, and the connection between them is where the
|
||||
trouble lives. I'll get to that.
|
||||
|
||||
## A few words before the numbers
|
||||
|
||||
If you don't do this for a living, here is the vocabulary this post needs.
|
||||
|
||||
| Word | What it means here |
|
||||
|---|---|
|
||||
| **Storage** | Hard drives. Big, cheap, slow. Where files sit when nothing is using them. |
|
||||
| **Memory (RAM)** | Fast working space. Expensive, and it forgets everything when the power goes out. Where data goes while it is actively in use. |
|
||||
| **Graphics card (GPU)** | A video card, which turns out to be very good at the arithmetic AI needs. |
|
||||
| **Card memory (VRAM)** | The fast space built into the graphics card. Faster again, and far more expensive. |
|
||||
| **Container** | One program packaged together with everything it needs to run, so it can be started, stopped, or updated without disturbing the others. |
|
||||
| **Protection drive (parity)** | An extra drive holding repair information, so that if a normal drive dies you can rebuild it from the rest. |
|
||||
|
||||
One analogy carries most of this post. Think of a kitchen:
|
||||
|
||||
- **Storage is the pantry.** Lots of room, and you have to get up and walk to it.
|
||||
- **Memory is the counter.** Much smaller, and everything you are working on right now
|
||||
has to be on it.
|
||||
- **Card memory is the cutting board.** The smallest and dearest space, and the thing
|
||||
you are actively working on has to be on it at the moment the knife comes down.
|
||||
|
||||
Anything you use often wants to be closer to the knife. Nearly every decision below is
|
||||
some version of that sentence.
|
||||
|
||||
## Side by side
|
||||
|
||||
| | **MarvinBlade** — remembers | **SpaghetAI** — thinks |
|
||||
|---|---|---|
|
||||
| Job | Holds everything, runs everyday services | Runs the AI work |
|
||||
| Case | Cisco rack server | Dell rack server |
|
||||
| Memory | 128 GB | **768 GB** |
|
||||
| Storage | **258 TB** across 30 hard drives | 960 GB of solid-state, no drive array |
|
||||
| If a drive dies | Covered by two protection drives | Covered by nothing, on purpose |
|
||||
| Graphics | 1 ordinary card (5 GB) | **2 cards, 40 GB between them** |
|
||||
| Programs running | 81 | 5 |
|
||||
| Age | About 8 years | Newer |
|
||||
|
||||
Both run Unraid, a Linux built for exactly this kind of pile of mismatched drives. Same
|
||||
operating system, same era of hardware, opposite design goals.
|
||||
|
||||
## The work: MarvinBlade, the machine that remembers
|
||||
|
||||
MarvinBlade is an eight-year-old server whose whole job is to hold things and keep
|
||||
holding them.
|
||||
|
||||
It has **258 terabytes of storage spread across 30 hard drives**, with about 117 TB
|
||||
still free. The drives are a mix of sizes — some 4 TB, most 8 TB, a few 16 TB — which is
|
||||
normally a problem, because most storage systems want all their drives to match.
|
||||
|
||||
Two of the thirty drives are **protection drives**. They don't hold your files; they hold
|
||||
the arithmetic needed to rebuild the others. Because there are two of them, this machine
|
||||
can lose **two hard drives at the same time** and still have everything.
|
||||
|
||||
That sounds like enough, and for a long time I assumed it was the whole story. It isn't.
|
||||
I'll come back to that in the section about what actually worries me now.
|
||||
|
||||
### What it runs
|
||||
|
||||
Eighty-one separate programs live on this machine. The full list is on my
|
||||
[Home System project page](/projects/home-system/), but grouped, it's:
|
||||
|
||||
- **Media** — a streaming library for video and music and photos, so I can watch our
|
||||
own files from any screen in the house.
|
||||
- **Records** — a photo library, scanned documents, finances, groceries.
|
||||
- **One sign-in** — a single login page in front of everything worth protecting, so
|
||||
there is one place to turn access off.
|
||||
- **Documents** — a file-sync and office suite that replaces the Google-style tools.
|
||||
- **Automations** — the plumbing that makes the first four groups talk to each other.
|
||||
|
||||
For a while I wanted this machine to also do AI work. It has a basic graphics card in it,
|
||||
and it can run small models, but it kept hitting the same wall: a model that fits in
|
||||
memory is a model that runs slowly, and a model big enough to be genuinely useful doesn't
|
||||
fit. That's what led to the second machine.
|
||||
|
||||
## The work: SpaghetAI, the machine that thinks
|
||||
|
||||
This is the one people find strange, and I understand why.
|
||||
|
||||
SpaghetAI has **768 GB of memory and two graphics cards with 40 GB of their own memory
|
||||
between them**. It has **no hard drives at all** — just about a terabyte of solid-state
|
||||
storage for the programs themselves.
|
||||
|
||||
And when I looked at it recently, it was **using only 77 of those 768 GB.** That is 10%
|
||||
of the memory in the machine. So the obvious question is: why buy 768 GB for 77 GB of
|
||||
work?
|
||||
|
||||
### Why 768 GB of memory for 77 GB of work
|
||||
|
||||
Back to the kitchen. The counter looks empty, but the counter is empty **because I
|
||||
already put everything on it.** Nothing is being cooked yet.
|
||||
|
||||
Here's what that memory is actually for:
|
||||
|
||||
- **The model has to be on the counter already.** An AI model is a very large file. If the
|
||||
machine has to go fetch it from a drive each time you ask something, an answer that
|
||||
should take two seconds takes two minutes. So the models are loaded and left there,
|
||||
waiting. That is most of the 77 GB that is currently used.
|
||||
- **Long conversations eat memory fast.** Reading one page is cheap. Reading five hundred
|
||||
pages at once is not, and the cost climbs faster than the page count does. The rest of
|
||||
the 768 GB is there so the answer to "can you read all of these?" is always yes.
|
||||
- **Searching across documents wants to be instant.** Finding the passage that answers a
|
||||
question means holding an index of everything searchable in fast memory. On a hard
|
||||
drive, that same search is slow enough that you stop doing it.
|
||||
|
||||
And here is the number that convinced me the design is right rather than wasteful. At the
|
||||
same moment that memory showed 10% used, **both graphics cards were nearly full — about
|
||||
19 of their 20 GB in use each — while doing nothing at all.**
|
||||
|
||||
That is the machine at rest. The models are loaded, resident, and waiting. Nothing is
|
||||
being asked of them. It isn't underused; it is **pre-loaded**.
|
||||
|
||||
### What I actually built on top of it
|
||||
|
||||
Five programs, which is a much shorter list than the hardware suggests. That's
|
||||
intentional — one thin layer doing the thinking, and nothing else.
|
||||
|
||||
| Program | What it does for me |
|
||||
|---|---|
|
||||
| **strata** | The main one. I ask a question in a web page; it searches my documents and answers with sources I can click. |
|
||||
| **LocalAI_Worker** | A helper that lets the first machine ask this one for help when a job is too big for it. |
|
||||
| **Docling-Serve** | Turns a PDF or a scan into clean, readable text — the step before anything can be searched. |
|
||||
| **appapi-harp** | Hooks the AI into the document suite, so the same answers appear where I already work. |
|
||||
| **open-terminal** | A controlled command line the AI can use, for jobs that aren't document questions. |
|
||||
|
||||
The piece I'd point at if you only remember one thing: **the two machines work together as
|
||||
one AI service.** MarvinBlade already ran the AI program for my chat interface and my
|
||||
search stack. When SpaghetAI came along, it simply joined that same setup as a helper.
|
||||
Small and easy jobs still run on the old card; jobs that need real graphics power go to the
|
||||
new one. **Nothing about the front door changed** — the same search box, the same chat
|
||||
window. It just got a stronger option behind it.
|
||||
|
||||
If you're wondering why the PDF converter matters that much: it's the unglamorous half of
|
||||
the whole project. Getting a model to answer well is mostly a matter of getting its
|
||||
reading material into clean text first. Most of my early frustration came from models
|
||||
giving confident nonsense, and most of that nonsense traced back to a badly converted
|
||||
document rather than a bad model.
|
||||
|
||||
## The outcome
|
||||
|
||||
It works. I can open a web page, ask a question in plain English about documents that
|
||||
exist only inside my house, and get an answer with links back to the pages it came from.
|
||||
Photos, PDFs, scans, notes. Nothing left my network to do it.
|
||||
|
||||
The honest limits, because they matter more than the wins:
|
||||
|
||||
- **It is not faster than a cloud service.** My setup is slower than the big commercial
|
||||
ones, and the models I can run are less capable than the ones I'd use for a hard
|
||||
reasoning problem. I still use those.
|
||||
- **Speed comes from the pre-loading, not the hardware.** Warm, it's fine. Cold, it's
|
||||
slow — and how cold it goes depends entirely on the problem in the next section.
|
||||
- **It takes upkeep.** Updates break things, and drives die. This is the part people
|
||||
underestimate when they see the exciting spec sheet.
|
||||
|
||||
What I get for that is not speed or capability. It's that the answer is the same one
|
||||
whether or not I have internet, and the material it read never left the building.
|
||||
|
||||
## The mistake I made, and would make again differently
|
||||
|
||||
Here is the part this post exists to warn you about.
|
||||
|
||||
SpaghetAI has no hard drives. So where do its model files — the multi-gigabyte ones —
|
||||
live?
|
||||
|
||||
**On MarvinBlade.** The AI machine reaches across the network, to the storage machine,
|
||||
to load its own brain.
|
||||
|
||||
```text
|
||||
MarvinBlade SpaghetAI
|
||||
┌──────────────────┐ ┌────────────────────┐
|
||||
│ holds all the │ │ does the thinking │
|
||||
│ files, and all │◄──────►│ 40 GB of graphics │
|
||||
│ the model files │ network│ memory, waiting │
|
||||
└──────────────────┘ └────────────────────┘
|
||||
▲ ▲
|
||||
│ │
|
||||
if this goes down, this can't
|
||||
everything does start up
|
||||
```
|
||||
|
||||
The consequences, in order of how much they annoy me:
|
||||
|
||||
1. **The AI machine cannot start over.** Restart it and it needs a network trip to reload
|
||||
its models. Fast if the models are already in memory; slow if they aren't.
|
||||
2. **They fail together.** If MarvinBlade goes down, the AI goes down with it, even
|
||||
though the expensive half of the AI stack is sitting idle two feet away with its
|
||||
graphics cards still loaded.
|
||||
3. **One power problem takes out both.** And that's the thing I actually found.
|
||||
|
||||
MarvinBlade's 30 drives don't fit inside the server case. They live in **two separate
|
||||
drive cabinets** bolted into the rack beside it, connected by cable.
|
||||
|
||||
Each cabinet has four power supplies, so it can survive one failing. Right now **two of
|
||||
the four in each cabinet are dead.** The cabinets still run — they have working supplies
|
||||
— but the *backup* is gone. A single power event now takes out most of 30 drives and both
|
||||
protection drives at once. No amount of protection survives that. Meanwhile a parity
|
||||
check was running the day I looked, which is the system quietly verifying it can still
|
||||
rebuild a drive.
|
||||
|
||||
So the lesson, which I'd give anyone building this: **protection against drive failure is
|
||||
not the same as protection against everything else.** The thing most likely to take my
|
||||
setup down isn't a dying disk. It's a power supply, a network cable, or the fact that I
|
||||
made one machine responsible for the other's ability to think.
|
||||
|
||||
Two smaller findings from the same check-up, both cheaper to fix than buying more
|
||||
capacity: the space holding all the programs is **86% full**, which is how you get an
|
||||
outage from a log file rather than a dead drive; and a spare drive passed its health
|
||||
check while quietly reporting two repaired sectors, which is the sort of thing you note
|
||||
and replace rather than ignore.
|
||||
|
||||
## Do this yourself
|
||||
|
||||
The useful thing about the design is that it's a *destination*, not a starting point. If
|
||||
you want to run this kind of thing at home, start far smaller than mine.
|
||||
|
||||
**Tier 1 — one normal PC and one decent graphics card.** A machine with 32 GB of memory
|
||||
and a card with 12 GB of its own will run a genuinely useful model, and it will do
|
||||
document search over a few thousand files comfortably. This is where you should start.
|
||||
The software is free, the learning is real, and none of it is wasted if you outgrow the
|
||||
hardware.
|
||||
|
||||
**Tier 2 — a used workstation with 128–256 GB of memory.** This is the step that changes
|
||||
what you can ask. Bigger models, larger document sets, and services that stay up instead
|
||||
of being started when needed. Business machines go cheaply secondhand; this is the sweet
|
||||
spot.
|
||||
|
||||
**Tier 3 — split the jobs, which is where I am.** A storage machine and a thinking
|
||||
machine, once you have enough of both to care about them failing separately.
|
||||
|
||||
Two rules of thumb I'd give myself five years ago:
|
||||
|
||||
> **Buy memory before you buy storage.** Storage is cheap and easy to add later. Memory is
|
||||
> the thing that decides what you can run at all.
|
||||
|
||||
> **Only build protection for things you would hate to lose.** A media library is not the
|
||||
> same as scanned documents. Two copies beat one; three beat two, and the difference
|
||||
> between two and three is where the real cost is.
|
||||
|
||||
And one about money, because people get this wrong in both directions: this is not
|
||||
cheaper than a subscription. The hardware cost real money and the electricity is
|
||||
measurable. I'm not buying savings. I'm buying the ability to keep my paperwork at home
|
||||
and have it still be useful.
|
||||
|
||||
## What runs this site
|
||||
|
||||
This website lives on MarvinBlade as one more program in the eighty-one. I mention it
|
||||
because I had "hosted on Appwrite" written in various notes for a long time, and it isn't
|
||||
true any more — it's a plain build served by a web server on the storage box. The site
|
||||
gets built from source and served, like everything else here. I'd rather say what's
|
||||
actually running.
|
||||
|
||||
## If you take one thing from this
|
||||
|
||||
Two machines built for opposite reasons, one pipeline between them. The spec that looks
|
||||
ridiculous — 768 GB of memory running at 10% — stops looking ridiculous once you notice
|
||||
the graphics cards are 95% full and idle. The machine isn't wasting money on memory it
|
||||
doesn't need; it's holding its work in place before the work arrives.
|
||||
|
||||
And the number that matters most on either box isn't the storage count or the memory
|
||||
count. It's the cable between them, because that's the one thing neither machine can
|
||||
survive alone.
|
||||
|
||||
---
|
||||
|
||||
*Numbers are as measured on 3 November 2026 and will drift. Capacities are written in
|
||||
terabytes as the server reports them.*
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: "Privacy Policy"
|
||||
date: 2025-08-01
|
||||
---
|
||||
|
||||
This Privacy Policy explains how we collect, use, and protect your personal information when you visit our website.
|
||||
|
||||
## Information We Collect
|
||||
|
||||
We may collect the following types of information:
|
||||
|
||||
- **Personal Information**: Name, email address, and other contact details you provide when subscribing to our newsletter or contacting us.
|
||||
- **Usage Data**: Information about how you use our website, including pages visited, time spent, and click patterns.
|
||||
- **Device Information**: Details about your device, including browser type, operating system, and IP address.
|
||||
|
||||
## How We Use Your Information
|
||||
|
||||
We use the information we collect to:
|
||||
|
||||
- Provide and improve our website and services
|
||||
- Respond to your inquiries and requests
|
||||
- Send you newsletters and updates (with your consent)
|
||||
- Analyze website usage and performance
|
||||
- Comply with legal obligations
|
||||
|
||||
## Cookies
|
||||
|
||||
We use cookies and similar tracking technologies to enhance your experience. You can control cookies through your browser settings.
|
||||
|
||||
## Third-Party Services
|
||||
|
||||
We may use third-party services that collect information separately. This privacy policy does not apply to those services.
|
||||
|
||||
## Your Rights
|
||||
|
||||
You have the right to:
|
||||
|
||||
- Access your personal information
|
||||
- Request corrections or updates
|
||||
- Request deletion of your information
|
||||
- Opt out of marketing communications
|
||||
|
||||
## Contact Us
|
||||
|
||||
If you have questions about this privacy policy, please contact us at privacy@spaghet.io.
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
title: "Terms of Service"
|
||||
date: 2025-08-01
|
||||
---
|
||||
|
||||
These Terms of Service govern your use of our website and services.
|
||||
|
||||
## Acceptance of Terms
|
||||
|
||||
By accessing or using our website, you agree to be bound by these Terms of Service.
|
||||
|
||||
## Use of Website
|
||||
|
||||
You may use our website for personal, non-commercial purposes. You agree not to:
|
||||
|
||||
- Modify or copy any part of the website
|
||||
- Use the website for any unlawful purpose
|
||||
- Interfere with the proper working of the website
|
||||
|
||||
## Content
|
||||
|
||||
All content on our website, including text, graphics, and images, is our property and is protected by intellectual property laws.
|
||||
|
||||
## Disclaimer
|
||||
|
||||
Our website and content are provided "as is" without warranties of any kind. We do not warrant that the website will be error-free or uninterrupted.
|
||||
|
||||
## Limitation of Liability
|
||||
|
||||
We shall not be liable for any damages arising from your use of our website, including direct, indirect, or consequential damages.
|
||||
|
||||
## Changes to Terms
|
||||
|
||||
We reserve the right to modify these Terms of Service at any time. Your continued use of the website constitutes acceptance of any changes.
|
||||
|
||||
## Contact Us
|
||||
|
||||
If you have questions about these terms, please contact us at legal@spaghet.io.
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
title: "Astro Profile"
|
||||
summary: "Personal portfolio website built with Astro, React, and Tailwind CSS"
|
||||
date: 2025-08-01
|
||||
tags: ["Astro", "React", "Tailwind CSS", "JavaScript", "TypeScript"]
|
||||
draft: false
|
||||
demoUrl: "https://spaghet.io"
|
||||
repoUrl: "https://github.com/spaghetgaming/astro-profile"
|
||||
---
|
||||
|
||||
A modern personal portfolio website showcasing my work, projects, and technical expertise. Built with Astro for optimal performance and SEO, utilizing React components for interactive elements, and styled with Tailwind CSS for responsive design.
|
||||
|
||||
Features include:
|
||||
- Responsive design that works across all device sizes
|
||||
- Smooth animations and transitions for enhanced user experience
|
||||
- Clean, modern aesthetic with dark/light mode support
|
||||
- Integrated blog section for technical articles
|
||||
- Project showcase with detailed descriptions
|
||||
- Contact form with email integration
|
||||
- SEO optimization for better search engine visibility
|
||||
|
||||
The site demonstrates my proficiency in modern web development practices and technologies, including component-based architecture, responsive design principles, and performance optimization techniques.
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
title: "Gitea Implementation"
|
||||
summary: "Self-hosted Git service with continuous integration capabilities"
|
||||
date: 2025-08-01
|
||||
tags: ["Git", "Gitea", "CI/CD", "Docker", "DevOps"]
|
||||
draft: false
|
||||
demoUrl: "https://gitea.spaghet.io"
|
||||
---
|
||||
|
||||
Deployment and configuration of Gitea as a self-hosted Git service for version control and continuous integration. This implementation provides a comprehensive solution for managing code repositories, tracking issues, and automating development workflows.
|
||||
|
||||
Key features include:
|
||||
- Repository management with Git-based version control
|
||||
- Issue tracking and project management tools
|
||||
- Continuous integration and deployment capabilities
|
||||
- User authentication and access control
|
||||
- Integration with Docker containers for easy deployment
|
||||
- Customizable webhooks and automation scripts
|
||||
- Backup and disaster recovery procedures
|
||||
|
||||
The project demonstrates my expertise in DevOps practices, infrastructure management, and the implementation of self-hosted solutions that provide greater control and security over development processes.
|
||||
@@ -0,0 +1,93 @@
|
||||
---
|
||||
title: "Home System"
|
||||
summary: "Technology as Lifestyle — two Unraid servers: 258 TB of dual-parity storage and a 768 GB / 40 GB-VRAM GPU inference box running 86 containers between them."
|
||||
date: 2026-11-03
|
||||
tags: ["DevOps", "Docker", "Unraid", "Homelab", "NVIDIA", "LocalAI", "RAG", "Authentik", "PostgreSQL", "MariaDB", "MySQL", "MongoDB", "Redis", "Minio", "Plex", "Nextcloud", "n8n", "Node-RED", "KVM"]
|
||||
draft: false
|
||||
---
|
||||
|
||||
Two Unraid 7.3.0 hosts, designed to fail differently. MarvinBlade is the storage and
|
||||
application layer — capacity and availability. SpaghetAI is the inference layer — memory
|
||||
and VRAM, with no array at all. The plain-language version of this, with the
|
||||
reasoning and the mistakes, is the blog post
|
||||
[Running AI From My Own Computers](/blog/04-marvinblade-and-spaghetai/).
|
||||
|
||||
## The two boxes
|
||||
|
||||
| | **MarvinBlade** | **SpaghetAI** |
|
||||
|---|---|---|
|
||||
| Role | Primary storage + application server | GPU / AI inference server |
|
||||
| Chassis | Cisco UCS C220 M4S | Dell PowerEdge R740 |
|
||||
| CPU | 2× Xeon E5-2683 v4 — 32 cores / 64 threads | 2× Xeon Silver 4214 — 24 cores / 48 threads |
|
||||
| RAM | 128 GB DDR4 ECC | 768 GB DDR4 ECC (22× 32 GB RDIMM) |
|
||||
| GPU | 1× Quadro P2000 (5 GB) | 2× RTX A4500 (40 GB total VRAM) |
|
||||
| Storage | 258 TB raw across 30 array disks, 117 TB free | 960 GB btrfs SSD pool, no array |
|
||||
| Parity | 2× 16 TB — survives two simultaneous disk failures | none, by design |
|
||||
| Filesystem | XFS throughout | btrfs |
|
||||
| Containers | 81 | 5 |
|
||||
| VMs | 2 — Home Assistant, Windows Server 2025 | none |
|
||||
|
||||
MarvinBlade's 30 spindles live in two NetApp DS424IOM6 24-bay SAS shelves chained over
|
||||
QSFP+. Cache and hot-tier SSDs sit outside the array: 1 TB cache pool, 2 TB media pool,
|
||||
and a 720 GB Docker vDisk pool.
|
||||
|
||||
## What runs on them
|
||||
|
||||
| Category | Services |
|
||||
|---|---|
|
||||
| **Media** | Plex, Audiobookshelf, Immich (+ CUDA ML worker), Romm, Owncast, Sonarr, Radarr, Prowlarr, tdarr, SABnzbd, Deluge, Ombi |
|
||||
| **Databases** | PostgreSQL 17, PostgreSQL 17 + pgvector, MariaDB, MySQL, MongoDB 7.0, Redis, Qdrant |
|
||||
| **Identity & security** | Authentik (SSO + LDAP outpost), oauth2-proxy, Anubis, Vaultwarden, OpenBao, Pi-hole |
|
||||
| **Web & collaboration** | NGINX Proxy Manager, Nextcloud (Talk HPB, Whiteboard), Collabora CODE, OnlyOffice, DocuSeal, Reactive Resume, Gitea, spaghet-home |
|
||||
| **Automation & AI** | n8n (+ sandbox), Windmill, Node-RED, Open WebUI, LocalAI, strata, Docling-Serve, Morphic, SearXNG, Open Terminal |
|
||||
| **Gaming** | Crafty (Minecraft control panel), mcpelevator, Virtual Tabletop |
|
||||
| **Observability** | Splunk, Uptime Kuma, GoAccess, Notifiarr, autoheal |
|
||||
|
||||
Authentik fronts every service that matters, with oauth2-proxy and Anubis handling the
|
||||
apps that can't speak OIDC natively.
|
||||
|
||||
## SpaghetAI — the inference layer
|
||||
|
||||
Five containers, ~139 GB of RAM between them, both A4500s holding ~19 GB of resident
|
||||
weights each.
|
||||
|
||||
| Container | What it does | RAM |
|
||||
|---|---|---|
|
||||
| **strata** | RAG / document-search app (CUDA 13 build), port 8280 | 126 GB |
|
||||
| **LocalAI_Worker** | Distributed LocalAI worker node, gRPC 50050–50060 | 4.6 GB |
|
||||
| **Docling-Serve** | Document → Markdown/JSON parsing API, port 5001 | 4.5 GB |
|
||||
| **appapi-harp** | Nextcloud App API companion | 0.16 GB |
|
||||
| **open-terminal** | AI-accessible shell, port 8973 | 0.16 GB |
|
||||
|
||||
LocalAI runs in distributed mode: MarvinBlade hosts the orchestrator and the general
|
||||
CPU/Quadro inference, SpaghetAI joins as a GPU worker over gRPC, so heavier models get
|
||||
scheduled onto the A4500s without changing anything at the front door.
|
||||
|
||||
## The dependency between them
|
||||
|
||||
SpaghetAI has no array. Its model weights live on MarvinBlade, mounted over SMB from the
|
||||
`local_ai` share (a 2 TB cache-exclusive pool on a Crucial MX500).
|
||||
|
||||
That makes MarvinBlade a single point of failure for SpaghetAI's cold starts and model
|
||||
swaps — the GPU box can't serve anything it hasn't already loaded if the storage box
|
||||
goes down. The fix on the list is a local NVMe mirror of the hot weights so the inference
|
||||
path has its own fault boundary.
|
||||
|
||||
## Failure domains
|
||||
|
||||
Dual parity protects against two disks dying at once, which is not the most likely way
|
||||
to lose the array. Power to a shelf is. Both SAS shelves have lost PSU redundancy, and
|
||||
the array depends on that network hop between the two boxes. Durability here is a chain —
|
||||
disks, parity, shelf power, SMB — and the parity is the strongest link in it.
|
||||
|
||||
## Day-to-day operations
|
||||
|
||||
- End-to-end support for 30+ users across the containerized applications, including
|
||||
troubleshooting, configuration guidance and documentation.
|
||||
- On-call for critical services, with Uptime Kuma and Splunk providing the signal.
|
||||
- DevOps workflows automated through n8n, Windmill, Node-RED, custom APIs and Gitea
|
||||
Actions — this site itself builds and deploys through the pipeline.
|
||||
- Backup strategy layered on the dual-parity array, with separate `backup` share and
|
||||
off-array copies.
|
||||
|
||||
Specs above were measured from live telemetry on 3 November 2026 and will drift.
|
||||
@@ -0,0 +1,198 @@
|
||||
---
|
||||
title: "Spaghet.io Website"
|
||||
summary: "A comprehensive overview of the Spaghet.io personal website, detailing its features, design elements, and technical implementation."
|
||||
date: 2025-08-13
|
||||
tags: ["website", "portfolio", "personal", "astro", "spaghetti"]
|
||||
draft: false
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Spaghet.io is my personal website that showcases my professional work, blog posts, projects, and expertise in technology and innovation. The site embodies my passion for spaghetti, noodles, and all things tech through its design and functionality.
|
||||
|
||||
## Key Features
|
||||
|
||||
### 1. Responsive Design
|
||||
|
||||
The website features a fully responsive design that works seamlessly across:
|
||||
- Desktop browsers
|
||||
- Tablets
|
||||
- Mobile devices
|
||||
- All screen sizes
|
||||
|
||||
### 2. Dark Mode Support
|
||||
|
||||
Dual Theme Implementation:
|
||||
- Light mode with warm, spaghetti-themed colors
|
||||
- Dark mode with complementary dark theme that maintains visual consistency
|
||||
- Smooth transitions between themes
|
||||
- Automatic theme detection based on system preferences
|
||||
|
||||
### 3. Spaghetti-Themed Color Palette
|
||||
|
||||
**Primary Colors:**
|
||||
- Spaghetti Yellow: #FDE68A - Used for highlights and interactive elements
|
||||
- Spaghetti Red: #FECACA - Used for accents and important actions
|
||||
- Spaghetti Cream: #FEF3C7 - Used for backgrounds and subtle elements
|
||||
- Spaghetti Brown: #78350F - Used for text content and primary elements
|
||||
|
||||
### 4. Interactive UI Components
|
||||
|
||||
**Navigation Elements:**
|
||||
- Fixed header with smooth scrolling
|
||||
- Mobile-friendly drawer navigation
|
||||
- Hover effects with color transitions
|
||||
- Selected state indicators with consistent theme colors
|
||||
|
||||
**Content Presentation:**
|
||||
- Blog post cards with hover animations
|
||||
- Project showcase with filtering capabilities
|
||||
- Tag-based organization system
|
||||
- Responsive tables and lists
|
||||
|
||||
### 5. Technical Implementation
|
||||
|
||||
**Built With:**
|
||||
- Astro: Static site generator for optimal performance
|
||||
- SolidJS: For reactive UI components
|
||||
- Tailwind CSS: Utility-first CSS framework
|
||||
- TypeScript: Type safety and enhanced development experience
|
||||
- Markdown: Content management system
|
||||
|
||||
### 6. Performance Optimizations
|
||||
|
||||
**Optimizations Implemented:**
|
||||
- Lazy loading of images and components
|
||||
- Efficient CSS with minimal bundle size
|
||||
- Optimized JavaScript with tree-shaking
|
||||
- Responsive image handling
|
||||
- Minimal third-party dependencies
|
||||
|
||||
## UI Components
|
||||
|
||||
### Header & Navigation
|
||||
- Fixed position header with brand logo
|
||||
- Desktop navigation with hover effects
|
||||
- Mobile drawer menu with hamburger icon
|
||||
- Search functionality
|
||||
- Theme toggle button
|
||||
|
||||
### Hero Section
|
||||
- Animated background elements
|
||||
- Welcome message with personal introduction
|
||||
- Call-to-action buttons styled with spaghetti theme
|
||||
- Responsive text sizing for all devices
|
||||
|
||||
### Blog Section
|
||||
- Recent posts preview
|
||||
- Filterable by tags
|
||||
- Card-based layout with hover effects
|
||||
- Date formatting and categorization
|
||||
|
||||
### Projects Section
|
||||
- Project showcase with filtering capabilities
|
||||
- Tag-based organization system
|
||||
- Responsive grid layout
|
||||
- Detailed project cards with descriptions
|
||||
|
||||
### Footer
|
||||
- Copyright information with current year
|
||||
- Legal links (Privacy Policy, Terms of Service)
|
||||
- Social media integration
|
||||
- Consistent spaghetti-themed styling
|
||||
|
||||
## Design Elements
|
||||
|
||||
### Visual Theme
|
||||
|
||||
The website maintains a consistent spaghetti theme throughout:
|
||||
- Warm color scheme that evokes feelings of comfort and satisfaction
|
||||
- Clean, organized layout that mirrors the structure of good spaghetti
|
||||
- Subtle animations and transitions for enhanced user experience
|
||||
- Proper contrast ratios for accessibility
|
||||
|
||||
### Typography
|
||||
|
||||
- Clear hierarchy with appropriate font weights
|
||||
- Responsive text sizing
|
||||
- Consistent spacing and alignment
|
||||
- Readable fonts optimized for both light and dark modes
|
||||
|
||||
### Layout Structure
|
||||
|
||||
- Grid-based responsive layout
|
||||
- Consistent padding and margins
|
||||
- Visual balance across all sections
|
||||
- Proper use of white space
|
||||
|
||||
## Technical Architecture
|
||||
|
||||
### Component Structure
|
||||
|
||||
The site uses a modular component architecture:
|
||||
- Header - Navigation and branding
|
||||
- Footer - Site information and links
|
||||
- Blog - Content display with filtering
|
||||
- Projects - Portfolio showcase
|
||||
- ArrowCard - Generic card component for content
|
||||
- StackCard - Technology stack display
|
||||
- Search - Search functionality
|
||||
|
||||
### Theme System
|
||||
|
||||
The theme system supports:
|
||||
- CSS variables for consistent color management
|
||||
- Dark mode detection and switching
|
||||
- Theme persistence across sessions
|
||||
- Smooth transitions between themes
|
||||
|
||||
### Content Management
|
||||
|
||||
Content is managed through:
|
||||
- Markdown files for blog posts and projects
|
||||
- Astro's content collections
|
||||
- Frontmatter metadata for categorization
|
||||
- Template-based generation system
|
||||
|
||||
## Responsive Features
|
||||
|
||||
### Mobile Experience
|
||||
- Touch-friendly navigation elements
|
||||
- Optimized touch targets
|
||||
- Collapsible sections for smaller screens
|
||||
- Performance optimized for mobile devices
|
||||
|
||||
### Tablet Experience
|
||||
- Adaptive layout adjustments
|
||||
- Intermediate view sizes
|
||||
- Maintained usability across screen sizes
|
||||
|
||||
### Desktop Experience
|
||||
- Full-width content presentation
|
||||
- Advanced hover effects and animations
|
||||
- Multi-column layouts where appropriate
|
||||
|
||||
## Accessibility
|
||||
|
||||
The website includes accessibility features:
|
||||
- Semantic HTML structure
|
||||
- Proper contrast ratios for text
|
||||
- Keyboard navigation support
|
||||
- Screen reader compatibility
|
||||
- Responsive design for all devices
|
||||
|
||||
## Future Enhancements
|
||||
|
||||
Potential future improvements include:
|
||||
- Enhanced animation system with more sophisticated transitions
|
||||
- Additional interactive elements that reflect the spaghetti theme
|
||||
- More advanced filtering and search capabilities
|
||||
- Integration with external APIs for dynamic content
|
||||
- Expanded multimedia presentation options
|
||||
- Improved social sharing features
|
||||
|
||||
## Conclusion
|
||||
|
||||
Spaghet.io represents a cohesive blend of technical excellence and thematic consistency. The site successfully combines modern web technologies with a playful yet professional spaghetti-themed aesthetic to create an engaging user experience that reflects my passion for both technology and culinary arts.
|
||||
|
||||
The implementation maintains the structure and organization that makes good spaghetti satisfying to use, while providing an enjoyable browsing experience across all devices and themes.
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
company: "Spaghet Tech"
|
||||
role: "Creator"
|
||||
dateStart: 2023-05-01
|
||||
dateEnd: 2026-10-14
|
||||
---
|
||||
|
||||
Deep knowledge of ITSM (e.g., INC, PRB, CHG, ESC, etc.), ITOM (e.g., CMDB, ACC, CertDisc, etc.), and ITAM (e.g., SAM, HAM) to position myself as a trusted advisor.
|
||||
|
||||
Proven ability to connect with decision-makers in industries (e.g., healthcare, enterprise services) through professional platforms, conferences, or referrals to secure long-term partnerships.
|
||||
|
||||
Skilled in translating technical services (e.g., instance data replication, M365 integration) into business value, ensuring alignment with client goals and fostering trust.
|
||||
|
||||
Financial acumen to balance market rates, project scope, and client budgets while offering flexible pricing models (e.g., hourly vs. project-based) to secure work.
|
||||
|
||||
Hands-on experience with tools like Docker, Kubernetes, and ITSM/ITOM platforms to deliver scalable, secure, and compliant solutions (e.g., Archiving, Certificate Discovery, CMDB steering).
|
||||
|
||||
Ability to coordinate cross-functional teams, manage timelines, and ensure successful delivery of complex projects (e.g., Employee Center Migrations, IDR for global instances).
|
||||
|
||||
Quick thinking to address challenges like data replication gaps, integration hurdles, or user support needs for 30+ users, while maintaining system reliability.
|
||||
|
||||
Strong customer service skills to provide ongoing support, troubleshoot issues, and retain clients (e.g., maintaining 30+ user satisfaction through proactive documentation and on-call maintenance).
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
company: "Clear Skye"
|
||||
role: "Technical Architect"
|
||||
dateStart: 2022-03-01
|
||||
dateEnd: 2023-05-01
|
||||
---
|
||||
|
||||
Proficient in ServiceNow Identity Governance modules (e.g., IdentityIQ, ClearSkye IGA) for designing, configuring, and optimizing workflows for access management, entitlements, and compliance.
|
||||
|
||||
Expertise in AWS, Azure, GCP to build scalable, secure, and compliant identity governance architectures for hybrid/multi-cloud environments.
|
||||
|
||||
Experience with REST, SOAP, and middleware tools to integrate ClearSkye IGA with identity providers (SAML, OAuth), HR systems, and enterprise apps for seamless data flow.
|
||||
|
||||
Knowledge of GDPR, SOC2, ISO 27001, and NIST frameworks to design secure IGA solutions with access controls, audit trails, and regulatory alignment.
|
||||
|
||||
Skilled in automating deployment pipelines, IaC (Terraform, CloudFormation), and monitoring tools (Prometheus) to ensure reliable IGA system updates.
|
||||
|
||||
Expertise in designing data privacy frameworks, managing user data lifecycle, and leveraging analytics for risk assessments, entitlement audits, and access insights.
|
||||
|
||||
Proven ability to collaborate with IT ops, security teams, and business stakeholders to translate governance requirements into technical solutions.
|
||||
|
||||
Ability to resolve complex IGA challenges (e.g., entitlement conflicts, access delays) and adapt architectures to evolving compliance, user, and tech trends.
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
company: "Neoteric Technologies"
|
||||
role: "Sr. Cloud Architect"
|
||||
dateStart: 2021-03-01
|
||||
dateEnd: 2022-01-01
|
||||
---
|
||||
|
||||
Results-driven technical leader with deep expertise in cloud architecture and infrastructure design.
|
||||
|
||||
Extensive experience in designing scalable, secure, and compliant identity governance architectures for hybrid/multi-cloud environments.
|
||||
|
||||
Proficient in AWS, Azure, and GCP platforms to build robust cloud solutions.
|
||||
|
||||
Skilled in automating deployment pipelines and implementing Infrastructure as Code (IaC) using tools like Terraform and CloudFormation.
|
||||
|
||||
Experience with monitoring tools to ensure reliable system updates and performance optimization.
|
||||
|
||||
Knowledge of security frameworks and compliance standards to design secure cloud solutions.
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
company: "Computer Aid, Inc."
|
||||
role: "Technical Consultant"
|
||||
dateStart: 2019-07-01
|
||||
dateEnd: 2021-07-01
|
||||
---
|
||||
|
||||
Technical Consultant for ServiceNow practice with expertise in IT Service Management platforms.
|
||||
|
||||
Deep knowledge of ITSM (e.g., INC, PRG, CHG, ESC) and related frameworks to support enterprise clients.
|
||||
|
||||
Experience in implementing and optimizing ServiceNow solutions for various business needs.
|
||||
|
||||
Strong ability to translate technical requirements into business value for clients.
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
company: "TriMedx"
|
||||
role: "Senior Software Engineer"
|
||||
dateStart: 2017-09-01
|
||||
dateEnd: 2019-07-01
|
||||
---
|
||||
|
||||
Experienced software engineer with focus on delivering fast, elegant code along with delightful user interfaces.
|
||||
|
||||
Proficient in web technologies including JavaScript, HTML, CSS, React, AngularJS, and Angular.
|
||||
|
||||
Strong background in developing marketing and ecommerce websites to complex enterprise applications.
|
||||
|
||||
Dedicated to creating functional and aesthetically pleasing digital solutions.
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
company: "CareWorks Tech"
|
||||
role: "ServiceNow Developer"
|
||||
dateStart: 2016-06-01
|
||||
dateEnd: 2017-09-01
|
||||
---
|
||||
|
||||
Experienced ServiceNow developer with expertise in IT Service Management platforms.
|
||||
|
||||
Skilled in implementing and customizing ServiceNow solutions for enterprise clients.
|
||||
|
||||
Knowledge of ITSM frameworks including INC, PRG, CHG, ESC to support business operations.
|
||||
|
||||
Proficient in configuring and maintaining ServiceNow applications to meet client requirements.
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
company: "zulily"
|
||||
role: "Technical Change Manager"
|
||||
dateStart: 2014-10-01
|
||||
dateEnd: 2016-06-01
|
||||
---
|
||||
|
||||
Designed and maintained internal tools for Fulfillment Center (FC) Operations, including:
|
||||
|
||||
- Weekly performance monitoring systems with actionable feedback for employee development and recognition.
|
||||
- Employee recognition program to incentivize performance.
|
||||
- Supplies inventory management system (e.g., Corrugated Boxes, Tape, Bubble Wrap) for tracking usage and movement.
|
||||
- Employee kiosks for Overtime sign-ups, Voluntary-Time-Off, Department Transfers, and peer recognition.
|
||||
- Dock Management System to streamline trailer tracking for transportation vendors.
|
||||
|
||||
Tested and approved deployments of Fulfillment Center Systems (FCS) tools for fulfillment tasks (e.g., Receive, Stow, Pick, Pack).
|
||||
|
||||
Documented and prioritized feature requests, improvements, and bug fixes from FC Operations, managing Agile sprints with weekly and biweekly check-ins to ensure project alignment.
|
||||
|
||||
Led operational process improvements to enhance efficiency, scalability, and overall FC operations performance.
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
company: "Amazon"
|
||||
role: "Area Manager"
|
||||
dateStart: 2010-03-01
|
||||
dateEnd: 2014-10-01
|
||||
---
|
||||
|
||||
Monitored associate productivity metrics and resolved performance barriers.
|
||||
|
||||
Conducted training sessions for peers and leadership on new fulfillment tech tools.
|
||||
|
||||
Empowered direct reports to enforce safety, quality, and productivity standards.
|
||||
|
||||
Recruited top talent for individual contributors to boost team success.
|
||||
|
||||
Led cross-functional teams to implement processes improving operational efficiency in North America.
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
company: "National Guard Bureau"
|
||||
role: "Chaplain Assistant"
|
||||
dateStart: 2007-12-01
|
||||
dateEnd: 2012-12-01
|
||||
---
|
||||
|
||||
Support role within the National Guard Bureau focused on chaplain services and community outreach.
|
||||
@@ -1,93 +1,69 @@
|
||||
---
|
||||
import type { BlogPost, Project } from "@lib/appwrite-service"
|
||||
import { getBlogPosts, getProjects } from "@lib/appwrite-service"
|
||||
import type { BlogPost, Project } from "@lib/types"
|
||||
|
||||
type Props = {
|
||||
entry: BlogPost | Project | any
|
||||
collection?: string
|
||||
allEntries?: any[]
|
||||
}
|
||||
|
||||
const { entry } = Astro.props
|
||||
const collection = entry.$collectionId === process.env.VITE_APPWRITE_BLOG_COLLECTION_ID ? 'blog' : 'projects'
|
||||
const { entry, collection = "blog", allEntries = [] } = Astro.props
|
||||
const content = entry?.content || ""
|
||||
|
||||
// Get the content from the entry
|
||||
const content = entry.contentHtml
|
||||
|
||||
// Fetch all documents for navigation
|
||||
let prevEntry = null
|
||||
let nextEntry = null
|
||||
|
||||
if (collection === "blog") {
|
||||
const blogPosts = await getBlogPosts()
|
||||
// Sort by date descending to get newest first
|
||||
const sortedPosts = blogPosts.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
|
||||
|
||||
// Find current post index
|
||||
const currentIndex = sortedPosts.findIndex(post => post.$id === entry.$id)
|
||||
// Find prev/next entries
|
||||
let prevEntry: any = null
|
||||
let nextEntry: any = null
|
||||
|
||||
if (allEntries.length > 0) {
|
||||
const currentIndex = allEntries.findIndex((e: any) => e.id === entry.id)
|
||||
if (currentIndex > 0) {
|
||||
prevEntry = sortedPosts[currentIndex - 1]
|
||||
prevEntry = allEntries[currentIndex - 1]
|
||||
}
|
||||
|
||||
if (currentIndex < sortedPosts.length - 1) {
|
||||
nextEntry = sortedPosts[currentIndex + 1]
|
||||
}
|
||||
} else if (collection === "projects") {
|
||||
const projects = await getProjects()
|
||||
// Sort by date descending to get newest first
|
||||
const sortedProjects = projects.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
|
||||
|
||||
// Find current project index
|
||||
const currentIndex = sortedProjects.findIndex(project => project.$id === entry.$id)
|
||||
|
||||
if (currentIndex > 0) {
|
||||
prevEntry = sortedProjects[currentIndex - 1]
|
||||
}
|
||||
|
||||
if (currentIndex < sortedProjects.length - 1) {
|
||||
nextEntry = sortedProjects[currentIndex + 1]
|
||||
if (currentIndex < allEntries.length - 1) {
|
||||
nextEntry = allEntries[currentIndex + 1]
|
||||
}
|
||||
}
|
||||
---
|
||||
|
||||
<div>
|
||||
<article class="text-spaghetti-brown/80 dark:text-spaghetti-cream" set:html={content} />
|
||||
<article class="text-ink" set:html={content} />
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
{prevEntry && (
|
||||
<a href={`/${collection}/${prevEntry.$id}`} class="group p-4 gap-3 flex items-center border rounded-lg hover:bg-black/5 hover:dark:bg-spaghetti-cream/10 border-black/15 dark:border-spaghetti-cream/20 blend">
|
||||
<div class="order-2 w-full h-full group-hover:text-spaghetti-brown/80 group-hover:dark:text-spaghetti-cream blend">
|
||||
<a href={`/${collection}/${prevEntry.id}`} class="group p-4 gap-3 flex items-center border rounded-lg bg-surface border-edge hover:bg-wash blend">
|
||||
<div class="order-2 w-full h-full group-hover:text-link blend">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<div class="text-sm uppercase">
|
||||
Prev
|
||||
</div>
|
||||
</div>
|
||||
<div class="font-semibold mt-3 text-spaghetti-brown/80 dark:text-spaghetti-cream">
|
||||
<div class="font-semibold mt-3 text-ink">
|
||||
{prevEntry.title}
|
||||
</div>
|
||||
</div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="order-1 stroke-current group-hover:stroke-black group-hover:dark:stroke-white rotate-180">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="order-1 stroke-current rotate-180">
|
||||
<line x1="5" y1="12" x2="19" y2="12" class="scale-x-0 group-hover:scale-x-100 translate-x-4 group-hover:translate-x-1 transition-all duration-300 ease-in-out" />
|
||||
<polyline points="12 5 19 12 12 19" class="translate-x-0 group-hover:translate-x-1 transition-all duration-300 ease-in-out" />
|
||||
</svg>
|
||||
</a>
|
||||
)}
|
||||
{nextEntry && (
|
||||
<a href={`/${collection}/${nextEntry.$id}`} class="group p-4 gap-3 flex items-center border rounded-lg hover:bg-black/5 hover:dark:bg-spaghetti-cream/10 border-black/15 dark:border-spaghetti-cream/20 transition-colors duration-300 ease-in-out blend dark:text-spaghetti-cream">
|
||||
<div class="w-full h-full text-right group-hover:text-spaghetti-brown/80 group-hover:dark:text-spaghetti-cream blend">
|
||||
<a href={`/${collection}/${nextEntry.id}`} class="group p-4 gap-3 flex items-center border rounded-lg bg-surface border-edge hover:bg-wash transition-colors duration-300 ease-in-out blend">
|
||||
<div class="w-full h-full text-right group-hover:text-link blend">
|
||||
<div class="text-sm uppercase">
|
||||
Next
|
||||
</div>
|
||||
<div class="font-semibold mt-3 text-spaghetti-brown/80 dark:text-spaghetti-cream">
|
||||
<div class="font-semibold mt-3 text-ink">
|
||||
{nextEntry.title}
|
||||
</div>
|
||||
</div>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="stroke-current group-hover:stroke-black group-hover:dark:stroke-white blend">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="stroke-current blend">
|
||||
<line x1="5" y1="12" x2="19" y2="12" class="scale-x-0 group-hover:scale-x-100 translate-x-4 group-hover:translate-x-1 transition-all duration-300 ease-in-out" />
|
||||
<polyline points="12 5 19 12 12 19" class="translate-x-0 group-hover:translate-x-1 transition-all duration-300 ease-in-out" />
|
||||
</svg>
|
||||
</a>
|
||||
)}
|
||||
{!prevEntry && !nextEntry && (
|
||||
<div class="col-span-2 text-center py-8 text-gray-500 blend">
|
||||
<div class="col-span-2 text-center py-8 text-ink-muted blend">
|
||||
No adjacent articles available
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -1,27 +1,29 @@
|
||||
---
|
||||
import type { BlogPost, Project } from "@lib/appwrite-service"
|
||||
import type { BlogPost, Project } from "@lib/types"
|
||||
import { formatDate, readingTime } from "@lib/utils"
|
||||
|
||||
type Props = {
|
||||
entry: BlogPost | Project | any
|
||||
collection?: string
|
||||
}
|
||||
|
||||
const { entry } = Astro.props
|
||||
const { entry, collection = "blog" } = Astro.props
|
||||
if (!entry) {
|
||||
return null
|
||||
}
|
||||
const { title, summary, date } = entry
|
||||
const demoUrl = "demoUrl" in entry ? entry.demoUrl : null
|
||||
const repoUrl = "repoUrl" in entry ? entry.repoUrl : null
|
||||
const collection = entry.$collectionId === process.env.VITE_APPWRITE_BLOG_COLLECTION_ID ? 'blog' : 'projects'
|
||||
const body = entry.content
|
||||
|
||||
const body = entry.content || ""
|
||||
---
|
||||
|
||||
<div>
|
||||
<a href={`/${collection}`} class="group w-fit p-1.5 gap-1.5 text-sm flex items-center border text-spaghetti-brown/100 dark:text-spaghetti-yellow rounded hover:bg-spaghetti-brown/5 hover:dark:bg-spaghetti-red/10 border-spaghetti-brown/15 dark:border-spaghetti-cream/20 transition-colors duration-300 ease-in-out">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="stroke-current group-hover:stroke-spaghetti-brown group-hover:dark:stroke-spaghetti-yellow">
|
||||
<a href={`/${collection}`} class="group w-fit p-1.5 gap-1.5 text-sm flex items-center border text-ink rounded border-edge hover:bg-chip hover:text-chip-ink transition-colors duration-300 ease-in-out">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" class="stroke-current">
|
||||
<line x1="19" y1="12" x2="5" y2="12" class="scale-x-0 group-hover:scale-x-100 translate-x-3 group-hover:translate-x-0 transition-all duration-300 ease-in-out" />
|
||||
<polyline points="12 19 5 12 12 5" class="translate-x-1 group-hover:translate-x-0 transition-all duration-300 ease-in-out" />
|
||||
</svg>
|
||||
<div class="w-full group-hover:text-spaghetti-brown group-hover:dark:text-spaghetti-yellow transition-colors duration-300 ease-in-out">
|
||||
<div class="w-full transition-colors duration-300 ease-in-out">
|
||||
Back to {`${collection.charAt(0).toUpperCase()}${collection.slice(1)}`}
|
||||
</div>
|
||||
</a>
|
||||
@@ -39,30 +41,30 @@ const body = entry.content
|
||||
{readingTime(body)}
|
||||
</div>
|
||||
</div>
|
||||
<h1 class="text-3xl font-semibold text-spaghetti-brown/100 dark:text-spaghetti-cream mt-2">
|
||||
<h1 class="text-3xl font-semibold text-ink mt-2">
|
||||
{title}
|
||||
</h1>
|
||||
<div class="mt-1 text-spaghetti-brown/80 dark:text-spaghetti-cream">
|
||||
<div class="mt-1 text-ink-muted">
|
||||
{summary}
|
||||
</div>
|
||||
{(demoUrl || repoUrl) &&
|
||||
<div class="mt-4 flex flex-wrap gap-2">
|
||||
{demoUrl &&
|
||||
<a href={demoUrl} target="_blank" class="group flex gap-2 items-center px-3 py-1.5 truncate rounded text-xs md:text-sm lg:text-base border border-spaghetti-yellow/50 dark:border-spaghetti-yellow/50 hover:bg-spaghetti-yellow/20 hover:dark:bg-spaghetti-yellow/20 blend text-spaghetti-brown dark:text-spaghetti-brown">
|
||||
<a href={demoUrl} target="_blank" class="group flex gap-2 items-center px-3 py-1.5 truncate rounded text-xs md:text-sm lg:text-base border border-edge hover:bg-chip blend text-ink group-hover:text-chip-ink">
|
||||
<svg class="size-4">
|
||||
<use href="/ui.svg#globe" class="fill-current group-hover:fill-black group-hover:dark:fill-white blend"/>
|
||||
<use href="/ui.svg#globe" class="fill-current blend"/>
|
||||
</svg>
|
||||
<span class="text-current group-hover:text-black group-hover:dark:text-white blend">
|
||||
<span class="text-current blend">
|
||||
See Demo
|
||||
</span>
|
||||
</a>
|
||||
}
|
||||
{repoUrl &&
|
||||
<a href={repoUrl} target="_blank" class="group flex gap-2 items-center px-3 py-1.5 truncate rounded text-xs md:text-sm lg:text-base border border-spaghetti-yellow/50 dark:border-spaghetti-yellow/50 hover:bg-spaghetti-yellow/20 hover:dark:bg-spaghetti-yellow/20 blend text-spaghetti-brown dark:text-spaghetti-brown">
|
||||
<a href={repoUrl} target="_blank" class="group flex gap-2 items-center px-3 py-1.5 truncate rounded text-xs md:text-sm lg:text-base border border-edge hover:bg-chip blend text-ink group-hover:text-chip-ink">
|
||||
<svg class="size-4">
|
||||
<use href="/ui.svg#link" class="fill-current group-hover:fill-black group-hover:dark:fill-white blend"/>
|
||||
<use href="/ui.svg#link" class="fill-current blend"/>
|
||||
</svg>
|
||||
<span class="text-current group-hover:text-black group-hover:dark:text-white blend">
|
||||
<span class="text-current blend">
|
||||
See Repository
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { getBlogPosts, getProjects, getWorkExperiences, getLegalDocuments } from '../appwrite-service';
|
||||
|
||||
describe('AppWrite Service', () => {
|
||||
describe('getBlogPosts', () => {
|
||||
it('should return an array of blog posts', async () => {
|
||||
const posts = await getBlogPosts();
|
||||
|
||||
expect(Array.isArray(posts)).toBe(true);
|
||||
expect(posts.length).toBeGreaterThan(0);
|
||||
|
||||
// Check that each post has the expected properties
|
||||
posts.forEach((post) => {
|
||||
expect(post).toHaveProperty('title');
|
||||
expect(post).toHaveProperty('summary');
|
||||
expect(post).toHaveProperty('date');
|
||||
expect(post).toHaveProperty('tags');
|
||||
expect(post).toHaveProperty('draft');
|
||||
expect(post).toHaveProperty('content');
|
||||
expect(post).toHaveProperty('template');
|
||||
expect(post).toHaveProperty('featured');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('getProjects', () => {
|
||||
it('should return an array of projects', async () => {
|
||||
const projects = await getProjects();
|
||||
|
||||
expect(Array.isArray(projects)).toBe(true);
|
||||
expect(projects.length).toBeGreaterThan(0);
|
||||
|
||||
// Check that each project has the expected properties
|
||||
projects.forEach((project) => {
|
||||
expect(project).toHaveProperty('title');
|
||||
expect(project).toHaveProperty('summary');
|
||||
expect(project).toHaveProperty('date');
|
||||
expect(project).toHaveProperty('tags');
|
||||
expect(project).toHaveProperty('draft');
|
||||
expect(project).toHaveProperty('content');
|
||||
expect(project).toHaveProperty('demoUrl');
|
||||
expect(project).toHaveProperty('repoUrl');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('getWorkExperiences', () => {
|
||||
it('should return an array of work experiences', async () => {
|
||||
const workExperiences = await getWorkExperiences();
|
||||
|
||||
expect(Array.isArray(workExperiences)).toBe(true);
|
||||
expect(workExperiences.length).toBeGreaterThan(0);
|
||||
|
||||
// Check that each work experience has the expected properties
|
||||
workExperiences.forEach((work) => {
|
||||
expect(work).toHaveProperty('company');
|
||||
expect(work).toHaveProperty('role');
|
||||
expect(work).toHaveProperty('dateStart');
|
||||
expect(work).toHaveProperty('content');
|
||||
expect(work).toHaveProperty('dateEnd');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('getLegalDocuments', () => {
|
||||
it('should return an array of legal documents', async () => {
|
||||
const legalDocuments = await getLegalDocuments();
|
||||
|
||||
expect(Array.isArray(legalDocuments)).toBe(true);
|
||||
expect(legalDocuments.length).toBeGreaterThan(0);
|
||||
|
||||
// Check that each legal document has the expected properties
|
||||
legalDocuments.forEach((doc) => {
|
||||
expect(doc).toHaveProperty('title');
|
||||
expect(doc).toHaveProperty('date');
|
||||
expect(doc).toHaveProperty('content');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,67 @@
|
||||
// src/lib/__tests__/content.test.ts
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { byDateDesc } from "../content"
|
||||
|
||||
/**
|
||||
* Fixture factory rather than inline literals in every test: mirrors the shape
|
||||
* of an Astro content entry (id + data.date) without pulling in astro:content.
|
||||
*/
|
||||
function dated(id: string, date: string) {
|
||||
return { id, data: { date: new Date(date) } }
|
||||
}
|
||||
|
||||
describe("byDateDesc", () => {
|
||||
it("should order entries newest first when dates differ", () => {
|
||||
// Arrange: loader order (by id) is oldest -> newest.
|
||||
const entries = [
|
||||
dated("01-building-my-personal-website", "2025-08-12"),
|
||||
dated("03-spaghet-io-website-improvements", "2025-08-13"),
|
||||
dated("04-marvinblade-and-spaghetai", "2026-11-03"),
|
||||
]
|
||||
|
||||
// Act
|
||||
const sorted = [...entries].sort(byDateDesc)
|
||||
|
||||
// Assert
|
||||
expect(sorted.map((entry) => entry.id)).toEqual([
|
||||
"04-marvinblade-and-spaghetai",
|
||||
"03-spaghet-io-website-improvements",
|
||||
"01-building-my-personal-website",
|
||||
])
|
||||
})
|
||||
|
||||
it("should reverse entries that the loader already sorted oldest first by filename", () => {
|
||||
const entries = [
|
||||
dated("astro-profile", "2025-08-01"),
|
||||
dated("home-system", "2026-11-03"),
|
||||
]
|
||||
|
||||
expect([...entries].sort(byDateDesc).map((entry) => entry.id)).toEqual([
|
||||
"home-system",
|
||||
"astro-profile",
|
||||
])
|
||||
})
|
||||
|
||||
it("should break ties on id when two entries share the same date", () => {
|
||||
// Arrange: identical dates make the date comparison return 0.
|
||||
const entries = [
|
||||
dated("gitea", "2025-08-01"),
|
||||
dated("astro-profile", "2025-08-01"),
|
||||
]
|
||||
|
||||
// Act: sort twice to prove the result is stable, not build-order dependent.
|
||||
const first = [...entries].sort(byDateDesc).map((entry) => entry.id)
|
||||
const second = [...entries.reverse()].sort(byDateDesc).map((entry) => entry.id)
|
||||
|
||||
// Assert
|
||||
expect(first).toEqual(["astro-profile", "gitea"])
|
||||
expect(second).toEqual(first)
|
||||
})
|
||||
|
||||
it("should leave single-entry and empty collections untouched without throwing", () => {
|
||||
expect([...[dated("only", "2026-11-03")]].sort(byDateDesc).map((e) => e.id)).toEqual([
|
||||
"only",
|
||||
])
|
||||
expect(([] as ReturnType<typeof dated>[]).sort(byDateDesc)).toEqual([])
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,257 @@
|
||||
// src/lib/__tests__/filters.test.ts
|
||||
import { describe, it, expect } from "vitest"
|
||||
import {
|
||||
collectTags,
|
||||
filterEntries,
|
||||
hasActiveFilters,
|
||||
matchesQuery,
|
||||
normalizeTag,
|
||||
parseFilterParams,
|
||||
sortEntries,
|
||||
tagCounts,
|
||||
writeFilterParams,
|
||||
DEFAULT_SORT,
|
||||
type FilterState,
|
||||
type ListEntry,
|
||||
} from "../filters"
|
||||
|
||||
/** Mirrors the fields the listing island receives, without Astro's virtual module. */
|
||||
function entry(
|
||||
id: string,
|
||||
tags: string[],
|
||||
overrides: Partial<ListEntry> = {}
|
||||
): ListEntry {
|
||||
return {
|
||||
id,
|
||||
title: `Entry ${id}`,
|
||||
summary: `Summary ${id}`,
|
||||
date: "2026-01-01T00:00:00.000Z",
|
||||
tags,
|
||||
...overrides,
|
||||
}
|
||||
}
|
||||
|
||||
function state(overrides: Partial<FilterState> = {}): FilterState {
|
||||
return { tags: [], query: "", sort: DEFAULT_SORT, ...overrides }
|
||||
}
|
||||
|
||||
describe("normalizeTag", () => {
|
||||
it("should case-fold and trim", () => {
|
||||
expect(normalizeTag(" Tailwind CSS ")).toBe("tailwind css")
|
||||
})
|
||||
})
|
||||
|
||||
describe("collectTags", () => {
|
||||
it("should collapse tags that differ only by case into one option", () => {
|
||||
// The real bug: /projects carries both `Astro` and `astro` in frontmatter,
|
||||
// so the sidebar rendered two checkboxes that did the same thing.
|
||||
const tags = collectTags([
|
||||
entry("a", ["Astro", "React"]),
|
||||
entry("b", ["astro", "Tailwind CSS"]),
|
||||
])
|
||||
|
||||
expect(tags.map((tag) => tag.key)).toEqual(["astro", "react", "tailwind css"])
|
||||
})
|
||||
|
||||
it("should pick the most frequent spelling as the label", () => {
|
||||
const tags = collectTags([
|
||||
entry("a", ["astro"]),
|
||||
entry("b", ["Astro"]),
|
||||
entry("c", ["Astro"]),
|
||||
])
|
||||
|
||||
expect(tags).toEqual([{ key: "astro", label: "Astro" }])
|
||||
})
|
||||
|
||||
it("should keep the first-seen spelling when the counts tie", () => {
|
||||
const first = collectTags([entry("a", ["Docker"]), entry("b", ["docker"])])
|
||||
const second = collectTags([entry("a", ["docker"]), entry("b", ["Docker"])])
|
||||
|
||||
expect(first).toEqual([{ key: "docker", label: "Docker" }])
|
||||
expect(second).toEqual([{ key: "docker", label: "docker" }])
|
||||
})
|
||||
|
||||
it("should sort options alphabetically and drop blanks", () => {
|
||||
const tags = collectTags([entry("a", ["zeta", "", " ", "alpha"])])
|
||||
expect(tags.map((tag) => tag.label)).toEqual(["alpha", "zeta"])
|
||||
})
|
||||
|
||||
it("should return nothing for an empty collection", () => {
|
||||
expect(collectTags([])).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
describe("matchesQuery", () => {
|
||||
const post = entry("k", ["Docker"], {
|
||||
title: "Home Server",
|
||||
summary: "Unraid and backups",
|
||||
})
|
||||
|
||||
it("should match everything on an empty or whitespace query", () => {
|
||||
expect(matchesQuery(post, "")).toBe(true)
|
||||
expect(matchesQuery(post, " ")).toBe(true)
|
||||
})
|
||||
|
||||
it("should match title, summary and tags case-insensitively", () => {
|
||||
expect(matchesQuery(post, "SERVER")).toBe(true)
|
||||
expect(matchesQuery(post, "backups")).toBe(true)
|
||||
expect(matchesQuery(post, "docKer")).toBe(true)
|
||||
})
|
||||
|
||||
it("should not match the body, which is not part of the shape", () => {
|
||||
expect(matchesQuery(post, "nope")).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe("filterEntries", () => {
|
||||
const entries = [
|
||||
entry("css-html", ["CSS", "html"]),
|
||||
entry("css-only", ["css"]),
|
||||
entry("html-only", ["Html"]),
|
||||
entry("rust-only", ["rust"]),
|
||||
]
|
||||
|
||||
it("should return everything when nothing is selected", () => {
|
||||
expect(filterEntries(entries, state()).map((e) => e.id)).toEqual([
|
||||
"css-html",
|
||||
"css-only",
|
||||
"html-only",
|
||||
"rust-only",
|
||||
])
|
||||
})
|
||||
|
||||
it("should OR selected tags, broadening rather than narrowing", () => {
|
||||
// Deliberate change from the old AND behavior: clicking a second tag adds
|
||||
// results, which is what a checkbox list looks like it does.
|
||||
expect(filterEntries(entries, state({ tags: ["css", "html"] })).map((e) => e.id)).toEqual([
|
||||
"css-html",
|
||||
"css-only",
|
||||
"html-only",
|
||||
])
|
||||
})
|
||||
|
||||
it("should match selected tags case-insensitively on both sides", () => {
|
||||
expect(filterEntries(entries, state({ tags: ["CsS"] })).map((e) => e.id)).toEqual([
|
||||
"css-html",
|
||||
"css-only",
|
||||
])
|
||||
})
|
||||
|
||||
it("should intersect the keyword filter with the tag filter", () => {
|
||||
const result = filterEntries(entries, state({ tags: ["css", "rust"], query: "html" }))
|
||||
expect(result.map((e) => e.id)).toEqual(["css-html"])
|
||||
})
|
||||
|
||||
it("should return nothing for a tag nobody carries", () => {
|
||||
expect(filterEntries(entries, state({ tags: ["go"] }))).toEqual([])
|
||||
})
|
||||
|
||||
it("should not throw when an entry is missing tags", () => {
|
||||
const loose = [{ ...entry("a", []), tags: undefined }] as unknown as ListEntry[]
|
||||
expect(() => filterEntries(loose, state({ tags: ["css"] }))).not.toThrow()
|
||||
expect(collectTags(loose)).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
describe("sortEntries", () => {
|
||||
const entries = [
|
||||
entry("old", [], { date: "2025-01-01T00:00:00.000Z", title: "Bravo" }),
|
||||
entry("new", [], { date: "2026-01-01T00:00:00.000Z", title: "alpha" }),
|
||||
entry("mid", [], { date: "2025-06-01T00:00:00.000Z", title: "Charlie" }),
|
||||
]
|
||||
|
||||
it("should sort newest first by default", () => {
|
||||
expect(sortEntries(entries, "newest").map((e) => e.id)).toEqual(["new", "mid", "old"])
|
||||
})
|
||||
|
||||
it("should sort oldest first", () => {
|
||||
expect(sortEntries(entries, "oldest").map((e) => e.id)).toEqual(["old", "mid", "new"])
|
||||
})
|
||||
|
||||
it("should sort by title case-insensitively", () => {
|
||||
expect(sortEntries(entries, "az").map((e) => e.title)).toEqual(["alpha", "Bravo", "Charlie"])
|
||||
})
|
||||
|
||||
it("should not mutate the caller's array", () => {
|
||||
const original = entries.map((e) => e.id)
|
||||
sortEntries(entries, "oldest")
|
||||
expect(entries.map((e) => e.id)).toEqual(original)
|
||||
})
|
||||
|
||||
it("should tolerate an unparseable date without throwing", () => {
|
||||
const broken = [entry("a", [], { date: "not-a-date" }), entry("b", [], { date: "2026-01-01T00:00:00.000Z" })]
|
||||
expect(() => sortEntries(broken, "newest")).not.toThrow()
|
||||
expect(sortEntries(broken, "newest").map((e) => e.id)).toEqual(["b", "a"])
|
||||
})
|
||||
})
|
||||
|
||||
describe("tagCounts", () => {
|
||||
const entries = [
|
||||
entry("a", ["Docker", "Astro"]),
|
||||
entry("b", ["docker"]),
|
||||
entry("c", ["Rust"]),
|
||||
]
|
||||
|
||||
it("should count each tag once per entry", () => {
|
||||
expect(tagCounts(entries, state()).get("docker")).toBe(2)
|
||||
expect(tagCounts(entries, state()).get("astro")).toBe(1)
|
||||
})
|
||||
|
||||
it("should count within the keyword filter", () => {
|
||||
const counts = tagCounts(entries, state({ query: "Entry c" }))
|
||||
expect(counts.get("rust")).toBe(1)
|
||||
expect(counts.get("docker")).toBeUndefined()
|
||||
})
|
||||
|
||||
it("should not count a tag twice when an entry spells it two ways", () => {
|
||||
const counts = tagCounts([entry("a", ["Astro", "astro"])], state())
|
||||
expect(counts.get("astro")).toBe(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe("hasActiveFilters", () => {
|
||||
it("should be false for the default state", () => {
|
||||
expect(hasActiveFilters(state())).toBe(false)
|
||||
})
|
||||
|
||||
it("should be true for tags, a keyword, or a non-default sort", () => {
|
||||
expect(hasActiveFilters(state({ tags: ["css"] }))).toBe(true)
|
||||
expect(hasActiveFilters(state({ query: " hi " }))).toBe(true)
|
||||
expect(hasActiveFilters(state({ sort: "az" }))).toBe(true)
|
||||
expect(hasActiveFilters(state({ query: " " }))).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe("URL params", () => {
|
||||
it("should round-trip tags, keyword and sort", () => {
|
||||
const params = new URLSearchParams()
|
||||
writeFilterParams(params, state({ tags: ["docker", "astro"], query: "home lab", sort: "oldest" }))
|
||||
|
||||
expect(parseFilterParams(params)).toEqual({
|
||||
tags: ["docker", "astro"],
|
||||
query: "home lab",
|
||||
sort: "oldest",
|
||||
})
|
||||
})
|
||||
|
||||
it("should omit defaults so /blog stays clean", () => {
|
||||
const params = new URLSearchParams()
|
||||
writeFilterParams(params, state())
|
||||
expect(params.toString()).toBe("")
|
||||
})
|
||||
|
||||
it("should case-fold and dedupe tags when parsing", () => {
|
||||
const parsed = parseFilterParams(new URLSearchParams("tags=Docker,docker,,astro"))
|
||||
expect(parsed.tags).toEqual(["docker", "astro"])
|
||||
})
|
||||
|
||||
it("should fall back to defaults for junk values", () => {
|
||||
const parsed = parseFilterParams(new URLSearchParams("sort=random&tags=%20%20"))
|
||||
expect(parsed.sort).toBe(DEFAULT_SORT)
|
||||
expect(parsed.tags).toEqual([])
|
||||
})
|
||||
|
||||
it("should ignore a missing sort entirely", () => {
|
||||
expect(parseFilterParams(new URLSearchParams("q=x")).query).toBe("x")
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,101 @@
|
||||
// src/lib/__tests__/search.test.ts
|
||||
import { describe, it, expect } from "vitest"
|
||||
import {
|
||||
createSearcher,
|
||||
partitionByCollection,
|
||||
runSearch,
|
||||
MIN_QUERY_LENGTH,
|
||||
} from "../search"
|
||||
import type { SearchEntry } from "@lib/types"
|
||||
|
||||
const ENTRIES: SearchEntry[] = [
|
||||
{
|
||||
id: "01-building-my-personal-website",
|
||||
slug: "01-building-my-personal-website",
|
||||
collection: "blog",
|
||||
title: "Building My Personal Website: From Idea to Deployment",
|
||||
summary: "A journey through creating my personal portfolio site.",
|
||||
tags: ["Tutorial", "Astro", "Portfolio", "Docker"],
|
||||
date: "2025-08-12T00:00:00.000Z",
|
||||
},
|
||||
{
|
||||
id: "astro-profile",
|
||||
slug: "astro-profile",
|
||||
collection: "projects",
|
||||
title: "Astro Profile",
|
||||
summary: "An Astro-based profile template with built in markdown support.",
|
||||
tags: ["portfolio", "personal", "astro"],
|
||||
date: "2025-08-08T00:00:00.000Z",
|
||||
},
|
||||
]
|
||||
|
||||
describe("createSearcher / runSearch", () => {
|
||||
const searcher = createSearcher(ENTRIES)
|
||||
|
||||
it("should return no results when the query is shorter than MIN_QUERY_LENGTH", () => {
|
||||
expect(runSearch(searcher, "")).toEqual([])
|
||||
expect(runSearch(searcher, "a")).toEqual([])
|
||||
// Whitespace-only input is treated as empty.
|
||||
expect(runSearch(searcher, " ")).toEqual([])
|
||||
})
|
||||
|
||||
it("should match on title", () => {
|
||||
const results = runSearch(searcher, "website")
|
||||
expect(results.map((entry) => entry.slug)).toContain(
|
||||
"01-building-my-personal-website"
|
||||
)
|
||||
})
|
||||
|
||||
it("should match tags case-insensitively", () => {
|
||||
const results = runSearch(searcher, "ASTRO")
|
||||
expect(results.length).toBeGreaterThan(0)
|
||||
expect(results.map((entry) => entry.slug)).toContain("astro-profile")
|
||||
})
|
||||
|
||||
it("should tolerate a mistyped query (fuzzy match)", () => {
|
||||
const results = runSearch(searcher, "websit")
|
||||
expect(results.map((entry) => entry.slug)).toContain(
|
||||
"01-building-my-personal-website"
|
||||
)
|
||||
})
|
||||
|
||||
it("should return no results when nothing matches", () => {
|
||||
expect(runSearch(searcher, "zzzq")).toEqual([])
|
||||
})
|
||||
|
||||
it("should never return fewer results than an exact substring match would", () => {
|
||||
const query = "deployment"
|
||||
const contains = ENTRIES.filter((entry) => entry.title.includes(query))
|
||||
expect(runSearch(searcher, query).length).toBeGreaterThanOrEqual(
|
||||
contains.length
|
||||
)
|
||||
})
|
||||
|
||||
it("should handle an empty dataset without throwing", () => {
|
||||
const empty = createSearcher([])
|
||||
expect(runSearch(empty, "astro")).toEqual([])
|
||||
})
|
||||
|
||||
it("should not require MIN_QUERY_LENGTH to change the contract", () => {
|
||||
expect(MIN_QUERY_LENGTH).toBeGreaterThan(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe("partitionByCollection", () => {
|
||||
it("should split results into posts and projects by collection", () => {
|
||||
const { posts, projects } = partitionByCollection(ENTRIES)
|
||||
expect(posts.map((entry) => entry.slug)).toEqual([
|
||||
"01-building-my-personal-website",
|
||||
])
|
||||
expect(projects.map((entry) => entry.slug)).toEqual(["astro-profile"])
|
||||
})
|
||||
|
||||
it("should return empty buckets for an empty result set", () => {
|
||||
expect(partitionByCollection([])).toEqual({ posts: [], projects: [] })
|
||||
})
|
||||
|
||||
it("should preserve every entry exactly once across both buckets", () => {
|
||||
const { posts, projects } = partitionByCollection(ENTRIES)
|
||||
expect(posts.length + projects.length).toBe(ENTRIES.length)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,160 @@
|
||||
// src/lib/__tests__/status.test.ts
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { parseBeatTime, summarize, monitorsInGroups, BEAT, type KumaHeartbeat } from "@lib/status"
|
||||
|
||||
const NOW = Date.parse("2026-11-05T21:00:00.000Z")
|
||||
|
||||
function beat(status: number, minutesAgo = 0): KumaHeartbeat {
|
||||
const time = new Date(NOW - minutesAgo * 60_000)
|
||||
const pad = (n: number, width = 2) => String(n).padStart(width, "0")
|
||||
// Kuma emits naive UTC strings with millisecond precision.
|
||||
const stamp =
|
||||
`${time.getUTCFullYear()}-${pad(time.getUTCMonth() + 1)}-${pad(time.getUTCDate())} ` +
|
||||
`${pad(time.getUTCHours())}:${pad(time.getUTCMinutes())}:${pad(time.getUTCSeconds())}` +
|
||||
`.${pad(time.getUTCMilliseconds(), 3)}`
|
||||
return { status, time: stamp, ping: 12 }
|
||||
}
|
||||
|
||||
function list(...beats: KumaHeartbeat[]) {
|
||||
return beats
|
||||
}
|
||||
|
||||
describe("parseBeatTime", () => {
|
||||
it("should read Kuma's naive timestamp as UTC, not local time", () => {
|
||||
expect(parseBeatTime("2026-11-05 21:00:00.000")).toBe(NOW)
|
||||
})
|
||||
|
||||
it("should accept an already-offset timestamp without double-applying UTC", () => {
|
||||
expect(parseBeatTime("2026-11-05T21:00:00.000Z")).toBe(NOW)
|
||||
})
|
||||
|
||||
it("should return null for a malformed timestamp", () => {
|
||||
expect(parseBeatTime("not a time")).toBeNull()
|
||||
expect(parseBeatTime("")).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe("monitorsInGroups", () => {
|
||||
const groups = [
|
||||
{ name: "Critical Services", monitorList: [{ id: 75 }, { id: 36 }] },
|
||||
{ name: "Game Servers", monitorList: [{ id: 89 }] },
|
||||
]
|
||||
|
||||
it("should return null when no narrowing is configured", () => {
|
||||
expect(monitorsInGroups(groups, [])).toBeNull()
|
||||
})
|
||||
|
||||
it("should collect the monitor ids of the named groups, case-insensitively", () => {
|
||||
const ids = monitorsInGroups(groups, ["critical services"])
|
||||
expect(ids).not.toBeNull()
|
||||
expect([...ids!].sort()).toEqual(["36", "75"])
|
||||
})
|
||||
|
||||
it("should return an empty set when no group matches, so the caller reports unknown", () => {
|
||||
expect(monitorsInGroups(groups, ["Nonexistent"])).toEqual(new Set<string>())
|
||||
})
|
||||
|
||||
it("should tolerate a missing group list", () => {
|
||||
expect(monitorsInGroups(null, ["Critical Services"])).toEqual(new Set<string>())
|
||||
})
|
||||
})
|
||||
|
||||
describe("summarize", () => {
|
||||
it("should report all systems normal when every monitor's last beat is up", () => {
|
||||
const snapshot = summarize({
|
||||
now: NOW,
|
||||
heartbeatList: {
|
||||
"1": list(beat(BEAT.UP, 3), beat(BEAT.UP, 2), beat(BEAT.UP, 1)),
|
||||
"2": list(beat(BEAT.UP, 1)),
|
||||
},
|
||||
})
|
||||
expect(snapshot.state).toBe("up")
|
||||
expect(snapshot.label).toBe("All systems normal")
|
||||
expect(snapshot.summary).toEqual({ total: 2, up: 2, down: 0, pending: 0, maintenance: 0 })
|
||||
})
|
||||
|
||||
it("should judge only the newest beat of each monitor", () => {
|
||||
const snapshot = summarize({
|
||||
now: NOW,
|
||||
heartbeatList: {
|
||||
// Recovered: an older down must not keep the footer red.
|
||||
"1": list(beat(BEAT.DOWN, 9), beat(BEAT.UP, 1)),
|
||||
// Regressed: an older up must not keep the footer green.
|
||||
"2": list(beat(BEAT.UP, 9), beat(BEAT.DOWN, 1)),
|
||||
},
|
||||
})
|
||||
expect(snapshot.state).toBe("degraded")
|
||||
expect(snapshot.label).toBe("Partial outage")
|
||||
expect(snapshot.summary).toEqual({ total: 2, up: 1, down: 1, pending: 0, maintenance: 0 })
|
||||
})
|
||||
|
||||
it("should report a major outage when no monitor is up", () => {
|
||||
const snapshot = summarize({
|
||||
now: NOW,
|
||||
heartbeatList: { "1": list(beat(BEAT.DOWN, 1)), "2": list(beat(BEAT.DOWN, 1)) },
|
||||
})
|
||||
expect(snapshot.state).toBe("down")
|
||||
expect(snapshot.label).toBe("Major outage")
|
||||
})
|
||||
|
||||
it("should treat a pending monitor as degraded rather than normal", () => {
|
||||
const snapshot = summarize({
|
||||
now: NOW,
|
||||
heartbeatList: { "1": list(beat(BEAT.UP, 1)), "2": list(beat(BEAT.PENDING, 1)) },
|
||||
})
|
||||
expect(snapshot.state).toBe("degraded")
|
||||
})
|
||||
|
||||
it("should surface maintenance ahead of outages, matching Uptime Kuma", () => {
|
||||
const snapshot = summarize({
|
||||
now: NOW,
|
||||
heartbeatList: { "1": list(beat(BEAT.DOWN, 1)), "2": list(beat(BEAT.MAINTENANCE, 1)) },
|
||||
})
|
||||
expect(snapshot.state).toBe("maintenance")
|
||||
expect(snapshot.label).toBe("Under maintenance")
|
||||
})
|
||||
|
||||
it("should degrade the label when an incident is open even if every beat is up", () => {
|
||||
const snapshot = summarize({
|
||||
now: NOW,
|
||||
incidents: [{ id: 1, name: "Plex down", is_public: true }],
|
||||
heartbeatList: { "1": list(beat(BEAT.UP, 1)) },
|
||||
})
|
||||
expect(snapshot.state).toBe("degraded")
|
||||
expect(snapshot.incidents).toBe(1)
|
||||
})
|
||||
|
||||
it("should report unknown when the status page exposes no monitors", () => {
|
||||
const snapshot = summarize({ now: NOW, heartbeatList: {} })
|
||||
expect(snapshot.state).toBe("unknown")
|
||||
expect(snapshot.reason).toBe("no-monitors")
|
||||
expect(snapshot.label).toBe("Status unavailable")
|
||||
})
|
||||
|
||||
it("should report unknown when the newest beat is older than the stale window", () => {
|
||||
const snapshot = summarize({
|
||||
now: NOW,
|
||||
staleAfterMs: 900_000,
|
||||
heartbeatList: { "1": list(beat(BEAT.UP, 20)) },
|
||||
})
|
||||
expect(snapshot.state).toBe("unknown")
|
||||
expect(snapshot.reason).toBe("stale")
|
||||
})
|
||||
|
||||
it("should tolerate a missing heartbeatList without throwing", () => {
|
||||
const snapshot = summarize({ now: NOW, heartbeatList: null })
|
||||
expect(snapshot.state).toBe("unknown")
|
||||
expect(snapshot.summary.total).toBe(0)
|
||||
})
|
||||
|
||||
it("should expose the newest beat time and the status page link for the footer", () => {
|
||||
const snapshot = summarize({
|
||||
now: NOW,
|
||||
statusPageUrl: "https://uptime.spaghet.io/status/public",
|
||||
heartbeatList: { "1": list(beat(BEAT.UP, 5)), "2": list(beat(BEAT.UP, 1)) },
|
||||
})
|
||||
expect(snapshot.lastBeatAt).toBe(new Date(NOW - 60_000).toISOString())
|
||||
expect(snapshot.checkedAt).toBe(new Date(NOW).toISOString())
|
||||
expect(snapshot.statusPageUrl).toBe("https://uptime.spaghet.io/status/public")
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,51 @@
|
||||
// src/lib/__tests__/utils.test.ts
|
||||
import { describe, it, expect } from "vitest"
|
||||
import { formatDate, readingTime, isNavActive } from "@lib/utils"
|
||||
|
||||
describe("formatDate", () => {
|
||||
it("should render a frontmatter date exactly as authored when it is midnight UTC", () => {
|
||||
expect(formatDate(new Date("2025-08-12T00:00:00.000Z"))).toBe("Aug 12, 2025")
|
||||
})
|
||||
|
||||
it("should not shift the day when given an ISO string instead of a Date", () => {
|
||||
expect(formatDate("2026-11-03T00:00:00.000Z")).toBe("Nov 03, 2026")
|
||||
})
|
||||
|
||||
it("should stay stable for a date near the end of a month across timezones", () => {
|
||||
expect(formatDate(new Date("2026-11-30T00:00:00.000Z"))).toBe("Nov 30, 2026")
|
||||
})
|
||||
})
|
||||
|
||||
describe("readingTime", () => {
|
||||
it("should return a whole-number minute estimate for html content", () => {
|
||||
expect(readingTime("<p>one two three</p>")).toBe("1 min read")
|
||||
})
|
||||
})
|
||||
|
||||
describe("isNavActive", () => {
|
||||
it("should match an exact pathname", () => {
|
||||
expect(isNavActive("/blog", "/blog")).toBe(true)
|
||||
expect(isNavActive("/", "/")).toBe(true)
|
||||
})
|
||||
|
||||
it("should match a nested route by its first path section", () => {
|
||||
expect(isNavActive("/blog/some-post", "/blog")).toBe(true)
|
||||
expect(isNavActive("/projects/tool", "/projects")).toBe(true)
|
||||
})
|
||||
|
||||
it("should not match a different section", () => {
|
||||
expect(isNavActive("/blog/some-post", "/projects")).toBe(false)
|
||||
expect(isNavActive("/work", "/blog")).toBe(false)
|
||||
})
|
||||
|
||||
it("should activate the search link on /search and its subpaths", () => {
|
||||
// Regression: the drawer compared "/" + subpath[0] against the bare string
|
||||
// "search", which could never be true, so the search pill never activated.
|
||||
expect(isNavActive("/search", "/search")).toBe(true)
|
||||
expect(isNavActive("/search/anything", "/search")).toBe(true)
|
||||
})
|
||||
|
||||
it("should not treat the root path as a prefix for every link", () => {
|
||||
expect(isNavActive("/blog", "/")).toBe(false)
|
||||
})
|
||||
})
|
||||
@@ -1,396 +0,0 @@
|
||||
import type { Models, } from "appwrite";
|
||||
import { Query } from "appwrite";
|
||||
import { databases, } from "./appwrite"; // Import the already initialized databases instances
|
||||
import { remark } from "remark";
|
||||
import remarkRehype from "remark-rehype";
|
||||
import rehypeStringify from "rehype-stringify";
|
||||
|
||||
|
||||
// We're using the storage instance from appwrite.ts which is properly initialized
|
||||
// This file only contains service functions and types
|
||||
|
||||
/**
|
||||
* Convert markdown content to HTML
|
||||
*/
|
||||
export function convertMarkdownToHTML(markdown: string): string {
|
||||
if (!markdown) return "";
|
||||
|
||||
try {
|
||||
const file = remark()
|
||||
.use(remarkRehype)
|
||||
.use(rehypeStringify)
|
||||
.processSync(markdown);
|
||||
|
||||
return file.toString();
|
||||
} catch (error) {
|
||||
console.error("Error converting markdown to HTML:", error);
|
||||
return markdown; // Return raw markdown if conversion fails
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Types for our collections
|
||||
export type BlogPost = Models.Document & {
|
||||
title: string;
|
||||
summary: string;
|
||||
date: Date;
|
||||
tags: string[];
|
||||
draft: boolean;
|
||||
content: string;
|
||||
contentHtml?: string; // HTML version of the content
|
||||
image?: string; // File ID for the featured image
|
||||
template: string; // e.g., "default", "feature", "news"
|
||||
featured: boolean;
|
||||
};
|
||||
|
||||
|
||||
export type Project = Models.Document & {
|
||||
title: string;
|
||||
summary: string;
|
||||
date: Date;
|
||||
tags: string[];
|
||||
draft: boolean;
|
||||
demoUrl?: string;
|
||||
repoUrl?: string;
|
||||
content: string;
|
||||
contentHtml?: string; // HTML version of the content
|
||||
image?: string; // File ID for the featured image
|
||||
};
|
||||
|
||||
|
||||
export type WorkExperience = Models.Document & {
|
||||
company: string;
|
||||
role: string;
|
||||
dateStart: Date;
|
||||
content: string;
|
||||
contentHtml?: string; // HTML version of the content
|
||||
dateEnd: Date | string;
|
||||
};
|
||||
|
||||
export type LegalDocument = Models.Document & {
|
||||
title: string;
|
||||
date: Date;
|
||||
content: string;
|
||||
contentHtml?: string; // HTML version of the content
|
||||
};
|
||||
|
||||
|
||||
// Define a unified type for search results
|
||||
export type SearchEntry = BlogPost | Project;
|
||||
|
||||
// Collection IDs - these should be configured based on your Appwrite setup
|
||||
|
||||
let blogCollection = '', projectsCollection = '', workCollection = '', legalCollection = '', databaseID = '';
|
||||
|
||||
// Check if we're in a server environment (SSR)
|
||||
if (typeof window === 'undefined') {
|
||||
// Server-side: use environment variables directly
|
||||
blogCollection = process?.env?.VITE_APPWRITE_BLOG_COLLECTION_ID || 'blog';
|
||||
projectsCollection = process?.env?.VITE_APPWRITE_PROJECTS_COLLECTION_ID || "projects";
|
||||
workCollection = process?.env?.VITE_APPWRITE_WORK_COLLECTION_ID || "work";
|
||||
legalCollection = process?.env?.VITE_APPWRITE_LEGAL_COLLECTION_ID || "legal";
|
||||
databaseID = process.env.VITE_APPWRITE_DATABASE_ID || "main";
|
||||
} else {
|
||||
blogCollection = import.meta.env.PUBLIC_APPWRITE_BLOG_COLLECTION_ID || 'blog';
|
||||
projectsCollection = import.meta.env.PUBLIC_APPWRITE_PROJECTS_COLLECTION_ID || "projects";
|
||||
workCollection = import.meta.env.PUBLIC_APPwrite_WORK_COLLECTION_ID || "work";
|
||||
legalCollection = import.meta.env.PUBLIC_APPWRITE_LEGAL_COLLECTION_ID || "legal";
|
||||
databaseID = import.meta.env.PUBLIC_APPWRITE_DATABASE_ID || "main";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get blog posts from Appwrite database
|
||||
*/
|
||||
export async function getBlogPosts(): Promise<BlogPost[]> {
|
||||
try {
|
||||
const response = await databases.listDocuments<BlogPost>(
|
||||
databaseID,
|
||||
blogCollection
|
||||
);
|
||||
|
||||
// Convert markdown content to HTML for each post
|
||||
const postsWithHtml = response.documents.map(post => ({
|
||||
...post,
|
||||
contentHtml: convertMarkdownToHTML(post.content)
|
||||
}));
|
||||
|
||||
return postsWithHtml;
|
||||
} catch (error) {
|
||||
console.error("Error fetching blog posts:", error);
|
||||
throw new Error("Failed to fetch blog posts");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get paginated blog posts from Appwrite database
|
||||
*/
|
||||
export async function getBlogPostsPaginated(page: number, limit: number): Promise<{ posts: BlogPost[], total: number }> {
|
||||
try {
|
||||
// For Appwrite SDK, the correct way to call listDocuments with pagination
|
||||
const response = await databases.listDocuments<BlogPost>(
|
||||
databaseID,
|
||||
blogCollection,
|
||||
[
|
||||
// Only fetch published posts (not drafts)
|
||||
Query.equal("draft", false),
|
||||
Query.orderDesc('date')
|
||||
]
|
||||
);
|
||||
|
||||
// Apply pagination manually since Appwrite SDK might not support offset/limit directly in this version
|
||||
const paginatedPosts = response.documents.slice((page - 1) * limit, page * limit);
|
||||
|
||||
// Convert markdown content to HTML for each post
|
||||
const postsWithHtml = paginatedPosts.map(post => ({
|
||||
...post,
|
||||
contentHtml: convertMarkdownToHTML(post.content)
|
||||
}));
|
||||
|
||||
return {
|
||||
posts: postsWithHtml,
|
||||
total: response.total
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error fetching paginated blog posts:", error);
|
||||
throw new Error("Failed to fetch paginated blog posts");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a specific blog post by ID
|
||||
*/
|
||||
export async function getBlogPostById(id: string): Promise<BlogPost> {
|
||||
try {
|
||||
const response = await databases.getDocument<BlogPost>(
|
||||
databaseID,
|
||||
blogCollection,
|
||||
id
|
||||
);
|
||||
|
||||
// Convert markdown content to HTML
|
||||
return {
|
||||
...response,
|
||||
contentHtml: convertMarkdownToHTML(response.content)
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error fetching blog post:", error);
|
||||
throw new Error("Failed to fetch blog post");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get projects from Appwrite database
|
||||
*/
|
||||
export async function getProjects(): Promise<Project[]> {
|
||||
try {
|
||||
const response = await databases.listDocuments<Project>(
|
||||
databaseID,
|
||||
projectsCollection,
|
||||
[
|
||||
// Only fetch published projects (not drafts)
|
||||
Query.equal("draft", false),
|
||||
Query.orderDesc('date')
|
||||
]
|
||||
);
|
||||
|
||||
// Convert markdown content to HTML for each project
|
||||
const projectsWithHtml = response.documents.map(project => ({
|
||||
...project,
|
||||
contentHtml: convertMarkdownToHTML(project.content)
|
||||
}));
|
||||
|
||||
return projectsWithHtml;
|
||||
} catch (error) {
|
||||
console.error("Error fetching projects:", error);
|
||||
throw new Error("Failed to fetch projects");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get paginated projects from Appwrite database
|
||||
*/
|
||||
export async function getProjectsPaginated(page: number, limit: number): Promise<{ posts: Project[], total: number }> {
|
||||
try {
|
||||
const response = await databases.listDocuments<Project>(
|
||||
databaseID,
|
||||
projectsCollection,
|
||||
[
|
||||
// Only fetch published projects (not drafts)
|
||||
Query.equal("draft", false),
|
||||
Query.orderDesc('date')
|
||||
]
|
||||
);
|
||||
|
||||
// Apply pagination manually since Appwrite SDK might not support offset/limit directly in this version
|
||||
const paginatedPosts = response.documents.slice((page - 1) * limit, page * limit);
|
||||
|
||||
// Convert markdown content to HTML for each project
|
||||
const projectsWithHtml = paginatedPosts.map(project => ({
|
||||
...project,
|
||||
contentHtml: convertMarkdownToHTML(project.content)
|
||||
}));
|
||||
|
||||
return {
|
||||
posts: projectsWithHtml,
|
||||
total: response.total
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error fetching paginated projects:", error);
|
||||
throw new Error("Failed to fetch paginated projects");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a specific project by ID
|
||||
*/
|
||||
export async function getProjectById(id: string): Promise<Project> {
|
||||
try {
|
||||
const response = await databases.getDocument<Project>(
|
||||
databaseID,
|
||||
projectsCollection,
|
||||
id
|
||||
);
|
||||
|
||||
// Convert markdown content to HTML
|
||||
return {
|
||||
...response,
|
||||
contentHtml: convertMarkdownToHTML(response.content)
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error fetching project:", error);
|
||||
throw new Error("Failed to fetch project");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get work experiences from Appwrite database
|
||||
*/
|
||||
export async function getWorkExperiences(): Promise<WorkExperience[]> {
|
||||
try {
|
||||
const response = await databases.listDocuments<WorkExperience>(
|
||||
databaseID,
|
||||
workCollection
|
||||
);
|
||||
|
||||
// Convert markdown content to HTML for each project
|
||||
return response.documents.map(work => ({
|
||||
...work,
|
||||
contentHtml: convertMarkdownToHTML(work.content)
|
||||
}));
|
||||
} catch (error) {
|
||||
console.error("Error fetching work experiences:", error);
|
||||
throw new Error("Failed to fetch work experiences");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get legal documents from Appwrite database
|
||||
*/
|
||||
export async function getLegalDocuments(): Promise<LegalDocument[]> {
|
||||
try {
|
||||
const response = await databases.listDocuments<LegalDocument>(
|
||||
databaseID,
|
||||
legalCollection
|
||||
);
|
||||
|
||||
return response.documents;
|
||||
} catch (error) {
|
||||
console.error("Error fetching legal documents:", error);
|
||||
throw new Error("Failed to fetch legal documents");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Perform a search across blog posts and projects using Appwrite SDK
|
||||
*/
|
||||
export async function searchContent(query: string): Promise<{ posts: BlogPost[], projects: Project[] }> {
|
||||
try {
|
||||
// Search in blog collection for the query term
|
||||
const blogResponse = await databases.listDocuments<BlogPost>(
|
||||
databaseID,
|
||||
blogCollection,
|
||||
[
|
||||
Query.and([
|
||||
Query.equal("draft", false),
|
||||
Query.or([
|
||||
Query.search("title", query),
|
||||
Query.search("summary", query),
|
||||
Query.search("content", query)
|
||||
])
|
||||
]),
|
||||
Query.orderDesc('date')
|
||||
]
|
||||
);
|
||||
|
||||
// Search in projects collection for the query term
|
||||
const projectResponse = await databases.listDocuments<Project>(
|
||||
databaseID,
|
||||
projectsCollection,
|
||||
[
|
||||
Query.and([
|
||||
Query.equal("draft", false),
|
||||
Query.or([
|
||||
Query.search("title", query),
|
||||
Query.search("summary", query),
|
||||
Query.search("content", query)
|
||||
])
|
||||
]),
|
||||
Query.orderDesc('date')
|
||||
]
|
||||
);
|
||||
|
||||
// Convert markdown content to HTML for blog posts
|
||||
const blogPostsWithHtml = blogResponse.documents.map(post => ({
|
||||
...post,
|
||||
contentHtml: convertMarkdownToHTML(post.content)
|
||||
}));
|
||||
|
||||
// Convert markdown content to HTML for projects
|
||||
const projectsWithHtml = projectResponse.documents.map(project => ({
|
||||
...project,
|
||||
contentHtml: convertMarkdownToHTML(project.content)
|
||||
}));
|
||||
|
||||
return {
|
||||
posts: blogPostsWithHtml,
|
||||
projects: projectsWithHtml
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Error performing search:", error);
|
||||
// More specific error handling for Appwrite errors
|
||||
if (error instanceof Error) {
|
||||
throw new Error(`Search failed: ${error.message}`);
|
||||
}
|
||||
throw new Error("Search failed due to an unknown error");
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the duplicate function - keep only the original searchContent function
|
||||
// The original searchContent function is already correctly implemented and should be used
|
||||
|
||||
|
||||
/**
|
||||
* Get a public URL for a file
|
||||
*/
|
||||
export function getFileUrl(bucketId: string, fileId: string): string {
|
||||
return `${process.env.VITE_APPWRITE_ENDPOINT}/storage/buckets/${bucketId}/files/${fileId}/view?project=${process.env.VITE_APPWRITE_PROJECT_ID}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a preview URL for a file (thumb or preview)
|
||||
*/
|
||||
export function getFilePreviewUrl(bucketId: string, fileId: string, type: "thumb" | "preview"): string {
|
||||
return `${process.env.VITE_APPWRITE_ENDPOINT}/storage/buckets/${bucketId}/files/${fileId}/view?project=${process.env.VITE_APPWRITE_PROJECT_ID}&mode=${type}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a download URL for a file
|
||||
*/
|
||||
export function getFileDownloadUrl(bucketId: string, fileId: string): string {
|
||||
return `${process.env.VITE_APPWRITE_ENDPOINT}/storage/buckets/${bucketId}/files/${fileId}/download?project=${process.env.VITE_APPWRITE_PROJECT_ID}`;
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
import { Client, Databases } from "appwrite";
|
||||
|
||||
const client = new Client();
|
||||
|
||||
// Check if we're in a server environment (SSR)
|
||||
if (typeof window === 'undefined') {
|
||||
// Server-side: use environment variables directly
|
||||
const endpoint = process.env.VITE_APPWRITE_ENDPOINT;
|
||||
const projectId = process.env.VITE_APPWRITE_PROJECT_ID;
|
||||
|
||||
if (!endpoint || !projectId) {
|
||||
throw new Error('Appwrite configuration missing in server environment');
|
||||
}
|
||||
|
||||
client
|
||||
.setEndpoint(endpoint) // Your Appwrite endpoint
|
||||
.setProject(projectId); // Your Project ID
|
||||
} else {
|
||||
// Client-side: use import.meta.env (need to prefix with PUBLIC_ for Astro to make them available)
|
||||
const endpoint = import.meta.env.PUBLIC_APPWRITE_ENDPOINT;
|
||||
const projectId = import.meta.env.PUBLIC_APPWRITE_PROJECT_ID;
|
||||
|
||||
if (!endpoint || !projectId) {
|
||||
throw new Error('Appwrite configuration missing in client environment');
|
||||
}
|
||||
|
||||
client
|
||||
.setEndpoint(endpoint) // Your Appwrite endpoint
|
||||
.setProject(projectId); // Your Project ID
|
||||
}
|
||||
|
||||
export const databases = new Databases(client);
|
||||
@@ -0,0 +1,43 @@
|
||||
// src/lib/content.ts
|
||||
import type { CollectionEntry } from "astro:content"
|
||||
import type { SearchEntry } from "@lib/types"
|
||||
|
||||
/**
|
||||
* Structural shape of anything the glob loader hands back for a dated
|
||||
* collection. Deliberately narrower than CollectionEntry<"blog"> so the
|
||||
* comparator can be unit tested without Astro's virtual module.
|
||||
*/
|
||||
interface DatedEntry {
|
||||
id: string
|
||||
data: { date: Date }
|
||||
}
|
||||
|
||||
/**
|
||||
* The glob loader returns entries in filename order, never by frontmatter
|
||||
* date, so every listing page must opt into date ordering explicitly.
|
||||
* Equal dates fall back to id to keep the order deterministic across builds
|
||||
* (two projects share 2025-08-01).
|
||||
*/
|
||||
export function byDateDesc(a: DatedEntry, b: DatedEntry): number {
|
||||
const diff = b.data.date.getTime() - a.data.date.getTime()
|
||||
return diff !== 0 ? diff : a.id.localeCompare(b.id)
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a blog or project content entry down to the slim, serializable shape
|
||||
* used by ArrowCard and the search index. Centralising this keeps every page
|
||||
* (home, blog, projects, search) emitting identical card props.
|
||||
*/
|
||||
export function toSearchEntry(
|
||||
entry: CollectionEntry<"blog"> | CollectionEntry<"projects">
|
||||
): SearchEntry {
|
||||
return {
|
||||
id: entry.id,
|
||||
slug: entry.id,
|
||||
collection: entry.collection as "blog" | "projects",
|
||||
title: entry.data.title,
|
||||
summary: entry.data.summary,
|
||||
tags: entry.data.tags,
|
||||
date: entry.data.date.toISOString(),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
// src/lib/filters.ts
|
||||
import type { ListEntry } from "@lib/types"
|
||||
|
||||
export type { ListEntry }
|
||||
|
||||
export type SortKey = "newest" | "oldest" | "az"
|
||||
|
||||
export const DEFAULT_SORT: SortKey = "newest"
|
||||
export const SORT_KEYS: SortKey[] = ["newest", "oldest", "az"]
|
||||
export const SORT_LABELS: Record<SortKey, string> = {
|
||||
newest: "Newest first",
|
||||
oldest: "Oldest first",
|
||||
az: "Title A–Z",
|
||||
}
|
||||
|
||||
export interface TagOption {
|
||||
/** Case-folded identity, what gets stored in state and in the URL. */
|
||||
key: string
|
||||
/** The spelling shown to humans. */
|
||||
label: string
|
||||
}
|
||||
|
||||
export interface FilterState {
|
||||
tags: string[]
|
||||
query: string
|
||||
sort: SortKey
|
||||
}
|
||||
|
||||
export const TAGS_PARAM = "tags"
|
||||
export const QUERY_PARAM = "q"
|
||||
export const SORT_PARAM = "sort"
|
||||
|
||||
export function normalizeTag(tag: string): string {
|
||||
return tag.trim().toLowerCase()
|
||||
}
|
||||
|
||||
/**
|
||||
* Dedupe tags case-insensitively and pick one canonical spelling per tag.
|
||||
*
|
||||
* Frontmatter is hand-written, so the same tag appears as both `Astro` and
|
||||
* `astro` across the projects collection. Matching has always been
|
||||
* case-insensitive, which meant the filter sidebar rendered two visually
|
||||
* different checkboxes that did exactly the same thing. The label with the
|
||||
* most occurrences wins; ties fall back to first-seen order, so the result is
|
||||
* stable across builds.
|
||||
*/
|
||||
export function collectTags(entries: ListEntry[]): TagOption[] {
|
||||
const spellings = new Map<string, Map<string, number>>()
|
||||
|
||||
for (const entry of entries) {
|
||||
for (const raw of entry.tags ?? []) {
|
||||
const label = raw.trim()
|
||||
if (!label) continue
|
||||
const key = normalizeTag(label)
|
||||
const counts = spellings.get(key) ?? new Map<string, number>()
|
||||
counts.set(label, (counts.get(label) ?? 0) + 1)
|
||||
spellings.set(key, counts)
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(spellings, ([key, counts]) => ({
|
||||
key,
|
||||
label: mostFrequent(counts),
|
||||
})).sort((a, b) => a.label.localeCompare(b.label))
|
||||
}
|
||||
|
||||
/** Highest count wins; `Map` iteration order breaks ties by first insertion. */
|
||||
function mostFrequent(counts: Map<string, number>): string {
|
||||
let best = ""
|
||||
let bestCount = -1
|
||||
for (const [label, count] of counts) {
|
||||
if (count > bestCount) {
|
||||
best = label
|
||||
bestCount = count
|
||||
}
|
||||
}
|
||||
return best
|
||||
}
|
||||
|
||||
/**
|
||||
* Keyword match over the fields the card shows: title, summary and tags. Body
|
||||
* text is intentionally out of scope — full-text search lives on /search.
|
||||
*/
|
||||
export function matchesQuery(entry: ListEntry, query: string): boolean {
|
||||
const needle = query.trim().toLowerCase()
|
||||
if (!needle) return true
|
||||
return (
|
||||
entry.title.toLowerCase().includes(needle) ||
|
||||
entry.summary.toLowerCase().includes(needle) ||
|
||||
(entry.tags ?? []).some((tag) => tag.toLowerCase().includes(needle))
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* OR semantics: an entry is kept when it carries *any* selected tag.
|
||||
*
|
||||
* The old filter AND-ed the selection, so picking a second tag almost always
|
||||
* emptied the list with no explanation. Broadening on click is what the
|
||||
* checkboxes look like they do.
|
||||
*/
|
||||
export function filterEntries<T extends ListEntry>(
|
||||
entries: T[],
|
||||
state: FilterState
|
||||
): T[] {
|
||||
const selected = state.tags.map(normalizeTag).filter(Boolean)
|
||||
const matched = entries.filter(
|
||||
(entry) =>
|
||||
matchesQuery(entry, state.query) &&
|
||||
(selected.length === 0 ||
|
||||
(entry.tags ?? []).some((tag) => selected.includes(normalizeTag(tag))))
|
||||
)
|
||||
return sortEntries(matched, state.sort)
|
||||
}
|
||||
|
||||
function timestamp(entry: ListEntry): number {
|
||||
const ms = new Date(entry.date).getTime()
|
||||
// A malformed frontmatter date must not sort the whole list to NaN.
|
||||
return Number.isFinite(ms) ? ms : 0
|
||||
}
|
||||
|
||||
export function sortEntries<T extends ListEntry>(entries: T[], sort: SortKey): T[] {
|
||||
const copy = [...entries]
|
||||
if (sort === "az") return copy.sort((a, b) => a.title.localeCompare(b.title))
|
||||
if (sort === "oldest") return copy.sort((a, b) => timestamp(a) - timestamp(b))
|
||||
return copy.sort((a, b) => timestamp(b) - timestamp(a))
|
||||
}
|
||||
|
||||
/**
|
||||
* How many entries each tag would contribute *within the current keyword
|
||||
* filter*, keyed by tag. Tags are not counted against each other: under OR
|
||||
* semantics every selected tag is contributing, and a count that collapsed as
|
||||
* soon as you clicked something would read like the filter was broken.
|
||||
*/
|
||||
export function tagCounts(entries: ListEntry[], state: FilterState): Map<string, number> {
|
||||
const counts = new Map<string, number>()
|
||||
for (const entry of entries) {
|
||||
if (!matchesQuery(entry, state.query)) continue
|
||||
for (const key of new Set((entry.tags ?? []).map(normalizeTag))) {
|
||||
if (!key) continue
|
||||
counts.set(key, (counts.get(key) ?? 0) + 1)
|
||||
}
|
||||
}
|
||||
return counts
|
||||
}
|
||||
|
||||
export function hasActiveFilters(state: FilterState): boolean {
|
||||
return state.tags.length > 0 || state.query.trim().length > 0 || state.sort !== DEFAULT_SORT
|
||||
}
|
||||
|
||||
/**
|
||||
* Read filter state out of a URL query string. Anything unparseable falls back
|
||||
* to the default rather than throwing: these values come from a hand-edited
|
||||
* address bar and have no contract to honour.
|
||||
*/
|
||||
export function parseFilterParams(params: URLSearchParams): FilterState {
|
||||
const rawSort = params.get(SORT_PARAM)
|
||||
return {
|
||||
tags: Array.from(
|
||||
new Set(
|
||||
(params.get(TAGS_PARAM) ?? "")
|
||||
.split(",")
|
||||
.map(normalizeTag)
|
||||
.filter(Boolean)
|
||||
)
|
||||
),
|
||||
query: params.get(QUERY_PARAM) ?? "",
|
||||
sort: SORT_KEYS.includes(rawSort as SortKey) ? (rawSort as SortKey) : DEFAULT_SORT,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write filter state back into a URLSearchParams, omitting defaults so a plain
|
||||
* /blog stays a clean, shareable /blog.
|
||||
*/
|
||||
export function writeFilterParams(params: URLSearchParams, state: FilterState): void {
|
||||
if (state.tags.length > 0) params.set(TAGS_PARAM, state.tags.join(","))
|
||||
else params.delete(TAGS_PARAM)
|
||||
|
||||
if (state.query.trim().length > 0) params.set(QUERY_PARAM, state.query.trim())
|
||||
else params.delete(QUERY_PARAM)
|
||||
|
||||
if (state.sort !== DEFAULT_SORT) params.set(SORT_PARAM, state.sort)
|
||||
else params.delete(SORT_PARAM)
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
// src/lib/search.ts
|
||||
import Fuse, { type IFuseOptions } from "fuse.js"
|
||||
import type { SearchEntry } from "@lib/types"
|
||||
|
||||
export type { SearchEntry }
|
||||
|
||||
/** Minimum characters before we bother running a query. */
|
||||
export const MIN_QUERY_LENGTH = 2
|
||||
|
||||
const FUSE_OPTIONS: IFuseOptions<SearchEntry> = {
|
||||
keys: [
|
||||
{ name: "title", weight: 0.4 },
|
||||
{ name: "tags", weight: 0.35 },
|
||||
{ name: "summary", weight: 0.25 },
|
||||
],
|
||||
threshold: 0.4,
|
||||
ignoreLocation: true,
|
||||
minMatchCharLength: MIN_QUERY_LENGTH,
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a reusable fuzzy searcher over a set of entries.
|
||||
*
|
||||
* The index is created once per island hydration, so typing does not rebuild
|
||||
* it on every keystroke.
|
||||
*/
|
||||
export function createSearcher(entries: SearchEntry[]): Fuse<SearchEntry> {
|
||||
return new Fuse(entries, FUSE_OPTIONS)
|
||||
}
|
||||
|
||||
/**
|
||||
* Run a fuzzy query. Queries shorter than `MIN_QUERY_LENGTH` yield no results,
|
||||
* which lets the UI distinguish "not searched yet" from "searched, found none".
|
||||
*/
|
||||
export function runSearch(
|
||||
searcher: Fuse<SearchEntry>,
|
||||
rawQuery: string
|
||||
): SearchEntry[] {
|
||||
const query = rawQuery.trim()
|
||||
if (query.length < MIN_QUERY_LENGTH) return []
|
||||
return searcher.search(query).map((result) => result.item)
|
||||
}
|
||||
|
||||
/**
|
||||
* Partition a flat result set back into per-collection buckets for rendering.
|
||||
*/
|
||||
export function partitionByCollection(results: SearchEntry[]): {
|
||||
posts: SearchEntry[]
|
||||
projects: SearchEntry[]
|
||||
} {
|
||||
return {
|
||||
posts: results.filter((entry) => entry.collection === "blog"),
|
||||
projects: results.filter((entry) => entry.collection === "projects"),
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
/**
|
||||
* Reads the public Uptime Kuma status page (https://uptime.spaghet.io/status/public)
|
||||
* and reduces it to the single "is everything fine?" signal the footer shows.
|
||||
*
|
||||
* Two endpoints matter:
|
||||
* GET /api/status-page/:slug -> config, incidents, monitor groups (~5 KB)
|
||||
* GET /api/status-page/heartbeat/:slug -> last 100 beats per monitor (~200 KB)
|
||||
*
|
||||
* The heartbeat payload is far too heavy to hand to the browser, and Uptime Kuma
|
||||
* only sends CORS headers in dev mode, so everything here runs server-side and the
|
||||
* browser talks to our own /api/status route instead. Results are cached in-process
|
||||
* (Uptime Kuma caches the heartbeat route for 1 minute anyway) and concurrent
|
||||
* requests share one in-flight fetch so a busy page never stampedes the Kuma box.
|
||||
*/
|
||||
|
||||
/** Beat statuses as defined by Uptime Kuma's `src/util.ts`. */
|
||||
export const BEAT = {
|
||||
DOWN: 0,
|
||||
UP: 1,
|
||||
PENDING: 2,
|
||||
MAINTENANCE: 3,
|
||||
} as const
|
||||
|
||||
export type SystemState = "up" | "degraded" | "down" | "maintenance" | "unknown"
|
||||
|
||||
export type UnknownReason = "no-monitors" | "stale" | "http-error" | "fetch-failed"
|
||||
|
||||
export interface KumaHeartbeat {
|
||||
status: number
|
||||
/** Naive server timestamp, e.g. "2026-11-05 21:05:09.655" (UTC). */
|
||||
time: string
|
||||
ping?: number | null
|
||||
msg?: string
|
||||
}
|
||||
|
||||
export interface StatusSnapshot {
|
||||
state: SystemState
|
||||
/** Footer copy, e.g. "All systems normal". */
|
||||
label: string
|
||||
summary: {
|
||||
total: number
|
||||
up: number
|
||||
down: number
|
||||
pending: number
|
||||
maintenance: number
|
||||
}
|
||||
incidents: number
|
||||
/** ISO timestamp of when the upstream data was read. */
|
||||
checkedAt: string
|
||||
/** Newest beat timestamp seen, ISO. Useful for spotting a paused Kuma. */
|
||||
lastBeatAt: string | null
|
||||
reason?: UnknownReason
|
||||
statusPageUrl: string
|
||||
}
|
||||
|
||||
const LABELS: Record<SystemState, string> = {
|
||||
up: "All systems normal",
|
||||
degraded: "Partial outage",
|
||||
down: "Major outage",
|
||||
maintenance: "Under maintenance",
|
||||
unknown: "Status unavailable",
|
||||
}
|
||||
|
||||
interface StatusConfig {
|
||||
base: string
|
||||
slug: string
|
||||
pageUrl: string
|
||||
apiUrl: string
|
||||
heartbeatUrl: string
|
||||
cacheTtlMs: number
|
||||
timeoutMs: number
|
||||
staleAfterMs: number
|
||||
/** Group names that count toward the footer light. Empty = every group. */
|
||||
watchGroups: string[]
|
||||
}
|
||||
|
||||
function envInt(name: string, fallback: number): number {
|
||||
const raw = process.env[name]
|
||||
if (raw === undefined || raw === "") return fallback
|
||||
const parsed = Number.parseInt(raw, 10)
|
||||
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback
|
||||
}
|
||||
|
||||
export function statusConfig(): StatusConfig {
|
||||
const base = (process.env.STATUS_PAGE_URL ?? "https://uptime.spaghet.io").replace(/\/+$/, "")
|
||||
const slug = process.env.STATUS_PAGE_SLUG ?? "public"
|
||||
return {
|
||||
base,
|
||||
slug,
|
||||
pageUrl: `${base}/status/${slug}`,
|
||||
apiUrl: `${base}/api/status-page/${slug}`,
|
||||
heartbeatUrl: `${base}/api/status-page/heartbeat/${slug}`,
|
||||
cacheTtlMs: envInt("STATUS_CACHE_TTL_SECONDS", 60) * 1000,
|
||||
timeoutMs: envInt("STATUS_TIMEOUT_SECONDS", 4) * 1000,
|
||||
// A monitor that has not reported in this long means Kuma itself is idle or
|
||||
// the beat loop died, so the last known "up" can no longer be trusted.
|
||||
staleAfterMs: envInt("STATUS_STALE_AFTER_SECONDS", 900) * 1000,
|
||||
// Opt-in narrowing, e.g. STATUS_WATCH_GROUPS="Critical Services,Database Services"
|
||||
// so a hobby game server cannot turn the footer red.
|
||||
watchGroups: (process.env.STATUS_WATCH_GROUPS ?? "")
|
||||
.split(",")
|
||||
.map((name) => name.trim())
|
||||
.filter(Boolean),
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Kuma stores beat times as naive UTC strings. `new Date("...")` would parse them
|
||||
* in the runtime's local zone, so pin the offset explicitly.
|
||||
*/
|
||||
export function parseBeatTime(time: string): number | null {
|
||||
if (!time) return null
|
||||
const normalized = /(?:Z|[+-]\d{2}:?\d{2})$/.test(time)
|
||||
? time
|
||||
: `${time.replace(" ", "T")}Z`
|
||||
const ms = Date.parse(normalized)
|
||||
return Number.isNaN(ms) ? null : ms
|
||||
}
|
||||
|
||||
/**
|
||||
* Pure reduction of the upstream payloads into one state. Mirrors Uptime Kuma's
|
||||
* own `overallStatus()` computed property: maintenance wins immediately, any
|
||||
* non-up beat degrades the page, and zero up beats means a total outage.
|
||||
*/
|
||||
export function summarize(input: {
|
||||
incidents?: unknown[] | null
|
||||
heartbeatList?: Record<string, KumaHeartbeat[]> | null
|
||||
now?: number
|
||||
staleAfterMs?: number
|
||||
statusPageUrl?: string
|
||||
}): StatusSnapshot {
|
||||
const now = input.now ?? Date.now()
|
||||
const staleAfterMs = input.staleAfterMs ?? 900_000
|
||||
const heartbeatList = input.heartbeatList ?? {}
|
||||
const incidents = Array.isArray(input.incidents) ? input.incidents : []
|
||||
|
||||
const summary = { total: 0, up: 0, down: 0, pending: 0, maintenance: 0 }
|
||||
let newestBeatMs: number | null = null
|
||||
|
||||
for (const beats of Object.values(heartbeatList)) {
|
||||
const last = beats?.[beats.length - 1]
|
||||
if (!last) continue
|
||||
|
||||
summary.total += 1
|
||||
if (last.status === BEAT.UP) summary.up += 1
|
||||
else if (last.status === BEAT.DOWN) summary.down += 1
|
||||
else if (last.status === BEAT.PENDING) summary.pending += 1
|
||||
else if (last.status === BEAT.MAINTENANCE) summary.maintenance += 1
|
||||
|
||||
const beatMs = parseBeatTime(last.time)
|
||||
if (beatMs !== null && (newestBeatMs === null || beatMs > newestBeatMs)) newestBeatMs = beatMs
|
||||
}
|
||||
|
||||
let state: SystemState
|
||||
let reason: UnknownReason | undefined
|
||||
|
||||
if (summary.total === 0) {
|
||||
state = "unknown"
|
||||
reason = "no-monitors"
|
||||
} else if (newestBeatMs !== null && now - newestBeatMs > staleAfterMs) {
|
||||
state = "unknown"
|
||||
reason = "stale"
|
||||
} else if (summary.maintenance > 0) {
|
||||
state = "maintenance"
|
||||
} else if (summary.up === 0) {
|
||||
state = "down"
|
||||
} else if (summary.down > 0 || summary.pending > 0 || incidents.length > 0) {
|
||||
state = "degraded"
|
||||
} else {
|
||||
state = "up"
|
||||
}
|
||||
|
||||
return {
|
||||
state,
|
||||
label: LABELS[state],
|
||||
summary,
|
||||
incidents: incidents.length,
|
||||
checkedAt: new Date(now).toISOString(),
|
||||
lastBeatAt: newestBeatMs === null ? null : new Date(newestBeatMs).toISOString(),
|
||||
...(reason ? { reason } : {}),
|
||||
statusPageUrl: input.statusPageUrl ?? "https://uptime.spaghet.io/status/public",
|
||||
}
|
||||
}
|
||||
|
||||
function snapshotForError(statusPageUrl: string, reason: UnknownReason): StatusSnapshot {
|
||||
const empty = summarize({ heartbeatList: {}, statusPageUrl })
|
||||
return { ...empty, state: "unknown", label: LABELS.unknown, reason }
|
||||
}
|
||||
|
||||
async function fetchJson(url: string, timeoutMs: number): Promise<unknown> {
|
||||
const response = await fetch(url, {
|
||||
signal: AbortSignal.timeout(timeoutMs),
|
||||
headers: { accept: "application/json", "user-agent": "spaghet.io-status/1.0" },
|
||||
})
|
||||
if (!response.ok) throw new Error(`Uptime Kuma returned ${response.status} for ${url}`)
|
||||
return response.json()
|
||||
}
|
||||
|
||||
/**
|
||||
* Monitor ids belonging to the named groups (case-insensitive). Used when
|
||||
* STATUS_WATCH_GROUPS narrows the footer light to a subset of the status page.
|
||||
* Returns null when no narrowing is configured, so callers can skip filtering.
|
||||
*/
|
||||
export function monitorsInGroups(
|
||||
publicGroupList: Array<{ name?: string; monitorList?: Array<{ id: number | string }> }> | null | undefined,
|
||||
watchGroups: string[]
|
||||
): Set<string> | null {
|
||||
if (watchGroups.length === 0) return null
|
||||
const wanted = new Set(watchGroups.map((name) => name.toLowerCase()))
|
||||
const ids = new Set<string>()
|
||||
for (const group of publicGroupList ?? []) {
|
||||
if (!wanted.has(String(group?.name ?? "").toLowerCase())) continue
|
||||
for (const monitor of group.monitorList ?? []) ids.add(String(monitor.id))
|
||||
}
|
||||
return ids
|
||||
}
|
||||
|
||||
async function readUpstream(config: StatusConfig): Promise<StatusSnapshot> {
|
||||
// The heartbeat route carries no incident info, and the page route carries no
|
||||
// beats, so both are needed. They are independent, so fetch them together.
|
||||
const [page, heartbeat] = await Promise.all([
|
||||
fetchJson(config.apiUrl, config.timeoutMs) as Promise<{
|
||||
incidents?: unknown[]
|
||||
publicGroupList?: Array<{ name?: string; monitorList?: Array<{ id: number }> }>
|
||||
}>,
|
||||
fetchJson(config.heartbeatUrl, config.timeoutMs) as Promise<{
|
||||
heartbeatList?: Record<string, KumaHeartbeat[]>
|
||||
}>,
|
||||
])
|
||||
|
||||
const heartbeatList = heartbeat?.heartbeatList ?? {}
|
||||
const allowed = monitorsInGroups(page?.publicGroupList, config.watchGroups)
|
||||
const scoped = allowed
|
||||
? Object.fromEntries(Object.entries(heartbeatList).filter(([id]) => allowed.has(id)))
|
||||
: heartbeatList
|
||||
|
||||
return summarize({
|
||||
incidents: page?.incidents,
|
||||
heartbeatList: scoped,
|
||||
staleAfterMs: config.staleAfterMs,
|
||||
statusPageUrl: config.pageUrl,
|
||||
})
|
||||
}
|
||||
|
||||
let cached: { snapshot: StatusSnapshot; expiresAt: number } | null = null
|
||||
let inFlight: Promise<StatusSnapshot> | null = null
|
||||
|
||||
async function load(config: StatusConfig): Promise<StatusSnapshot> {
|
||||
try {
|
||||
const snapshot = await readUpstream(config)
|
||||
cached = { snapshot, expiresAt: Date.now() + config.cacheTtlMs }
|
||||
return snapshot
|
||||
} catch (error: unknown) {
|
||||
const reason: UnknownReason =
|
||||
error instanceof Error && /returned \d{3}/.test(error.message) ? "http-error" : "fetch-failed"
|
||||
if (process.env.NODE_ENV !== "test") {
|
||||
console.error("[status] Uptime Kuma unreachable:", error instanceof Error ? error.message : error)
|
||||
}
|
||||
// Never throw at a caller: an unreachable Kuma becomes an honest "unknown"
|
||||
// so the footer degrades instead of 500ing every page render.
|
||||
const fallback = snapshotForError(config.pageUrl, reason)
|
||||
cached = { snapshot: fallback, expiresAt: Date.now() + config.cacheTtlMs }
|
||||
return fallback
|
||||
} finally {
|
||||
inFlight = null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cached, single-flight view of the status page.
|
||||
*
|
||||
* A page render never waits on Uptime Kuma twice: the first request fetches, and
|
||||
* while that is in flight everyone else joins it. Once a snapshot exists, an
|
||||
* expired cache serves the previous value immediately and refreshes in the
|
||||
* background (stale-while-revalidate), which keeps TTFB flat even if Kuma is slow.
|
||||
*/
|
||||
export async function getSystemStatus(opts: { force?: boolean } = {}): Promise<StatusSnapshot> {
|
||||
const config = statusConfig()
|
||||
|
||||
if (inFlight) return inFlight
|
||||
|
||||
if (cached) {
|
||||
const fresh = cached.expiresAt > Date.now()
|
||||
if (!opts.force) {
|
||||
if (fresh) return cached.snapshot
|
||||
// Expired: serve the previous value and revalidate behind it.
|
||||
inFlight = load(config)
|
||||
void inFlight
|
||||
return cached.snapshot
|
||||
}
|
||||
}
|
||||
|
||||
inFlight = load(config)
|
||||
return inFlight
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
export interface BlogPost {
|
||||
id: string;
|
||||
title: string;
|
||||
summary: string;
|
||||
date: string;
|
||||
tags: string[];
|
||||
draft: boolean;
|
||||
content: string;
|
||||
template: string;
|
||||
featured: boolean;
|
||||
}
|
||||
|
||||
export interface Project {
|
||||
id: string;
|
||||
title: string;
|
||||
summary: string;
|
||||
date: string;
|
||||
tags: string[];
|
||||
draft: boolean;
|
||||
content: string;
|
||||
/** Optional in the content schema (`z.string().optional()`), so optional here too. */
|
||||
demoUrl?: string;
|
||||
repoUrl?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The slim, client-serializable shape of a searchable document.
|
||||
*
|
||||
* Markdown `body` is deliberately excluded: serializing every post's full
|
||||
* content into the island's `props` measured 21,873 chars (43.5 KB page) and
|
||||
* was never matched against, so it was pure payload tax.
|
||||
*/
|
||||
export interface SearchEntry {
|
||||
id: string;
|
||||
slug: string;
|
||||
collection: "blog" | "projects";
|
||||
title: string;
|
||||
summary: string;
|
||||
tags: string[];
|
||||
date: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* The fields a listing card and its filters actually read.
|
||||
*
|
||||
* Deliberately excludes the markdown `content`: the /blog and /projects islands
|
||||
* serialized every entry's full body into the island's props on each request and
|
||||
* never matched against it. `BlogPost`, `Project` and `SearchEntry` all satisfy
|
||||
* this shape structurally, so cards and filters accept any of them.
|
||||
*/
|
||||
export interface ListEntry {
|
||||
id: string;
|
||||
title: string;
|
||||
summary: string;
|
||||
date: string;
|
||||
tags: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Shape accepted by ArrowCard. A union so the cards on the blog/projects
|
||||
* listing pages (flat ListEntry) and search results (SearchEntry, which
|
||||
* carries `collection` + `slug`) both type-check.
|
||||
*/
|
||||
export type CardEntry = ListEntry | SearchEntry
|
||||
|
||||
export interface WorkExperience {
|
||||
id: string;
|
||||
company: string;
|
||||
role: string;
|
||||
dateStart: string;
|
||||
dateEnd: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
export interface LegalDocument {
|
||||
id: string;
|
||||
title: string;
|
||||
date: string;
|
||||
content: string;
|
||||
}
|
||||
@@ -5,12 +5,40 @@ export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
|
||||
/**
|
||||
* Colors for the active (current-page) nav pill, shared by Header.astro and
|
||||
* Drawer.astro so the four copies cannot drift apart again.
|
||||
*
|
||||
* No `dark:` variants: `chip` / `chip-ink` are re-declared under `html.dark` in
|
||||
* src/styles/global.css, so the same classes give brown-on-noodle in light mode
|
||||
* and espresso-on-charred-yellow in dark mode.
|
||||
*/
|
||||
export const ACTIVE_NAV_COLORS = "bg-chip text-chip-ink"
|
||||
|
||||
/**
|
||||
* Whether a nav link is the active one: exact match, or the first path section
|
||||
* of the current URL (so /blog/some-post highlights the /blog link).
|
||||
*
|
||||
* Shared by Header.astro and Drawer.astro. Note the drawer previously compared
|
||||
* `"/" + subpath?.[0]` against the bare string `"search"`, which can never be
|
||||
* true; every caller now passes the same href it renders.
|
||||
*/
|
||||
export function isNavActive(pathname: string, href: string): boolean {
|
||||
if (pathname === href) return true
|
||||
const section = pathname.match(/[^/]+/g)?.[0]
|
||||
return section !== undefined && `/${section}` === href
|
||||
}
|
||||
|
||||
export function formatDate(date: Date | string) {
|
||||
if (typeof date === "string") date = new Date(date)
|
||||
return Intl.DateTimeFormat("en-US", {
|
||||
month: "short",
|
||||
day: "2-digit",
|
||||
year: "numeric"
|
||||
year: "numeric",
|
||||
// Frontmatter dates such as `date: 2025-08-12` parse to midnight UTC. Without
|
||||
// pinning the timezone, formatting in a negative-offset locale (EST) shifted
|
||||
// every authored date one day earlier on screen.
|
||||
timeZone: "UTC",
|
||||
}).format(date)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,92 +0,0 @@
|
||||
import { type APIRoute } from 'astro';
|
||||
import { getFileUrl, getFilePreviewUrl } from '../../../lib/appwrite-service.ts';
|
||||
|
||||
export const GET: APIRoute = async ({ params, request }) => {
|
||||
const { fileID } = params;
|
||||
|
||||
// Validate that we have a file ID
|
||||
if (!fileID) {
|
||||
return new Response(
|
||||
JSON.stringify({ error: 'File ID is required' }),
|
||||
{ status: 400, headers: { 'Content-Type': 'application/json' } }
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
// Get the bucket ID from environment variables
|
||||
const bucketId = process.env.VITE_APPWRITE_BUCKET_ID;
|
||||
|
||||
if (!bucketId) {
|
||||
return new Response(
|
||||
JSON.stringify({ error: 'Bucket ID is not configured' }),
|
||||
{ status: 500, headers: { 'Content-Type': 'application/json' } }
|
||||
);
|
||||
}
|
||||
|
||||
// Parse query parameters for preview type
|
||||
const url = new URL(request.url);
|
||||
const type = url.searchParams.get('type') as "thumb" | "preview" | null;
|
||||
|
||||
let fileUrl: string;
|
||||
|
||||
// Determine the appropriate URL based on query parameter or default to view
|
||||
if (type === 'thumb' || type === 'preview') {
|
||||
fileUrl = getFilePreviewUrl(bucketId, fileID, type);
|
||||
} else {
|
||||
// Default to regular view URL
|
||||
fileUrl = getFileUrl(bucketId, fileID);
|
||||
}
|
||||
|
||||
// Return a redirect response to the file URL
|
||||
return new Response(
|
||||
null,
|
||||
{
|
||||
status: 302,
|
||||
headers: {
|
||||
'Location': fileUrl
|
||||
}
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
console.error('Error fetching file:', error);
|
||||
return new Response(
|
||||
JSON.stringify({ error: 'Failed to fetch file' }),
|
||||
{ status: 500, headers: { 'Content-Type': 'application/json' } }
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// Handle HEAD requests for preflight checks
|
||||
export const HEAD: APIRoute = async ({ params }) => {
|
||||
const { fileID } = params;
|
||||
|
||||
if (!fileID) {
|
||||
return new Response(
|
||||
null,
|
||||
{ status: 400 }
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
// Get the bucket ID from environment variables
|
||||
const bucketId = process.env.VITE_APPWRITE_BUCKET_ID;
|
||||
|
||||
if (!bucketId) {
|
||||
return new Response(
|
||||
null,
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
|
||||
// For HEAD requests, we just validate that the file URL can be generated
|
||||
// This is a basic check - in production you might want to actually verify
|
||||
// that the file exists on Appwrite
|
||||
const fileUrl = getFileUrl(bucketId, fileID);
|
||||
|
||||
// Return a successful response (we don't actually need to return anything specific for HEAD)
|
||||
return new Response(null, { status: 200 });
|
||||
} catch (error) {
|
||||
console.error('Error checking file:', error);
|
||||
return new Response(null, { status: 500 });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
import type { APIRoute } from "astro"
|
||||
import { getSystemStatus } from "@lib/status"
|
||||
|
||||
export const prerender = false
|
||||
|
||||
/**
|
||||
* Footer-safe view of the Uptime Kuma status page: one small JSON document,
|
||||
* server-fetched and cached, so the browser never has to (and can't) reach the
|
||||
* Kuma API directly — it sends no CORS headers outside dev.
|
||||
*/
|
||||
export const GET: APIRoute = async ({ url }) => {
|
||||
const force = url.searchParams.get("refresh") === "1"
|
||||
const snapshot = await getSystemStatus({ force })
|
||||
|
||||
return new Response(JSON.stringify(snapshot), {
|
||||
status: 200,
|
||||
headers: {
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
// The server already caches upstream, so keep the browser cache short and
|
||||
// let the footer's own timer drive refreshes.
|
||||
"cache-control": "public, max-age=30, stale-while-revalidate=120",
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -1,38 +1,43 @@
|
||||
---
|
||||
import { getCollection } from "astro:content"
|
||||
import PageLayout from "@layouts/PageLayout.astro"
|
||||
import TopLayout from "@layouts/TopLayout.astro"
|
||||
import BottomLayout from "@layouts/BottomLayout.astro"
|
||||
import ArticleTopLayout from "@layouts/ArticleTopLayout.astro"
|
||||
import ArticleBottomLayout from "@layouts/ArticleBottomLayout.astro"
|
||||
import { getBlogPostById } from "@lib/appwrite-service"
|
||||
|
||||
export const prerender = true
|
||||
|
||||
// Get the requested post
|
||||
const slug = Astro.params.slug || ''
|
||||
const post = await getBlogPostById(slug)
|
||||
.then(blogPost => {
|
||||
if (blogPost) {
|
||||
return blogPost;
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Error fetching blog post:", error);
|
||||
return null;
|
||||
})
|
||||
export async function getStaticPaths() {
|
||||
const entries = await getCollection("blog", ({ data }) => !data.draft)
|
||||
// The article layouts expect the flat BlogPost shape (title/summary/date at the
|
||||
// top level). Astro's collection entries nest frontmatter under `data`, so
|
||||
// spreading the entry alone left every article heading blank and made
|
||||
// formatDate(undefined) fall back to today's date.
|
||||
const flat = entries.map((entry) => ({
|
||||
...entry,
|
||||
...entry.data,
|
||||
content: entry.rendered?.html ?? "",
|
||||
}))
|
||||
return entries.map((entry, i) => ({
|
||||
params: { slug: entry.id },
|
||||
props: { entry: flat[i], allEntries: flat },
|
||||
}))
|
||||
}
|
||||
|
||||
const { title, summary } = post || { title: "Post not found", summary: "" }
|
||||
const { entry, allEntries } = Astro.props
|
||||
const { title, summary } = entry.data
|
||||
---
|
||||
|
||||
<PageLayout title={title} description={summary}>
|
||||
<TopLayout>
|
||||
<div class="animate">
|
||||
<ArticleTopLayout entry={post}/>
|
||||
<ArticleTopLayout entry={entry}/>
|
||||
</div>
|
||||
</TopLayout>
|
||||
<BottomLayout>
|
||||
<div class="animate">
|
||||
<ArticleBottomLayout entry={post} />
|
||||
<ArticleBottomLayout entry={entry} allEntries={allEntries} />
|
||||
</div>
|
||||
</BottomLayout>
|
||||
</PageLayout>
|
||||
@@ -1,31 +1,30 @@
|
||||
---
|
||||
import { getCollection } from "astro:content"
|
||||
import PageLayout from "@layouts/PageLayout.astro"
|
||||
import TopLayout from "@layouts/TopLayout.astro"
|
||||
import BottomLayout from "@layouts/BottomLayout.astro"
|
||||
import Blog from "@components/Blog"
|
||||
import FilteredList from "@components/FilteredList"
|
||||
import { BLOG } from "@consts"
|
||||
import { getBlogPostsPaginated } from "@lib/appwrite-service"
|
||||
import { byDateDesc } from "@lib/content"
|
||||
import { parseFilterParams } from "@lib/filters"
|
||||
|
||||
// Get page and limit from URL parameters
|
||||
const url = new URL(typeof window !== 'undefined' ? window.location.href : 'http://localhost')
|
||||
const pageParam = url.searchParams.get('page') || '1'
|
||||
const limitParam = url.searchParams.get('limit') || '10'
|
||||
const page = parseInt(pageParam)
|
||||
const limit = parseInt(limitParam)
|
||||
const entries = await getCollection("blog", ({ data }) => !data.draft)
|
||||
// Only the fields the cards and the filters read. `content` was serialized into
|
||||
// the island's props on every request and never matched against — the markdown
|
||||
// body is the single largest thing on this page.
|
||||
const posts = entries
|
||||
.sort(byDateDesc)
|
||||
.map((entry) => ({
|
||||
id: entry.id,
|
||||
title: entry.data.title,
|
||||
summary: entry.data.summary,
|
||||
date: entry.data.date.toISOString(),
|
||||
tags: entry.data.tags,
|
||||
}))
|
||||
|
||||
// Fetch paginated blog posts
|
||||
const { posts } = await getBlogPostsPaginated(page, limit)
|
||||
.then(result => {
|
||||
return result;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Error fetching blog posts:", error);
|
||||
return { posts: [], total: 0 };
|
||||
})
|
||||
|
||||
// Get all tags for filtering
|
||||
const tags = [...new Set(posts.flatMap(post => post.tags))]
|
||||
.sort((a, b) => a.localeCompare(b))
|
||||
// Frontmatter runs on the server, so the initial filter state has to come from
|
||||
// the request URL rather than `window.location` (see src/pages/search/index.astro).
|
||||
const initial = parseFilterParams(Astro.url.searchParams)
|
||||
---
|
||||
|
||||
<PageLayout title={BLOG.TITLE} description={BLOG.DESCRIPTION}>
|
||||
@@ -36,7 +35,7 @@ const tags = [...new Set(posts.flatMap(post => post.tags))]
|
||||
</TopLayout>
|
||||
<BottomLayout>
|
||||
<div class="animate">
|
||||
<Blog client:load tags={tags} data={posts} />
|
||||
<FilteredList client:load collection="blog" entries={posts} initial={initial} />
|
||||
</div>
|
||||
</BottomLayout>
|
||||
</PageLayout>
|
||||
@@ -1,22 +1,24 @@
|
||||
---
|
||||
import { getBlogPosts, getProjects } from "@lib/appwrite-service";
|
||||
import { getCollection } from "astro:content"
|
||||
import PageLayout from "@layouts/PageLayout.astro"
|
||||
import ArrowCard from "@components/ArrowCard"
|
||||
import StackCard from "@components/StackCard.astro"
|
||||
import { SITE, SOCIALS } from "@consts"
|
||||
import TwinklingStars from "@components/TwinklingStars.astro"
|
||||
import MeteorShower from "@components/MeteorShower.astro"
|
||||
import { byDateDesc, toSearchEntry } from "@lib/content"
|
||||
import ParmesanFlecks from "@components/ParmesanFlecks.astro"
|
||||
import MeatballShower from "@components/MeatballShower.astro"
|
||||
|
||||
// Fetch blog posts and projects from Appwrite
|
||||
const posts = (await getBlogPosts())
|
||||
.filter(post => !post.draft)
|
||||
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
|
||||
.slice(0,3)
|
||||
const allBlogEntries = await getCollection("blog", ({ data }) => !data.draft)
|
||||
const posts = allBlogEntries
|
||||
.sort(byDateDesc)
|
||||
.slice(0, 3)
|
||||
.map(toSearchEntry)
|
||||
|
||||
const projects = (await getProjects())
|
||||
.filter(project => !project.draft)
|
||||
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
|
||||
.slice(0,3)
|
||||
const allProjectEntries = await getCollection("projects", ({ data }) => !data.draft)
|
||||
const projects = allProjectEntries
|
||||
.sort(byDateDesc)
|
||||
.slice(0, 3)
|
||||
.map(toSearchEntry)
|
||||
|
||||
const stack = [
|
||||
{
|
||||
@@ -38,11 +40,6 @@ const stack = [
|
||||
text: "Tailwind",
|
||||
icon: "tailwind",
|
||||
href: "https://tailwindcss.com"
|
||||
},
|
||||
{
|
||||
text: "Appwrite",
|
||||
icon: "simple-icons--appwrite",
|
||||
href: "https://appwrite.io"
|
||||
}
|
||||
]
|
||||
---
|
||||
@@ -57,17 +54,17 @@ const stack = [
|
||||
</div>
|
||||
|
||||
<!-- Dark Theme: Stars -->
|
||||
<div class='absolute inset-0 bg-black hidden dark:block'>
|
||||
<div class='absolute inset-0 bg-page hidden dark:block'>
|
||||
<div id='stars1' class='fixed inset-0'></div>
|
||||
<div id='stars2' class='fixed inset-0'></div>
|
||||
<div id='stars3' class='fixed inset-0'></div>
|
||||
</div>
|
||||
|
||||
<!-- Dark Theme: Twinkling Stars / Meteor Shower -->
|
||||
<!-- Dark Theme: Parmesan Flecks / Meatball Shower -->
|
||||
<div id="galaxy" class="fixed inset-0">
|
||||
<div class="hidden dark:block">
|
||||
<TwinklingStars/>
|
||||
<MeteorShower/>
|
||||
<ParmesanFlecks/>
|
||||
<MeatballShower/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -76,16 +73,22 @@ const stack = [
|
||||
<!-- HERO -->
|
||||
<section class="relative h-screen w-full">
|
||||
<div id="planetcont" class='animate absolute inset-0 top-1/4 overflow-hidden'>
|
||||
<div id="crescent" class='absolute top-0 left-1/2 -translate-x-1/2 w-[250vw] min-h-[100vh] aspect-square rounded-full p-[1px] bg-gradient-to-b from-black/25 dark:from-white/75 from-0% to-transparent to-5%'>
|
||||
<div id="planet" class='w-full h-full bg-white dark:bg-black rounded-full p-[1px] overflow-hidden flex justify-center'>
|
||||
<div id="blur" class='w-full h-20 rounded-full bg-neutral-900/25 dark:bg-white/25 blur-3xl'/>
|
||||
<div id="crescent" class='absolute top-0 left-1/2 -translate-x-1/2 w-[250vw] min-h-[100vh] aspect-square rounded-full p-[1px] bg-gradient-to-b from-ink/25 dark:from-ink/75 from-0% to-transparent to-5%'>
|
||||
<div id="planet" class='w-full h-full bg-surface rounded-full p-[1px] overflow-hidden flex justify-center'>
|
||||
<div id="blur" class='w-full h-20 rounded-full bg-ink/25 blur-3xl'/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- The planet's `surface` fill (white in light mode) reaches the bottom of the hero, so its
|
||||
shared edge with the `page`-coloured About section below reads as a hard line at 100vh.
|
||||
This fades the last of the hero into the page colour. Both ends are theme tokens, so it
|
||||
follows the light/dark flip with no `dark:` variant. It comes after #planetcont so it
|
||||
paints over it, and is click-through so the CTAs stay usable. -->
|
||||
<div aria-hidden="true" class="pointer-events-none absolute inset-x-0 bottom-0 h-40 bg-gradient-to-b from-page/0 from-25% to-page"></div>
|
||||
<div class="animate absolute h-full w-full flex items-center justify-center">
|
||||
<div class='relative w-full h-full flex items-center justify-center text-spaghetti-brown/100 dark:text-spaghetti-cream'>
|
||||
<div class='relative w-full h-full flex items-center justify-center text-ink'>
|
||||
<div class='p-5 text-center'>
|
||||
<img src='/api/assets/689d27a400194d326f69' alt="Quinn Marvin" class="rounded-full w-32 h-32 mx-auto mb-4 border-4 border-spaghetti-brown dark:border-spaghetti-cream" />
|
||||
<img src='/images/profile.jpg' alt="Quinn Marvin" class="rounded-full w-32 h-32 mx-auto mb-4 border-4 border-edge" />
|
||||
<p class='animated text-lg md:text-xl lg:text-2xl font-semibold opacity-75'>
|
||||
Hello, I am Quinn Marvin
|
||||
</p>
|
||||
@@ -96,16 +99,16 @@ const stack = [
|
||||
Passionate about spaghetti, noodles and all things tech.
|
||||
</p>
|
||||
<p class='animated text-sm md:text-base lg:text-lg opacity-75 mt-2'>
|
||||
Running 2 Unraid servers with Docker container ecosystem
|
||||
Two home servers: one stores everything, one does the thinking
|
||||
</p>
|
||||
<p class='animated text-sm md:text-base lg:text-lg opacity-75 mt-1'>
|
||||
Supporting PostgreSQL, MariaDB, MySQL, MongoDB, Redis, and Minio
|
||||
258 TB of storage, 81 services, and AI that runs in my own house
|
||||
</p>
|
||||
<div id="ctaButtons" class='animated flex flex-wrap gap-4 justify-center mt-5'>
|
||||
<a href='/blog' class='py-2 px-4 rounded truncate text-xs md:text-sm lg:text-base bg-spaghetti-red dark:bg-spaghetti-red dark:text-spaghetti-brown hover:opacity-75 blend'>
|
||||
<a href='/blog' class='py-2 px-4 rounded truncate text-xs md:text-sm lg:text-base bg-link text-page hover:bg-link-hover blend'>
|
||||
Read my blog
|
||||
</a>
|
||||
<a href='/work' class='py-2 px-4 truncate rounded text-xs md:text-sm lg:text-base border border-spaghetti-yellow/50 dark:border-spaghetti-yellow/50 hover:bg-spaghetti-yellow/20 hover:dark:bg-spaghetti-yellow/20 blend dark:text-spaghetti-cream'>
|
||||
<a href='/work' class='py-2 px-4 truncate rounded text-xs md:text-sm lg:text-base border border-edge text-ink hover:bg-chip hover:text-chip-ink blend'>
|
||||
View my work
|
||||
</a>
|
||||
</div>
|
||||
@@ -114,17 +117,18 @@ const stack = [
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="relative bg-white dark:bg-black dark:text-spaghetti-brown">
|
||||
<div class="relative bg-page text-ink">
|
||||
<div class="mx-auto max-w-screen-sm p-5 space-y-24 pb-16">
|
||||
|
||||
<!-- About Section -->
|
||||
<section class="animate">
|
||||
<article class="text-spaghetti-brown/100 dark:text-spaghetti-cream">
|
||||
<article class="text-ink">
|
||||
<p>Hello! I'm Quinn Marvin, a passionate CEO/Creator/Innovator with an unrelenting love for spaghetti, noodles, and all things tech.</p>
|
||||
<p>With 10+ years of experience building high-performing engineering teams and driving innovation in dynamic environments, I combine deep technical expertise with exceptional emotional intelligence and a human-centered leadership approach.</p>
|
||||
<p>I specialize in IT Service Management (ITSM), IT Operations Management (ITOM), and IT Asset Management (ITAM), positioning myself as a trusted advisor to enterprise clients.</p>
|
||||
<p>My technical background includes extensive experience with Docker, Kubernetes, and cloud platforms to deliver scalable, secure, and compliant solutions for complex projects.</p>
|
||||
<p>Currently running 2 Unraid servers with powerful hardware configurations (128GB RAM, 2 x E5 Xeon CPU, 200TB raw storage on NetApp arrays) and a comprehensive Docker container ecosystem supporting PostgreSQL, MariaDB, MySQL, MongoDB, Redis, and Minio.</p>
|
||||
<p>Currently I run two home servers built for opposite jobs. <strong>MarvinBlade</strong> holds about 258 TB across thirty hard drives, with extra protection so the files survive drives failing. <strong>SpaghetAI</strong> has almost no storage at all but a great deal of memory and two graphics cards, so that AI tools can answer questions about my own documents without those documents leaving the house. Eighty-one programs run across the two, covering media, photos, files, finances, and automation, with one sign-in protecting the things that matter.</p>
|
||||
<p>How and why, in plain language: <a href="/blog/04-marvinblade-and-spaghetai/">Running AI From My Own Computers</a>.</p>
|
||||
<p>Just like the perfect bowl of spaghetti - structured, well-organized, and satisfying to use - I'm passionate about creating technology solutions that are both functional and elegant.</p>
|
||||
</article>
|
||||
</section>
|
||||
@@ -133,11 +137,11 @@ const stack = [
|
||||
<section class="animate">
|
||||
<div class="space-y-4">
|
||||
<div class="flex justify-between">
|
||||
<p class="font-semibold text-spaghetti-brown dark:text-spaghetti-cream">
|
||||
<p class="font-semibold text-ink">
|
||||
Recent posts
|
||||
</p>
|
||||
<a href="/blog" class="w-fit col-span-3 group flex gap-1 items-center underline decoration-[.5px] decoration-black/25 dark:decoration-white/50 hover:decoration-black dark:hover:decoration-white text-black dark:text-white underline-offset-2 blend">
|
||||
<span class="text-black/75 dark:text-white/75 group-hover:text-black group-hover:dark:text-white blend">
|
||||
<a href="/blog" class="w-fit col-span-3 group flex gap-1 items-center underline decoration-[.5px] decoration-edge text-ink-muted underline-offset-2 hover:text-link hover:decoration-link blend">
|
||||
<span class="group-hover:text-link blend">
|
||||
All posts
|
||||
</span>
|
||||
</a>
|
||||
@@ -155,7 +159,7 @@ const stack = [
|
||||
<!-- Tech Stack Section -->
|
||||
<section class="animate">
|
||||
<div class="space-y-4">
|
||||
<p class="font-semibold text-spaghetti-brown dark:text-spaghetti-cream">
|
||||
<p class="font-semibold text-ink">
|
||||
Website build with
|
||||
</p>
|
||||
<div class="flex flex-wrap items-center gap-2 mt-5">
|
||||
@@ -167,10 +171,10 @@ const stack = [
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
<div class="dark:text-spaghetti-cream">
|
||||
<div class="text-ink">
|
||||
Performing reactivity and statefulness, special guest
|
||||
<a href="https://www.solidjs.com/" target="_blank" class="w-fit group underline decoration-[.5px] decoration-black/25 dark:decoration-white/50 hover:decoration-black dark:hover:decoration-white text-black dark:text-white underline-offset-2 blend">
|
||||
<span class="text-spaghetti-brown/75 dark:text-spaghetti-cream/75 group-hover:text-spaghetti-brown group-hover:dark:text-spaghetti-cream blend">
|
||||
<a href="https://www.solidjs.com/" target="_blank" class="w-fit group underline decoration-[.5px] decoration-edge text-ink-muted underline-offset-2 hover:text-link hover:decoration-link blend">
|
||||
<span class="group-hover:text-link blend">
|
||||
SolidJS
|
||||
</span>
|
||||
</a>
|
||||
@@ -182,11 +186,11 @@ const stack = [
|
||||
<section class="animate">
|
||||
<div class="space-y-4">
|
||||
<div class="flex justify-between">
|
||||
<p class="font-semibold text-spaghetti-brown dark:text-spaghetti-cream">
|
||||
<p class="font-semibold text-ink">
|
||||
Recent projects
|
||||
</p>
|
||||
<a href="/projects" class="w-fit col-span-3 group flex gap-1 items-center underline decoration-[.5px] decoration-black/25 dark:decoration-white/50 hover:decoration-black dark:hover:decoration-white text-black dark:text-white underline-offset-2 blend">
|
||||
<span class="text-black/75 dark:text-white/75 group-hover:text-black group-hover:dark:text-white blend">
|
||||
<a href="/projects" class="w-fit col-span-3 group flex gap-1 items-center underline decoration-[.5px] decoration-edge text-ink-muted underline-offset-2 hover:text-link hover:decoration-link blend">
|
||||
<span class="group-hover:text-link blend">
|
||||
All projects
|
||||
</span>
|
||||
</a>
|
||||
@@ -203,7 +207,7 @@ const stack = [
|
||||
|
||||
<!-- Contact Section -->
|
||||
<section class="animate">
|
||||
<div class=" text-spaghetti-brown dark:text-spaghetti-cream">
|
||||
<div class=" text-ink">
|
||||
<p class="font-semibold">
|
||||
Let's Connect
|
||||
</p>
|
||||
@@ -218,8 +222,8 @@ const stack = [
|
||||
</span>
|
||||
</div>
|
||||
<div class="col-span-3 truncate">
|
||||
<a href={social.HREF} target="_blank" class="w-fit col-span-3 group flex gap-1 items-center underline decoration-[.5px] decoration-black/25 dark:decoration-white/50 hover:decoration-black dark:hover:decoration-white text-black dark:text-white underline-offset-2 blend">
|
||||
<span class="text-black/75 dark:text-white/75 group-hover:text-black group-hover:dark:text-white blend">
|
||||
<a href={social.HREF} target="_blank" class="w-fit col-span-3 group flex gap-1 items-center underline decoration-[.5px] decoration-edge text-ink-muted underline-offset-2 hover:text-link hover:decoration-link blend">
|
||||
<span class="group-hover:text-link blend">
|
||||
{social.TEXT}
|
||||
</span>
|
||||
</a>
|
||||
|
||||
@@ -1,37 +1,36 @@
|
||||
---
|
||||
export const prerender = true;
|
||||
import { getCollection } from "astro:content"
|
||||
import PageLayout from "@layouts/PageLayout.astro"
|
||||
import TopLayout from "@layouts/TopLayout.astro"
|
||||
import BottomLayout from "@layouts/BottomLayout.astro"
|
||||
import { formatDate } from "@lib/utils"
|
||||
import { SITE } from "@consts"
|
||||
import { getLegalDocuments } from "@lib/appwrite-service"
|
||||
|
||||
// Get the requested legal doc (simplified approach)
|
||||
const legalDocs = await getLegalDocuments()
|
||||
const doc = legalDocs.find(d => d.$id === Astro.params.slug) || null
|
||||
|
||||
if (!doc) {
|
||||
// Handle case where document is not found
|
||||
return new Response("Not Found", { status: 404 })
|
||||
export async function getStaticPaths() {
|
||||
const entries = await getCollection("legal")
|
||||
return entries.map((entry) => ({
|
||||
params: { slug: entry.id },
|
||||
props: { entry },
|
||||
}))
|
||||
}
|
||||
|
||||
// Skip render() call since we're using Appwrite data directly
|
||||
// const { Content } = await doc.render();
|
||||
|
||||
const { entry } = Astro.props
|
||||
const doc = entry
|
||||
---
|
||||
|
||||
<PageLayout title={doc.title} description={`${doc.title} for ${SITE.TITLE}`}>
|
||||
<PageLayout title={doc.data.title} description={`${doc.data.title} for ${SITE.TITLE}`}>
|
||||
<TopLayout>
|
||||
<div class="animate">
|
||||
<div class="page-heading">
|
||||
{doc.title}
|
||||
{doc.data.title}
|
||||
</div>
|
||||
<p class="font-normal opacity-75">
|
||||
Last updated: {formatDate(doc.date)}
|
||||
Last updated: {formatDate(doc.data.date)}
|
||||
</p>
|
||||
</div>
|
||||
</TopLayout>
|
||||
<BottomLayout>
|
||||
<article class="animate prose dark:prose-invert text-spaghetti-brown/100 dark:text-spaghetti-cream" set:html={doc.contentHtml}></article>
|
||||
<article class="animate prose dark:prose-invert text-ink" set:html={doc.rendered?.html}></article>
|
||||
</BottomLayout>
|
||||
</PageLayout>
|
||||
@@ -1,37 +1,41 @@
|
||||
---
|
||||
import { getCollection } from "astro:content"
|
||||
import PageLayout from "@layouts/PageLayout.astro"
|
||||
import TopLayout from "@layouts/TopLayout.astro"
|
||||
import BottomLayout from "@layouts/BottomLayout.astro"
|
||||
import ArticleTopLayout from "@layouts/ArticleTopLayout.astro"
|
||||
import ArticleBottomLayout from "@layouts/ArticleBottomLayout.astro"
|
||||
import { getProjectById } from "@lib/appwrite-service"
|
||||
|
||||
// Get the requested project
|
||||
const slug = Astro.params.slug || ''
|
||||
const project = await getProjectById(slug)
|
||||
.then(projectData => {
|
||||
if (projectData) {
|
||||
return projectData
|
||||
}
|
||||
return null;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Error fetching project:", error);
|
||||
return null;
|
||||
})
|
||||
export const prerender = true
|
||||
|
||||
const { title, summary } = project || { title: "Project not found", summary: "" }
|
||||
export async function getStaticPaths() {
|
||||
const entries = await getCollection("projects", ({ data }) => !data.draft)
|
||||
// Flatten frontmatter to the shape ArticleTopLayout/ArticleBottomLayout expect;
|
||||
// see the note in src/pages/blog/[...slug].astro.
|
||||
const flat = entries.map((entry) => ({
|
||||
...entry,
|
||||
...entry.data,
|
||||
content: entry.rendered?.html ?? "",
|
||||
}))
|
||||
return entries.map((entry, i) => ({
|
||||
params: { slug: entry.id },
|
||||
props: { entry: flat[i], allEntries: flat },
|
||||
}))
|
||||
}
|
||||
|
||||
const { entry, allEntries } = Astro.props
|
||||
const { title, summary } = entry.data
|
||||
---
|
||||
|
||||
<PageLayout title={title} description={summary}>
|
||||
<TopLayout>
|
||||
<div class="animate">
|
||||
<ArticleTopLayout entry={project}/>
|
||||
<ArticleTopLayout entry={entry} collection="projects"/>
|
||||
</div>
|
||||
</TopLayout>
|
||||
<BottomLayout>
|
||||
<div class="animate">
|
||||
<ArticleBottomLayout entry={project} />
|
||||
<ArticleBottomLayout entry={entry} collection="projects" allEntries={allEntries} />
|
||||
</div>
|
||||
</BottomLayout>
|
||||
</PageLayout>
|
||||
@@ -1,33 +1,28 @@
|
||||
---
|
||||
import { getCollection } from "astro:content"
|
||||
import PageLayout from "@layouts/PageLayout.astro"
|
||||
import TopLayout from "@layouts/TopLayout.astro"
|
||||
import BottomLayout from "@layouts/BottomLayout.astro"
|
||||
import Projects from "@components/Projects"
|
||||
import FilteredList from "@components/FilteredList"
|
||||
import { PROJECTS } from "@consts"
|
||||
import { getProjectsPaginated } from "@lib/appwrite-service"
|
||||
import { byDateDesc } from "@lib/content"
|
||||
import { parseFilterParams } from "@lib/filters"
|
||||
|
||||
const entries = await getCollection("projects", ({ data }) => !data.draft)
|
||||
// Only the fields the cards and the filters read; see src/pages/blog/index.astro.
|
||||
const projects = entries
|
||||
.sort(byDateDesc)
|
||||
.map((entry) => ({
|
||||
id: entry.id,
|
||||
title: entry.data.title,
|
||||
summary: entry.data.summary,
|
||||
date: entry.data.date.toISOString(),
|
||||
tags: entry.data.tags,
|
||||
}))
|
||||
|
||||
// Get page and limit from URL parameters
|
||||
const url = new URL(typeof window !== 'undefined' ? window.location.href : 'https://home.spaghet.io')
|
||||
const pageParam = url.searchParams.get('page') || '1'
|
||||
const limitParam = url.searchParams.get('limit') || '10'
|
||||
const page = parseInt(pageParam)
|
||||
const limit = parseInt(limitParam)
|
||||
|
||||
// Fetch paginated projects
|
||||
const { posts } = await getProjectsPaginated(page, limit)
|
||||
.then(result => {
|
||||
console.log(result)
|
||||
return result;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Error fetching projects:", error);
|
||||
return { posts: [], total: 0 };
|
||||
})
|
||||
|
||||
// Get all tags for filtering
|
||||
const tags = [...new Set(posts.flatMap(project => project.tags))]
|
||||
.sort((a, b) => a.localeCompare(b))
|
||||
// Frontmatter runs on the server, so the initial filter state has to come from
|
||||
// the request URL rather than `window.location` (see src/pages/search/index.astro).
|
||||
const initial = parseFilterParams(Astro.url.searchParams)
|
||||
---
|
||||
|
||||
<PageLayout title={PROJECTS.TITLE} description={PROJECTS.DESCRIPTION}>
|
||||
@@ -38,7 +33,7 @@ const tags = [...new Set(posts.flatMap(project => project.tags))]
|
||||
</TopLayout>
|
||||
<BottomLayout>
|
||||
<div class="animate">
|
||||
<Projects client:load tags={tags} data={posts} />
|
||||
<FilteredList client:load collection="projects" entries={projects} initial={initial} />
|
||||
</div>
|
||||
</BottomLayout>
|
||||
</PageLayout>
|
||||
@@ -1,35 +1,27 @@
|
||||
import rss from "@astrojs/rss"
|
||||
import { getCollection } from "astro:content"
|
||||
import { SITE } from "@consts"
|
||||
import { getBlogPosts, getProjects } from "@lib/appwrite-service"
|
||||
|
||||
type Context = {
|
||||
site: string
|
||||
}
|
||||
|
||||
export async function GET(context: Context) {
|
||||
// Get data from Appwrite instead of Astro content collections
|
||||
const blogPosts = await getBlogPosts()
|
||||
const projects = await getProjects()
|
||||
const entries = await getCollection("blog", ({ data }) => !data.draft)
|
||||
|
||||
// Combine and sort items by date (most recent first)
|
||||
const items = [...blogPosts, ...projects]
|
||||
.sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime())
|
||||
.map((item) => ({
|
||||
title: item.title,
|
||||
description: item.summary,
|
||||
pubDate: item.date,
|
||||
link: item.$collectionId === process.env.VITE_APPWRITE_BLOG_COLLECTION_ID ? `/blog/${item.$id}/` : `/projects/${item.$id}/`,
|
||||
const items = entries
|
||||
.sort((a, b) => b.data.date.getTime() - a.data.date.getTime())
|
||||
.map((entry) => ({
|
||||
title: entry.data.title,
|
||||
description: entry.data.summary,
|
||||
pubDate: entry.data.date,
|
||||
link: `/blog/${entry.id}/`,
|
||||
}))
|
||||
|
||||
return rss({
|
||||
title: SITE.TITLE,
|
||||
description: SITE.DESCRIPTION,
|
||||
site: context.site,
|
||||
items: items.map((item) => ({
|
||||
title: item.title,
|
||||
description: item.description,
|
||||
pubDate: item.pubDate,
|
||||
link: item.link,
|
||||
})),
|
||||
items: items,
|
||||
})
|
||||
}
|
||||
@@ -1,19 +1,45 @@
|
||||
---
|
||||
import { getCollection } from "astro:content"
|
||||
import PageLayout from "@layouts/PageLayout.astro"
|
||||
import TopLayout from "@layouts/TopLayout.astro"
|
||||
import BottomLayout from "@layouts/BottomLayout.astro"
|
||||
import Search from "@components/Search"
|
||||
import { SEARCH } from "@consts"
|
||||
import type { SearchEntry } from "@lib/search"
|
||||
|
||||
// The search page now uses client-side search with Appwrite SDK directly
|
||||
// No need to pre-load all data as the Search component handles this via API calls
|
||||
// Blog posts -> slim searchable entries.
|
||||
// `body` is intentionally NOT serialized to the client; see src/lib/search.ts.
|
||||
const blogEntries = await getCollection("blog", ({ data }) => !data.draft)
|
||||
const posts: SearchEntry[] = blogEntries.map((entry) => ({
|
||||
id: entry.id,
|
||||
slug: entry.id,
|
||||
collection: "blog",
|
||||
title: entry.data.title,
|
||||
summary: entry.data.summary,
|
||||
date: entry.data.date.toISOString(),
|
||||
tags: entry.data.tags,
|
||||
}))
|
||||
|
||||
// Handle URL search parameters - add proper client-side handling for search query
|
||||
const url = new URL(typeof window !== 'undefined' ? window.location.href : 'http://localhost')
|
||||
const searchParam = url.searchParams.get('search') || ''
|
||||
// Projects -> slim searchable entries.
|
||||
const projectEntries = await getCollection("projects", ({ data }) => !data.draft)
|
||||
const projects: SearchEntry[] = projectEntries.map((entry) => ({
|
||||
id: entry.id,
|
||||
slug: entry.id,
|
||||
collection: "projects",
|
||||
title: entry.data.title,
|
||||
summary: entry.data.summary,
|
||||
date: entry.data.date.toISOString(),
|
||||
tags: entry.data.tags,
|
||||
}))
|
||||
|
||||
// Pass initial search query to component if present in URL
|
||||
const initialQuery = searchParam
|
||||
const entries: SearchEntry[] = [...posts, ...projects]
|
||||
|
||||
// Read the `?search=` param from the incoming SSR request.
|
||||
// NOTE: this frontmatter runs on the server, so `window` is never available
|
||||
// here. The previous `typeof window !== 'undefined' ? window.location.href : ...`
|
||||
// guard always fell through to a query-less localhost URL, so deep links,
|
||||
// refreshes and back/forward silently lost the user's query.
|
||||
const initialQuery = Astro.url.searchParams.get("search") ?? ""
|
||||
---
|
||||
|
||||
<PageLayout title={SEARCH.TITLE} description={SEARCH.DESCRIPTION}>
|
||||
@@ -24,7 +50,7 @@ const initialQuery = searchParam
|
||||
</TopLayout>
|
||||
<BottomLayout>
|
||||
<div class="animate" id="search-container">
|
||||
<Search client:load query={initialQuery}/>
|
||||
<Search client:load query={initialQuery} entries={entries} />
|
||||
</div>
|
||||
</BottomLayout>
|
||||
</PageLayout>
|
||||
@@ -1,22 +1,11 @@
|
||||
---
|
||||
import { getCollection } from "astro:content"
|
||||
import PageLayout from "@layouts/PageLayout.astro"
|
||||
import TopLayout from "@layouts/TopLayout.astro"
|
||||
import BottomLayout from "@layouts/BottomLayout.astro"
|
||||
import { WORK } from "@consts"
|
||||
import { getWorkExperiences, type WorkExperience } from "@lib/appwrite-service"
|
||||
|
||||
type Props = {
|
||||
entry: WorkExperience
|
||||
}
|
||||
|
||||
const work = await getWorkExperiences()
|
||||
.then(workList => {
|
||||
return workList;
|
||||
})
|
||||
.catch(error => {
|
||||
console.error("Error fetching work experiences:", error);
|
||||
return [];
|
||||
})
|
||||
const work = await getCollection("work")
|
||||
|
||||
function formatWorkDate(input: Date | string) {
|
||||
if (typeof input === "string") input = new Date(input)
|
||||
@@ -39,18 +28,18 @@ function formatWorkDate(input: Date | string) {
|
||||
<BottomLayout>
|
||||
<ul>
|
||||
{
|
||||
work.sort((a, b) => a.dateEnd > b.dateEnd ? -1 : b.dateEnd > a.dateEnd ? 1 : 0).map((entry) => (
|
||||
<li class="animate border-b border-black/10 dark:border-white/25 mt-4 py-8 first-of-type:mt-0 first-of-type:pt-0 last-of-type:border-none">
|
||||
<div class="text-sm uppercase mb-4">
|
||||
{formatWorkDate(entry.dateStart)} - {formatWorkDate(entry.dateEnd)}
|
||||
work.sort((a, b) => a.data.dateEnd > b.data.dateEnd ? -1 : b.data.dateEnd > a.data.dateEnd ? 1 : 0).map((entry) => (
|
||||
<li class="animate border-b border-line mt-4 py-8 first-of-type:mt-0 first-of-type:pt-0 last-of-type:border-none">
|
||||
<div class="text-sm uppercase mb-4 text-accent">
|
||||
{formatWorkDate(entry.data.dateStart)} - {formatWorkDate(entry.data.dateEnd)}
|
||||
</div>
|
||||
<div class="text-spaghetti-brown/100 dark:text-spaghetti-yellow font-semibold">
|
||||
{entry.company}
|
||||
<div class="text-ink font-semibold">
|
||||
{entry.data.company}
|
||||
</div>
|
||||
<div class="text-sm font-semibold text-spaghetti-brown/100 dark:text-spaghetti-yellow">
|
||||
{entry.role}
|
||||
<div class="text-sm font-semibold text-accent">
|
||||
{entry.data.role}
|
||||
</div>
|
||||
<article class="prose dark:prose-invert text-spaghetti-brown/100 dark:text-spaghetti-cream" set:html={entry.contentHtml}></article>
|
||||
<article class="prose dark:prose-invert text-ink" set:html={entry.rendered?.html}></article>
|
||||
</li>
|
||||
))
|
||||
}
|
||||
|
||||
@@ -1,14 +1,145 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
@import "tailwindcss";
|
||||
|
||||
:root{
|
||||
--copy-btn-margin:10px;
|
||||
/* Pastel Palette Colors for Spaghetti Theme */
|
||||
--spaghetti-yellow: #FDE68A;
|
||||
--spaghetti-red: #FECACA;
|
||||
--spaghetti-cream: #FEF3C7;
|
||||
--spaghetti-brown: #78350F;
|
||||
/* v4 replacement for v3's `darkMode: "class"`. Required so public/js/theme.js
|
||||
toggling `.dark` on <html> actually drives the `dark:` utilities. */
|
||||
@custom-variant dark (&:where(.dark, .dark *));
|
||||
|
||||
@plugin "@tailwindcss/typography";
|
||||
|
||||
/**
|
||||
* THE ONE PALETTE.
|
||||
*
|
||||
* Everything visual hangs off semantic tokens below. Utilities are generated from
|
||||
* `--color-*` in `@theme`, and Tailwind emits them as `var(--color-*)` references,
|
||||
* so re-declaring the same names under `html.dark` (see just after this block)
|
||||
* flips the whole site at runtime. That is why components no longer need `dark:`
|
||||
* colour variants: `bg-surface` is cream-white in light mode and espresso in dark,
|
||||
* from the same class.
|
||||
*
|
||||
* The pasta identity lives in the *values*, not the names: sauce-red links,
|
||||
* noodle-yellow chips, meatball-brown ink, parmesan highlights, and a warm
|
||||
* espresso plate for the night-sky mode. Ratios in the comments are measured
|
||||
* against the surface they sit on (WCAG AA: 4.5:1 body text, 3:1 large text and
|
||||
* interactive borders).
|
||||
*/
|
||||
@theme {
|
||||
/* --- Surfaces ---------------------------------------------------------- */
|
||||
--color-page: #FBF3E2; /* warm cream plate (light) / espresso (dark) */
|
||||
--color-surface: #FFFFFF; /* raised card on the plate */
|
||||
--color-wash: #F5EAD5; /* hover fill */
|
||||
|
||||
/* --- Ink --------------------------------------------------------------- */
|
||||
--color-ink: #3E2113; /* 13.3:1 on page, 14.7:1 on surface */
|
||||
--color-ink-muted: #6B4A32; /* 7.2:1 on page */
|
||||
--color-accent: #7A4E0F; /* dates, eyebrows, labels — 6.5:1 on page */
|
||||
|
||||
/* --- Sauce ------------------------------------------------------------- */
|
||||
--color-link: #B3261E; /* 5.9:1 on page */
|
||||
--color-link-hover: #8C1B15; /* 8.3:1 on page */
|
||||
|
||||
/* --- Edges ------------------------------------------------------------- */
|
||||
--color-edge: #9C8874; /* interactive borders — 3.07:1 on page (WCAG 1.4.11) */
|
||||
--color-line: #E4D9C6; /* decorative hairlines and dividers */
|
||||
|
||||
/* --- Noodles / parmesan ------------------------------------------------ */
|
||||
--color-chip: #FDE68A; /* tag + pill fill */
|
||||
--color-chip-ink: #3E2113; /* 11.8:1 on chip */
|
||||
/* Code blocks are a raised white card, not a tinted one. Measured: the
|
||||
`light-plus` syntax tokens (worst case #e50000 property names) hold 4.85:1
|
||||
on #FFFFFF but fall to 4.07:1 on the tinted #F5EAD5, so any cream wash
|
||||
under code puts real code text below AA. */
|
||||
--color-code-bg: #FFFFFF;
|
||||
--color-focus: #B3261E; /* focus ring, 5.9:1 on page */
|
||||
|
||||
/* --- Status light (footer) --------------------------------------------- */
|
||||
--color-status-ok: #15803D;
|
||||
--color-status-ok-ping: #4ADE80;
|
||||
--color-status-warn: #B45309;
|
||||
--color-status-warn-ping: #FBBF24;
|
||||
--color-status-down: #B3261E;
|
||||
--color-status-down-ping: #F87171;
|
||||
--color-status-maint: #3730A3;
|
||||
--color-status-maint-ping: #A5B4FC;
|
||||
--color-status-unknown: #6B7280;
|
||||
|
||||
/* --- Decorative source palette (hero sky, gradients, art) -------------- *
|
||||
* Raw ingredient colours. Never used for text: the pastels are tuned for
|
||||
* the dark sky and fall to 1.1-1.5:1 on the cream plate. */
|
||||
--color-spaghetti-yellow: #FDE68A;
|
||||
--color-spaghetti-red: #FECACA;
|
||||
--color-spaghetti-cream: #FEF3C7;
|
||||
--color-spaghetti-brown: #78350F;
|
||||
--color-spaghetti-dark-cream: #F5E6D3;
|
||||
--color-spaghetti-dark-red: #FCA5A5;
|
||||
--color-spaghetti-dark-yellow: #FCD34D;
|
||||
|
||||
--color-marinara: #E23B2C;
|
||||
--color-marinara-dark: #B3261E;
|
||||
--color-meatball: #A05A2E;
|
||||
--color-meatball-mid: #6B3418;
|
||||
--color-meatball-dark: #34190C;
|
||||
--color-parmesan: #FFF6E5;
|
||||
|
||||
/* --- Type -------------------------------------------------------------- */
|
||||
--font-sans: "Atkinson", system-ui, sans-serif;
|
||||
|
||||
/* --- Motion ------------------------------------------------------------ */
|
||||
--animate-twinkle: twinkle 2s ease-in-out forwards;
|
||||
--animate-meatball: meatball 3s ease-in-out forwards;
|
||||
--animate-tumble: meatball-tumble 1.4s linear infinite;
|
||||
|
||||
@keyframes twinkle {
|
||||
0% { opacity: 0; transform: rotate(0deg); }
|
||||
50% { opacity: 1; transform: rotate(180deg); }
|
||||
100% { opacity: 0; transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* Streak travels up its own length (head of the meatball leads, sauce trails). */
|
||||
@keyframes meatball {
|
||||
0% { opacity: 0; transform: translateY(200%); }
|
||||
50% { opacity: 1; }
|
||||
100% { opacity: 0; transform: translateY(0); }
|
||||
}
|
||||
|
||||
@keyframes meatball-tumble {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(200deg); }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dark mode: same names, cooked longer. Only the values change, so every
|
||||
* `bg-page` / `text-ink` / `border-edge` class in the components follows.
|
||||
*/
|
||||
html.dark {
|
||||
--color-page: #140C08;
|
||||
--color-surface: #1E130D;
|
||||
--color-wash: #241811;
|
||||
|
||||
--color-ink: #F5E6D3; /* 15.8:1 on page */
|
||||
--color-ink-muted: #C9B49B; /* 9.7:1 on page */
|
||||
--color-accent: #FCD34D; /* 13.4:1 on page */
|
||||
|
||||
--color-link: #FCA5A5; /* 10.2:1 on page */
|
||||
--color-link-hover: #FFD1D1; /* 14.1:1 on page */
|
||||
|
||||
--color-edge: #6E6359; /* 3.31:1 on page, 3.11:1 on surface */
|
||||
--color-line: #2E2620;
|
||||
|
||||
--color-chip: #3E3014;
|
||||
--color-chip-ink: #F5E6D3; /* 10.5:1 on chip */
|
||||
--color-code-bg: #1E130D;
|
||||
--color-focus: #FCD34D;
|
||||
|
||||
--color-status-ok: #22C55E;
|
||||
--color-status-ok-ping: #86EFAC;
|
||||
--color-status-warn: #F59E0B;
|
||||
--color-status-warn-ping: #FCD34D;
|
||||
--color-status-down: #E23B2C;
|
||||
--color-status-down-ping: #FCA5A5;
|
||||
--color-status-maint: #818CF8;
|
||||
--color-status-maint-ping: #A5B4FC;
|
||||
--color-status-unknown: #9CA3AF;
|
||||
}
|
||||
|
||||
@layer base {
|
||||
@@ -27,180 +158,209 @@
|
||||
font-style: normal;
|
||||
font-display: swap;
|
||||
}
|
||||
|
||||
html {
|
||||
overflow-y: scroll;
|
||||
color-scheme: light;
|
||||
background-color: var(--color-page);
|
||||
font-family: var(--font-sans);
|
||||
}
|
||||
|
||||
html.dark {
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
body {
|
||||
@apply relative flex h-full w-full flex-col antialiased;
|
||||
background-color: var(--color-page);
|
||||
color: var(--color-ink);
|
||||
}
|
||||
|
||||
main {
|
||||
@apply flex flex-1 flex-col;
|
||||
background-color: var(--color-page);
|
||||
color: var(--color-ink);
|
||||
}
|
||||
|
||||
header {
|
||||
@apply border-b transition-all duration-300 ease-in-out;
|
||||
}
|
||||
|
||||
header:not(.scrolled) {
|
||||
@apply border-transparent bg-transparent;
|
||||
}
|
||||
|
||||
header.scrolled {
|
||||
/* Sits on the plate, so it has to be a translucent version of it. A fixed
|
||||
white/75 over cream page read as 1.00:1 — an invisible bar over content. */
|
||||
background-color: color-mix(in oklab, var(--color-page) 78%, transparent);
|
||||
@apply border-line backdrop-blur-sm saturate-200;
|
||||
}
|
||||
|
||||
.page-heading {
|
||||
@apply font-semibold;
|
||||
color: var(--color-ink);
|
||||
}
|
||||
|
||||
::selection {
|
||||
background-color: var(--color-chip);
|
||||
color: var(--color-chip-ink);
|
||||
}
|
||||
|
||||
:focus-visible {
|
||||
outline: 2px solid var(--color-focus);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
html {
|
||||
overflow-y: scroll;
|
||||
color-scheme: light;
|
||||
background-color: var(--spaghetti-cream);
|
||||
font-family: "Atkinson", sans-serif;
|
||||
/**
|
||||
* PROSE.
|
||||
*
|
||||
* The typography plugin only exposes its colours through `--tw-prose-*`, so this
|
||||
* is the single place article styling is set. Declared for `.prose` and
|
||||
* `.prose-invert` together: the tokens already flip with `html.dark`, so the
|
||||
* invert variant is now a no-op kept only so existing markup keeps working.
|
||||
*
|
||||
* The `html` prefix is load-bearing, not decoration. Tailwind emits the plugin's
|
||||
* own `.prose { --tw-prose-*: oklch(…) }` defaults into the same `components`
|
||||
* layer but *after* this block, so at equal specificity the plugin would win and
|
||||
* articles would render slate instead of sauce. `html .prose` is (0,1,1) and
|
||||
* outranks it.
|
||||
*/
|
||||
@layer components {
|
||||
/* `article` is in the list because the base rule below applies the `prose`
|
||||
utility with @apply, which inlines the plugin's oklch defaults onto the
|
||||
element. Blog articles carry no `.prose` class of their own, so they need
|
||||
these tokens directly or they render slate. */
|
||||
html .prose,
|
||||
html .prose-invert,
|
||||
html article {
|
||||
--tw-prose-body: var(--color-ink);
|
||||
--tw-prose-headings: var(--color-ink);
|
||||
--tw-prose-lead: var(--color-ink-muted);
|
||||
--tw-prose-links: var(--color-link);
|
||||
--tw-prose-bold: var(--color-ink);
|
||||
--tw-prose-counters: var(--color-accent);
|
||||
--tw-prose-bullets: var(--color-accent);
|
||||
--tw-prose-hr: var(--color-line);
|
||||
--tw-prose-quotes: var(--color-ink);
|
||||
--tw-prose-quote-borders: var(--color-chip);
|
||||
--tw-prose-captions: var(--color-ink-muted);
|
||||
--tw-prose-code: var(--color-ink);
|
||||
--tw-prose-pre-code: var(--color-ink);
|
||||
--tw-prose-pre-bg: var(--color-code-bg);
|
||||
--tw-prose-th-borders: var(--color-edge);
|
||||
--tw-prose-td-borders: var(--color-line);
|
||||
|
||||
/* The plugin's invert set points at the same tokens; without this, markup
|
||||
carrying `prose-invert` would fall back to the plugin's slate defaults. */
|
||||
--tw-prose-invert-body: var(--color-ink);
|
||||
--tw-prose-invert-headings: var(--color-ink);
|
||||
--tw-prose-invert-lead: var(--color-ink-muted);
|
||||
--tw-prose-invert-links: var(--color-link);
|
||||
--tw-prose-invert-bold: var(--color-ink);
|
||||
--tw-prose-invert-counters: var(--color-accent);
|
||||
--tw-prose-invert-bullets: var(--color-accent);
|
||||
--tw-prose-invert-hr: var(--color-line);
|
||||
--tw-prose-invert-quotes: var(--color-ink);
|
||||
--tw-prose-invert-quote-borders: var(--color-chip);
|
||||
--tw-prose-invert-captions: var(--color-ink-muted);
|
||||
--tw-prose-invert-code: var(--color-ink);
|
||||
--tw-prose-invert-pre-code: var(--color-ink);
|
||||
--tw-prose-invert-pre-bg: var(--color-code-bg);
|
||||
--tw-prose-invert-th-borders: var(--color-edge);
|
||||
--tw-prose-invert-td-borders: var(--color-line);
|
||||
}
|
||||
|
||||
article {
|
||||
@apply prose max-w-full pb-12;
|
||||
}
|
||||
|
||||
article img {
|
||||
@apply mx-auto block py-5;
|
||||
}
|
||||
|
||||
/* Inline code needs a fill of its own; the plugin gives it none.
|
||||
|
||||
Two things are load-bearing here:
|
||||
- `article` is in the selector list because article bodies are styled by the
|
||||
base `article { @apply prose }` rule, not by a `.prose` class, so the
|
||||
plugin inlines its defaults as `article :where(code) …`. A `.prose`-only
|
||||
rule would never match a blog post.
|
||||
- The `html` prefix wins the tie: the plugin's
|
||||
`article :where(code):not(:where([class~=not-prose] *))::before { content: "`" }`
|
||||
is (0,0,2) and emitted after a bare `:where` rule of equal weight, so
|
||||
without it the literal backticks survive. */
|
||||
html .prose :where(code):not(:where(pre code, [class~="not-prose"], [class~="not-prose"] *)),
|
||||
html article :where(code):not(:where(pre code, [class~="not-prose"], [class~="not-prose"] *)) {
|
||||
background-color: var(--color-code-bg);
|
||||
border: 1px solid var(--color-line);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.1em 0.35em;
|
||||
}
|
||||
|
||||
html .prose :where(code):not(:where(pre code, [class~="not-prose"], [class~="not-prose"] *))::before,
|
||||
html .prose :where(code):not(:where(pre code, [class~="not-prose"], [class~="not-prose"] *))::after,
|
||||
html article :where(code):not(:where(pre code, [class~="not-prose"], [class~="not-prose"] *))::before,
|
||||
html article :where(code):not(:where(pre code, [class~="not-prose"], [class~="not-prose"] *))::after {
|
||||
content: none;
|
||||
}
|
||||
|
||||
/* With `defaultColor: false` Shiki no longer paints a background inline, so
|
||||
the block is ours to colour. `article pre` is listed alongside `.prose pre`
|
||||
for the same reason as the inline-code rule above: article bodies get prose
|
||||
styling from `article { @apply prose }`, so a blog post's <pre> does not
|
||||
match a `.prose` class selector and would otherwise lose its border. */
|
||||
.prose pre,
|
||||
html article pre {
|
||||
background-color: var(--color-code-bg);
|
||||
border: 1px solid var(--color-line);
|
||||
border-radius: 0.5rem;
|
||||
color: var(--color-ink);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dual-theme Shiki swap.
|
||||
*
|
||||
* `themes: { light, dark }` + `defaultColor: false` puts each token's colour
|
||||
* in `--shiki-light` / `--shiki-dark` custom properties rather than a hard
|
||||
* `color:`, so nothing is painted until a rule like these chooses one per
|
||||
* mode. No `!important` is needed — the inline styles carry only the custom
|
||||
* properties, never a `color`.
|
||||
*
|
||||
* Only colour is swapped — this Shiki version emits no `--shiki-*-style`
|
||||
* variables, so forcing font-style here would flatten italic tokens.
|
||||
*/
|
||||
.astro-code {
|
||||
color: var(--shiki-light);
|
||||
}
|
||||
|
||||
.astro-code span {
|
||||
color: var(--shiki-light);
|
||||
}
|
||||
|
||||
html.dark .astro-code,
|
||||
html.dark .astro-code span {
|
||||
color: var(--shiki-dark);
|
||||
}
|
||||
|
||||
.prose blockquote {
|
||||
border-left-color: var(--color-chip);
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.prose a {
|
||||
text-decoration-color: color-mix(in oklab, var(--color-link) 45%, transparent);
|
||||
text-underline-offset: 3px;
|
||||
transition: color 300ms ease-in-out, text-decoration-color 300ms ease-in-out;
|
||||
}
|
||||
|
||||
.prose a:hover {
|
||||
color: var(--color-link-hover);
|
||||
text-decoration-color: currentColor;
|
||||
}
|
||||
}
|
||||
|
||||
html.dark {
|
||||
color-scheme: dark;
|
||||
background-color: #000000; /* Darker black for better contrast */
|
||||
}
|
||||
|
||||
/* Apply pastel cream background to main content areas */
|
||||
main {
|
||||
@apply flex flex-col flex-1 bg-spaghetti-cream dark:bg-black;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
@apply h-full w-full antialiased;
|
||||
@apply text-black/75 dark:text-white/75;
|
||||
}
|
||||
|
||||
/* Better dark mode text contrast */
|
||||
.dark {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgba(255, 255, 255, var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
/* Improved border visibility in dark mode */
|
||||
.border-black\/15 {
|
||||
border-color: rgba(255, 255, 255, 0.15) !important;
|
||||
}
|
||||
|
||||
.border-white\/20 {
|
||||
border-color: rgba(255, 255, 255, 0.2) !important;
|
||||
}
|
||||
|
||||
/* Better contrast for links and important text */
|
||||
.prose a {
|
||||
color: var(--spaghetti-red) !important;
|
||||
}
|
||||
|
||||
.prose h1,
|
||||
.prose h2,
|
||||
.prose h3,
|
||||
.prose h4,
|
||||
.prose h5,
|
||||
.prose h6 {
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.prose code {
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.prose blockquote {
|
||||
border-left-color: var(--spaghetti-yellow) !important;
|
||||
}
|
||||
|
||||
.prose th,
|
||||
.prose td {
|
||||
color: #ffffff !important;
|
||||
}
|
||||
|
||||
.page-heading {
|
||||
@apply font-semibold text-black dark:text-white;
|
||||
}
|
||||
|
||||
/* Better contrast for text elements */
|
||||
.text-spaghetti-brown {
|
||||
color: #f59e0b !important; /* Amber-400 for better visibility */
|
||||
}
|
||||
|
||||
/* Better background for code blocks in dark mode */
|
||||
.prose pre {
|
||||
background-color: #1f2937 !important; /* gray-800 */
|
||||
color: #f9fafb !important; /* gray-50 */
|
||||
}
|
||||
|
||||
/* Improved dark mode for cards and buttons */
|
||||
.group:hover .border-black\/15,
|
||||
.group:hover .border-white\/20 {
|
||||
border-color: rgba(255, 255, 255, 0.3) !important;
|
||||
}
|
||||
|
||||
/* Pastel Theme Colors */
|
||||
.text-spaghetti-yellow {
|
||||
color: var(--spaghetti-yellow);
|
||||
}
|
||||
|
||||
.text-spaghetti-red {
|
||||
color: var(--spaghetti-red);
|
||||
}
|
||||
|
||||
.text-spaghetti-brown {
|
||||
color: var(--spaghetti-brown);
|
||||
}
|
||||
|
||||
.bg-spaghetti-cream {
|
||||
background-color: var(--spaghetti-cream);
|
||||
}
|
||||
|
||||
body {
|
||||
@apply relative flex flex-col;
|
||||
@apply bg-white dark:bg-black;
|
||||
}
|
||||
|
||||
main {
|
||||
@apply flex flex-col flex-1 bg-white dark:bg-black;
|
||||
}
|
||||
|
||||
header {
|
||||
@apply border-b;
|
||||
@apply transition-all duration-300 ease-in-out;
|
||||
}
|
||||
|
||||
header:not(.scrolled) {
|
||||
@apply bg-transparent border-transparent;
|
||||
}
|
||||
|
||||
header.scrolled {
|
||||
@apply bg-white/75 dark:bg-black/50;
|
||||
@apply border-black/10 dark:border-white/25;
|
||||
@apply backdrop-blur-sm saturate-200;
|
||||
}
|
||||
|
||||
article {
|
||||
@apply prose dark:prose-invert max-w-full pb-12;
|
||||
/* Ensure our theme colors are applied properly in prose */
|
||||
color: var(--spaghetti-brown);
|
||||
}
|
||||
|
||||
/* Override default prose styles that conflict with our theme */
|
||||
.prose {
|
||||
color: var(--spaghetti-brown);
|
||||
}
|
||||
|
||||
.prose a {
|
||||
color: var(--spaghetti-red);
|
||||
}
|
||||
|
||||
.prose h1,
|
||||
.prose h2,
|
||||
.prose h3,
|
||||
.prose h4,
|
||||
.prose h5,
|
||||
.prose h6 {
|
||||
color: var(--spaghetti-brown);
|
||||
}
|
||||
|
||||
.prose code {
|
||||
color: var(--spaghetti-brown);
|
||||
}
|
||||
|
||||
.prose pre {
|
||||
background-color: var(--spaghetti-cream);
|
||||
}
|
||||
|
||||
.prose blockquote {
|
||||
border-left-color: var(--spaghetti-yellow);
|
||||
}
|
||||
|
||||
.prose th,
|
||||
.prose td {
|
||||
color: var(--spaghetti-brown);
|
||||
}
|
||||
|
||||
.page-heading {
|
||||
@apply font-semibold text-black dark:text-white;
|
||||
}
|
||||
|
||||
.blend {
|
||||
@apply transition-all duration-300 ease-in-out;
|
||||
@@ -228,55 +388,144 @@ article {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
article img {
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* TWINKLE STARS
|
||||
* PARMESAN FLECKS
|
||||
*/
|
||||
|
||||
#twinkle-star.template {
|
||||
#parmesan-fleck.template {
|
||||
@apply absolute -left-full; /* hide offscreen */
|
||||
}
|
||||
|
||||
#twinkle-star.twinkle {
|
||||
@apply animate-twinkle; /* defined in tailwind.config */
|
||||
#parmesan-fleck.fleck {
|
||||
@apply animate-twinkle; /* defined in @theme above */
|
||||
filter: drop-shadow(0 0 3px color-mix(in srgb, var(--color-parmesan) 55%, transparent));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Meteors
|
||||
* Meatballs — shooting meatballs on trails of marinara
|
||||
* The wrapper is the streak: its head (top edge) is the meatball, the sauce trails below it.
|
||||
*/
|
||||
|
||||
#meteors .shower {
|
||||
@apply absolute inset-0 top-0;;
|
||||
#meatballs .shower {
|
||||
@apply absolute inset-0 top-0;
|
||||
@apply left-1/2 -translate-x-1/2;
|
||||
@apply w-screen aspect-square;
|
||||
}
|
||||
|
||||
#meteors .meteor {
|
||||
@apply animate-meteor; /* defined in tailwind.config */
|
||||
@apply absolute top-1/2 left-1/2 w-px h-[75vh];
|
||||
@apply bg-gradient-to-b from-white to-transparent;
|
||||
#meatballs .meatball {
|
||||
@apply animate-meatball; /* defined in @theme above */
|
||||
@apply absolute top-1/2 left-1/2;
|
||||
/* --trail-length / --trail-width / --ball-size are set per instance by the script. */
|
||||
width: var(--trail-width, 16px);
|
||||
height: var(--trail-length, 40vh);
|
||||
}
|
||||
|
||||
#meteors .shower.ur {
|
||||
#meatballs .trail {
|
||||
@apply absolute left-1/2 top-0;
|
||||
width: var(--trail-width, 16px);
|
||||
height: 100%;
|
||||
transform: translateX(-50%);
|
||||
background: linear-gradient(to bottom,
|
||||
var(--color-marinara) 0%,
|
||||
var(--color-marinara-dark) 45%,
|
||||
transparent 100%);
|
||||
clip-path: polygon(0 0, 100% 0, 62% 100%, 38% 100%);
|
||||
filter: blur(1.2px);
|
||||
opacity: .85;
|
||||
}
|
||||
|
||||
/* Bright, freshly sauced core right under the meatball. */
|
||||
#meatballs .trail::after {
|
||||
content: "";
|
||||
@apply absolute inset-0;
|
||||
background: linear-gradient(to bottom,
|
||||
rgba(255, 112, 86, .85) 0%,
|
||||
rgba(226, 59, 44, .3) 30%,
|
||||
transparent 62%);
|
||||
clip-path: polygon(32% 0, 68% 0, 55% 100%, 45% 100%);
|
||||
}
|
||||
|
||||
/* Anchor for the sphere; keeps the lighting fixed while the texture tumbles. */
|
||||
#meatballs .ball {
|
||||
@apply absolute left-1/2 top-0;
|
||||
width: var(--ball-size, 12px);
|
||||
height: var(--ball-size, 12px);
|
||||
transform: translate(-50%, -50%);
|
||||
overflow: hidden;
|
||||
border-radius: 46% 54% 51% 49% / 53% 47% 55% 45%; /* hand-rolled, never a perfect sphere */
|
||||
background:
|
||||
radial-gradient(circle at 31% 27%, color-mix(in srgb, var(--color-meatball) 15%, #FFD6AA) 0 9%, transparent 44%),
|
||||
radial-gradient(circle at 72% 76%, rgba(0, 0, 0, .42) 0 26%, transparent 60%),
|
||||
radial-gradient(circle at 50% 45%, var(--color-meatball) 0 40%, var(--color-meatball-mid) 72%, var(--color-meatball-dark) 100%);
|
||||
box-shadow:
|
||||
inset -1px -2px 3px rgba(20, 8, 4, .8),
|
||||
inset 2px 2px 3px rgba(255, 200, 150, .16),
|
||||
0 0 7px color-mix(in srgb, var(--color-marinara) 50%, transparent);
|
||||
}
|
||||
|
||||
/* Seared crumb texture, rotating so the meatball looks like it tumbles in flight. */
|
||||
#meatballs .ball::after {
|
||||
content: "";
|
||||
@apply absolute inset-0;
|
||||
border-radius: inherit;
|
||||
background:
|
||||
radial-gradient(circle at 62% 34%, rgba(35, 16, 8, .75) 0 7%, transparent 8%),
|
||||
radial-gradient(circle at 34% 62%, rgba(35, 16, 8, .65) 0 6%, transparent 7%),
|
||||
radial-gradient(circle at 55% 70%, rgba(140, 88, 52, .55) 0 5%, transparent 6%),
|
||||
radial-gradient(circle at 22% 38%, rgba(140, 88, 52, .5) 0 4%, transparent 5%);
|
||||
animation: var(--animate-tumble);
|
||||
}
|
||||
|
||||
/* Sauce droplets flung to the sides of the stream. Offsets are fractions of the trail, so they
|
||||
stay put however long or wide a streak is. The dot itself is invisible; only shadows are drawn. */
|
||||
#meatballs .splatter {
|
||||
@apply absolute left-1/2 top-0 rounded-full;
|
||||
--spray: max(11px, calc(var(--trail-width, 16px) * 1.1));
|
||||
width: 3px;
|
||||
height: 3px;
|
||||
background: transparent;
|
||||
opacity: .8;
|
||||
filter: blur(.35px);
|
||||
}
|
||||
|
||||
#meatballs .meatball.v1 .splatter {
|
||||
box-shadow:
|
||||
calc(var(--spray) * -1) calc(var(--trail-length, 40vh) * .3) 0 -1px var(--color-marinara),
|
||||
var(--spray) calc(var(--trail-length, 40vh) * .48) 0 -.5px var(--color-marinara-dark),
|
||||
calc(var(--spray) * -1.5) calc(var(--trail-length, 40vh) * .66) 0 -.5px rgba(179, 38, 30, .7),
|
||||
calc(var(--spray) * 1.2) calc(var(--trail-length, 40vh) * .84) 0 -1px rgba(226, 59, 44, .5);
|
||||
}
|
||||
|
||||
#meatballs .meatball.v2 .splatter {
|
||||
box-shadow:
|
||||
var(--spray) calc(var(--trail-length, 40vh) * .26) 0 -.5px var(--color-marinara-dark),
|
||||
calc(var(--spray) * -1.3) calc(var(--trail-length, 40vh) * .44) 0 -1px var(--color-marinara),
|
||||
calc(var(--spray) * 1.6) calc(var(--trail-length, 40vh) * .62) 0 -.5px rgba(179, 38, 30, .65),
|
||||
calc(var(--spray) * -1.1) calc(var(--trail-length, 40vh) * .86) 0 -.5px rgba(226, 59, 44, .45);
|
||||
}
|
||||
|
||||
#meatballs .meatball.v3 .splatter {
|
||||
box-shadow:
|
||||
calc(var(--spray) * -1.6) calc(var(--trail-length, 40vh) * .34) 0 -1px var(--color-marinara-dark),
|
||||
calc(var(--spray) * 1.2) calc(var(--trail-length, 40vh) * .5) 0 -.5px var(--color-marinara),
|
||||
calc(var(--spray) * 1.05) calc(var(--trail-length, 40vh) * .7) 0 -1px rgba(179, 38, 30, .6),
|
||||
calc(var(--spray) * -1.35) calc(var(--trail-length, 40vh) * .9) 0 -1.5px rgba(226, 59, 44, .4);
|
||||
}
|
||||
|
||||
#meatballs .shower.ur {
|
||||
@apply rotate-45;
|
||||
}
|
||||
|
||||
#meteors .shower.dr {
|
||||
#meatballs .shower.dr {
|
||||
@apply rotate-135;
|
||||
}
|
||||
|
||||
#meteors .shower.dl {
|
||||
#meatballs .shower.dl {
|
||||
@apply rotate-225;
|
||||
}
|
||||
|
||||
#meteors .shower.ul {
|
||||
#meatballs .shower.ul {
|
||||
@apply rotate-315;
|
||||
}
|
||||
|
||||
@@ -291,5 +540,7 @@ article img {
|
||||
}
|
||||
|
||||
.copy-svg {
|
||||
@apply w-full aspect-square text-white opacity-70 hover:opacity-90;
|
||||
/* The button sits inside the code block, whose background is now the light
|
||||
`code-bg` token in light mode. `text-white` was invisible there (1.1:1). */
|
||||
@apply w-full aspect-square text-ink-muted opacity-70 hover:opacity-90;
|
||||
}
|
||||
@@ -7,11 +7,25 @@ export interface Site extends Page {
|
||||
AUTHOR: string
|
||||
}
|
||||
|
||||
/**
|
||||
* A nav entry. HREF may be site-relative (Home, Work, Blog, Projects) or an
|
||||
* absolute off-site URL (Docs → docs.spaghet.io). EXTERNAL marks the off-site
|
||||
* entries so the renderers can add target/rel and skip active-page styling;
|
||||
* it is intentionally explicit rather than sniffed at call sites so the two
|
||||
* navs (Header.astro, Drawer.astro) can never disagree.
|
||||
*/
|
||||
export type Links = {
|
||||
TEXT: string
|
||||
HREF: string
|
||||
EXTERNAL?: boolean
|
||||
}[]
|
||||
|
||||
export type Cta = {
|
||||
TEXT: string
|
||||
HREF: string
|
||||
ICON: string
|
||||
}
|
||||
|
||||
export type Socials = {
|
||||
NAME: string
|
||||
ICON: string
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
import defaultTheme from "tailwindcss/defaultTheme"
|
||||
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
export default {
|
||||
darkMode: ["class"],
|
||||
content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"],
|
||||
theme: {
|
||||
extend: {
|
||||
fontFamily: {
|
||||
"sans": ["Atkinson", ...defaultTheme.fontFamily.sans],
|
||||
},
|
||||
typography: {
|
||||
DEFAULT: {
|
||||
css: {
|
||||
maxWidth: "full",
|
||||
"--tw-prose-body": "var(--spaghetti-brown)",
|
||||
"--tw-prose-headings": "var(--spaghetti-brown)",
|
||||
"--tw-prose-lead": "var(--spaghetti-brown)",
|
||||
"--tw-prose-links": "var(--spaghetti-red)",
|
||||
"--tw-prose-bold": "var(--spaghetti-brown)",
|
||||
"--tw-prose-counters": "var(--spaghetti-brown)",
|
||||
"--tw-prose-bullets": "var(--spaghetti-brown)",
|
||||
"--tw-prose-hr": "var(--spaghetti-brown)",
|
||||
"--tw-prose-quotes": "var(--spaghetti-brown)",
|
||||
"--tw-prose-quote-border": "var(--spaghetti-yellow)",
|
||||
"--tw-prose-captions": "var(--spaghetti-brown)",
|
||||
"--tw-prose-code": "var(--spaghetti-brown)",
|
||||
"--tw-prose-pre-code": "var(--spaghetti-brown)",
|
||||
"--tw-prose-pre-bg": "var(--spaghetti-cream)",
|
||||
"--tw-prose-th-borders": "var(--spaghetti-brown)",
|
||||
"--tw-prose-td-borders": "var(--spaghetti-brown)",
|
||||
},
|
||||
},
|
||||
dark: {
|
||||
css: {
|
||||
"--tw-prose-body": "var(--spaghetti-brown)",
|
||||
"--tw-prose-headings": "var(--spaghetti-brown)",
|
||||
"--tw-prose-lead": "var(--spaghetti-brown)",
|
||||
"--tw-prose-links": "var(--spaghetti-red)",
|
||||
"--tw-prose-bold": "var(--spaghetti-brown)",
|
||||
"--tw-prose-counters": "var(--spaghetti-brown)",
|
||||
"--tw-prose-bullets": "var(--spaghetti-brown)",
|
||||
"--tw-prose-hr": "var(--spaghetti-brown)",
|
||||
"--tw-prose-quotes": "var(--spaghetti-brown)",
|
||||
"--tw-prose-quote-border": "var(--spaghetti-yellow)",
|
||||
"--tw-prose-captions": "var(--spaghetti-brown)",
|
||||
"--tw-prose-code": "var(--spaghetti-brown)",
|
||||
"--tw-prose-pre-code": "var(--spaghetti-brown)",
|
||||
"--tw-prose-pre-bg": "var(--spaghetti-cream)",
|
||||
"--tw-prose-th-borders": "var(--spaghetti-brown)",
|
||||
"--tw-prose-td-borders": "var(--spaghetti-brown)",
|
||||
},
|
||||
}
|
||||
},
|
||||
rotate: {
|
||||
"45": "45deg",
|
||||
"135": "135deg",
|
||||
"225": "225deg",
|
||||
"315": "315deg",
|
||||
},
|
||||
animation: {
|
||||
twinkle: "twinkle 2s ease-in-out forwards",
|
||||
meteor: "meteor 3s ease-in-out forwards",
|
||||
},
|
||||
keyframes: {
|
||||
twinkle: {
|
||||
"0%": {
|
||||
opacity: 0,
|
||||
transform: "rotate(0deg)"
|
||||
},
|
||||
"50%": {
|
||||
opacity: 1,
|
||||
transform: "rotate(180deg)"
|
||||
},
|
||||
"100%": {
|
||||
opacity: 0,
|
||||
transform: "rotate(360deg)"
|
||||
},
|
||||
},
|
||||
meteor: {
|
||||
"0%": {
|
||||
opacity: 0,
|
||||
transform: "translateY(200%)"
|
||||
},
|
||||
"50%": {
|
||||
opacity: 1
|
||||
},
|
||||
"100%": {
|
||||
opacity: 0,
|
||||
transform: "translateY(0)"
|
||||
},
|
||||
},
|
||||
},
|
||||
colors: {
|
||||
spaghetti: {
|
||||
yellow: "#FDE68A",
|
||||
red: "#FECACA",
|
||||
cream: "#FEF3C7",
|
||||
brown: "#78350F",
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
plugins: [require("@tailwindcss/typography")],
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// vitest.config.ts
|
||||
import { defineConfig } from "vitest/config"
|
||||
import { fileURLToPath } from "node:url"
|
||||
import solid from "vite-plugin-solid"
|
||||
|
||||
// Mirrors the tsconfig path aliases so modules under test can import via @lib/...
|
||||
const src = fileURLToPath(new URL("./src", import.meta.url))
|
||||
|
||||
export default defineConfig({
|
||||
// Compiles Solid JSX for the island render tests; Astro uses the same plugin for the app.
|
||||
plugins: [solid({ ssr: true })],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@lib": `${src}/lib`,
|
||||
"@components": `${src}/components`,
|
||||
"@layouts": `${src}/layouts`,
|
||||
"@pages": `${src}/pages`,
|
||||
"@styles": `${src}/styles`,
|
||||
"@consts": `${src}/consts.ts`,
|
||||
"@types": `${src}/types.ts`,
|
||||
},
|
||||
},
|
||||
test: {
|
||||
environment: "node",
|
||||
include: ["src/**/__tests__/**/*.test.ts", "src/**/*.test.ts"],
|
||||
// Rolldown (Vite 8's bundler, loaded when Vitest reads this config) sizes
|
||||
// its native thread pool to `nproc`. On hosts that report many CPUs but
|
||||
// cannot actually spawn that many threads, the default `forks` pool aborts
|
||||
// with "spawn node EAGAIN". The `threads` pool with a single worker avoids
|
||||
// forking one child process per file; the matching RAYON/TOKIO caps live in
|
||||
// the package.json scripts.
|
||||
pool: "threads",
|
||||
maxWorkers: 1,
|
||||
fileParallelism: false,
|
||||
},
|
||||
})
|
||||