IOPaint/lama_cleaner/app/src/components/Settings/SettingsModal.tsx

38 lines
1015 B
TypeScript
Raw Normal View History

2022-04-12 14:58:57 +02:00
import React from 'react'
import { useRecoilState } from 'recoil'
import { settingState } from '../../store/Atoms'
import Modal from '../shared/Modal'
import HDSettingBlock from './HDSettingBlock'
2022-04-14 14:43:07 +02:00
import ModelSettingBlock from './ModelSettingBlock'
2022-04-12 14:58:57 +02:00
2022-04-17 17:31:12 +02:00
interface SettingModalProps {
onClose: () => void
}
export default function SettingModal(props: SettingModalProps) {
const { onClose } = props
2022-04-12 14:58:57 +02:00
const [setting, setSettingState] = useRecoilState(settingState)
2022-04-17 17:31:12 +02:00
const handleOnClose = () => {
2022-04-12 14:58:57 +02:00
setSettingState(old => {
return { ...old, show: false }
})
2022-04-17 17:31:12 +02:00
onClose()
2022-04-12 14:58:57 +02:00
}
return (
<Modal
2022-04-17 17:31:12 +02:00
onClose={handleOnClose}
2022-04-12 14:58:57 +02:00
title="Settings"
className="modal-setting"
show={setting.show}
>
2022-04-15 18:11:51 +02:00
{/* It's not possible because this poses a security risk */}
{/* https://stackoverflow.com/questions/34870711/download-a-file-at-different-location-using-html5 */}
{/* <SavePathSettingBlock /> */}
2022-04-14 14:43:07 +02:00
<ModelSettingBlock />
2022-04-12 14:58:57 +02:00
<HDSettingBlock />
</Modal>
)
}