feat: drawers registry
This commit is contained in:
@ -6,26 +6,35 @@ import {
|
||||
IconTrash,
|
||||
} from "@tabler/icons-react";
|
||||
import { Box, Group, Menu, Text } from "@mantine/core";
|
||||
import { useStatusesContext } from "@/app/deals/contexts/StatusesContext";
|
||||
import { useDrawersContext } from "@/drawers/DrawersContext";
|
||||
import useIsMobile from "@/hooks/useIsMobile";
|
||||
import { StatusSchema } from "@/lib/client";
|
||||
import { BoardSchema, StatusSchema } from "@/lib/client";
|
||||
|
||||
type Props = {
|
||||
status: StatusSchema;
|
||||
handleEdit: () => void;
|
||||
board: BoardSchema | null;
|
||||
onDeleteStatus: (status: StatusSchema) => void;
|
||||
refetchStatuses?: () => void;
|
||||
withChangeOrderButton?: boolean;
|
||||
};
|
||||
|
||||
const StatusMenu: FC<Props> = ({ status, handleEdit }) => {
|
||||
const StatusMenu: FC<Props> = ({
|
||||
status,
|
||||
handleEdit,
|
||||
board,
|
||||
onDeleteStatus,
|
||||
refetchStatuses,
|
||||
withChangeOrderButton = true,
|
||||
}) => {
|
||||
const isMobile = useIsMobile();
|
||||
const { onDeleteStatus, setIsEditorDrawerOpened } = useStatusesContext();
|
||||
const { openDrawer } = useDrawersContext();
|
||||
|
||||
return (
|
||||
<Menu>
|
||||
<Menu.Target>
|
||||
<Box
|
||||
style={{
|
||||
cursor: "pointer",
|
||||
}}
|
||||
style={{ cursor: "pointer" }}
|
||||
onClick={e => e.stopPropagation()}>
|
||||
<IconDotsVertical />
|
||||
</Box>
|
||||
@ -51,11 +60,18 @@ const StatusMenu: FC<Props> = ({ status, handleEdit }) => {
|
||||
<Text>Удалить</Text>
|
||||
</Group>
|
||||
</Menu.Item>
|
||||
{isMobile && (
|
||||
{isMobile && withChangeOrderButton && (
|
||||
<Menu.Item
|
||||
onClick={e => {
|
||||
e.stopPropagation();
|
||||
setIsEditorDrawerOpened(true);
|
||||
if (!board) return;
|
||||
openDrawer({
|
||||
key: "boardStatusesEditorDrawer",
|
||||
props: {
|
||||
board,
|
||||
},
|
||||
onClose: refetchStatuses,
|
||||
});
|
||||
}}>
|
||||
<Group wrap={"nowrap"}>
|
||||
<IconExchange />
|
||||
|
||||
Reference in New Issue
Block a user