From eef465dee0e409f185e88f9310ba01775b6bed7b Mon Sep 17 00:00:00 2001 From: voidarc Date: Sun, 15 Nov 2026 19:04:07 +0000 Subject: [PATCH] made layout reactive --- src/routes/+page.server.ts | 2 +- src/routes/+page.svelte | 406 ++++++++++++++++++++----------------- src/routes/Commits.svelte | 28 ++- src/routes/Content.svelte | 14 +- src/routes/layout.css | 37 ++++ 5 files changed, 292 insertions(+), 195 deletions(-) diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts index 74dfafa..6ff4495 100644 --- a/src/routes/+page.server.ts +++ b/src/routes/+page.server.ts @@ -19,7 +19,7 @@ export const load: PageServerLoad = () => { const latestBook = getLatestBook(globalThis.fetch, KOMGA_LIBRARY_ID); const contentItems: ContentItem = getContentItems(globalThis.fetch, CHANNEL_ID, BLOG_URL); - const latestCommits: GitCommit = getLatestCommits(globalThis.fetch, 20); + const latestCommits: GitCommit = getLatestCommits(globalThis.fetch, 50); latestSong.catch(() => {}); latestSeries.catch(() => {}); diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 5bb703f..878d025 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -7,201 +7,245 @@ let { data }: { data: PageData } = $props(); import voidarcIcon from '../voidarc-hollow.svg?raw'; + + let contentHeight = $state(0); -
-
- {@html voidarcIcon} -
- [VOIDARC INCORPORATED] -
-
+
-
-
- -

Adumh00man

-
-

- Adumh00man is a mysterious all-powerful being pretending to be a cat pretending to be a nix - youtuber. Currently maintaining an awesome nix config, and using nixos fulltime, his - programming languages of choice are rust and svelte (if you can count svelte as a language). - He is also an avid homelabber, running all of his services on-prem so that the evil - corporations that be can't control him when the world is eventually owned by them. This - includes his - git server, his - blog, and some other services he - uses to "legally aqquire media" (yarr me hearties). -

-
-
-
- {#await data.streamed.latestSong} -

Loading latest song...

- {:then song} - -
-

Currently Listening to…

-
- window.open( - `https://soundcloud.com/search?q=${song.name} ${song.artist}`, - '_blank' - )} - style="cursor: pointer;" - role="link" - onkeydown={(e) => { - if (e.key === 'Enter') { - } - }} - tabindex="0" - title="{song.name} - {song.artist}" - class="pl-2" - > -

- {song.name} -

-

- {song.artist} - {song.album} -

-
-
- {:catch error} -

{error}

- {/await} -
-
- {#await data.streamed.latestSeries} -

Loading Latest Watched Series...

- {:then series} - -
-

Currently Watching…

-
- window.open(`https://thetvdb.com/search?query=${series.name}`, '_blank')} - style="cursor: pointer;" - role="link" - onkeydown={(e) => { - if (e.key === 'Enter') { - } - }} - tabindex="0" - title="{series.name} S{series.episode.seasonNumber}E{series.episode - .episodeNumber} - {series.episode.name}" - class="pl-2" - > -

- {series.name} -

-

- S{series.episode.seasonNumber}E{series.episode.episodeNumber} - {series.episode - .name} -

-
-
- {:catch error} -

{error}

- {/await} -
-
- {#await data.streamed.latestBook} -

Loading Latest Book...

- {:then book} - -
-

Currently Reading…

-
- window.open( - `https://bookbrainz.org/search?q=${book.series} ${book.number}`, - '_blank' - )} - style="cursor: pointer;" - role="link" - onkeydown={(e) => { - if (e.key === 'Enter') { - } - }} - tabindex="0" - class="pl-2" - > -

- {book.series} -

-

- v{book.number} p{book.currentPage}/{book.totalPages} -

-
-
- {/await} -
+
+ {@html voidarcIcon}
+
-
-
-
- Content
- - - - - - +
+
+
+
+ +

Adumh00man

+

+ Adumh00man is a mysterious all-powerful being pretending to be a cat pretending to be a + nix youtuber. Currently maintaining an awesome nix config, and using nixos fulltime, his + programming languages of choice are rust and svelte (if you can count svelte as a + language). He is also an avid homelabber, running all of his services on-prem so that the + evil corporations that be can't control him when the world is eventually owned by them. + This includes his + git server, his + blog, and some other services + he uses to "legally aqquire media" (yarr me hearties). +

- {#await data.streamed.contentItems} -

Loading latest Content...

- {:then items} - - {/await} -
- -
-
- Commits -
- - - -
+
+ {#await data.streamed.latestSong} +

Loading latest song...

+ {:then song} + +
+

Currently Listening to…

+
+ window.open( + `https://soundcloud.com/search?q=${song.name} ${song.artist}`, + '_blank' + )} + style="cursor: pointer;" + role="link" + onkeydown={(e) => { + if (e.key === 'Enter') { + } + }} + tabindex="0" + title="{song.name} - {song.artist}" + class="pl-2" + > +

+ {song.name} +

+

+ {song.artist} - {song.album} +

+
+
+ {:catch error} +

{error}

+ {/await}
-
- {#await data.streamed.latestCommits} -

loading commits...

- {:then commits} - {console.log(commits)} - +
+ {#await data.streamed.latestSeries} +

Loading Latest Watched Series...

+ {:then series} + +
+

Currently Watching…

+
+ window.open(`https://thetvdb.com/search?query=${series.name}`, '_blank')} + style="cursor: pointer;" + role="link" + onkeydown={(e) => { + if (e.key === 'Enter') { + } + }} + tabindex="0" + title="{series.name} S{series.episode.seasonNumber}E{series.episode + .episodeNumber} - {series.episode.name}" + class="pl-2" + > +

+ {series.name} +

+

+ S{series.episode.seasonNumber}E{series.episode.episodeNumber} - {series.episode + .name} +

+
+
+ {:catch error} +

{error}

+ {/await} +
+
+ {#await data.streamed.latestBook} +

Loading Latest Book...

+ {:then book} + +
+

Currently Reading…

+
+ window.open( + `https://bookbrainz.org/search?q=${book.series} ${book.number}`, + '_blank' + )} + style="cursor: pointer;" + role="link" + onkeydown={(e) => { + if (e.key === 'Enter') { + } + }} + tabindex="0" + class="pl-2" + > +

+ {book.series} +

+

+ v{book.number} p{book.currentPage}/{book.totalPages} +

+
+
{/await}
+
+
+
+ Content +
+ {#await data.streamed.contentItems} +

Loading latest Content...

+ {:then items} + + {/await} +
+ +
+
+
+ Commits +
+ + + +
+
+
+ {#await data.streamed.latestCommits} +

loading commits...

+ {:then commits} + {console.log(commits)} + + {/await} +
+
+
+
+ + diff --git a/src/routes/Commits.svelte b/src/routes/Commits.svelte index 349edd2..6c45bdd 100644 --- a/src/routes/Commits.svelte +++ b/src/routes/Commits.svelte @@ -11,7 +11,7 @@ let graphHeight = $state(0); let nodePositions = $state<{ x: number; y: number }[]>([]); - // Only render commits that fit entirely inside the available height. + // Render commits until the available height is filled. The last row may be clipped. let visibleCount = $state(0); let measurementVersion = 0; @@ -41,10 +41,9 @@ let fit = 0; for (const row of rows) { - const height = row.getBoundingClientRect().height; - if (used + height > available) break; + if (used >= available) break; - used += height; + used += row.getBoundingClientRect().height; fit += 1; } @@ -62,10 +61,23 @@ void fitVisibleItems(); - const observer = new ResizeObserver(() => void fitVisibleItems()); + let frame = 0; + + function schedule() { + cancelAnimationFrame(frame); + frame = requestAnimationFrame(() => void fitVisibleItems()); + } + + const observer = new ResizeObserver(schedule); observer.observe(parent); - return () => observer.disconnect(); + window.addEventListener('resize', schedule); + + return () => { + observer.disconnect(); + window.removeEventListener('resize', schedule); + cancelAnimationFrame(frame); + }; }); // Measure the actual centre of every visible article card. @@ -161,7 +173,7 @@ {/each} -
+
{#each visibleItems as commit, index (commit.hash)}
@@ -205,7 +217,7 @@ > {commit.shortHash}

-

{commit.message}

+

{commit.message}

diff --git a/src/routes/Content.svelte b/src/routes/Content.svelte index 288c721..42587d8 100644 --- a/src/routes/Content.svelte +++ b/src/routes/Content.svelte @@ -54,7 +54,7 @@
{#each items as item, index (item.link)} -
+
@@ -105,14 +107,16 @@ : item.type == 2 ? 'var(--ctp-pink)' : 'var(--ctp-lavender)'} - class="group dynamic-container flex bg-ctp-surface1 p-3 pl-2" + class="group dynamic-container flex bg-ctp-surface1 p-3 pl-2 max-[600px]:flex-col" > {#if item.image} -
+
{/if} -
+
{#if item.type == 2}