import { useRef } from 'react' import { useTranslation } from '@/i18n/react-i18next-compat' import { Dialog, DialogTrigger, DialogContent, DialogTitle, DialogDescription, DialogClose, DialogFooter, DialogHeader, } from '@/components/ui/dialog' import { Button } from '@/components/ui/button' interface FactoryResetDialogProps { onReset: () => void children: React.ReactNode } export function FactoryResetDialog({ onReset, children, }: FactoryResetDialogProps) { const { t } = useTranslation() const resetButtonRef = useRef(null) const handleReset = () => { onReset() } const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === 'Enter') { handleReset() } } return ( {children} { e.preventDefault() resetButtonRef.current?.focus() }} > {t('settings:general.factoryResetTitle')} {t('settings:general.factoryResetDesc')} ) }