refactor(web): Admin, Settings and Collection share one rail layout (DRY W7)
The three areas each repeated the same title, left rail and content grid. SectionLayout now draws it once, with the rail and any lines under the title as snippets. Admin pages now get the content cap Settings has (max-w-[100rem]): both lay their groups out in SettingsColumns, and without it Admin's two columns stretched across a very wide screen. The Collection keeps its uncapped lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,40 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import type { Snippet } from 'svelte';
|
||||||
|
|
||||||
|
// An area laid out as one page per section down a left rail: Settings,
|
||||||
|
// Admin and the Collection, so the sections sit in the same place
|
||||||
|
// everywhere. On a phone the rail stacks above the page.
|
||||||
|
let {
|
||||||
|
title,
|
||||||
|
intro,
|
||||||
|
rail,
|
||||||
|
contentClass = 'max-w-[100rem] space-y-6',
|
||||||
|
children
|
||||||
|
}: {
|
||||||
|
title: string;
|
||||||
|
/** Lines under the title. */
|
||||||
|
intro?: Snippet;
|
||||||
|
rail: Snippet;
|
||||||
|
/** Pages laid out in SettingsColumns keep the default: the cap only stops
|
||||||
|
the columns stretching on a very wide screen. */
|
||||||
|
contentClass?: string;
|
||||||
|
children?: Snippet;
|
||||||
|
} = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="space-y-4">
|
||||||
|
<header class="space-y-1">
|
||||||
|
<h1 class="font-display text-2xl font-medium text-text-primary">{title}</h1>
|
||||||
|
{@render intro?.()}
|
||||||
|
</header>
|
||||||
|
<div class="md:grid md:grid-cols-[11rem_minmax(0,1fr)] md:gap-6">
|
||||||
|
<div class="mb-4 md:mb-0">
|
||||||
|
<div class="md:sticky md:top-4">
|
||||||
|
{@render rail()}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="min-w-0 {contentClass}">
|
||||||
|
{@render children?.()}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import SectionLayout from '#lib/components/SectionLayout.svelte';
|
||||||
import SectionRail, { type RailItem } from '#lib/components/SectionRail.svelte';
|
import SectionRail, { type RailItem } from '#lib/components/SectionRail.svelte';
|
||||||
|
|
||||||
let { children } = $props<{ children: import('svelte').Snippet }>();
|
let { children } = $props<{ children: import('svelte').Snippet }>();
|
||||||
@@ -18,16 +19,9 @@
|
|||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="space-y-4">
|
<SectionLayout title="Admin">
|
||||||
<h1 class="font-display text-2xl font-medium text-text-primary">Admin</h1>
|
{#snippet rail()}
|
||||||
<div class="md:grid md:grid-cols-[11rem_minmax(0,1fr)] md:gap-6">
|
<SectionRail label="Admin sections" {items} />
|
||||||
<div class="mb-4 md:mb-0">
|
{/snippet}
|
||||||
<div class="md:sticky md:top-4">
|
{@render children?.()}
|
||||||
<SectionRail label="Admin sections" {items} />
|
</SectionLayout>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="min-w-0 space-y-6">
|
|
||||||
{@render children?.()}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import SectionLayout from '#lib/components/SectionLayout.svelte';
|
||||||
import { createAdminSummaryQuery } from '#lib/api/admin.js';
|
import { createAdminSummaryQuery } from '#lib/api/admin.js';
|
||||||
import { QUEUES, countOf, queueLabel } from '#lib/admin/queues.js';
|
import { QUEUES, countOf, queueLabel } from '#lib/admin/queues.js';
|
||||||
import CollectionRail from '#lib/components/CollectionRail.svelte';
|
import CollectionRail from '#lib/components/CollectionRail.svelte';
|
||||||
@@ -13,9 +14,8 @@
|
|||||||
const waiting = $derived(QUEUES.filter((d) => countOf(summary, d.key) > 0));
|
const waiting = $derived(QUEUES.filter((d) => countOf(summary, d.key) > 0));
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="space-y-4">
|
<SectionLayout title="Collection" contentClass="">
|
||||||
<header class="space-y-1">
|
{#snippet intro()}
|
||||||
<h1 class="font-display text-2xl font-medium text-text-primary">Collection</h1>
|
|
||||||
<p class="text-sm text-text-secondary">
|
<p class="text-sm text-text-secondary">
|
||||||
What in the library needs looking at: tracks people reported, songs held twice, files from
|
What in the library needs looking at: tracks people reported, songs held twice, files from
|
||||||
doubtful sources, and the tracks waiting for a good file.
|
doubtful sources, and the tracks waiting for a good file.
|
||||||
@@ -33,16 +33,9 @@
|
|||||||
<p class="text-sm text-text-secondary" data-testid="collection-health">Nothing needs you.</p>
|
<p class="text-sm text-text-secondary" data-testid="collection-health">Nothing needs you.</p>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
</header>
|
{/snippet}
|
||||||
|
{#snippet rail()}
|
||||||
<div class="md:grid md:grid-cols-[11rem_minmax(0,1fr)] md:gap-6">
|
<CollectionRail {summary} />
|
||||||
<div class="mb-4 md:mb-0">
|
{/snippet}
|
||||||
<div class="md:sticky md:top-4">
|
{@render children?.()}
|
||||||
<CollectionRail {summary} />
|
</SectionLayout>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="min-w-0">
|
|
||||||
{@render children?.()}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import SectionLayout from '#lib/components/SectionLayout.svelte';
|
||||||
import SectionRail from '#lib/components/SectionRail.svelte';
|
import SectionRail from '#lib/components/SectionRail.svelte';
|
||||||
|
|
||||||
let { children } = $props<{ children: import('svelte').Snippet }>();
|
let { children } = $props<{ children: import('svelte').Snippet }>();
|
||||||
@@ -16,19 +17,9 @@
|
|||||||
];
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="space-y-4">
|
<SectionLayout title="Settings">
|
||||||
<h1 class="font-display text-2xl font-medium text-text-primary">Settings</h1>
|
{#snippet rail()}
|
||||||
<div class="md:grid md:grid-cols-[11rem_minmax(0,1fr)] md:gap-6">
|
<SectionRail label="Settings sections" {items} />
|
||||||
<div class="mb-4 md:mb-0">
|
{/snippet}
|
||||||
<div class="md:sticky md:top-4">
|
{@render children?.()}
|
||||||
<SectionRail label="Settings sections" {items} />
|
</SectionLayout>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Each page lays its groups out in SettingsColumns: two columns on a
|
|
||||||
wide screen, each narrow enough that a row's control sits near its
|
|
||||||
name. The cap only stops the columns stretching on a very wide one. -->
|
|
||||||
<div class="min-w-0 max-w-[100rem] space-y-6">
|
|
||||||
{@render children?.()}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user