feat: boards dnd editor for mobile

This commit is contained in:
2025-08-09 15:51:23 +04:00
parent e3137de46d
commit 9fb9e794db
9 changed files with 139 additions and 49 deletions

View File

@ -1,4 +1,4 @@
import React, { FC, useState } from "react";
import React, { CSSProperties, FC, useState } from "react";
import { Box, Group, Text } from "@mantine/core";
import BoardMenu from "@/app/deals/components/Board/BoardMenu";
import { useBoardsContext } from "@/app/deals/contexts/BoardsContext";
@ -7,9 +7,10 @@ import { BoardSchema } from "@/lib/client";
type Props = {
board: BoardSchema;
containerStyle?: CSSProperties;
};
const Board: FC<Props> = ({ board }) => {
const Board: FC<Props> = ({ board, containerStyle }) => {
const [isHovered, setIsHovered] = useState(false);
const { onUpdateBoard } = useBoardsContext();
@ -20,7 +21,7 @@ const Board: FC<Props> = ({ board }) => {
py={"xs"}
justify={"space-between"}
wrap={"nowrap"}
style={{ borderWidth: 1 }}
style={{ ...containerStyle, borderWidth: 1 }}
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}>
<InPlaceInput

View File

@ -6,12 +6,13 @@ import { useBoardsContext } from "@/app/deals/contexts/BoardsContext";
import { BoardSchema } from "@/lib/client";
type Props = {
isHovered: boolean;
board: BoardSchema;
startEditing: () => void;
isHovered?: boolean;
menuIconSize?: number;
};
const BoardMenu: FC<Props> = ({ isHovered, board, startEditing }) => {
const BoardMenu: FC<Props> = ({ board, startEditing, isHovered = true, menuIconSize = 16 }) => {
const { selectedBoard, onDeleteBoard } = useBoardsContext();
return (
@ -28,7 +29,7 @@ const BoardMenu: FC<Props> = ({ isHovered, board, startEditing }) => {
cursor: "pointer",
}}
onClick={e => e.stopPropagation()}>
<IconDotsVertical size={16} />
<IconDotsVertical size={menuIconSize} />
</Box>
</Menu.Target>
<Menu.Dropdown>

View File

@ -17,9 +17,9 @@ const DealContainer: FC<Props> = ({ deal, disabled = false }) => {
<SortableItem
disabled={disabled}
dragHandleStyle={{ cursor: "pointer" }}
id={deal.id}>
{dealBody}
</SortableItem>
id={deal.id}
renderItem={() => dealBody}
/>
</Box>
);
};