feat: A darkroom shell + projects overview home, models page into the shell (HEL-608)

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
shigongyuan-agent
2026-09-27 21:42:06 +08:00
co-authored by multica-agent
parent 5d909aca3b
commit 4945d29e52
12 changed files with 2359 additions and 78 deletions
@@ -0,0 +1,458 @@
<script lang="ts">
import { createQuery } from '@tanstack/svelte-query';
import LanguageSwitcher from '$lib/components/LanguageSwitcher.svelte';
import Icon from '$lib/components/ui/Icon.svelte';
import type { IconName } from '$lib/components/ui/icons';
import { settings } from '$lib/api';
import { t } from '$lib/i18n.svelte';
/**
* A「片场暗房」application shell — spec-v2 §3 (HEL-608).
*
* 216px left navigation with the confirmed item order, the 影工坊 brand,
* a ComfyUI address row pinned to the nav bottom, and a per-page top bar
* (title 20/600 + gray blurb + page actions). Unbuilt pages stay in the
* nav with an honest 「开发中」 pill instead of pretending to work.
*/
type NavId =
| 'projects'
| 'workbench'
| 'image'
| 'video'
| 'tasks'
| 'agents'
| 'connections'
| 'models'
| 'settings';
interface NavItem {
id: NavId;
labelKey: string;
icon: IconName;
href?: string;
wip?: boolean;
}
// Order is fixed by spec-v2 §3: 项目 / 创作工作台 / 生图 / 生视频 /
// 生成任务 / 智能体 / ComfyUI 连接 / 模型设置 / 设置.
const NAV: NavItem[] = [
{ id: 'projects', labelKey: 'shell.navProjects', icon: 'home', href: '/' },
{ id: 'workbench', labelKey: 'shell.navWorkbench', icon: 'story', href: '/canvas' },
{ id: 'image', labelKey: 'shell.navImage', icon: 'image', wip: true },
{ id: 'video', labelKey: 'shell.navVideo', icon: 'film', wip: true },
{ id: 'tasks', labelKey: 'shell.navTasks', icon: 'queue', wip: true },
{ id: 'agents', labelKey: 'shell.navAgents', icon: 'sparkle', href: '/agents' },
{ id: 'connections', labelKey: 'shell.navConnections', icon: 'link', wip: true },
{ id: 'models', labelKey: 'shell.navModels', icon: 'assets', href: '/models' },
{ id: 'settings', labelKey: 'shell.navSettings', icon: 'settings', href: '/settings' },
];
interface Props {
active: NavId;
title: string;
subtitle?: string;
/** Page-level actions rendered right of the top bar (chips / buttons). */
actions?: import('svelte').Snippet;
children?: import('svelte').Snippet;
}
let { active, title, subtitle, actions, children }: Props = $props();
// Real ComfyUI address from settings — shown honestly without a fake
// "connected" claim; the standalone connections page is not built yet.
const settingsQuery = createQuery({
queryKey: ['settings'],
queryFn: settings.get,
staleTime: 60_000,
});
const comfyUrl = $derived.by(() => {
const raw = ($settingsQuery.data?.comfyui_base_url ?? '').trim();
if (!raw) return '';
try {
const u = new URL(raw.includes('://') ? raw : `http://${raw}`);
return u.host;
} catch {
return raw;
}
});
</script>
<svelte:head>
<title>{title} · {t('shell.brand')}</title>
</svelte:head>
<div class="a-shell a-darkroom">
<!-- Mobile guard: this is a desktop-first tool (spec §4.5). -->
<div class="desktop-only-notice" data-testid="mobile-notice">
<Icon name="film" size={22} />
<p>{t('shell.mobileNotice')}</p>
</div>
<div class="shell-frame">
<aside class="side">
<a class="brand" href="/" title={t('shell.brandHome')}>
<span class="brand-mark"><Icon name="film" size={17} /></span>
<span class="brand-name">{t('shell.brand')}</span>
</a>
<nav class="nav" aria-label={t('shell.navAria')}>
{#each NAV as item (item.id)}
{#if item.href}
<a
class="nav-item"
class:active={active === item.id}
href={item.href}
aria-current={active === item.id ? 'page' : undefined}
>
<span class="nav-icon"><Icon name={item.icon} size={17} /></span>
<span class="nav-label">{t(item.labelKey)}</span>
</a>
{:else}
<span class="nav-item disabled" title={t('shell.wipHint')} aria-disabled="true">
<span class="nav-icon"><Icon name={item.icon} size={17} /></span>
<span class="nav-label">{t(item.labelKey)}</span>
<span class="wip-pill">{t('shell.wip')}</span>
</span>
{/if}
{/each}
</nav>
<div class="side-foot">
<a class="comfy-row" href="/settings" title={t('shell.comfyManage')}>
<span class="dot" aria-hidden="true"></span>
<span class="comfy-text">
{#if comfyUrl}
{t('shell.comfyAt', { host: comfyUrl })}
{:else}
{t('shell.comfyUnset')}
{/if}
</span>
</a>
<div class="lang-row">
<LanguageSwitcher />
</div>
</div>
</aside>
<div class="main">
<header class="topbar">
<div class="topbar-copy">
<h1>{title}</h1>
{#if subtitle}<p class="sub">{subtitle}</p>{/if}
</div>
{#if actions}
<div class="topbar-actions">
{@render actions()}
</div>
{/if}
</header>
<div class="body">
{@render children?.()}
</div>
</div>
</div>
</div>
<style>
.a-shell {
position: fixed;
inset: 0;
}
.desktop-only-notice {
display: none;
}
.shell-frame {
height: 100%;
display: flex;
min-width: 0;
}
/* ---------------- side navigation (§3, 216px) ---------------- */
.side {
width: 216px;
flex-shrink: 0;
background: var(--surface);
border-right: 1px solid var(--border);
display: flex;
flex-direction: column;
padding: 16px 12px 12px;
gap: 14px;
box-sizing: border-box;
overflow-y: auto;
}
.brand {
display: flex;
align-items: center;
gap: 9px;
padding: 2px 8px;
text-decoration: none;
color: var(--text);
}
.brand-mark {
width: 30px;
height: 30px;
border-radius: 8px;
background: linear-gradient(135deg, #e8a33d, #b96a1b);
color: #16130a;
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.brand-name {
font-size: 15.5px;
font-weight: 700;
letter-spacing: 0.02em;
white-space: nowrap;
}
.nav {
display: flex;
flex-direction: column;
gap: 2px;
}
.nav-item {
display: flex;
align-items: center;
gap: 10px;
min-height: 38px;
padding: 0 10px;
border-radius: 8px;
color: var(--text-2);
font-size: 13px;
text-decoration: none;
transition:
background-color 150ms cubic-bezier(0.16, 1, 0.3, 1),
color 150ms;
}
.nav-item .nav-icon {
display: inline-flex;
flex-shrink: 0;
}
a.nav-item:hover {
background: var(--surface-3);
color: var(--text);
}
.nav-item.active {
background: var(--surface-3);
color: var(--text);
font-weight: 600;
}
.nav-item.disabled {
cursor: default;
user-select: none;
color: var(--text-3);
}
.wip-pill {
margin-left: auto;
padding: 1px 8px;
border-radius: 999px;
background: var(--surface-3);
color: var(--text-3);
font-size: 10px;
white-space: nowrap;
}
.side-foot {
margin-top: auto;
display: flex;
flex-direction: column;
gap: 8px;
padding-top: 12px;
border-top: 1px solid var(--border);
}
.comfy-row {
display: flex;
align-items: center;
gap: 8px;
padding: 7px 10px;
border-radius: 7px;
text-decoration: none;
color: var(--text-2);
font-size: 11.5px;
transition:
background-color 150ms cubic-bezier(0.16, 1, 0.3, 1),
color 150ms;
}
.comfy-row:hover {
background: var(--surface-3);
color: var(--text);
}
/* Untested by default — the connections page (a6) is not built yet, so
no green "connected" claim is made (honesty rule on HEL-608). */
.dot {
width: 7px;
height: 7px;
border-radius: 50%;
background: var(--text-3);
flex-shrink: 0;
}
.comfy-text {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.lang-row :global(.lang-switcher) {
background: var(--surface-2);
color: var(--text-2);
border-color: var(--border-strong);
width: 100%;
box-sizing: border-box;
}
/* ---------------- main column ---------------- */
.main {
flex: 1;
min-width: 0;
display: flex;
flex-direction: column;
background: var(--bg);
}
.topbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
padding: 14px 28px;
border-bottom: 1px solid var(--border);
background: var(--bg);
flex-shrink: 0;
min-height: 64px;
box-sizing: border-box;
}
.topbar-copy h1 {
margin: 0;
font-size: 20px;
font-weight: 600;
color: var(--text);
line-height: 1.3;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.sub {
margin: 3px 0 0;
font-size: 12.5px;
color: var(--text-3);
line-height: 1.5;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.topbar-actions {
display: flex;
align-items: center;
gap: 10px;
flex-shrink: 0;
}
.body {
flex: 1;
min-height: 0;
overflow-y: auto;
}
/* ---------------- responsive (§4.5) ---------------- */
@media (max-width: 1023px) {
.side {
width: 64px;
padding: 14px 8px 10px;
align-items: center;
}
.brand {
padding: 0;
justify-content: center;
}
.brand-name {
display: none;
}
.nav {
width: 100%;
}
.nav-item {
justify-content: center;
padding: 0;
}
.nav-label {
display: none;
}
.wip-pill {
display: none;
}
/* icon-only rail: a small dot marks unbuilt entries */
.nav-item.disabled .nav-icon {
position: relative;
}
.nav-item.disabled .nav-icon::after {
content: '';
position: absolute;
top: -2px;
right: -4px;
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--text-3);
}
.comfy-text,
.lang-row {
display: none;
}
.comfy-row {
justify-content: center;
padding: 6px;
}
.topbar {
padding: 12px 18px;
}
.sub {
white-space: normal;
}
}
@media (max-width: 767px) {
.shell-frame {
display: none;
}
.desktop-only-notice {
display: flex;
height: 100%;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
padding: 32px;
text-align: center;
color: var(--text-2);
}
.desktop-only-notice p {
margin: 0;
font-size: 14px;
line-height: 1.7;
}
.desktop-only-notice :global(.icon) {
color: var(--accent);
}
}
</style>