Files
kandev/apps/web/lib/session/session-deletion.ts
T
Clément Fiere ba96562f04 feat: add quick chat idle dot indicator (#2750)
Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
2026-08-18 06:52:26 +00:00

19 lines
717 B
TypeScript

import type { QuickChatSession } from "@/lib/state/slices/ui/types";
export type SessionDeletionTarget =
| { kind: "quick-chat-task"; taskId: string }
| { kind: "session"; sessionId: string };
/** Routes Quick Chat members through task deletion and ordinary sessions through session deletion. */
export function resolveSessionDeletionTarget(
sessionId: string,
taskId: string,
quickChatSessions: readonly QuickChatSession[],
): SessionDeletionTarget {
const quickChatSession = quickChatSessions.find((session) => session.sessionId === sessionId);
if (quickChatSession) {
return { kind: "quick-chat-task", taskId: quickChatSession.taskId ?? taskId };
}
return { kind: "session", sessionId };
}