refactor: drawers refactored

This commit is contained in:
2025-09-06 11:09:42 +04:00
parent 67780b5251
commit d76dc82cb8
44 changed files with 239 additions and 227 deletions

View File

@ -1,6 +1,5 @@
import { Box, Card, Group, Pill, Stack, Text } from "@mantine/core";
import { useDealsContext } from "@/app/deals/contexts/DealsContext";
import { useProjectsContext } from "@/app/deals/contexts/ProjectsContext";
import { useDrawersContext } from "@/drawers/DrawersContext";
import { DealSchema } from "@/lib/client";
import styles from "./DealCard.module.css";
@ -10,15 +9,17 @@ type Props = {
};
const DealCard = ({ deal }: Props) => {
const { selectedProject } = useProjectsContext();
const { dealsCrud } = useDealsContext();
const { openDrawer } = useDrawersContext();
const onClick = () => {
if (!selectedProject) return;
openDrawer({
key: "dealEditorDrawer",
props: { project: selectedProject, deal, dealsCrud },
props: {
value: deal,
onChange: deal => dealsCrud.onUpdate(deal.id, deal),
onDelete: dealsCrud.onDelete,
},
});
};