From 8dfb3a2d099613dfd213ea205cb15482a8105493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=ADvia?= Date: Tue, 19 May 2026 01:29:56 -0300 Subject: [PATCH] refactor: restructure components, extract content/services, and rework CSS system --- {static => assets}/88x31/paige.gif | Bin {static => assets}/bnuy.webp | Bin {static => assets}/button.html | 0 assets/ui/arrow.svg | 7 + extra/arrow.svg | 13 - src/components/Fm.tsx | 153 ------------ src/components/KVTable.tsx | 62 ----- src/components/MediaItem.tsx | 196 --------------- src/components/NavigationBar.tsx | 69 ------ src/components/Projects.tsx | 174 ------------- src/components/content/FeaturedSong.tsx | 142 +++++++++++ src/components/content/Projects.tsx | 166 +++++++++++++ src/components/content/RecentTracks.tsx | 152 ++++++++++++ src/components/content/SongArt.tsx | 102 ++++++++ src/components/home/ButtonWall.tsx | 66 +++++ src/components/{ => home}/Heading.tsx | 68 ++--- src/components/{ => layout}/Footer.tsx | 64 ++--- src/components/layout/NavigationBar.tsx | 83 +++++++ src/components/ui/CollapsibleParagraph.tsx | 54 ++++ .../{SectionTitle.tsx => ui/Heading.tsx} | 11 +- src/components/{ => ui}/Icon.tsx | 0 src/components/ui/PropertyTable.tsx | 89 +++++++ src/constants.ts | 97 -------- src/content/friends.ts | 18 ++ src/content/projects.ts | 71 ++++++ src/content/songs.ts | 48 ++++ src/layout.tsx | 35 ++- src/{global.ts => lib/context.ts} | 1 + src/lib/css.ts | 143 +++++++++++ src/lib/interval.ts | 30 +++ src/{hash => lib}/meowmix1.ts | 39 +-- src/mech/css.ts | 232 ------------------ src/mech/mini.ts | 59 ----- src/middleware/minification.ts | 95 +++++++ src/{mech => middleware}/routing.ts | 0 src/middleware/scoped-css.ts | 55 +++++ src/mod.ts | 21 +- src/routes/mod.tsx | 86 ++++--- src/routes/reports.tsx | 7 +- src/{mech/fm.ts => services/lastfm.ts} | 44 ++-- src/utils/temp.ts | 23 -- static/fonts/bricolage-grotesque/import.css | 109 ++++++++ .../bricolage-grotesque-latin-200-normal.woff | Bin 0 -> 26888 bytes ...bricolage-grotesque-latin-200-normal.woff2 | Bin 0 -> 22032 bytes .../bricolage-grotesque-latin-300-normal.woff | Bin 0 -> 27272 bytes ...bricolage-grotesque-latin-300-normal.woff2 | Bin 0 -> 22232 bytes .../bricolage-grotesque-latin-400-normal.woff | Bin 0 -> 27264 bytes ...bricolage-grotesque-latin-400-normal.woff2 | Bin 0 -> 22364 bytes .../bricolage-grotesque-latin-500-normal.woff | Bin 0 -> 27284 bytes ...bricolage-grotesque-latin-500-normal.woff2 | Bin 0 -> 22476 bytes .../bricolage-grotesque-latin-600-normal.woff | Bin 0 -> 27256 bytes ...bricolage-grotesque-latin-600-normal.woff2 | Bin 0 -> 22456 bytes .../bricolage-grotesque-latin-700-normal.woff | Bin 0 -> 27044 bytes ...bricolage-grotesque-latin-700-normal.woff2 | Bin 0 -> 22384 bytes .../bricolage-grotesque-latin-800-normal.woff | Bin 0 -> 26436 bytes ...bricolage-grotesque-latin-800-normal.woff2 | Bin 0 -> 21844 bytes ...colage-grotesque-latin-ext-200-normal.woff | Bin 0 -> 13648 bytes ...olage-grotesque-latin-ext-200-normal.woff2 | Bin 0 -> 10472 bytes ...colage-grotesque-latin-ext-300-normal.woff | Bin 0 -> 13684 bytes ...olage-grotesque-latin-ext-300-normal.woff2 | Bin 0 -> 10568 bytes ...colage-grotesque-latin-ext-400-normal.woff | Bin 0 -> 13724 bytes ...olage-grotesque-latin-ext-400-normal.woff2 | Bin 0 -> 10536 bytes ...colage-grotesque-latin-ext-500-normal.woff | Bin 0 -> 13744 bytes ...olage-grotesque-latin-ext-500-normal.woff2 | Bin 0 -> 10640 bytes ...colage-grotesque-latin-ext-600-normal.woff | Bin 0 -> 13764 bytes ...olage-grotesque-latin-ext-600-normal.woff2 | Bin 0 -> 10616 bytes ...colage-grotesque-latin-ext-700-normal.woff | Bin 0 -> 13704 bytes ...olage-grotesque-latin-ext-700-normal.woff2 | Bin 0 -> 10632 bytes ...colage-grotesque-latin-ext-800-normal.woff | Bin 0 -> 13612 bytes ...olage-grotesque-latin-ext-800-normal.woff2 | Bin 0 -> 10496 bytes ...olage-grotesque-vietnamese-200-normal.woff | Bin 0 -> 6672 bytes ...lage-grotesque-vietnamese-200-normal.woff2 | Bin 0 -> 4948 bytes ...olage-grotesque-vietnamese-300-normal.woff | Bin 0 -> 6744 bytes ...lage-grotesque-vietnamese-300-normal.woff2 | Bin 0 -> 5056 bytes ...olage-grotesque-vietnamese-400-normal.woff | Bin 0 -> 6728 bytes ...lage-grotesque-vietnamese-400-normal.woff2 | Bin 0 -> 5052 bytes ...olage-grotesque-vietnamese-500-normal.woff | Bin 0 -> 6764 bytes ...lage-grotesque-vietnamese-500-normal.woff2 | Bin 0 -> 5104 bytes ...olage-grotesque-vietnamese-600-normal.woff | Bin 0 -> 6844 bytes ...lage-grotesque-vietnamese-600-normal.woff2 | Bin 0 -> 5116 bytes ...olage-grotesque-vietnamese-700-normal.woff | Bin 0 -> 6816 bytes ...lage-grotesque-vietnamese-700-normal.woff2 | Bin 0 -> 5108 bytes ...olage-grotesque-vietnamese-800-normal.woff | Bin 0 -> 6800 bytes ...lage-grotesque-vietnamese-800-normal.woff2 | Bin 0 -> 5060 bytes static/fonts/iosevka-custom/import.css | 8 +- .../{TTF => ttf}/IosevkaCustom-Bold.ttf | Bin .../{TTF => ttf}/IosevkaCustom-BoldItalic.ttf | Bin .../{TTF => ttf}/IosevkaCustom-Extended.ttf | Bin .../IosevkaCustom-ExtendedBold.ttf | Bin .../IosevkaCustom-ExtendedBoldItalic.ttf | Bin .../IosevkaCustom-ExtendedItalic.ttf | Bin .../{TTF => ttf}/IosevkaCustom-Italic.ttf | Bin .../{TTF => ttf}/IosevkaCustom-Regular.ttf | Bin static/fonts/space-grotesk/import.css | 3 +- .../space-grotesk-v22-latin-700.woff2 | Bin 95 files changed, 1645 insertions(+), 1250 deletions(-) rename {static => assets}/88x31/paige.gif (100%) rename {static => assets}/bnuy.webp (100%) rename {static => assets}/button.html (100%) create mode 100644 assets/ui/arrow.svg delete mode 100644 extra/arrow.svg delete mode 100644 src/components/Fm.tsx delete mode 100644 src/components/KVTable.tsx delete mode 100644 src/components/MediaItem.tsx delete mode 100644 src/components/NavigationBar.tsx delete mode 100644 src/components/Projects.tsx create mode 100644 src/components/content/FeaturedSong.tsx create mode 100644 src/components/content/Projects.tsx create mode 100644 src/components/content/RecentTracks.tsx create mode 100644 src/components/content/SongArt.tsx create mode 100644 src/components/home/ButtonWall.tsx rename src/components/{ => home}/Heading.tsx (79%) rename src/components/{ => layout}/Footer.tsx (54%) create mode 100644 src/components/layout/NavigationBar.tsx create mode 100644 src/components/ui/CollapsibleParagraph.tsx rename src/components/{SectionTitle.tsx => ui/Heading.tsx} (51%) rename src/components/{ => ui}/Icon.tsx (100%) create mode 100644 src/components/ui/PropertyTable.tsx delete mode 100644 src/constants.ts create mode 100644 src/content/friends.ts create mode 100644 src/content/projects.ts create mode 100644 src/content/songs.ts rename src/{global.ts => lib/context.ts} (99%) create mode 100644 src/lib/css.ts create mode 100644 src/lib/interval.ts rename src/{hash => lib}/meowmix1.ts (59%) delete mode 100644 src/mech/css.ts delete mode 100644 src/mech/mini.ts create mode 100644 src/middleware/minification.ts rename src/{mech => middleware}/routing.ts (100%) create mode 100644 src/middleware/scoped-css.ts rename src/{mech/fm.ts => services/lastfm.ts} (65%) delete mode 100644 src/utils/temp.ts create mode 100644 static/fonts/bricolage-grotesque/import.css create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-200-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-200-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-300-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-300-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-400-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-400-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-500-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-500-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-600-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-600-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-700-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-700-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-800-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-800-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-200-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-200-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-300-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-300-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-400-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-400-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-500-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-500-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-600-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-600-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-700-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-700-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-800-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-latin-ext-800-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-200-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-200-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-300-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-300-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-400-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-400-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-500-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-500-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-600-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-600-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-700-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-700-normal.woff2 create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-800-normal.woff create mode 100644 static/fonts/bricolage-grotesque/webfonts/bricolage-grotesque-vietnamese-800-normal.woff2 rename static/fonts/iosevka-custom/{TTF => ttf}/IosevkaCustom-Bold.ttf (100%) rename static/fonts/iosevka-custom/{TTF => ttf}/IosevkaCustom-BoldItalic.ttf (100%) rename static/fonts/iosevka-custom/{TTF => ttf}/IosevkaCustom-Extended.ttf (100%) rename static/fonts/iosevka-custom/{TTF => ttf}/IosevkaCustom-ExtendedBold.ttf (100%) rename static/fonts/iosevka-custom/{TTF => ttf}/IosevkaCustom-ExtendedBoldItalic.ttf (100%) rename static/fonts/iosevka-custom/{TTF => ttf}/IosevkaCustom-ExtendedItalic.ttf (100%) rename static/fonts/iosevka-custom/{TTF => ttf}/IosevkaCustom-Italic.ttf (100%) rename static/fonts/iosevka-custom/{TTF => ttf}/IosevkaCustom-Regular.ttf (100%) rename static/fonts/space-grotesk/{WOFF2 => webfonts}/space-grotesk-v22-latin-700.woff2 (100%) diff --git a/static/88x31/paige.gif b/assets/88x31/paige.gif similarity index 100% rename from static/88x31/paige.gif rename to assets/88x31/paige.gif diff --git a/static/bnuy.webp b/assets/bnuy.webp similarity index 100% rename from static/bnuy.webp rename to assets/bnuy.webp diff --git a/static/button.html b/assets/button.html similarity index 100% rename from static/button.html rename to assets/button.html diff --git a/assets/ui/arrow.svg b/assets/ui/arrow.svg new file mode 100644 index 0000000..e1a7eb7 --- /dev/null +++ b/assets/ui/arrow.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/extra/arrow.svg b/extra/arrow.svg deleted file mode 100644 index 9fefc00..0000000 --- a/extra/arrow.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/src/components/Fm.tsx b/src/components/Fm.tsx deleted file mode 100644 index 65cb5fe..0000000 --- a/src/components/Fm.tsx +++ /dev/null @@ -1,153 +0,0 @@ -/** - * Copyright (c) 2025 adoravel - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -import { boundaries, elevation, fontSize, radius, spacing, theme } from "~/layout.tsx"; -import { css, Import } from "../mech/css.ts"; -import { FM_USER, tracks } from "../mech/fm.ts"; - -const fm = css(` - :scope { - margin-top: 0.5rem !important; - } - - .fm-more:hover { - opacity: 1; - } - - .fm-more::before { - content: "→"; - position: absolute; - color: transparent; - font-size: 15rem; - -webkit-text-stroke: 2px ${theme.surfaceBorder}; - z-index: ${elevation.below}; - } - - .fm-more { - position: relative; - display: flex; - align-items: center; - justify-content: center; - flex-direction: column; - overflow: hidden; - width: 100%; - height: 100%; - opacity: 75%; - - background: ${theme.base}; - border: 1px solid ${theme.baseBorder}; - border-radius: ${radius.art}; - font-size: ${fontSize.sm}; - color: ${theme.text}; - padding: ${spacing[3]}; - z-index: ${elevation.base}; - - @media (max-width: 930px) { - display: none; - } - } - - :scope { - display: grid; - grid-template-columns: repeat(auto-fill, minmax(120px, 160px)); - gap: ${spacing[6]}; - margin-top: ${spacing[2]}; - padding: 0; - margin: 0; - list-style: none; - } - - li > a { - display: flex; - flex-direction: column; - align-items: center; - text-align: center; - gap: ${spacing[3]}; - max-width: ${boundaries.avatarSize}; - } - - li > a > .cover { - width: ${boundaries.avatarSize}; - height: ${boundaries.avatarSize}; - border-radius: ${radius.art}; - background: ${theme.lift}; - object-fit: cover; - } - - li > a > .meta { - display: flex; - flex-direction: column; - font-size: ${fontSize.md}; - color: ${theme.subtext}; - } - - li > a > .meta > .loved { - color: ${theme.accent}; - } - - li > a > .meta strong { - font-weight: 600; - font-size: ${fontSize.base}; - color: ${theme.text}; - } - - li > a > .meta strong, - li > a > .meta span { - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; - line-clamp: 2; - overflow: hidden; - word-wrap: anywhere; - text-overflow: ellipsis; - max-width: 100%; - } -`); - -export function Fm() { - if (!tracks) return; - - const content = tracks().slice(0, 4); - - return ( - - ); -} diff --git a/src/components/KVTable.tsx b/src/components/KVTable.tsx deleted file mode 100644 index 6a7b165..0000000 --- a/src/components/KVTable.tsx +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Copyright (c) 2025 adoravel - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -import { css, Import } from "~/mech/css.ts"; -import { ease, fontSize, spacing, theme } from "~/layout.tsx"; - -const table = css(` - :scope { - border: 1px solid ${theme.surfaceBorder}; - } - - .kv-row { - display: grid; - grid-template-columns: minmax(80px, 140px) 1fr; - border-bottom: 1px solid ${theme.surfaceBorder}; - transition: background ${ease.fast}; - } - - .kv-row:last-child { border-bottom: none; } - - .kv-row:hover { background: ${theme.surface}; } - - .kv-key, .kv-val { - padding: ${spacing[3]} ${spacing[4]}; - line-height: 1; - font-family: inherit; - } - - .kv-key { - font-size: ${fontSize.xs}; - letter-spacing: ${spacing.letter.plus}; - color: ${theme.textMuted}; - border-right: 1px solid ${theme.surfaceBorder}; - font-weight: bold; - text-transform: uppercase; - } - - .kv-val { - font-size: ${fontSize.sm}; - color: ${theme.accent}; - } -`); - -export interface KVTableProps { - data: Record; -} - -export default function KVTable({ data }: KVTableProps) { - return ( -
- - {Object.entries(data).map(([key, [name, url]]) => ( -
- {key} - {name} -
- ))} -
- ); -} diff --git a/src/components/MediaItem.tsx b/src/components/MediaItem.tsx deleted file mode 100644 index 708a6ae..0000000 --- a/src/components/MediaItem.tsx +++ /dev/null @@ -1,196 +0,0 @@ -/** - * Copyright (c) 2025 adoravel - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -import { css, Import } from "~/mech/css.ts"; -import { boundaries, fontSize, radius, spacing, theme } from "~/layout.tsx"; - -export interface MediaItemProps { - header: string; - album: string; - artist: string; - releaseDate: string; - url: string; - tag?: string; - coverUrl?: string; -} - -const styles = css(` - :scope { - display: flex; - flex-direction: column; - background: ${theme.base}; - border: 1px solid ${theme.baseBorder}; - border-radius: ${radius.lg}; - font-size: ${fontSize.sm}; - color: ${theme.subtext}; - width: 100%; - } - - .listen-link { - margin-left: auto; - gap: ${spacing[1]}; - font-size: ${fontSize.xs}; - color: ${theme.textMuted}; - } - - .listen-link::after { - background-color: ${theme.textMuted} !important; - } - - .listen-link:hover { - &::after { - background-color: ${theme.accent} !important; - } - color: ${theme.accent}; - } - - .header { - display: flex; - align-items: center; - border-bottom: 1px solid ${theme.baseBorder}; - padding: ${spacing[2]} ${spacing[4]}; - gap: ${spacing[2]}; - } - - .release-date { - display: flex; - align-items: center; - font-size: ${fontSize.xs}; - color: ${theme.textMuted}; - letter-spacing: ${spacing.letter.plus}; - } - - .body { - display: flex; - align-items: flex-start; - padding: ${spacing[4]}; - gap: ${spacing[4]}; - - @media (max-width: ${boundaries.mobileMaxWidth}) { - align-items: center; - text-align: center; - flex-direction: column; - } - } - - .art { - width: 64px; - height: 64px; - overflow: hidden; - flex-shrink: 0; - background: ${theme.base}; - border: 1px solid ${theme.baseBorder}; - border-radius: ${radius.art}; - } - - .info-tag { - margin-left: 1ch; - color: ${theme.textMuted}; - } - - .default-pattern { - width: 64px; - height: 64px; - display: grid; - grid-template-columns: repeat(4, 1fr); - grid-template-rows: repeat(4, 1fr); - } - - .art-px { display: block } - .art-px-0 { background: ${theme.base} } - .art-px-1 { background: ${theme.accent} opacity: 0.85; } - .art-px-2 { background: ${theme.onAccent} opacity: 0.9; } - .art-px-3 { background: ${theme.textMuted} opacity: 0.25; } - .art-px-4 { background: ${theme.surfaceBorder} } - - .art[data-loaded] > .default-pattern { - display: none; - } - - .info { - display: flex; - flex-direction: column; - line-height: 1.75; - } - - .info-title { - font-size: ${fontSize.md}; - color: ${theme.text}; - font-weight: 500; - } - - .info-artist { - font-size: ${fontSize.sm}; - color: ${theme.textMuted}; - } - - .info-artist > span { - colo: ${theme.textMuted}; - } - - .art-cover { - width: 64px; - height: 64px; - object-fit: cover; - } -`); - -const ART_PATTERN = [ - [0, 1, 2, 0], - [1, 4, 1, 3], - [2, 1, 3, 1], - [0, 3, 1, 2], -] as const; - -function Art({ url }: { url: string | undefined }) { - return ( -
- -
- {ART_PATTERN.flat().map((n) => )} -
-
- ); -} - -export function MediaItem({ - header, - artist, - album, - releaseDate, - coverUrl, - url, - tag, -}: MediaItemProps) { - return ( - <> - - - - ); -} diff --git a/src/components/NavigationBar.tsx b/src/components/NavigationBar.tsx deleted file mode 100644 index 6dcb5b9..0000000 --- a/src/components/NavigationBar.tsx +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (c) 2025 adoravel - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -import { css, Import } from "~/mech/css.ts"; -import { fontSize, spacing, theme } from "~/layout.tsx"; - -const style = css(` - :scope { - display: flex; - flex-wrap: wrap; - align-items: center; - justify-content: center; - margin-bottom: ${spacing.section}; - } - - .itemList { - display: flex; - flex-wrap: wrap; - list-style: none; - font-weight: 500; - width: fit-content; - padding: ${spacing[1]}; - gap: ${spacing[1]}; - font-size: ${fontSize.md}; - background-color: ${theme.surface}; - border: 1px solid ${theme.surfaceBorder}; - border-radius: 1000px; - } - - .selected > .item { - background-color: ${theme.accent}; - color: ${theme.background}; - font-weight: 600; - border-radius: 1000px; - } - - .item { - color: ${theme.subtext}; - padding: ${spacing[2]} ${spacing[4]}; - line-height: 1; - display: block; - } -`); - -interface Props { - items: T; - selected: T[number][0]; -} - -export function NavigationBar

({ items, selected }: Props

) { - return ( - <> - -

- - ); -} diff --git a/src/components/Projects.tsx b/src/components/Projects.tsx deleted file mode 100644 index 5f1a2b4..0000000 --- a/src/components/Projects.tsx +++ /dev/null @@ -1,174 +0,0 @@ -/** - * Copyright (c) 2025 adoravel - * SPDX-License-Identifier: AGPL-3.0-or-later - */ - -import { css, Import } from "~/mech/css.ts"; -import { boundaries, ease, elevation, fontSize, radius, spacing, theme } from "~/layout.tsx"; -import { ExternalLink, License } from "~/components/Icon.tsx"; - -export interface Project { - author: string; - name: string; - description: string; - lang: ProjectLanguage; - license: string; - url: string; -} - -export enum ProjectLanguage { - TypeScript = 0x3178c6, - C = 0x555, - Scala = 0xc22d40, -} - -export interface ProjectsProps { - projects: Project[]; -} - -const projects = css(` - :scope { - list-style: none; - padding-left: 0; - display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - - @media (max-width: ${boundaries.mobileMaxWidth}) { - grid-template-columns: 1fr; - } - - margin-top: ${spacing[2]}; - gap: ${spacing[2]}; - } - - .project-card { - display: flex; - flex-direction: column; - text-decoration: none; - position: relative; - overflow: hidden; - height: 100%; - color: ${theme.text}; - background-color: ${theme.base}; - border: 1px solid ${theme.baseBorder}; - padding: ${spacing[3]} ${spacing[4]}; - border-radius: ${radius.lg}; - line-height: ${boundaries.lineHeight + .25}; - } - - .project-card:hover { - background-color: ${theme.surfaceHover}; - border-color: ${theme.surfaceBorderHover}; - - &::before { - transform: scale(1.125); - opacity: 1; - } - } - - .project-card::before { - display: flex; - position: absolute; - left: 0; - top: -7rem; - content: " svg { - vertical-align: bottom; - margin-right: 0.5ch; - } - - .author { - font-size: ${fontSize.md}; - margin-bottom: ${spacing[1]}; - } - - .description { - font-size: ${fontSize.sm}; - color: ${theme.subtext}; - margin-bottom: ${spacing[3]}; - overflow: hidden; - display: -webkit-box; - -webkit-box-orient: vertical; - -webkit-line-clamp: 2; - } - - .description, .info, .author { - position: relative; - z-index: ${elevation.base}; - } - - .info { - display: flex; - align-items: center; - gap: ${spacing[2]}; - font-size: ${fontSize.xs}; - color: ${theme.subtext}; - margin-top: auto; - } - - .language { - width: 10px; - height: 10px; - border-radius: ${radius.circle}; - background-color: var(--lang-colour, #ccc); - display: inline-block; - } -`); - -export default function Projects(props: ProjectsProps) { - if (!props.projects) return; - - return ( - - ); -} diff --git a/src/components/content/FeaturedSong.tsx b/src/components/content/FeaturedSong.tsx new file mode 100644 index 0000000..973ad40 --- /dev/null +++ b/src/components/content/FeaturedSong.tsx @@ -0,0 +1,142 @@ +/** + * Copyright (c) 2025 adoravel + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +import { css } from "~/lib/css.ts"; +import { boundaries, fontFamily, fontSize, radius, spacing, theme } from "~/layout.tsx"; +import { Song } from "~/content/songs.ts"; +import { SongArt } from "~/components/content/SongArt.tsx"; + +interface Props extends Song {} + +const Styled = css(` + :scope { + display: flex; + flex-direction: column; + width: 100%; + background: ${theme.base}; + border: 1px solid ${theme.baseBorder}; + border-radius: ${radius.lg}; + font-size: ${fontSize.sm}; + color: ${theme.subtext}; + + font-family: ${fontFamily.misc}; + letter-spacing: ${spacing.letter.misc}; + } + + .header { + display: flex; + align-items: center; + line-height: 1; + padding: ${spacing[4]} ${spacing[4]}; + gap: ${spacing[2]}; + border-bottom: 1px solid ${theme.baseBorder}; + } + + .release-date { + display: flex; + align-items: center; + color: ${theme.textMuted}; + letter-spacing: ${spacing.letter.plus}; + } + + .listen-link { + margin-left: auto; + gap: ${spacing[1]}; + color: ${theme.textMuted}; + font-size: ${fontSize.xs}; + } + + .listen-link::after { + background-color: ${theme.textMuted} !important; + margin-right: 0; + margin-left: 8px; + } + + .listen-link:hover { + color: ${theme.accent}; + + &::after { + background-color: ${theme.accent} !important; + } + } + + .body { + display: flex; + align-items: flex-start; + padding: ${spacing[4]}; + gap: ${spacing[4]}; + text-decoration: none; + color: inherit; + + @media (max-width: ${boundaries.mobileMaxWidth}) { + flex-direction: column; + align-items: center; + text-align: center; + } + } + + .info { + display: flex; + flex-direction: column; + line-height: 1.75; + } + + .info-title { + color: ${theme.text}; + font-weight: 500; + font-size: ${fontSize.md}; + } + + .info-tag { + margin-left: 1ch; + color: ${theme.textMuted}; + } + + .info-artist { + color: ${theme.textMuted}; + font-size: ${fontSize.sm}; + } + + .info-artist > span { + color: ${theme.textMuted}; + } +`); + +export default function FeaturedSong({ + title, + artist, + album, + releaseDate, + coverUrl, + url, + tag, +}: Props) { + return ( + +
+
+ {releaseDate} +
+ + listen + +
+ + +
+
+ {title} + {tag && {tag}} +
+
+ {album && {album}} +
+ {artist} +
+
+
+
+ ); +} diff --git a/src/components/content/Projects.tsx b/src/components/content/Projects.tsx new file mode 100644 index 0000000..31b4191 --- /dev/null +++ b/src/components/content/Projects.tsx @@ -0,0 +1,166 @@ +/** + * Copyright (c) 2025 adoravel + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +import { Project, ProjectLanguage } from "~/content/projects.ts"; +import { css } from "~/lib/css.ts"; +import { boundaries, ease, elevation, fontFamily, fontSize, radius, spacing, theme } from "~/layout.tsx"; +import { ExternalLink, License } from "~/components/ui/Icon.tsx"; + +interface Props { + projects: Project[]; +} + +const Styled = css(` + :scope { + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: ${spacing[2]}; + margin-top: ${spacing[2]}; + padding-left: 0; + list-style: none; + + font-family: ${fontFamily.misc}; + letter-spacing: ${spacing.letter.misc}; + + @media (max-width: ${boundaries.mobileMaxWidth}) { + grid-template-columns: 1fr; + } + } + + .project-card { + position: relative; + display: flex; + flex-direction: column; + height: 100%; + padding: ${spacing[3]} ${spacing[4]}; + color: ${theme.text}; + background-color: ${theme.base}; + border: 1px solid ${theme.baseBorder}; + border-radius: ${radius.lg}; + line-height: ${boundaries.lineHeight + 0.25}; + text-decoration: none; + overflow: hidden; + } + + .project-card:hover { + background-color: ${theme.surfaceHover}; + border-color: ${theme.surfaceBorderHover}; + + &::before { + transform: scale(1.125); + opacity: 1; + } + } + + .project-card::before { + position: absolute; + top: -7rem; + left: 0; + display: flex; + align-items: center; + justify-content: center; + width: 100%; + content: " svg { + margin-right: 0.5ch; + } +`); + +export default function Projects({ projects }: Props) { + if (!projects?.length) return; + + return ( + + {projects.map((project) => { + const langColour = project.lang.toString(16).padStart(6, "0"); + + return ( +
  • + + + + +
    + {project.author}/{project.name} +
    +

    {project.description}

    +
    + + {ProjectLanguage[project.lang]} +
    + + {project.license} +
    +
    +
    +
  • + ); + })} +
    + ); +} diff --git a/src/components/content/RecentTracks.tsx b/src/components/content/RecentTracks.tsx new file mode 100644 index 0000000..2248461 --- /dev/null +++ b/src/components/content/RecentTracks.tsx @@ -0,0 +1,152 @@ +/** + * Copyright (c) 2025 adoravel + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +import { boundaries, ease, elevation, fontFamily, fontSize, radius, spacing, theme } from "~/layout.tsx"; +import { css } from "~/lib/css.ts"; +import { tracks } from "~/services/lastfm.ts"; +import { SongArt } from "~/components/content/SongArt.tsx"; + +export interface RecentTracksProps { + tracks: NonNullable>; + cutoff: number; + profileUrl: string; +} + +const Styled = css(` + :scope { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(120px, 160px)); + gap: ${spacing[6]}; + margin: 0; + margin-top: 0.5rem !important; + padding: 0; + list-style: none; + + font-family: ${fontFamily.misc}; + letter-spacing: ${spacing.letter.misc}; + } + + li > a { + display: flex; + flex-direction: column; + align-items: center; + text-align: center; + gap: ${spacing[3]}; + max-width: ${boundaries.avatarSize}; + } + + .cover { + width: ${boundaries.avatarSize}; + height: ${boundaries.avatarSize}; + border-radius: ${radius.art}; + background: ${theme.lift}; + object-fit: cover; + } + + .meta { + display: flex; + flex-direction: column; + font-size: ${fontSize.md}; + color: ${theme.subtext}; + } + + .meta strong { + font-weight: 600; + font-size: ${fontSize.base}; + color: ${theme.text}; + } + + .loved { + color: ${theme.accent}; + } + + .meta strong, + .meta span { + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + word-break: break-word; + text-overflow: ellipsis; + max-width: 100%; + } + + .fm-more { + position: relative; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + overflow: hidden; + width: 100%; + height: 100%; + opacity: 0.75; + + background: ${theme.base}; + border: 1px solid ${theme.baseBorder}; + border-radius: ${radius.art}; + font-size: ${fontSize.sm}; + color: ${theme.text}; + padding: ${spacing[3]}; + z-index: ${elevation.base}; + transition: opacity ${ease.fast}; + + @media (max-width: 930px) { + display: none; + } + } + + .fm-more:hover { + opacity: 1; + } + + .fm-more::before { + content: "→"; + position: absolute; + color: transparent; + font-size: 15rem; + -webkit-text-stroke: 2px ${theme.surfaceBorder}; + z-index: ${elevation.below}; + } +`); + +function TrackItem({ track }: { track: RecentTracksProps["tracks"][number] }) { + const { url, coverUrl, title, artist, playing, loved } = track; + const showStatus = playing || loved; + + return ( +
  • + + +
    + {title} + {artist} + + {showStatus && ( + + {playing && ▷} + {loved && ❤} + + )} +
    +
    +
  • + ); +} + +export default function RecentTracks({ tracks, cutoff, profileUrl }: RecentTracksProps) { + const content = cutoff !== undefined ? tracks.slice(0, cutoff) : tracks; + + return ( + + {content.map((track) => )} +
  • + + Check out more on Last.fm + +
  • +
    + ); +} diff --git a/src/components/content/SongArt.tsx b/src/components/content/SongArt.tsx new file mode 100644 index 0000000..a6bb43c --- /dev/null +++ b/src/components/content/SongArt.tsx @@ -0,0 +1,102 @@ +/** + * Copyright (c) 2025 adoravel + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +import { css } from "~/lib/css.ts"; +import { radius, theme } from "~/layout.tsx"; + +const ART_PATTERN = [ + [0, 1, 2, 0], + [1, 4, 1, 3], + [2, 1, 3, 1], + [0, 3, 1, 2], +] as const; + +const randomisePattern = (): number[][] => { + const pool = ART_PATTERN.flat(); + + const size = ART_PATTERN.length; + const grid: number[][] = Array.from({ length: size }, () => []); + + for (let r = 0; r < size; r++) { + for (let c = 0; c < size; c++) { + const leftNeighbor = c > 0 ? grid[r][c - 1] : null; + const topNeighbor = r > 0 ? grid[r - 1][c] : null; + + const validIndices: number[] = []; + for (let i = 0; i < pool.length; i++) { + if (pool[i] !== leftNeighbor && pool[i] !== topNeighbor) { + validIndices.push(i); + } + } + + const targetIndex = validIndices.length > 0 + ? validIndices[Math.floor(Math.random() * validIndices.length)] + : Math.floor(Math.random() * pool.length); + + const [chosenValue] = pool.splice(targetIndex, 1); + grid[r].push(chosenValue); + } + } + + return grid; +}; + +const Styled = css(` + :scope { + position: relative; + width: 64px; + height: 64px; + flex-shrink: 0; + background: ${theme.base}; + border: 1px solid ${theme.baseBorder}; + border-radius: ${radius.art}; + overflow: hidden; + } + + .art-cover { + width: 100%; + height: 100%; + object-fit: cover; + display: block; + } + + .pattern { + position: absolute; + inset: 0; + display: grid; + grid-template-columns: repeat(4, 1fr); + grid-template-rows: repeat(4, 1fr); + } + + .art-px { display: block; } + .art-px-0 { background-color: ${theme.base}; } + .art-px-1 { background-color: ${theme.accent}; opacity: 0.85; } + .art-px-2 { background-color: ${theme.onAccent}; opacity: 0.9; } + .art-px-3 { background-color: ${theme.textMuted}; opacity: 0.25; } + .art-px-4 { background-color: ${theme.surfaceBorder}; } + + .art-cover[data-loaded="true"] + .pattern { + display: none; + } +`); + +export function SongArt({ url, class: className }: { class?: string; url: string | undefined }) { + return ( + + {url && ( + + )} +
    + {randomisePattern().flat().map((n, idx) => )} +
    +
    + ); +} diff --git a/src/components/home/ButtonWall.tsx b/src/components/home/ButtonWall.tsx new file mode 100644 index 0000000..c649e8f --- /dev/null +++ b/src/components/home/ButtonWall.tsx @@ -0,0 +1,66 @@ +/** + * Copyright (c) 2025 adoravel + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +import { css } from "~/lib/css.ts"; +import { spacing, theme } from "~/layout.tsx"; +import { friends } from "~/content/friends.ts"; + +const Styled = css(` + :scope { + display: flex; + flex-wrap: wrap; + gap: ${spacing[1]}; + } + + a, iframe { + display: inline-block; + text-align: center; + width: 88px; + height: 31px; + image-rendering: pixelated; + background-color: ${theme.lift}; + color: ${theme.text}; + clip-path: polygon( + 0px calc(100% - 2px), + 2px calc(100% - 2px), + 2px 100%, + calc(100% - 2px) 100%, + calc(100% - 2px) calc(100% - 2px), + 100% calc(100% - 2px), + 100% 2px, + calc(100% - 2px) 2px, + calc(100% - 2px) 0px, + 2px 0px, + 2px 2px, + 0px 2px + ); + } +`); + +export default function ButtonWall({ buttons }: { buttons: typeof friends }) { + return ( + + + + {buttons["88x31"][0].alt} + + {buttons.iframe.map((script: string, idx: number) => ( + - - {friends[0].alt} + + {friends["88x31"][0].alt} -