Files
opencode-manager/frontend/src/components/ui/unsaved-changes-dialog.tsx
T
Chris Scott a73ac19bbc feat(frontend): mobile-friendly config editor with find bar and unsaved-changes guard (#326)
* feat(frontend): mobile-friendly config editor with find bar and unsaved-changes guard

* refactor: remove retry-clone flow and share destructive-confirm dialog

Backend drops POST /:id/retry-clone and the supporting retryCloneRepo service
and claimRepoForRetry query; failed clones now delete the repo row rather than
lingering in error state. Frontend extracts ConfirmDestructiveDialog shared by
Delete/Discard/UnsavedChanges dialogs, memoizes CodeEditor rows, fixes scroll
jump while typing away from the active match, and aligns the responsive
breakpoint to 768px.
2026-07-27 16:46:12 -04:00

32 lines
812 B
TypeScript

import { ConfirmDestructiveDialog } from '@/components/ui/confirm-destructive-dialog'
interface UnsavedChangesDialogProps {
open: boolean
onOpenChange: (open: boolean) => void
onDiscard: () => void
onKeepEditing: () => void
itemName?: string
}
export function UnsavedChangesDialog({
open,
onOpenChange,
onDiscard,
onKeepEditing,
itemName,
}: UnsavedChangesDialogProps) {
return (
<ConfirmDestructiveDialog
open={open}
onOpenChange={onOpenChange}
onConfirm={onDiscard}
onCancel={onKeepEditing}
title="Unsaved Changes"
description={itemName ? `You have unsaved edits to ${itemName}.` : 'You have unsaved edits.'}
warning="Discarding will permanently lose these edits."
confirmLabel="Discard"
cancelLabel="Keep Editing"
/>
)
}