From a7aab01f051487327e5ce52b6a8905208c546e8c Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Fri, 18 Sep 2026 15:49:44 +0800 Subject: [变更性质] feat(frontend) [新增功能] 12 页面组件全量 shadcn:Card/Button/Table/Tabs/Select/Alert;375 底部 Tab Bar 改用 Tabs 组件实现 [实现方案] 页面级手写 class 全部移除(.btn/.banner/table.data/.badge/.tabs/.metric-row/.m-tile/.hint 等改为 shadcn + tailwind 工具类);Modal/DatasetWizard/DatasetCard/DiffView/CodeEditor/Status/Layout 同步 [影响范围] src/pages/*.svelte、src/components/*.svelte MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/Layout.svelte | 344 ++++++++-------------------------- 1 file changed, 76 insertions(+), 268 deletions(-) (limited to 'frontend/src/components/Layout.svelte') diff --git a/frontend/src/components/Layout.svelte b/frontend/src/components/Layout.svelte index ddd5090..18a79a2 100644 --- a/frontend/src/components/Layout.svelte +++ b/frontend/src/components/Layout.svelte @@ -5,6 +5,8 @@ import { postLogout } from '../lib/client'; import { projectsStore, projectOf, projectInvisible } from '../lib/listsStore.svelte'; import { Button } from '$lib/components/ui/button'; + import * as Tabs from '$lib/components/ui/tabs'; + import { Separator } from '$lib/components/ui/separator'; interface Props { route: Route; @@ -55,9 +57,7 @@ if (id && !activeProject) void projectsStore.ensure(id).catch(() => undefined); }); - // ---- 移动端导航重设计(375 → 底部 Tab Bar)---- - // 小型 matchMedia 反应式:jsdom 没有布局,真实渲染断言 - // (mobileTabbar.test.ts)通过 matchMedia stub 驱动 phone/桌面两种形态。 + // ---- 移动端导航(≤767px 底部 Tab Bar,shadcn Tabs 组件实现)---- import { onDestroy } from 'svelte'; let phoneMode = $state(false); let mqListener: ((e: MediaQueryListEvent) => void) | null = null; @@ -90,301 +90,109 @@ const activeTab = $derived( isProject || route.name === 'admin' ? 'projects' : route.name === 'account' ? 'account' : route.name ); + + const navLinkBase = 'block rounded-md py-1.5 px-2 text-sm no-underline hover:text-foreground'; -
+
{#if mobile} -
- 策研 Strategy Lab +
+ 策研 Strategy Lab {#if isProject} - {activeProject?.name ?? '项目'} · {projectNav.find(([t]) => t === projectTab)?.[1] ?? ''} + {activeProject?.name ?? '项目'} · {projectNav.find(([t]) => t === projectTab)?.[1] ?? ''} {/if} - +
{/if} -
{#if mobile} - + go(`/${v}`)} + data-testid="mobile-tabbar" + class="fixed left-0 right-0 bottom-0 z-40 flex items-stretch justify-around min-h-14 pb-[env(safe-area-inset-bottom,0)] bg-card/95 border-t border-border backdrop-blur" + aria-label="底部导航" + > + + {#each tabs as t (t.name)} + + {#if t.icon === 'project'} + + {:else if t.icon === 'dataset'} + + {:else if t.icon === 'run'} + + {:else} + + {/if} + {t.label} + + {/each} + + {/if} - - -- cgit v1.2.3