fix(HEL-767): align management header, theme cards and shared rail with sample

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
leefer
2026-10-22 06:38:32 +08:00
co-authored by multica-agent
parent dca88b3765
commit 2004f527cc
10 changed files with 1361 additions and 148 deletions
@@ -1,7 +1,6 @@
<script lang="ts">
import { resolve } from "$app/paths";
import { onMount } from "svelte";
import { spotlight } from "$lib/actions/spotlight";
import { createQuery } from "@tanstack/svelte-query";
import { toStore } from "svelte/store";
import { page } from "$app/state";
@@ -184,48 +183,61 @@
class="refract-shell"
class:focus
class:expanded
style:--scene={`var(--sc-${scene})`}
style:--scene={scene === "gold" ? "var(--gold)" : `var(--sc-${scene})`}
>
<aside class="sidebar" aria-label="全站导航">
<a class="brand" href={resolve('/')} aria-label="返回工作室"
>AIGC{#if expanded}<small>创作工作台</small>{/if}</a
<a class="brand" href={resolve("/")} aria-label="返回工作室"
><b>片</b>{#if expanded}<small>创作工作台</small>{/if}</a
>
<nav aria-label="主要导航">
{#each mainNav as item (item.id)}<a
class="nav-item reference-option"
use:spotlight
class="nav-item"
href={resolve(item.href)}
style:--nav-c={`var(--sc-${item.scene})`}
style:--nav-c={item.scene === "gold"
? "var(--gold)"
: `var(--sc-${item.scene})`}
aria-current={item.matches(page.url.pathname) ? "page" : undefined}
title={item.label}
><Icon name={item.icon} size={20} /><span>{item.label}</span></a
title={item.id === "connections"
? `${item.label} · ${connDetail}`
: item.label}
><Icon name={item.icon} size={18} /><span>{item.label}</span></a
>{/each}
</nav>
<hr />
<nav class="management" aria-label="管理导航">
{#each NAV_MANAGE as item (item.id)}<a
class="nav-item reference-option"
use:spotlight
class="nav-item"
href={resolve(item.href)}
style:--nav-c={`var(--sc-${item.scene})`}
style:--nav-c={item.scene === "gold"
? "var(--gold)"
: `var(--sc-${item.scene})`}
aria-current={item.matches(page.url.pathname) ? "page" : undefined}
title={item.label}
title={item.id === "connections"
? `${item.label} · ${connDetail}`
: item.label}
><Icon name={item.icon} size={18} /><span>{item.label}</span></a
>{/each}
</nav>
<div class="sidebar-bottom">
<button
class="nav-item reference-option"
use:spotlight
onclick={toggleNavigation}
aria-expanded={expanded}
title={expanded ? "收起导航" : "展开导航"}
><Icon name="chevron-right" size={18} /><span
>{expanded ? "收起导航" : "展开导航"}</span
></button
<a
class="queue-dot"
href={resolve("/tasks")}
title={`${genJobs.filter((j) => j.status === "running" || j.status === "pending").length} 个任务进行中`}
aria-label="查看生成任务"
>
<Icon name="nav-queue" />
{#if genJobs.some((j) => j.status === "running") && !reduceMotion.manual && !reduceMotion.system}<span
class="queue-ring"
aria-hidden="true"
></span>{/if}
{#if genJobs.some((j) => j.status === "running" || j.status === "pending")}<i
>{genJobs.filter(
(j) => j.status === "running" || j.status === "pending",
).length}</i
>{/if}
</a>
<button
class="nav-item reference-option"
use:spotlight
class="nav-item"
onclick={() => (themeOpen = true)}
aria-haspopup="dialog"
aria-expanded={themeOpen}
@@ -234,27 +246,36 @@
></button
>
<a
class="nav-item reference-option"
use:spotlight
href={resolve('/settings')}
class="nav-item"
href={resolve("/settings")}
aria-current={page.url.pathname === "/settings" ? "page" : undefined}
title="设置"><Icon name="settings" size={18} /><span>设置</span></a
title="设置"><Icon name="nav-gear" size={18} /><span>设置</span></a
>
<a
class="connection"
href={resolve('/connections')}
title={connDetail}
aria-label={connDetail}
><span class="status-chip-dot {connDot}"></span>{#if expanded}<span
>{probeState === "ok"
? "本地服务已连接"
: probeState === "testing"
? "正在检测服务"
: probeState === "fail"
? "本地服务离线"
: "配置本地服务"}</span
>{/if}</a
<button
class="nav-item"
onclick={toggleNavigation}
aria-expanded={expanded}
title={expanded ? "收起导航" : "展开导航"}
><Icon name="nav-palette" size={18} /><span
>{expanded ? "收起" : "导航"}</span
></button
>
{#if expanded}<a
class="connection"
href={resolve("/connections")}
title={connDetail}
aria-label={connDetail}
><span class="status-chip-dot {connDot}"></span>{#if expanded}<span
>{probeState === "ok"
? "本地服务已连接"
: probeState === "testing"
? "正在检测服务"
: probeState === "fail"
? "本地服务离线"
: "配置本地服务"}</span
>{/if}</a
>
{/if}
</div>
</aside>
<div
@@ -272,14 +293,14 @@
{#if currentNav?.id === "connections"}
<a
class="a-btn secondary sm"
href={resolve('/connections')}
href={resolve("/connections")}
aria-current={page.url.pathname === "/connections"
? "page"
: undefined}>ComfyUI 连接</a
>
<a
class="a-btn secondary sm"
href={resolve('/models')}
href={resolve("/models")}
aria-current={page.url.pathname === "/models" ? "page" : undefined}
>大语言模型</a
>
@@ -325,11 +346,6 @@
</Modal>
<style>
.management {
border-top: 1px solid var(--line-2);
margin-top: 8px;
padding-top: 8px;
}
.theme-dot {
width: 18px;
height: 18px;
@@ -353,7 +369,7 @@
color: var(--tx-2);
}
.nav-item[aria-current="page"] :global(svg) {
color: var(--nav-c, var(--scene));
color: var(--nav-c, var(--gold));
}
.refract-shell {
@@ -366,28 +382,45 @@
min-width: 0;
}
.refract-shell.expanded {
grid-template-columns: 174px minmax(0, 1fr);
grid-template-columns: var(--rail-expanded-width) minmax(0, 1fr);
}
.sidebar {
background: var(--bg-1);
border-right: 1px solid var(--line);
padding: 16px 8px 9px;
--icon-stroke: var(--manage-icon-stroke);
padding: var(--rail-padding);
align-items: center;
gap: 2px;
z-index: 5;
display: flex;
flex-direction: column;
min-height: 0;
overflow: auto;
scrollbar-width: thin;
overflow: visible;
}
.brand {
font-size: 19px;
font-weight: 800;
color: var(--gold);
text-align: center;
width: var(--rail-brand-size);
height: var(--rail-brand-size);
border-radius: var(--rail-brand-radius);
display: grid;
place-items: center;
margin-bottom: var(--rail-brand-margin);
position: relative;
background: var(--brand-grad);
box-shadow: var(--brand-glow);
text-decoration: none;
letter-spacing: -1px;
display: block;
margin: 2px 0 18px;
text-shadow: var(--brand-glow);
flex: none;
}
.brand b {
font: 800 15px/1 var(--font);
color: var(--brand-ink);
letter-spacing: -0.5px;
}
.sidebar hr {
width: 28px;
border: 0;
border-top: 1px solid var(--line-2);
margin: var(--rail-divider-margin);
flex: none;
}
.brand small {
display: block;
@@ -403,26 +436,24 @@
gap: 2px;
}
.nav-item {
min-height: 44px;
box-sizing: border-box;
position: relative;
width: var(--rail-nav-width);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
gap: 5px;
font-size: 10px;
line-height: 1;
padding: 7px 3px;
gap: 3px;
font: inherit;
padding: var(--rail-nav-padding);
color: var(--tx-3);
text-decoration: none;
border: 0;
background: none;
border-radius: var(--r-md);
border-radius: var(--rail-nav-radius);
cursor: pointer;
font-family: inherit;
transition:
background-color 180ms ease,
color 180ms ease,
transform 160ms var(--ease-out);
color var(--t-base),
background var(--t-base);
flex-shrink: 0;
}
.nav-item[aria-current="page"] {
@@ -436,20 +467,30 @@
.nav-item[aria-current="page"]::before {
content: "";
position: absolute;
left: -2px;
left: -6px;
top: 12px;
bottom: 12px;
width: 3px;
border-radius: 3px;
background: var(--nav-c, var(--scene));
background: var(--nav-c, var(--gold));
box-shadow: var(
--rail-active-shadow,
0 0 var(--rail-active-shadow-blur) var(--nav-c, var(--gold))
);
}
.nav-item:active {
transform: scale(var(--press-scale));
}
.nav-item > span {
font-size: var(--rail-nav-size);
line-height: 1;
white-space: nowrap;
}
.expanded .sidebar {
overflow-y: auto;
}
.expanded .nav-item {
width: var(--rail-expanded-nav-width);
flex-direction: row;
justify-content: flex-start;
gap: 12px;
@@ -457,26 +498,56 @@
padding: 10px 14px;
min-height: 43px;
}
.expanded .nav-item > span {
font-size: var(--rail-expanded-label-size);
}
.expanded .nav-item::before {
display: none;
}
.sidebar-bottom {
display: flex;
flex-direction: column;
gap: 2px;
align-items: center;
gap: 6px;
margin-top: auto;
padding-top: 8px;
}
.sidebar-bottom .nav-item {
min-height: 45px;
font-size: 9px;
padding: 7px 3px;
gap: 4px;
.queue-dot {
box-sizing: border-box;
width: var(--rail-queue-size);
height: var(--rail-queue-size);
border-radius: var(--rail-brand-radius);
display: grid;
place-items: center;
position: relative;
color: var(--tx-2);
background: var(--bg-2);
border: 1px solid var(--line);
}
.expanded .sidebar-bottom .nav-item {
min-height: 39px;
padding: 9px 14px;
font-size: 12px;
.queue-ring {
position: absolute;
inset: -1px;
border-radius: var(--rail-queue-ring-radius);
border: var(--rail-queue-ring-border) solid transparent;
border-top-color: var(--sc-video);
animation: rail-spin var(--rail-queue-ring-duration) linear infinite;
}
@keyframes rail-spin {
to {
transform: rotate(360deg);
}
}
.queue-dot i {
position: absolute;
top: -4px;
right: -4px;
min-width: 16px;
height: 16px;
padding: 0 4px;
border-radius: 8px;
background: var(--sc-video);
color: var(--on-scene);
font: 700 10px/16px var(--mono);
font-style: normal;
}
.connection {
display: flex;
@@ -587,48 +658,4 @@
text-overflow: ellipsis;
}
}
@media (max-height: 780px) {
.sidebar {
padding-top: 11px;
}
.brand {
margin-bottom: 8px;
}
.nav-item {
min-height: 40px;
padding: 5px 0 3px;
gap: 3px;
}
.sidebar-bottom {
gap: 0;
padding-top: 12px;
}
.sidebar-bottom .nav-item {
min-height: 37px;
}
}
@media (max-height: 740px) {
.sidebar {
padding-top: 10px;
}
.brand {
margin-bottom: 12px;
}
.sidebar nav {
gap: 4px;
}
.nav-item {
min-height: 38px;
padding: 4px 2px;
gap: 3px;
}
.sidebar-bottom {
padding-top: 8px;
}
.sidebar-bottom .nav-item {
min-height: 31px;
padding: 4px 2px;
}
}
</style>