@@ -11,7 +11,7 @@ import { ThinkingBudgetSelector } from "@/components/ThinkingBudgetSelector";
1111import { useSettings } from "@/hooks/useSettings" ;
1212import { useAppVersion } from "@/hooks/useAppVersion" ;
1313import { Button } from "@/components/ui/button" ;
14- import { ArrowLeft } from "lucide-react" ;
14+ import { ArrowLeft , Loader2 } from "lucide-react" ;
1515import { useRouter } from "@tanstack/react-router" ;
1616import { GitHubIntegration } from "@/components/GitHubIntegration" ;
1717import { VercelIntegration } from "@/components/VercelIntegration" ;
@@ -28,6 +28,8 @@ import { RuntimeModeSelector } from "@/components/RuntimeModeSelector";
2828export default function SettingsPage ( ) {
2929 const [ isResetDialogOpen , setIsResetDialogOpen ] = useState ( false ) ;
3030 const [ isResetting , setIsResetting ] = useState ( false ) ;
31+ const [ isDeleteAllAppsDialogOpen , setIsDeleteAllAppsDialogOpen ] = useState ( false ) ;
32+ const [ isDeletingAllApps , setIsDeletingAllApps ] = useState ( false ) ;
3133 const appVersion = useAppVersion ( ) ;
3234 const { settings, updateSettings } = useSettings ( ) ;
3335 const router = useRouter ( ) ;
@@ -49,6 +51,23 @@ export default function SettingsPage() {
4951 }
5052 } ;
5153
54+ const handleDeleteAllApps = async ( ) => {
55+ setIsDeletingAllApps ( true ) ;
56+ try {
57+ const ipcClient = IpcClient . getInstance ( ) ;
58+ await ipcClient . deleteAllApps ( ) ;
59+ showSuccess ( "Successfully deleted all apps." ) ;
60+ } catch ( error ) {
61+ console . error ( "Error deleting all apps:" , error ) ;
62+ showError (
63+ error instanceof Error ? error . message : "An unknown error occurred" ,
64+ ) ;
65+ } finally {
66+ setIsDeletingAllApps ( false ) ;
67+ setIsDeleteAllAppsDialogOpen ( false ) ;
68+ }
69+ } ;
70+
5271 return (
5372 < div className = "min-h-screen px-8 py-4" >
5473 < div className = "max-w-5xl mx-auto" >
@@ -169,6 +188,26 @@ export default function SettingsPage() {
169188 </ h2 >
170189
171190 < div className = "space-y-4" >
191+ < div className = "flex items-start justify-between flex-col sm:flex-row sm:items-center gap-4" >
192+ < div >
193+ < h3 className = "text-sm font-medium text-gray-900 dark:text-white" >
194+ Delete All Apps
195+ </ h3 >
196+ < p className = "text-xs text-gray-500 dark:text-gray-400 mt-1" >
197+ This will delete all your apps and their files. This action
198+ cannot be undone.
199+ </ p >
200+ </ div >
201+ < button
202+ onClick = { ( ) => setIsDeleteAllAppsDialogOpen ( true ) }
203+ disabled = { isDeletingAllApps }
204+ className = "rounded-md border border-transparent bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2"
205+ >
206+ { isDeletingAllApps && < Loader2 className = "h-4 w-4 animate-spin" /> }
207+ { isDeletingAllApps ? "Deleting..." : "Delete All Apps" }
208+ </ button >
209+ </ div >
210+
172211 < div className = "flex items-start justify-between flex-col sm:flex-row sm:items-center gap-4" >
173212 < div >
174213 < h3 className = "text-sm font-medium text-gray-900 dark:text-white" >
@@ -182,8 +221,9 @@ export default function SettingsPage() {
182221 < button
183222 onClick = { ( ) => setIsResetDialogOpen ( true ) }
184223 disabled = { isResetting }
185- className = "rounded-md border border-transparent bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed"
224+ className = "rounded-md border border-transparent bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 "
186225 >
226+ { isResetting && < Loader2 className = "h-4 w-4 animate-spin" /> }
187227 { isResetting ? "Resetting..." : "Reset Everything" }
188228 </ button >
189229 </ div >
@@ -192,6 +232,16 @@ export default function SettingsPage() {
192232 </ div >
193233 </ div >
194234
235+ < ConfirmationDialog
236+ isOpen = { isDeleteAllAppsDialogOpen }
237+ title = "Delete All Apps"
238+ message = "Are you sure you want to delete all apps? This will delete all your apps and their files. This action cannot be undone."
239+ confirmText = "Delete All Apps"
240+ cancelText = "Cancel"
241+ onConfirm = { handleDeleteAllApps }
242+ onCancel = { ( ) => setIsDeleteAllAppsDialogOpen ( false ) }
243+ />
244+
195245 < ConfirmationDialog
196246 isOpen = { isResetDialogOpen }
197247 title = "Reset Everything"
0 commit comments