+ {/* Search input — hidden when only showing the new-conversation confirmation */}
+ {!pendingNewConversation && (
+
+
+
+ )}
{/* Switch confirmation — overlays the list when pending */}
{pendingId !== null ? (
@@ -254,9 +260,10 @@ export function HistoryPanel({
/>
) : pendingNewConversation ? (
) : (
@@ -281,6 +288,7 @@ export function HistoryPanel({
diff --git a/src/components/SwitchConfirmation.tsx b/src/components/SwitchConfirmation.tsx
index 026d6abe..e1c3593c 100644
--- a/src/components/SwitchConfirmation.tsx
+++ b/src/components/SwitchConfirmation.tsx
@@ -1,34 +1,59 @@
import { memo } from 'react';
+type SwitchConfirmationVariant = 'switch' | 'new';
+
interface SwitchConfirmationProps {
- /** Called when the user wants to save the current session then load the new one. */
+ /** Called when the user wants to save the current session then proceed. */
onSaveAndSwitch: () => void;
- /** Called when the user wants to discard the current session and load the new one. */
+ /** Called when the user wants to discard the current session and proceed. */
onJustSwitch: () => void;
/** Called when the user wants to go back without switching. */
onCancel: () => void;
+ /**
+ * Controls the title and button labels.
+ * - `"switch"` (default) — "Switch conversations?" / "Save & Switch" / "Just Switch"
+ * - `"new"` — "New conversation?" / "Save & Start New" / "Start New"
+ */
+ variant?: SwitchConfirmationVariant;
}
+const VARIANT_TEXT: Record<
+ SwitchConfirmationVariant,
+ { title: string; save: string; proceed: string }
+> = {
+ switch: {
+ title: 'Switch conversations?',
+ save: 'Save & Switch',
+ proceed: 'Just Switch',
+ },
+ new: {
+ title: 'New conversation?',
+ save: 'Save & Start New',
+ proceed: 'Start New',
+ },
+};
+
/**
* Inline confirmation prompt displayed inside the history panel when the user
- * selects a conversation while an unsaved (or saved) session is active.
+ * needs to decide what to do with the current conversation before proceeding.
*
- * Presents two primary actions:
- * - **Save & Switch** — persists the current conversation before loading.
- * - **Just Switch** — discards the current conversation and loads immediately.
+ * Two variants:
+ * - **switch** — loading an existing conversation.
+ * - **new** — starting a fresh conversation via the "+" button.
*
- * A **Cancel** action returns the user to the history list.
+ * A **Cancel** action returns the user to the previous view.
*/
export const SwitchConfirmation = memo(function SwitchConfirmation({
onSaveAndSwitch,
onJustSwitch,
onCancel,
+ variant = 'switch',
}: SwitchConfirmationProps) {
+ const text = VARIANT_TEXT[variant];
+
return (