feat: lightroom-style workspace UI with album covers

Backend:
- expose cover thumbnail URL on album responses (LEFT JOIN + presign)
- auto-assign cover only when empty; FK cover_photo_id -> photos ON DELETE SET NULL
- add photos_count / members_count to album responses; cover repo test

Frontend:
- split layouts into (app) shell (resizable rail + contextual panel) and (public)
- album rail + create-album dialog; album panel with cover picker / make-cover
- photo viewer route with filmstrip, replacing lightbox; share reuses it
- grid density slider, toolbar + drag-and-drop upload, dark graphite default

OpenSpec: add lightroom-workspace-ui change (proposal, design, specs, tasks)
This commit is contained in:
iu
2026-10-10 18:15:13 +03:00
parent b90e6b0267
commit 304cfedb75
47 changed files with 1942 additions and 601 deletions
@@ -0,0 +1,78 @@
<script lang="ts">
import { page } from '$app/stores';
import { goto } from '$app/navigation';
import Icon from './Icon.svelte';
import CreateAlbumDialog from './CreateAlbumDialog.svelte';
import { albums } from '$lib/stores/albums.svelte';
import { auth } from '$lib/stores/auth.svelte';
const activeId = $derived($page.params.id ?? '');
let creating = $state(false);
$effect(() => {
if (auth.isAuthenticated && !albums.loaded) albums.load();
});
</script>
<div class="flex h-full flex-col">
<div class="border-border flex items-center justify-between border-b px-3 py-2">
<span class="text-text-muted text-xs font-semibold tracking-wide uppercase">Альбомы</span>
{#if auth.isAuthenticated}
<button
type="button"
class="text-text-muted hover:bg-bg-muted hover:text-text inline-flex items-center justify-center rounded-md p-1"
aria-label="Новый альбом"
title="Новый альбом"
onclick={() => (creating = true)}
>
<Icon name="add" class="size-4" />
</button>
{/if}
</div>
{#if !auth.isAuthenticated}
<p class="text-text-subtle p-3 text-sm">Войдите, чтобы видеть альбомы.</p>
{:else if albums.loading && albums.list.length === 0}
<p class="text-text-subtle p-3 text-sm">Загрузка…</p>
{:else if albums.list.length === 0}
<p class="text-text-subtle p-3 text-sm">Альбомов пока нет.</p>
{:else}
<ul class="flex-1 space-y-0.5 overflow-y-auto p-2">
{#each albums.list as album (album.id)}
<li>
<a
href="/albums/{album.id}"
class="flex items-center gap-2.5 rounded-md px-2 py-1.5 text-sm transition-colors {album.id ===
activeId
? 'bg-bg-muted text-text'
: 'text-text-muted hover:bg-bg-muted hover:text-text'}"
aria-current={album.id === activeId ? 'page' : undefined}
>
<span
class="bg-bg-muted border-border flex size-9 shrink-0 items-center justify-center overflow-hidden rounded border"
>
{#if album.cover_thumb_url}
<img
src={album.cover_thumb_url}
alt=""
class="h-full w-full object-cover"
loading="lazy"
/>
{:else}
<Icon name="image" class="size-4 text-text-subtle" />
{/if}
</span>
<span class="truncate">{album.title}</span>
</a>
</li>
{/each}
</ul>
{/if}
{#if creating}
<CreateAlbumDialog
onClose={() => (creating = false)}
onCreated={(album) => goto(`/albums/${album.id}`)}
/>
{/if}
</div>