fix: hidden creating statuses when board is not selected
This commit is contained in:
@ -6,6 +6,7 @@ import CreateStatusButton from "@/app/deals/components/shared/CreateStatusButton
|
||||
import DealCard from "@/app/deals/components/shared/DealCard/DealCard";
|
||||
import DealContainer from "@/app/deals/components/shared/DealContainer/DealContainer";
|
||||
import StatusColumnWrapper from "@/app/deals/components/shared/StatusColumnWrapper/StatusColumnWrapper";
|
||||
import { useBoardsContext } from "@/app/deals/contexts/BoardsContext";
|
||||
import { useDealsContext } from "@/app/deals/contexts/DealsContext";
|
||||
import useDealsAndStatusesDnd from "@/app/deals/hooks/useDealsAndStatusesDnd";
|
||||
import FunnelDnd from "@/components/dnd/FunnelDnd/FunnelDnd";
|
||||
@ -14,6 +15,7 @@ import { DealSchema, StatusSchema } from "@/lib/client";
|
||||
import { sortByLexorank } from "@/utils/lexorank";
|
||||
|
||||
const Funnel: FC = () => {
|
||||
const { selectedBoard } = useBoardsContext();
|
||||
const { deals } = useDealsContext();
|
||||
const isMobile = useIsMobile();
|
||||
|
||||
@ -66,6 +68,7 @@ const Funnel: FC = () => {
|
||||
</StatusColumnWrapper>
|
||||
)}
|
||||
disabledColumns={isMobile}
|
||||
isCreatingContainerEnabled={!!selectedBoard}
|
||||
/>
|
||||
);
|
||||
|
||||
@ -80,7 +83,7 @@ const Funnel: FC = () => {
|
||||
wrap={"nowrap"}
|
||||
gap={"xs"}>
|
||||
{renderFunnelDnd()}
|
||||
<CreateStatusButton />
|
||||
{selectedBoard && <CreateStatusButton />}
|
||||
</Group>
|
||||
</ScrollArea>
|
||||
);
|
||||
|
||||
@ -40,6 +40,7 @@ type Props<TContainer, TItem> = {
|
||||
getItemsByContainer: (container: TContainer, items: TItem[]) => TItem[];
|
||||
activeContainer: TContainer | null;
|
||||
activeItem: TItem | null;
|
||||
isCreatingContainerEnabled?: boolean;
|
||||
disabledColumns?: boolean;
|
||||
};
|
||||
|
||||
@ -60,6 +61,7 @@ const FunnelDnd = <
|
||||
getItemsByContainer,
|
||||
activeContainer,
|
||||
activeItem,
|
||||
isCreatingContainerEnabled = true,
|
||||
disabledColumns = false,
|
||||
}: Props<TContainer, TItem>) => {
|
||||
const sensors = useDndSensors();
|
||||
@ -106,7 +108,7 @@ const FunnelDnd = <
|
||||
}}
|
||||
classNames={styles}>
|
||||
{renderContainers()}
|
||||
<CreateStatusButton />
|
||||
{isCreatingContainerEnabled && <CreateStatusButton />}
|
||||
</Carousel>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user