import React, { useCallback, useState } from 'react' import { Modal, ModalClose, Button, Input, Checkbox } from '@janhq/joi' import { atom, useAtom, useAtomValue } from 'jotai' import useFactoryReset from '@/hooks/useFactoryReset' import { defaultJanDataFolderAtom } from '@/helpers/atoms/App.atom' export const modalValidationAtom = atom(false) const ModalConfirmReset = () => { const [modalValidation, setModalValidation] = useAtom(modalValidationAtom) const defaultJanDataFolder = useAtomValue(defaultJanDataFolderAtom) const { resetAll } = useFactoryReset() const [inputValue, setInputValue] = useState('') const [currentDirectoryChecked, setCurrentDirectoryChecked] = useState(true) const onFactoryResetClick = useCallback(() => { setModalValidation(false) resetAll(currentDirectoryChecked) }, [currentDirectoryChecked, resetAll, setModalValidation]) return ( setModalValidation(false)} title="Are you sure you want to reset to default settings?" content={

Restore application to its initial state, erasing all models and chat history. This action is irreversible and recommended only if the application is corrupted.

{`To confirm, please enter the word "RESET" below:`}

setInputValue(e.target.value)} />
setCurrentDirectoryChecked(e.target.checked)} label="Keep the current app data location" helperDescription={

Otherwise it will reset back to its original location at:{' '} {defaultJanDataFolder}

} />
setModalValidation(false)}>
} /> ) } export default ModalConfirmReset