@@ -35,6 +35,16 @@ import {
3535 SelectValue ,
3636} from '@/components/ui/select' ;
3737import { Progress } from '@/components/ui/progress' ;
38+ import {
39+ AlertDialog ,
40+ AlertDialogAction ,
41+ AlertDialogCancel ,
42+ AlertDialogContent ,
43+ AlertDialogDescription ,
44+ AlertDialogFooter ,
45+ AlertDialogHeader ,
46+ AlertDialogTitle ,
47+ } from '@/components/ui/alert-dialog' ;
3848
3949// Types
4050import { ModelInfo } from '@shared/types/ai' ;
@@ -341,7 +351,7 @@ export const AvailableModelCardComponent: React.FC<ModelCardProps> = ({
341351 variant = "default"
342352 size = "sm"
343353 onClick = { handlePullModel }
344- disabled = { isPulling || model . installed === true }
354+ disabled = { isPulling || model . installed }
345355 className = "w-full"
346356 >
347357 < Download className = "h-4 w-4 mr-2" />
@@ -353,7 +363,7 @@ export const AvailableModelCardComponent: React.FC<ModelCardProps> = ({
353363 < p >
354364 { isPulling
355365 ? 'Cancel the current download'
356- : model . installed === true
366+ : model . installed
357367 ? 'This model is already installed'
358368 : 'Download and install this model to your local Ollama' }
359369 </ p >
@@ -375,9 +385,15 @@ export const InstalledModelCardComponent: React.FC<ModelCardProps> = ({
375385 model,
376386} ) => {
377387 const isDeleting = modelHubState$ . deletingModels [ model . id ] ?. get ( ) || false ;
388+ const [ showDeleteDialog , setShowDeleteDialog ] = useState ( false ) ;
378389
379390 const handleDeleteModel = async ( ) => {
380391 await deleteModel ( model . id ) ;
392+ setShowDeleteDialog ( false ) ;
393+ } ;
394+
395+ const openDeleteDialog = ( ) => {
396+ setShowDeleteDialog ( true ) ;
381397 } ;
382398
383399 return (
@@ -427,7 +443,7 @@ export const InstalledModelCardComponent: React.FC<ModelCardProps> = ({
427443 < Button
428444 variant = "destructive"
429445 size = "sm"
430- onClick = { handleDeleteModel }
446+ onClick = { openDeleteDialog }
431447 disabled = { isDeleting }
432448 className = "w-full"
433449 >
@@ -446,6 +462,33 @@ export const InstalledModelCardComponent: React.FC<ModelCardProps> = ({
446462 </ TooltipContent >
447463 </ Tooltip >
448464 </ TooltipProvider >
465+
466+ { /* Delete Confirmation Dialog */ }
467+ < AlertDialog
468+ open = { showDeleteDialog }
469+ onOpenChange = { setShowDeleteDialog }
470+ >
471+ < AlertDialogContent >
472+ < AlertDialogHeader >
473+ < AlertDialogTitle > Remove Model</ AlertDialogTitle >
474+ < AlertDialogDescription >
475+ Are you sure you want to remove the model "{ model . name } "? This
476+ action cannot be undone.
477+ </ AlertDialogDescription >
478+ </ AlertDialogHeader >
479+ < AlertDialogFooter >
480+ < AlertDialogCancel onClick = { ( ) => setShowDeleteDialog ( false ) } >
481+ Cancel
482+ </ AlertDialogCancel >
483+ < AlertDialogAction
484+ onClick = { handleDeleteModel }
485+ className = "bg-red-500 hover:bg-red-600"
486+ >
487+ Remove
488+ </ AlertDialogAction >
489+ </ AlertDialogFooter >
490+ </ AlertDialogContent >
491+ </ AlertDialog >
449492 </ div >
450493 </ CardFooter >
451494 </ Card >
0 commit comments