* feat: wip implement back-end call csv import * fix: rebase IconBrandTwitter missing * feat: person and company csv import * fix: test & clean * fix: clean & test
31 lines
743 B
TypeScript
31 lines
743 B
TypeScript
import { useRecoilState } from 'recoil';
|
|
|
|
import { dialogInternalState } from '../states/dialogState';
|
|
|
|
import { Dialog } from './Dialog';
|
|
|
|
export function DialogProvider({ children }: React.PropsWithChildren) {
|
|
const [dialogState, setDialogState] = useRecoilState(dialogInternalState);
|
|
|
|
// Handle dialog close event
|
|
const handleDialogClose = (id: string) => {
|
|
setDialogState((prevState) => ({
|
|
...prevState,
|
|
queue: prevState.queue.filter((snackBar) => snackBar.id !== id),
|
|
}));
|
|
};
|
|
|
|
return (
|
|
<>
|
|
{children}
|
|
{dialogState.queue.map((dialog) => (
|
|
<Dialog
|
|
key={dialog.id}
|
|
{...dialog}
|
|
onClose={() => handleDialogClose(dialog.id)}
|
|
/>
|
|
))}
|
|
</>
|
|
);
|
|
}
|