fix(web): retire session archive UI and API, restore archived rows
Independent Staging Quality Gate / validate (push) Failing after 6m35s
Independent Staging Quality Gate / publish (push) Skipped

Remove archive/restore from the session menu and drop archived=1 listing. PATCH still accepts archived_at from old bundles then ignores it. A forward migration clears archived_at without bumping updated_at. Delete stays unchanged.
This commit is contained in:
jesse-ux
2026-09-21 18:49:40 +08:00
parent f8cb1dcdee
commit 5a4b87383f
29 changed files with 227 additions and 198 deletions
+2 -3
View File
@@ -218,7 +218,6 @@ export function AppSidebar({
onTogglePinned={() => sessionControls.onTogglePinned(session.id)}
onRename={() => sessionControls.onRename(session.id)}
onShare={() => sessionControls.onShare(session.id)}
onToggleArchived={() => sessionControls.onToggleArchived(session.id)}
onDelete={() => sessionControls.onDelete(session.id)}
/>
) : (
@@ -276,14 +275,14 @@ export function AppSidebar({
<SidebarContent>
{showExpandedContent ? (
<SidebarGroup className="session-nav" aria-label={sessionControls?.showingArchived ? "归档记录" : "最近对话"}>
<SidebarGroup className="session-nav" aria-label="最近对话">
{/* One flat list. It was three stacked sections — a 星盘列表 chip grid
and two <details> wrappers for 收藏对话 / 历史对话 — so the nav
carried two collapse affordances before the first session row.
Pinned sessions keep their priority as the first labelled group,
in the same shape as the recency groups under them. */}
<p className="sidebar-section-label" ref={historyHeadingRef} tabIndex={-1}>
{sessionControls?.showingArchived ? "归档记录" : "最近"}
最近
</p>
<SidebarGroupContent className="sidebar-nested">
{favoriteSessions.length === 0 && historySessions.length === 0 ? (
@@ -2,8 +2,6 @@
import { Menu } from "@base-ui/react/menu";
import {
Archive,
ArchiveRestore,
MoreHorizontal,
Pencil,
Share2,
@@ -22,23 +20,18 @@ export type SidebarSession = {
readonly title: string;
readonly subtitle?: string | null;
readonly pinned: boolean;
readonly archived: boolean;
readonly updatedAt: number;
};
export type SidebarSessionControls = {
readonly archivedCount: number;
readonly showingArchived: boolean;
readonly hasMore?: boolean;
readonly onLoadMore?: () => void;
readonly menuSessionId: string | null;
readonly disabled: boolean;
readonly onToggleArchivedView: () => void;
readonly onMenuSessionChange: (sessionId: string | null) => void;
readonly onTogglePinned: (sessionId: string) => void;
readonly onRename: (sessionId: string) => void;
readonly onShare: (sessionId: string) => void;
readonly onToggleArchived: (sessionId: string) => void;
readonly onDelete: (sessionId: string) => void;
};
@@ -60,7 +53,6 @@ type SidebarSessionRowInteractiveProps = SidebarSessionRowCommonProps & {
readonly onTogglePinned: () => void;
readonly onRename: () => void;
readonly onShare: () => void;
readonly onToggleArchived: () => void;
readonly onDelete: () => void;
};
@@ -122,7 +114,6 @@ export const SidebarSessionRow = forwardRef<HTMLButtonElement, SidebarSessionRow
onTogglePinned,
onRename,
onShare,
onToggleArchived,
onDelete,
} = props;
@@ -173,10 +164,6 @@ export const SidebarSessionRow = forwardRef<HTMLButtonElement, SidebarSessionRow
</Menu.Item>
<Menu.Item className="session-action-item" onClick={onRename}><Pencil aria-hidden="true" /><span>重命名</span></Menu.Item>
<Menu.Item className="session-action-item" onClick={onShare}><Share2 aria-hidden="true" /><span>转发</span></Menu.Item>
<Menu.Item className="session-action-item" onClick={onToggleArchived}>
{session.archived ? <ArchiveRestore aria-hidden="true" /> : <Archive aria-hidden="true" />}
<span>{session.archived ? "恢复" : "归档"}</span>
</Menu.Item>
<Menu.Separator className="session-actions-separator" />
<Menu.Item className="session-action-item session-action-danger" onClick={onDelete}><Trash2 aria-hidden="true" /><span>删除</span></Menu.Item>
</Menu.Popup>