made layout reactive

This commit is contained in:
2026-11-15 19:04:07 +00:00
parent d838bd4960
commit eef465dee0
5 changed files with 292 additions and 195 deletions

View File

@@ -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(() => {});

View File

@@ -7,39 +7,46 @@
let { data }: { data: PageData } = $props();
import voidarcIcon from '../voidarc-hollow.svg?raw';
let contentHeight = $state(0);
</script>
<div class="fira-mono-bold mt-5 flex h-40 w-full items-center justify-center text-center text-6xl">
<div class="page-frame">
<div
class="fira-mono-bold relative mt-5 flex h-40 w-full items-center justify-center text-center"
>
<div class="absolute aspect-[2/1.732] h-40 text-ctp-surface0">
{@html voidarcIcon}
</div>
<span class="absolute text-ctp-mauve">[VOIDARC INCORPORATED]</span>
</div>
<div class="m-6 mx-auto grid max-w-7xl grid-flow-row auto-rows-min gap-5">
<span class="banner-text absolute inset-x-0 text-ctp-mauve">[VOIDARC INCORPORATED]</span>
</div>
<div class="my-6 grid grid-flow-row auto-rows-min gap-5">
<div
class="main-container grid grid-cols-[2fr_1fr] py-7 pl-10"
class="main-container grid grid-cols-1 py-7 pl-4 min-[900px]:grid-cols-[2fr_1fr] min-[900px]:pl-10"
style="--container-color:var(--ctp-mauve);"
>
<div class="ml-6 py-4">
<div class="py-4 min-[900px]:ml-6">
<div class="flex">
<img src="/adumh00man.png" class="mt-[13px] mr-2 ml-[-15px] h-12" alt="" />
<p class="title-font text-bold text-[50px]">Adumh00man</p>
<p class="title-font text-bold text-[clamp(2.25rem,10vw,3.125rem)]">Adumh00man</p>
</div>
<p id="description-block" class="pr-10 pl-4 text-justify">
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
<p id="description-block" class="pr-4 pl-0 text-justify min-[900px]:pr-10 min-[900px]:pl-4">
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
<a class="text-link" href="https://git.voidarc.co.uk/voidarc">git server</a>, his
<a class="text-link" href="https://blog.voidarc.co.uk">blog</a>, and some other services he
uses to "legally aqquire media" (yarr me hearties).
<a class="text-link" href="https://blog.voidarc.co.uk">blog</a>, and some other services
he uses to "legally aqquire media" (yarr me hearties).
</p>
</div>
<div class="my-4 mr-4 grid min-w-100 flex-col gap-2 pr-3">
<div
class="sub-container flex items-center gap-3 overflow-hidden pr-3"
class="my-4 mr-4 grid min-w-0 grid-cols-1 flex-col gap-2 min-[900px]:min-w-100 min-[900px]:pr-3"
>
<div
class="sub-container flex items-center gap-3 overflow-hidden min-[900px]:pr-3"
style="--container-color:var(--ctp-green);"
>
{#await data.streamed.latestSong}
@@ -78,7 +85,7 @@
{/await}
</div>
<div
class="sub-container flex items-center gap-3 overflow-hidden pr-3"
class="sub-container flex items-center gap-3 overflow-hidden min-[900px]:pr-3"
style="--container-color:var(--ctp-peach);"
>
{#await data.streamed.latestSeries}
@@ -120,7 +127,7 @@
{/await}
</div>
<div
class="sub-container flex items-center gap-3 overflow-hidden pr-3"
class="sub-container flex items-center gap-3 overflow-hidden min-[900px]:pr-3"
style="--container-color:var(--ctp-red);"
>
{#await data.streamed.latestBook}
@@ -161,10 +168,16 @@
</div>
</div>
</div>
<div class="grid grid-cols-[9fr_7fr] grid-rows-1 gap-4">
<div class="main-container" style="--container-color:var(--ctp-blue);">
<div class="grid grid-cols-1 gap-4 min-[900px]:grid-cols-[9fr_7fr] min-[900px]:grid-rows-1">
<div
class="main-container"
bind:clientHeight={contentHeight}
style="--container-color:var(--ctp-blue);"
>
<div class="section-title fira-mono-bold mr-3 flex py-2 text-4xl">
Content <div class="flex w-full flex-row-reverse items-center gap-4 pr-4">
Content <div
class="flex w-full flex-row-reverse items-center gap-4 pr-4 max-[400px]:gap-2"
>
<a href="https://youtube.com/@adumh00man">
<SiYoutube size="40" class="hover:text-ctp-red" />
</a>
@@ -179,15 +192,19 @@
<Content {items} />
{/await}
</div>
<!-- The wrapper contributes no height, so the row is sized by the Content column alone. -->
<div class="relative min-h-0">
<!-- The wrapper contributes no height, so the row is sized by the Content column alone.
On narrow screens it is placed below the Content column and given the same height. -->
<div
class="commits-column relative min-h-0"
style={contentHeight ? `--content-height: ${contentHeight}px` : undefined}
>
<div
class="main-container absolute inset-0 flex flex-col overflow-hidden"
style="--container-color:var(--ctp-green);"
>
<div class="section-title fira-mono-bold mr-3 flex py-2 text-4xl">
Commits
<div class="flex w-full flex-row-reverse items-center gap-4 pr-4">
<div class="flex w-full flex-row-reverse items-center gap-4 pr-4 max-[400px]:gap-2">
<a href="https://git.voidarc.co.uk">
<SiGit size="35" class="hover:text-ctp-peach" />
</a>
@@ -204,4 +221,31 @@
</div>
</div>
</div>
</div>
</div>
<style>
.page-frame {
box-sizing: content-box;
margin-inline: auto;
max-width: 80rem;
padding-inline: clamp(1rem, 2.5vw, 2rem);
}
.banner-text {
font-size: min(3.75rem, 6vw);
white-space: nowrap;
}
@media (min-width: 900px) {
.banner-text {
font-size: 3.75rem;
}
}
@media (max-width: 899.98px) {
.commits-column {
height: var(--content-height, auto);
}
}
</style>

View File

@@ -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}
</svg>
<div bind:this={listElement} class=" mr-3 grid grid-flow-row auto-rows-min">
<div bind:this={listElement} class="mr-3 grid grid-flow-row auto-rows-min">
{#each visibleItems as commit, index (commit.hash)}
<div class="relative z-10 grid grid-cols-[1.25rem_minmax(0,1fr)] gap-x-3.5 gap-y-2 pb-2">
<!-- Timeline space -->
@@ -205,7 +217,7 @@
>
{commit.shortHash}
</p>
<p class="ml-2 line-clamp-1 group-hover:font-semibold">{commit.message}</p>
<p class="ml-2 line-clamp-1 min-w-0 group-hover:font-semibold">{commit.message}</p>
<div class="flex flex-1 flex-row">
<!-- spacer -->
<div class="flex-1"></div>

View File

@@ -54,7 +54,7 @@
<div bind:this={containerElement} class="relative mt-1">
<!-- SVG timeline overlay -->
<svg
class="pointer-events-none absolute top-0 left-0 z-0 overflow-visible"
class="pointer-events-none absolute top-0 left-0 z-0 overflow-visible max-[600px]:-left-1"
width="32"
height={graphHeight}
viewBox={`0 0 32 ${graphHeight}`}
@@ -92,7 +92,9 @@
<!-- Article list -->
<div class="mt-3 mr-4 grid grid-flow-row auto-rows-min">
{#each items as item, index (item.link)}
<div class="relative z-10 grid grid-cols-[2rem_minmax(0,1fr)] gap-4 pb-3">
<div
class="relative z-10 grid grid-cols-[2rem_minmax(0,1fr)] gap-4 pb-3 max-[600px]:grid-cols-[1.25rem_minmax(0,1fr)] max-[600px]:gap-2"
>
<!-- Timeline space -->
<div></div>
@@ -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}
<div class="mr-2 flex aspect-16/9 max-w-40 min-w-40 items-center">
<div
class="mr-2 flex aspect-16/9 max-w-40 min-w-40 items-center max-[600px]:mr-0 max-[600px]:mb-2 max-[600px]:w-full max-[600px]:max-w-none max-[600px]:min-w-0"
>
<img src={item.image} class="aspect-16/9" alt="" />
</div>
{/if}
<div style:padding-left={!item.image ? '4px' : 0}>
<div class="min-w-0" style:padding-left={!item.image ? '4px' : 0}>
{#if item.type == 2}
<p
class="line-clamp-3 font-medium italic group-hover:text-ctp-mauve group-hover:underline"

View File

@@ -141,6 +141,36 @@
aspect-ratio: 20/5;
}
@media (max-width: 899.98px) {
/* Let the boxes size to their content instead of the wide-screen 20/5 ratio. */
.sub-container {
aspect-ratio: auto;
}
.sub-container img {
height: auto;
max-height: 5rem;
}
}
/* On phone-sized screens the boxes are narrow, so give the text more room. */
@media (max-width: 499.98px) {
.sub-container img {
height: auto;
max-height: 4rem;
}
.sub-container .fira-mono-medium {
font-size: 0.875rem;
line-height: 1.25rem;
}
.sub-container .fira-mono-bold {
font-size: 1.125rem;
line-height: 1.75rem;
}
}
.dynamic-container {
--container-color: var(--ctp-lavender);
border-left: 5px solid var(--container-color);
@@ -155,6 +185,13 @@
border-left: 10px solid var(--ctp-surface2);
}
/* Remove the description's left border on smaller screens. */
@media (max-width: 899.98px) {
#description-block {
border-left: none;
}
}
#music-title-block {
border-left: 4px solid var(--ctp-overlay1);
}