diff --git a/app/src/components/History/HistoryTable.tsx b/app/src/components/History/HistoryTable.tsx index 67abe80d..38c4361e 100644 --- a/app/src/components/History/HistoryTable.tsx +++ b/app/src/components/History/HistoryTable.tsx @@ -45,6 +45,8 @@ export function HistoryTable() { const fileInputRef = useRef(null); const [importDialogOpen, setImportDialogOpen] = useState(false); const [selectedFile, setSelectedFile] = useState(null); + const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); + const [generationToDelete, setGenerationToDelete] = useState<{ id: string; name: string } | null>(null); const limit = 20; const { toast } = useToast(); @@ -167,6 +169,19 @@ export function HistoryTable() { ); }; + const handleDeleteClick = (generationId: string, profileName: string) => { + setGenerationToDelete({ id: generationId, name: profileName }); + setDeleteDialogOpen(true); + }; + + const handleDeleteConfirm = () => { + if (generationToDelete) { + deleteGeneration.mutate(generationToDelete.id); + setDeleteDialogOpen(false); + setGenerationToDelete(null); + } + }; + const handleImportConfirm = () => { if (selectedFile) { importGeneration.mutate(selectedFile, { @@ -307,7 +322,7 @@ export function HistoryTable() { Export Package deleteGeneration.mutate(gen.id)} + onClick={() => handleDeleteClick(gen.id, gen.profile_name)} disabled={deleteGeneration.isPending} className="text-destructive focus:text-destructive" > @@ -338,6 +353,35 @@ export function HistoryTable() { )} + + + + Delete Generation + + Are you sure you want to delete this generation from "{generationToDelete?.name}"? This action cannot be undone. + + + + + + + + + diff --git a/app/src/components/VoiceProfiles/SampleList.tsx b/app/src/components/VoiceProfiles/SampleList.tsx index 4c5b995d..19aa1ca8 100644 --- a/app/src/components/VoiceProfiles/SampleList.tsx +++ b/app/src/components/VoiceProfiles/SampleList.tsx @@ -2,6 +2,14 @@ import { Check, Edit, Pause, Play, Plus, Trash2, Volume2, X } from 'lucide-react import { useEffect, useRef, useState } from 'react'; import { Button } from '@/components/ui/button'; import { CircleButton } from '@/components/ui/circle-button'; +import { + Dialog, + DialogContent, + DialogDescription, + DialogFooter, + DialogHeader, + DialogTitle, +} from '@/components/ui/dialog'; import { Slider } from '@/components/ui/slider'; import { Textarea } from '@/components/ui/textarea'; import { useToast } from '@/components/ui/use-toast'; @@ -140,10 +148,19 @@ export function SampleList({ profileId }: SampleListProps) { const [uploadOpen, setUploadOpen] = useState(false); const [editingSampleId, setEditingSampleId] = useState(null); const [editedText, setEditedText] = useState(''); + const [deleteDialogOpen, setDeleteDialogOpen] = useState(false); + const [sampleToDelete, setSampleToDelete] = useState(null); - const handleDelete = (sampleId: string) => { - if (confirm('Are you sure you want to delete this sample?')) { - deleteSample.mutate(sampleId); + const handleDeleteClick = (sampleId: string) => { + setSampleToDelete(sampleId); + setDeleteDialogOpen(true); + }; + + const handleDeleteConfirm = () => { + if (sampleToDelete) { + deleteSample.mutate(sampleToDelete); + setDeleteDialogOpen(false); + setSampleToDelete(null); } }; @@ -268,7 +285,7 @@ export function SampleList({ profileId }: SampleListProps) { handleDelete(sample.id)} + onClick={() => handleDeleteClick(sample.id)} disabled={deleteSample.isPending} /> @@ -306,6 +323,35 @@ export function SampleList({ profileId }: SampleListProps) {

+ + + + + Delete Sample + + Are you sure you want to delete this audio sample? This action cannot be undone. + + + + + + + + ); }