11import { useEffect , useState } from 'react'
22import { AlertTriangle , Info } from 'lucide-react'
3- import { useRouter } from 'next/navigation'
43import { Alert , AlertDescription } from '@/components/ui/alert'
5- import {
6- AlertDialog ,
7- AlertDialogAction ,
8- AlertDialogCancel ,
9- AlertDialogContent ,
10- AlertDialogDescription ,
11- AlertDialogFooter ,
12- AlertDialogHeader ,
13- AlertDialogTitle ,
14- AlertDialogTrigger ,
15- } from '@/components/ui/alert-dialog'
164import { Button } from '@/components/ui/button'
175import { Label } from '@/components/ui/label'
186import {
@@ -25,18 +13,15 @@ import {
2513import { Skeleton } from '@/components/ui/skeleton'
2614import { Switch } from '@/components/ui/switch'
2715import { Tooltip , TooltipContent , TooltipTrigger } from '@/components/ui/tooltip'
28- import { resetAllStores } from '@/stores'
2916import { useGeneralStore } from '@/stores/settings/general/store'
3017
3118const TOOLTIPS = {
3219 debugMode : 'Enable visual debugging information during execution.' ,
3320 autoConnect : 'Automatically connect nodes.' ,
3421 autoFillEnvVars : 'Automatically fill API keys.' ,
35- resetData : 'Permanently delete all workflows, settings, and stored data.' ,
3622}
3723
3824export function General ( ) {
39- const router = useRouter ( )
4025 const [ retryCount , setRetryCount ] = useState ( 0 )
4126
4227 const isLoading = useGeneralStore ( ( state ) => state . isLoading )
@@ -81,11 +66,6 @@ export function General() {
8166 }
8267 }
8368
84- const handleResetData = ( ) => {
85- resetAllStores ( )
86- router . push ( '/w/1' ) // Redirect to home page after reset
87- }
88-
8969 const handleRetry = ( ) => {
9070 setRetryCount ( ( prev ) => prev + 1 )
9171 }
@@ -224,56 +204,6 @@ export function General() {
224204 ) }
225205 </ div >
226206 </ div >
227-
228- { /* Danger Zone Section */ }
229- < div >
230- < div className = 'flex items-center justify-between py-1' >
231- < div className = 'flex items-center gap-2' >
232- < Label className = 'font-medium' > Reset all data</ Label >
233- < Tooltip >
234- < TooltipTrigger asChild >
235- < Button
236- variant = 'ghost'
237- size = 'sm'
238- className = 'h-7 p-1 text-gray-500'
239- aria-label = 'Learn more about resetting all data'
240- disabled = { isLoading }
241- >
242- < Info className = 'h-5 w-5' />
243- </ Button >
244- </ TooltipTrigger >
245- < TooltipContent side = 'top' className = 'max-w-[300px] p-3' >
246- < p className = 'text-sm' > { TOOLTIPS . resetData } </ p >
247- </ TooltipContent >
248- </ Tooltip >
249- </ div >
250- < AlertDialog >
251- < AlertDialogTrigger asChild >
252- < Button variant = 'destructive' size = 'sm' disabled = { isLoading } >
253- Reset Data
254- </ Button >
255- </ AlertDialogTrigger >
256- < AlertDialogContent >
257- < AlertDialogHeader >
258- < AlertDialogTitle > Are you absolutely sure?</ AlertDialogTitle >
259- < AlertDialogDescription >
260- This action cannot be undone. This will permanently delete all your workflows,
261- settings, and stored data.
262- </ AlertDialogDescription >
263- </ AlertDialogHeader >
264- < AlertDialogFooter >
265- < AlertDialogCancel > Cancel</ AlertDialogCancel >
266- < AlertDialogAction
267- onClick = { handleResetData }
268- className = 'bg-destructive text-destructive-foreground hover:bg-destructive/90'
269- >
270- Reset Data
271- </ AlertDialogAction >
272- </ AlertDialogFooter >
273- </ AlertDialogContent >
274- </ AlertDialog >
275- </ div >
276- </ div >
277207 </ div >
278208 )
279209}
0 commit comments