fix: projects editor to selected project editor, moved attributes editor
This commit is contained in:
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
|
||||
import { BoardSchema, BoardService } from "../../../../../client";
|
||||
import { modals } from "@mantine/modals";
|
||||
import { notifications } from "../../../../../shared/lib/notifications.ts";
|
||||
import { useCardPageContext } from "../../../../../pages/CardsPage/contexts/CardPageContext.tsx";
|
||||
import { useProjectsContext } from "../../../../../contexts/ProjectsContext.tsx";
|
||||
|
||||
type Props = {
|
||||
boards: BoardSchema[];
|
||||
@@ -11,7 +11,7 @@ type Props = {
|
||||
|
||||
const useBoards = ({ boards, refetchBoards }: Props) => {
|
||||
const [selectedBoard, setSelectedBoard] = useState<BoardSchema | null>(null);
|
||||
const { selectedProject: project } = useCardPageContext();
|
||||
const { selectedProject: project } = useProjectsContext();
|
||||
|
||||
useEffect(() => {
|
||||
if (boards.length > 0 && selectedBoard === null) {
|
||||
@@ -24,7 +24,7 @@ const useBoards = ({ boards, refetchBoards }: Props) => {
|
||||
let newBoard = boards.find(board => board.id === selectedBoard.id);
|
||||
|
||||
if (!newBoard && boards.length > 0) {
|
||||
newBoard = boards[0]
|
||||
newBoard = boards[0];
|
||||
}
|
||||
setSelectedBoard(newBoard ?? null);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import { IconCheck, IconLayoutGridRemove, IconTrash } from "@tabler/icons-react"
|
||||
import { useContextMenu } from "mantine-contextmenu";
|
||||
import useCardSummaryState from "./useCardSummaryState.tsx";
|
||||
import isModuleInProject, { Modules } from "../../../../pages/CardsPage/utils/isModuleInProject.ts";
|
||||
import { useProjectsContext } from "../../../../contexts/ProjectsContext.tsx";
|
||||
|
||||
type Props = {
|
||||
cardSummary: CardSummary;
|
||||
@@ -18,7 +19,8 @@ type Props = {
|
||||
|
||||
const CardSummaryItem: FC<Props> = ({ cardSummary, color }) => {
|
||||
const { showContextMenu } = useContextMenu();
|
||||
const { selectedProject, setSelectedCard } = useCardPageContext();
|
||||
const { selectedProject } = useProjectsContext();
|
||||
const { setSelectedCard } = useCardPageContext();
|
||||
const { onDelete, onComplete, onDeleteFromGroup } = useCardSummaryState();
|
||||
|
||||
const isServicesAndProductsIncluded = isModuleInProject(Modules.SERVICES_AND_PRODUCTS, selectedProject);
|
||||
|
||||
@@ -9,8 +9,8 @@ import { groupBy, has, uniq } from "lodash";
|
||||
import { CardGroupView } from "../CardGroupView/CardGroupView.tsx";
|
||||
import CreateDealsFromFileButton from "../CreateCardsFromFileButton/CreateDealsFromFileButton.tsx";
|
||||
import DragState from "../../../../pages/CardsPage/enums/DragState.ts";
|
||||
import { useCardPageContext } from "../../../../pages/CardsPage/contexts/CardPageContext.tsx";
|
||||
import isModuleInProject, { Modules } from "../../../../pages/CardsPage/utils/isModuleInProject.ts";
|
||||
import { useProjectsContext } from "../../../../contexts/ProjectsContext.tsx";
|
||||
|
||||
type Props = {
|
||||
status: StatusSchema;
|
||||
@@ -27,7 +27,7 @@ export const CardsDndColumn: FC<Props> = ({
|
||||
dragState,
|
||||
withCreateButton = false,
|
||||
}) => {
|
||||
const { selectedProject } = useCardPageContext();
|
||||
const { selectedProject } = useProjectsContext();
|
||||
const isCreatingDealFromFileEnabled = isModuleInProject(Modules.SERVICES_AND_PRODUCTS, selectedProject);
|
||||
const isDropDisabled = dragState === DragState.DRAG_STATUS;
|
||||
const droppableId = status.id.toString();
|
||||
|
||||
@@ -7,8 +7,8 @@ import { CardService, StatusSchema } from "../../../../client";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { dateWithoutTimezone } from "../../../../shared/lib/date.ts";
|
||||
import { usePrefillCardContext } from "../../../../pages/CardsPage/contexts/PrefillCardContext.tsx";
|
||||
import { useCardPageContext } from "../../../../pages/CardsPage/contexts/CardPageContext.tsx";
|
||||
import isModuleInProject, { Modules } from "../../../../pages/CardsPage/utils/isModuleInProject.ts";
|
||||
import { useProjectsContext } from "../../../../contexts/ProjectsContext.tsx";
|
||||
|
||||
type Props = {
|
||||
status: StatusSchema;
|
||||
@@ -20,7 +20,7 @@ const CreateCardButton = ({ status }: Props) => {
|
||||
const queryClient = useQueryClient();
|
||||
const { prefillCard, setPrefillCard } = usePrefillCardContext();
|
||||
|
||||
const { selectedProject } = useCardPageContext();
|
||||
const { selectedProject } = useProjectsContext();
|
||||
const isPrefillingDealEnabled = isModuleInProject(Modules.SERVICES_AND_PRODUCTS, selectedProject);
|
||||
|
||||
return (
|
||||
|
||||
@@ -9,8 +9,8 @@ import ShippingWarehouseAutocomplete
|
||||
from "../../../Selects/ShippingWarehouseAutocomplete/ShippingWarehouseAutocomplete.tsx";
|
||||
import BaseMarketplaceSelect from "../../../Selects/BaseMarketplaceSelect/BaseMarketplaceSelect.tsx";
|
||||
import { usePrefillCardContext } from "../../../../pages/CardsPage/contexts/PrefillCardContext.tsx";
|
||||
import { useCardPageContext } from "../../../../pages/CardsPage/contexts/CardPageContext.tsx";
|
||||
import isModuleInProject, { Modules } from "../../../../pages/CardsPage/utils/isModuleInProject.ts";
|
||||
import { useProjectsContext } from "../../../../contexts/ProjectsContext.tsx";
|
||||
|
||||
type Props = {
|
||||
onSubmit: (quickDeal: QuickCard) => void;
|
||||
@@ -18,7 +18,7 @@ type Props = {
|
||||
};
|
||||
|
||||
const CreateCardForm: FC<Props> = ({ onSubmit, onCancel }) => {
|
||||
const { selectedProject } = useCardPageContext();
|
||||
const { selectedProject } = useProjectsContext();
|
||||
const isPrefillingEnabled = isModuleInProject(Modules.SERVICES_AND_PRODUCTS, selectedProject);
|
||||
const { prefillOnOpen, prefillCard } = usePrefillCardContext();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user