diff --git a/frontend/src/components/shared/overwrite/index.ts b/frontend/src/components/shared/overwrite/index.ts index f94d348f..efd75784 100644 --- a/frontend/src/components/shared/overwrite/index.ts +++ b/frontend/src/components/shared/overwrite/index.ts @@ -1,5 +1,5 @@ -export { OverwriteConfirmDialog } from './overwrite-confirm-dialog'; -export type { OverwriteConflict } from './overwrite-confirm-dialog'; -export { OverwriteCtaButtons } from './overwrite-cta-buttons'; +export { OverwriteButtons } from './overwrite-buttons'; +export { OverwriteDialog } from './overwrite-dialog'; +export type { OverwriteConflict } from './overwrite-dialog'; export { useOverwriteAction } from './use-overwrite-action'; export type { OverwriteOutcome } from './use-overwrite-action'; diff --git a/frontend/src/components/shared/overwrite/overwrite-cta-buttons.tsx b/frontend/src/components/shared/overwrite/overwrite-buttons.tsx similarity index 96% rename from frontend/src/components/shared/overwrite/overwrite-cta-buttons.tsx rename to frontend/src/components/shared/overwrite/overwrite-buttons.tsx index a8b93c13..09f3f09e 100644 --- a/frontend/src/components/shared/overwrite/overwrite-cta-buttons.tsx +++ b/frontend/src/components/shared/overwrite/overwrite-buttons.tsx @@ -4,7 +4,7 @@ import { Loader2, Replace } from 'lucide-react'; import { Button } from '@/components/ui/button'; -interface OverwriteCtaButtonsProps { +interface OverwriteButtonsProps { /** * When `true` both buttons are greyed-out and clicks are ignored. Use to * disable the CTAs based on form validity, selection emptiness, or any @@ -47,7 +47,7 @@ interface OverwriteCtaButtonsProps { * The component owns the spinner / icon swap, so callers don't repeat that * boilerplate in five different dialogs. */ -export const OverwriteCtaButtons = ({ +export const OverwriteButtons = ({ isDisabled, isProcessing, onOverwrite, @@ -56,7 +56,7 @@ export const OverwriteCtaButtons = ({ primaryIcon: PrimaryIcon, primaryLabel, primaryType = 'button', -}: OverwriteCtaButtonsProps) => { +}: OverwriteButtonsProps) => { const disabled = isDisabled || isProcessing; return ( diff --git a/frontend/src/components/shared/overwrite/overwrite-confirm-dialog.tsx b/frontend/src/components/shared/overwrite/overwrite-dialog.tsx similarity index 96% rename from frontend/src/components/shared/overwrite/overwrite-confirm-dialog.tsx rename to frontend/src/components/shared/overwrite/overwrite-dialog.tsx index c492216d..0706e3da 100644 --- a/frontend/src/components/shared/overwrite/overwrite-confirm-dialog.tsx +++ b/frontend/src/components/shared/overwrite/overwrite-dialog.tsx @@ -8,7 +8,7 @@ export interface OverwriteConflict { destinationName: string; } -interface OverwriteConfirmDialogProps { +interface OverwriteDialogProps { /** * Overrides the auto-generated confirm button label. Defaults to * `"Replace"` for a single conflict and `"Replace all"` for a batch. @@ -57,14 +57,14 @@ const buildDefaultConfirmText = (count: number): string => (count > 1 ? 'Replace * file-manager UX and keeps the user from being prompted N times for the * same destination directory. */ -export const OverwriteConfirmDialog = ({ +export const OverwriteDialog = ({ confirmText, conflicts, description, onCancel, onReplaceAll, title = 'Replace existing item?', -}: OverwriteConfirmDialogProps) => ( +}: OverwriteDialogProps) => ( } diff --git a/frontend/src/components/shared/overwrite/use-overwrite-action.ts b/frontend/src/components/shared/overwrite/use-overwrite-action.ts index 0b1da399..2bc8f920 100644 --- a/frontend/src/components/shared/overwrite/use-overwrite-action.ts +++ b/frontend/src/components/shared/overwrite/use-overwrite-action.ts @@ -1,6 +1,6 @@ import { useCallback, useEffect, useRef, useState } from 'react'; -import type { OverwriteConflict } from './overwrite-confirm-dialog'; +import type { OverwriteConflict } from './overwrite-dialog'; /** * Discriminated outcome of a server action that supports an overwrite flag. @@ -23,7 +23,7 @@ export type OverwriteOutcome = * Anonymous fallback descriptor used when a 409 sneaks through after a clean * preflight and the caller didn't provide `synthesizeFallbackConflicts`. Falls * back to the count-based copy ("N items already exist...") in - * `OverwriteConfirmDialog`. + * `OverwriteDialog`. */ const ANONYMOUS_FALLBACK_CONFLICT: OverwriteConflict = { destination: '', @@ -39,7 +39,7 @@ interface UseOverwriteActionOptions { /** * Pure function: inspect the local snapshot and return any destinations * that would conflict. Empty array → primary execute proceeds with - * `force=false`; non-empty → the OverwriteConfirmDialog is opened + * `force=false`; non-empty → the OverwriteDialog is opened * pre-populated with these descriptors. */ findConflicts: (plan: TPlan) => OverwriteConflict[]; @@ -55,21 +55,21 @@ interface UseOverwriteActionOptions { } interface UseOverwriteActionResult { - /** Live conflict descriptors. Wire to ``. */ + /** Live conflict descriptors. Wire to ``. */ conflicts: OverwriteConflict[]; /** * Execute the action with `force=true` immediately, bypassing the * preflight and the conflict prompt. Wire to the secondary CTA. */ forceExecute: (plan: TPlan) => Promise; - /** Wire to the `onReplaceAll` handler of ``. */ + /** Wire to the `onReplaceAll` handler of ``. */ handleReplaceAll: () => Promise; /** * Execute the action with the preflight + race-fallback workflow. Wire * to the primary CTA. */ primaryExecute: (plan: TPlan) => Promise; - /** Wire to the `onCancel` handler of ``. */ + /** Wire to the `onCancel` handler of ``. */ resetConflicts: () => void; } @@ -80,7 +80,7 @@ interface UseOverwriteActionResult { * Workflow: * 1. The user clicks the **primary CTA** → `primaryExecute(plan)` runs. * `findConflicts` is consulted on the local snapshot first; if anything - * collides, the OverwriteConfirmDialog opens with those descriptors. + * collides, the OverwriteDialog opens with those descriptors. * Otherwise `execute(plan, false)` is dispatched. A 409 from the server * (race) auto-opens the dialog with `synthesizeFallbackConflicts` (or an * anonymous fallback). diff --git a/frontend/src/features/flows/files/flow-files-attach-resources-dialog.tsx b/frontend/src/features/flows/files/flow-files-attach-resources-dialog.tsx index d7902075..6511a995 100644 --- a/frontend/src/features/flows/files/flow-files-attach-resources-dialog.tsx +++ b/frontend/src/features/flows/files/flow-files-attach-resources-dialog.tsx @@ -2,7 +2,7 @@ import { FolderInput, Search, X } from 'lucide-react'; import { useCallback, useMemo, useState } from 'react'; import { FileManager, type FileNode } from '@/components/shared/file-manager'; -import { OverwriteConfirmDialog, OverwriteCtaButtons, useOverwriteAction } from '@/components/shared/overwrite'; +import { OverwriteButtons, OverwriteDialog, useOverwriteAction } from '@/components/shared/overwrite'; import { Button } from '@/components/ui/button'; import { Dialog, @@ -251,7 +251,7 @@ const FlowFilesAttachResourcesDialogBody = ({ > Cancel - - { * (re-pulling a file the user already has) without an extra REST round-trip. * Nested conflicts (the user pulls `/etc/` while only `/etc/nginx.conf` is * cached) still surface server-side as a 409 and are auto-redialed by the - * caller through the same `OverwriteConfirmDialog` flow. + * caller through the same `OverwriteDialog` flow. */ export const findPullConflicts = ( pullTargets: readonly string[], diff --git a/frontend/src/features/flows/files/flow-files-promote-dialog.tsx b/frontend/src/features/flows/files/flow-files-promote-dialog.tsx index 6a7fab68..d1930d21 100644 --- a/frontend/src/features/flows/files/flow-files-promote-dialog.tsx +++ b/frontend/src/features/flows/files/flow-files-promote-dialog.tsx @@ -6,7 +6,7 @@ import { useForm } from 'react-hook-form'; import type { FileNode } from '@/components/shared/file-manager'; import type { OverwriteConflict } from '@/components/shared/overwrite'; -import { OverwriteConfirmDialog, OverwriteCtaButtons, useOverwriteAction } from '@/components/shared/overwrite'; +import { OverwriteButtons, OverwriteDialog, useOverwriteAction } from '@/components/shared/overwrite'; import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'; import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form'; @@ -234,7 +234,7 @@ const FlowFilesPromoteDialogForm = ({ files, flowId, onClose }: FlowFilesPromote > Cancel - { @@ -250,7 +250,7 @@ const FlowFilesPromoteDialogForm = ({ files, flowId, onClose }: FlowFilesPromote - Cancel - { @@ -444,7 +444,7 @@ const FlowFilesPullDialogForm = ({ cachedFiles, flowId, onClose, onSuccess }: Fl - Cancel - { @@ -241,7 +241,7 @@ const ResourcesCopyDialogForm = ({ files, onClose }: ResourcesCopyDialogFormProp - Cancel - { @@ -246,7 +246,7 @@ const ResourcesMoveDialogForm = ({ files, onClose }: ResourcesMoveDialogFormProp - { onClose={() => setFilesToCopy(null)} /> -