chore: initial commit

This commit is contained in:
2026-07-22 17:50:30 +08:00
parent d46cdd676e
commit 3abf272e33
190 changed files with 18073 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
import { useQueryClient } from '@tanstack/react-query'
import { QUERY_KEY } from '../constants.ts'
import { ActionsDialog } from './action-dialog.tsx'
import { useCrud } from './crud-provider.tsx'
import { DeleteDialog } from './delete-dialog.tsx'
export const ActionDialogs = () => {
const queryClient = useQueryClient()
const { action, setAction, currentRow, setCurrentRow } = useCrud()
const handleClose = () => {
setAction(null)
setTimeout(() => {
setCurrentRow(null)
}, 500)
}
const handleConfirm = () => {
queryClient.invalidateQueries({ queryKey: [QUERY_KEY] })
handleClose()
}
return (
<>
<ActionsDialog
key='add'
open={action === 'add'}
onClose={handleClose}
onConfirm={handleConfirm}
/>
{currentRow && (
<>
<ActionsDialog
currentRow={currentRow}
key={`edit-${currentRow.id}`}
open={action === 'edit'}
onClose={handleClose}
onConfirm={handleConfirm}
/>
<DeleteDialog
key={`delete-${currentRow.id}`}
currentRow={currentRow}
open={action === 'delete'}
onClose={handleClose}
onConfirm={handleConfirm}
/>
</>
)}
</>
)
}