From 2657469964e24ffbeb905024532120395f6e797c Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Sun, 30 Jun 2024 18:55:39 -0400 Subject: move to Donetick Org, First commit frontend --- src/views/Modals/Inputs/ConfirmationModal.jsx | 43 ++++++++++ src/views/Modals/Inputs/CreateThingModal.jsx | 112 ++++++++++++++++++++++++++ src/views/Modals/Inputs/DateModal.jsx | 45 +++++++++++ src/views/Modals/Inputs/SelectModal.jsx | 49 +++++++++++ src/views/Modals/Inputs/TextModal.jsx | 46 +++++++++++ 5 files changed, 295 insertions(+) create mode 100644 src/views/Modals/Inputs/ConfirmationModal.jsx create mode 100644 src/views/Modals/Inputs/CreateThingModal.jsx create mode 100644 src/views/Modals/Inputs/DateModal.jsx create mode 100644 src/views/Modals/Inputs/SelectModal.jsx create mode 100644 src/views/Modals/Inputs/TextModal.jsx (limited to 'src/views/Modals/Inputs') diff --git a/src/views/Modals/Inputs/ConfirmationModal.jsx b/src/views/Modals/Inputs/ConfirmationModal.jsx new file mode 100644 index 0000000..10f9bee --- /dev/null +++ b/src/views/Modals/Inputs/ConfirmationModal.jsx @@ -0,0 +1,43 @@ +import { Box, Button, Modal, ModalDialog, Typography } from '@mui/joy' +import React from 'react' + +function ConfirmationModal({ config }) { + const handleAction = isConfirmed => { + config.onClose(isConfirmed) + } + + return ( + + + + {config?.title} + + + + {config?.message} + + + + + + + + + ) +} +export default ConfirmationModal diff --git a/src/views/Modals/Inputs/CreateThingModal.jsx b/src/views/Modals/Inputs/CreateThingModal.jsx new file mode 100644 index 0000000..59263ff --- /dev/null +++ b/src/views/Modals/Inputs/CreateThingModal.jsx @@ -0,0 +1,112 @@ +import { + Box, + Button, + FormLabel, + Input, + Modal, + ModalDialog, + Option, + Select, + Textarea, + Typography, +} from '@mui/joy' +import { useEffect, useState } from 'react' + +function CreateThingModal({ isOpen, onClose, onSave, currentThing }) { + const [name, setName] = useState(currentThing?.name || '') + const [type, setType] = useState(currentThing?.type || 'numeric') + const [state, setState] = useState(currentThing?.state || '') + useEffect(() => { + if (type === 'boolean') { + if (state !== 'true' && state !== 'false') { + setState('false') + } + } else if (type === 'number') { + if (isNaN(state)) { + setState(0) + } + } + }, [type]) + const handleSave = () => { + onSave({ name, type, id: currentThing?.id, state: state || null }) + onClose() + } + + return ( + + + {/* */} + P;lease add info + Name + +