import type { CatalogNodePage, CatalogSnapshot } from './sourceCatalog' import './sourceCatalogBrowser.css' const stamp = (value: string) => new Date(value).toLocaleString('zh-CN', { hour12: false }) const shortHash = (value: string) => `${value.slice(0, 12)}…${value.slice(-8)}` interface Props { snapshots: CatalogSnapshot[] active: CatalogSnapshot | null page: CatalogNodePage | null loading: boolean error: string | null onClose: () => void onOpenSnapshot: (snapshot: CatalogSnapshot) => void onOpenFolder: (snapshot: CatalogSnapshot, nodeID: string) => void } export function SnapshotHistoryView({ snapshots, active, page, loading, error, onClose, onOpenSnapshot, onOpenFolder, }: Props) { return (

历史快照

只读查看不可变快照;切换查看不会改变当前生效版本。

{error ? (
{error}
) : null} {loading ?
正在读取历史快照目录…
: null} {active && page ? (
{active.source_name} 只读历史快照
{page.items.map((node) => ( ))}
名称 类型 大小 更新时间 内容Hash
{node.node_type === 'folder' ? ( ) : ( <>📄 {node.name} )} {node.node_type === 'folder' ? '文件夹' : '文件'} {typeof node.size_bytes === 'number' ? `${node.size_bytes} B` : '—'} {node.modified_at ? stamp(node.modified_at) : '—'} {node.content_sha256 ? shortHash(node.content_sha256) : '内容Hash未获取'}
{page.total > page.limit ? (

共 {page.total} 项 · 每页 {page.limit} 项

) : null}
) : null} {!loading && active && !page && !error ?
该快照暂无可见内容。
: null}
) }