Fix : skip rending when no entry selected

Add Support for notification when action happen
https://github.com/donetick/donetick/issues/471
This commit is contained in:
Mo Tarbin
2026-02-16 12:15:51 -05:00
parent 6416378b78
commit 6e3def2c13
2 changed files with 43 additions and 29 deletions

View File

@@ -8,22 +8,31 @@ import ConfirmationModal from './Inputs/ConfirmationModal'
function EditHistoryModal({ config, historyRecord }) {
const { ResponsiveModal } = useResponsiveModal()
useEffect(() => {
setCompletedDate(
moment(historyRecord.performedAt).format('YYYY-MM-DDTHH:mm'),
)
setDueDate(moment(historyRecord.dueDate).format('YYYY-MM-DDTHH:mm'))
setNotes(historyRecord.notes)
}, [historyRecord])
const [completedDate, setCompletedDate] = useState(
moment(historyRecord.completedDate).format('YYYY-MM-DDTHH:mm'),
)
const [dueDate, setDueDate] = useState(
moment(historyRecord.dueDate).format('YYYY-MM-DDTHH:mm'),
)
const [notes, setNotes] = useState(historyRecord.notes)
const [completedDate, setCompletedDate] = useState('')
const [dueDate, setDueDate] = useState('')
const [notes, setNotes] = useState('')
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false)
// Reset form when modal opens with new data
useEffect(() => {
if (config?.isOpen && historyRecord?.performedAt) {
setCompletedDate(
moment(historyRecord.performedAt).format('YYYY-MM-DDTHH:mm'),
)
setDueDate(
historyRecord.dueDate
? moment(historyRecord.dueDate).format('YYYY-MM-DDTHH:mm')
: '',
)
setNotes(historyRecord.notes || '')
}
}, [config?.isOpen, historyRecord])
// Don't render modal content if no valid historyRecord
if (!historyRecord?.performedAt) {
return null
}
return (
<ResponsiveModal
open={config?.isOpen}