From 5b8804d65ded6f78938618ed1c5955c0865f69cf Mon Sep 17 00:00:00 2001 From: 732642856 <732642856@qq.com> Date: Tue, 21 Jul 2026 13:32:25 +0800 Subject: [PATCH] fix: center chat deletion dialog (#22) * fix: center chat deletion dialog * fix: clarify archived chat state --- frontend/src/app/globals.css | 8 +++-- frontend/src/app/page.tsx | 31 ++++++++++++-------- tests/test_session_management_entrypoints.py | 11 +++++++ 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/frontend/src/app/globals.css b/frontend/src/app/globals.css index 372cbfb5..d335410b 100644 --- a/frontend/src/app/globals.css +++ b/frontend/src/app/globals.css @@ -707,6 +707,8 @@ input:disabled, select:disabled { color: var(--color-ink-tertiary); background: .auth-panel h1 { font-size: var(--type-display-sm); } .admin-section { padding: var(--space-5); } } -.session-delete-confirmation { position: fixed; inset: auto var(--space-5) var(--space-5) auto; z-index: 100; width: min(360px, calc(100vw - var(--space-10))); padding: var(--space-5); border: 1px solid var(--border); border-radius: 8px; background: var(--background); box-shadow: 0 12px 32px rgb(0 0 0 / 18%); } -.session-delete-confirmation p { margin: 0 0 var(--space-4); } -.session-delete-confirmation div { display: flex; justify-content: flex-end; gap: var(--space-3); } +.session-delete-overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: var(--space-5); background: rgb(0 0 0 / 32%); } +.session-delete-confirmation { width: min(420px, 100%); padding: var(--space-6); border: 1px solid var(--border); border-radius: 8px; background: var(--background); box-shadow: 0 20px 56px rgb(0 0 0 / 24%); } +.session-delete-confirmation h2 { margin: 0 0 var(--space-3); font-size: var(--type-title-lg); } +.session-delete-confirmation p { margin: 0; color: var(--muted-foreground); } +.session-delete-actions { display: flex; justify-content: flex-end; gap: var(--space-3); margin-top: var(--space-6); } diff --git a/frontend/src/app/page.tsx b/frontend/src/app/page.tsx index a913639a..298d32a9 100644 --- a/frontend/src/app/page.tsx +++ b/frontend/src/app/page.tsx @@ -1268,8 +1268,12 @@ export default function Home() { } function toggleArchivedSession(sessionId: string) { - setArchivedSessionIds((current) => current.includes(sessionId) ? current.filter((id) => id !== sessionId) : [sessionId, ...current]); - if (activeSessionId === sessionId) setActiveSessionId(visibleSessions.find((session) => session.id !== sessionId)?.id ?? ""); + const restoring = archivedSessionIds.includes(sessionId); + setArchivedSessionIds((current) => restoring ? current.filter((id) => id !== sessionId) : [sessionId, ...current]); + if (!restoring && activeSessionId === sessionId) { + setActiveSessionId(visibleSessions.find((session) => session.id !== sessionId)?.id ?? ""); + } + setComposerNotice(restoring ? "已恢复到聊天记录。" : "已归档,可在左侧归档中恢复。"); } async function shareSession(session: ChatSession) { @@ -2320,16 +2324,19 @@ export default function Home() { onOpenLogout={() => openAccountDialog("logout")} /> {pendingSessionDeletion ? ( -
删除“{pendingSessionDeletion.title}”?此操作不可恢复。
-“{pendingSessionDeletion.title}”将被永久删除,无法恢复。
+