feat(journal): delete sessions from the ui

Add a confirmation dialog that spells out the removal is irreversible, and expose delete from the GM session dropdown and the lobby session list.
This commit is contained in:
2026-09-13 13:36:42 +08:00
parent a65ca2ab93
commit 421af125bb
6 changed files with 176 additions and 22 deletions
+30 -14
View File
@@ -10,6 +10,7 @@ import {
interface SessionDropdownProps {
onCreate: () => void;
onDelete: (id: string, name: string) => void;
}
export const SessionDropdown: Component<SessionDropdownProps> = (props) => {
@@ -54,22 +55,37 @@ export const SessionDropdown: Component<SessionDropdownProps> = (props) => {
>
<For each={Object.entries(manifest().sessions)}>
{([id, meta]) => (
<button
onClick={(e) => {
e.stopPropagation();
handleSessionSelect(id);
}}
class={`w-full text-left px-3 py-1 text-xs hover:bg-gray-100 flex items-center gap-1 ${
id === stream.sessionId
? "bg-blue-50 text-blue-700"
: "text-gray-700"
<div
class={`flex items-center ${
id === stream.sessionId ? "bg-blue-50" : ""
}`}
>
<span class="truncate flex-1">{meta.name || id}</span>
<Show when={id === stream.sessionId}>
<span class="text-blue-500 shrink-0">✓</span>
</Show>
</button>
<button
onClick={(e) => {
e.stopPropagation();
handleSessionSelect(id);
}}
class={`flex-1 min-w-0 text-left px-3 py-1 text-xs hover:bg-gray-100 flex items-center gap-1 ${
id === stream.sessionId ? "text-blue-700" : "text-gray-700"
}`}
>
<span class="truncate flex-1">{meta.name || id}</span>
<Show when={id === stream.sessionId}>
<span class="text-blue-500 shrink-0">✓</span>
</Show>
</button>
<button
onClick={(e) => {
e.stopPropagation();
setDropdownOpen(false);
props.onDelete(id, meta.name || id);
}}
class="shrink-0 px-2 py-1 text-[10px] text-gray-300 hover:text-red-500"
title="删除会话"
>
🗑
</button>
</div>
)}
</For>
<div class="border-t border-gray-100 my-0.5" />