forked from bai/curriculum-project-hub
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4fc72541be | |||
| 672f05c66a |
@@ -11,7 +11,6 @@
|
||||
import { onMount } from "svelte";
|
||||
import { api } from "./api.js";
|
||||
import { me, toastErr, toastOk } from "./stores.js";
|
||||
import { logout } from "./session.js";
|
||||
import { selectedFilePath, clearSelectedFile } from "./browser.js";
|
||||
import { ROLE_LABEL } from "./labels.js";
|
||||
import type { FileEntry, NodeChild, NodeDetail, Role } from "./types.js";
|
||||
@@ -61,7 +60,6 @@
|
||||
currentFolder === null ? ($me?.isWebsiteAdmin ?? false) : atLeast(currentFolder.role, "EDIT"),
|
||||
);
|
||||
const projectCanEdit = $derived(projectNode !== null && projectNode.role !== "VIEW");
|
||||
const initial = $derived(($me?.displayName ?? $me?.userId ?? "U").slice(0, 1).toUpperCase());
|
||||
|
||||
/* ------------------------------------------------------------ 数据加载 */
|
||||
|
||||
@@ -387,16 +385,6 @@
|
||||
</button>
|
||||
{/if}
|
||||
<button class="btn btn-sm" onclick={refresh} title="刷新"><Icon name="refresh" size={13} /></button>
|
||||
|
||||
<div class="ml-1 flex shrink-0 items-center gap-2 border-l border-line-soft pl-3">
|
||||
<span class="flex h-6 w-6 items-center justify-center rounded-full bg-accent text-[11px] font-semibold text-white">{initial}</span>
|
||||
<span class="max-w-[120px] truncate text-[12.5px] text-ink">{$me?.displayName ?? $me?.userId ?? ""}</span>
|
||||
<button
|
||||
class="rounded-lg border border-line-soft px-2 py-1 text-[11.5px] text-ink-3 transition hover:bg-hover hover:text-ink"
|
||||
onclick={logout}
|
||||
title="退出登录"
|
||||
>退出</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 主体:网格 + 文件预览栏 -->
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/** 老师端。未登录显示登录卡片;登录后是带左栏导航的文件库(ADR-0031)。 */
|
||||
import { onMount } from "svelte";
|
||||
import { me, authChecked } from "$lib/stores.js";
|
||||
import { loadSession } from "$lib/session.js";
|
||||
import { loadSession, logout } from "$lib/session.js";
|
||||
import LoginView from "$lib/LoginView.svelte";
|
||||
import GridLibraryView from "$lib/GridLibraryView.svelte";
|
||||
import BinView from "$lib/BinView.svelte";
|
||||
@@ -17,27 +17,46 @@
|
||||
["library", "文件库", "layers"],
|
||||
["bin", "回收站", "trash"],
|
||||
];
|
||||
|
||||
const initial = $derived(($me?.displayName ?? $me?.userId ?? "U").slice(0, 1).toUpperCase());
|
||||
</script>
|
||||
|
||||
<svelte:head><title>文件库</title></svelte:head>
|
||||
<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)}
|
||||
<nav class="flex w-[168px] shrink-0 flex-col border-r border-line-soft bg-sidebar px-2.5 py-3.5">
|
||||
<!-- 标题 -->
|
||||
<div class="mb-3 px-2 text-[15px] font-bold text-ink">教研数据库</div>
|
||||
|
||||
<!-- 导航项 -->
|
||||
<div class="flex flex-1 flex-col gap-0.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}
|
||||
</div>
|
||||
|
||||
<!-- 底部:用户身份 + 退出 -->
|
||||
<div class="mt-auto flex items-center gap-2 border-t border-line-soft pt-3">
|
||||
<span class="flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-accent text-[11px] font-semibold text-white">{initial}</span>
|
||||
<span class="min-w-0 flex-1 truncate text-[12.5px] text-ink">{$me?.displayName ?? $me?.userId ?? ""}</span>
|
||||
<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}
|
||||
class="rounded-lg border border-line-soft px-2 py-1 text-[11.5px] text-ink-3 transition hover:bg-hover hover:text-ink"
|
||||
onclick={logout}
|
||||
title="退出登录"
|
||||
>退出</button>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
{#if view === "library"}
|
||||
|
||||
Reference in New Issue
Block a user