feat: implement offline support for labels and projects, enhance advanced settings with offline feature toggle, and add sync status indicator

- Added offline support for fetching and caching labels and projects using `offlineDB`.
- Enhanced `AdvancedSettings` to include an offline feature toggle with confirmation modal for disabling offline support.
- Introduced `SyncStatusIndicator` component to display sync status, pending commands, and failed commands.
- Created `PendingBadge` component to manage and display pending actions for synchronization.
- Removed deprecated offline mode toggle from `StorageSettings`.
- Improved error handling and user notifications for offline actions and sync processes.
This commit is contained in:
Mo Tarbin
2026-05-11 17:27:29 -04:00
parent 3d170d88fb
commit 2c353628a3
33 changed files with 3077 additions and 1067 deletions

View File

@@ -633,32 +633,27 @@ const TaskInput = ({ autoFocus, onChoreUpdate, isModalOpen, onClose }) => {
createChoreMutation
.mutateAsync(chore)
.then(resp => {
resp.json().then(data => {
if (resp.status !== 200) {
console.error('Error creating chore:', data)
return
} else {
onChoreUpdate({
...chore,
id: data.res,
nextDueDate: chore.dueDate,
})
handleCloseModal(false)
}
handleCloseModal()
setTaskText('')
})
.then(result => {
const choreData = result?.res
if (choreData?._pendingCreate) {
// Offline: task queued, add temp chore to UI immediately
onChoreUpdate(choreData)
} else {
// Online: choreData is the server's parsed response ({ res: id })
onChoreUpdate({
...chore,
id: choreData?.res || choreData?.id,
nextDueDate: chore.dueDate,
})
}
setTaskText('')
})
.catch(error => {
if (error?.queued) {
handleCloseModal(true)
}
console.error('Error creating chore:', error)
})
handleCloseModal(false)
}
if (userLabelsLoading || isCircleMembersLoading || isProjectsLoading) {
if (isCircleMembersLoading || isProjectsLoading) {
return <></>
}