refactor: drawers refactored
This commit is contained in:
@ -3,7 +3,6 @@ import { IconMoodSad } from "@tabler/icons-react";
|
||||
import { Group, Pagination, Stack, Text } from "@mantine/core";
|
||||
import useDealsTableColumns from "@/app/deals/components/desktop/DealsTable/useDealsTableColumns";
|
||||
import { useDealsContext } from "@/app/deals/contexts/DealsContext";
|
||||
import { useProjectsContext } from "@/app/deals/contexts/ProjectsContext";
|
||||
import BaseTable from "@/components/ui/BaseTable/BaseTable";
|
||||
import { useDrawersContext } from "@/drawers/DrawersContext";
|
||||
import { DealSchema } from "@/lib/client";
|
||||
@ -11,18 +10,16 @@ import { DealSchema } from "@/lib/client";
|
||||
const DealsTable: FC = () => {
|
||||
const { deals, paginationInfo, page, setPage, sortingForm, dealsCrud } =
|
||||
useDealsContext();
|
||||
const { selectedProject } = useProjectsContext();
|
||||
const { openDrawer } = useDrawersContext();
|
||||
|
||||
const onEditClick = useCallback(
|
||||
(deal: DealSchema) => {
|
||||
if (!selectedProject) return;
|
||||
openDrawer({
|
||||
key: "dealEditorDrawer",
|
||||
props: {
|
||||
deal,
|
||||
dealsCrud,
|
||||
project: selectedProject,
|
||||
value: deal,
|
||||
onChange: deal => dealsCrud.onUpdate(deal.id, deal),
|
||||
onDelete: dealsCrud.onDelete,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
@ -44,8 +44,12 @@ const TopToolPanel: FC<Props> = ({ view, setView }) => {
|
||||
if (!selectedProject) return;
|
||||
|
||||
openDrawer({
|
||||
key: "selectedProjectEditorDrawer",
|
||||
props: { project: selectedProject, projectsCrud },
|
||||
key: "projectEditorDrawer",
|
||||
props: {
|
||||
value: selectedProject,
|
||||
onChange: value => projectsCrud.onUpdate(value.id, value),
|
||||
onDelete: projectsCrud.onDelete,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user