forked from bai/curriculum-project-hub
83a6b012b7
- FileLibRecentVisit 删表(手写迁移;表当日新建无生产数据) - recentService/recentRoutes/RecentView 删除;GridLibraryView 埋点与 navTarget 跳转一并移除;types 清 RecentEntry - 左栏保留 文件库/回收站(ADR-0031 回收站半部不受影响) - breadcrumb 的 role 字段保留(独立可用的增量字段)
52 lines
1.6 KiB
Svelte
52 lines
1.6 KiB
Svelte
<script lang="ts">
|
|
/** 老师端。未登录显示登录卡片;登录后是带左栏导航的文件库(ADR-0031)。 */
|
|
import { onMount } from "svelte";
|
|
import { me, authChecked } from "$lib/stores.js";
|
|
import { loadSession } from "$lib/session.js";
|
|
import LoginView from "$lib/LoginView.svelte";
|
|
import GridLibraryView from "$lib/GridLibraryView.svelte";
|
|
import BinView from "$lib/BinView.svelte";
|
|
import Icon from "$lib/Icon.svelte";
|
|
|
|
onMount(loadSession);
|
|
|
|
type View = "library" | "bin";
|
|
let view = $state<View>("library");
|
|
|
|
const tabs: ReadonlyArray<readonly [View, string, "layers" | "trash"]> = [
|
|
["library", "文件库", "layers"],
|
|
["bin", "回收站", "trash"],
|
|
];
|
|
</script>
|
|
|
|
<svelte:head><title>文件库</title></svelte:head>
|
|
|
|
{#if !$authChecked}
|
|
<div class="flex h-full items-center justify-center text-ink-3">加载中…</div>
|
|
{:else if $me}
|
|
<div class="flex h-full">
|
|
<!-- 左栏导航(ADR-0031) -->
|
|
<nav class="flex w-[168px] shrink-0 flex-col gap-0.5 border-r border-line-soft bg-sidebar px-2.5 py-3.5">
|
|
{#each tabs as [id, label, icon] (id)}
|
|
<button
|
|
class="flex items-center gap-2.5 rounded-lg px-3 py-2 text-left text-[13px] transition {view === id
|
|
? 'bg-selected font-semibold text-ink'
|
|
: 'text-ink-2 hover:bg-hover'}"
|
|
onclick={() => (view = id)}
|
|
>
|
|
<span class="text-ink-3"><Icon name={icon} size={15} /></span>
|
|
{label}
|
|
</button>
|
|
{/each}
|
|
</nav>
|
|
|
|
{#if view === "library"}
|
|
<GridLibraryView />
|
|
{:else}
|
|
<BinView />
|
|
{/if}
|
|
</div>
|
|
{:else}
|
|
<LoginView />
|
|
{/if}
|