refactor: removed unnecessary view context
This commit is contained in:
@ -1,36 +1,22 @@
|
||||
"use client";
|
||||
|
||||
import { Space } from "@mantine/core";
|
||||
import TopToolPanel from "@/app/deals/components/desktop/TopToolPanel/TopToolPanel";
|
||||
import MainBlockHeader from "@/app/deals/components/mobile/MainBlockHeader/MainBlockHeader";
|
||||
import Funnel from "@/app/deals/components/shared/Funnel/Funnel";
|
||||
import { useState } from "react";
|
||||
import TopToolPanel, {
|
||||
View,
|
||||
} from "@/app/deals/components/desktop/TopToolPanel/TopToolPanel";
|
||||
import {
|
||||
BoardView,
|
||||
ScheduleView,
|
||||
TableView,
|
||||
} from "@/app/deals/components/shared/views";
|
||||
import { useBoardsContext } from "@/app/deals/contexts/BoardsContext";
|
||||
import { DealsContextProvider } from "@/app/deals/contexts/DealsContext";
|
||||
import { useProjectsContext } from "@/app/deals/contexts/ProjectsContext";
|
||||
import { useViewContext } from "@/app/deals/contexts/ViewContext";
|
||||
import PageBlock from "@/components/layout/PageBlock/PageBlock";
|
||||
import DealsTable from "../../desktop/DealsTable/DealsTable";
|
||||
|
||||
const BoardView = () => (
|
||||
<PageBlock>
|
||||
<MainBlockHeader />
|
||||
<Space h="md" />
|
||||
<Funnel />
|
||||
</PageBlock>
|
||||
);
|
||||
|
||||
const TableView = () => (
|
||||
<PageBlock>
|
||||
<DealsTable />
|
||||
</PageBlock>
|
||||
);
|
||||
|
||||
const ScheduleView = () => <PageBlock>-</PageBlock>;
|
||||
|
||||
const PageBody = () => {
|
||||
const { selectedBoard } = useBoardsContext();
|
||||
const { selectedProject } = useProjectsContext();
|
||||
const { view } = useViewContext();
|
||||
const [view, setView] = useState<View>("board");
|
||||
|
||||
const getViewContent = () => {
|
||||
switch (view) {
|
||||
@ -52,7 +38,10 @@ const PageBody = () => {
|
||||
|
||||
return (
|
||||
<DealsContextProvider {...getContextProps()}>
|
||||
<TopToolPanel />
|
||||
<TopToolPanel
|
||||
view={view}
|
||||
setView={setView}
|
||||
/>
|
||||
{getViewContent()}
|
||||
</DealsContextProvider>
|
||||
);
|
||||
|
||||
12
src/app/deals/components/shared/views/BoardView.tsx
Normal file
12
src/app/deals/components/shared/views/BoardView.tsx
Normal file
@ -0,0 +1,12 @@
|
||||
import { Space } from "@mantine/core";
|
||||
import MainBlockHeader from "@/app/deals/components/mobile/MainBlockHeader/MainBlockHeader";
|
||||
import Funnel from "@/app/deals/components/shared/Funnel/Funnel";
|
||||
import PageBlock from "@/components/layout/PageBlock/PageBlock";
|
||||
|
||||
export const BoardView = () => (
|
||||
<PageBlock>
|
||||
<MainBlockHeader />
|
||||
<Space h="md" />
|
||||
<Funnel />
|
||||
</PageBlock>
|
||||
);
|
||||
5
src/app/deals/components/shared/views/ScheduleView.tsx
Normal file
5
src/app/deals/components/shared/views/ScheduleView.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
import PageBlock from "@/components/layout/PageBlock/PageBlock";
|
||||
|
||||
export const ScheduleView = () => {
|
||||
return <PageBlock>-</PageBlock>;
|
||||
};
|
||||
8
src/app/deals/components/shared/views/TableView.tsx
Normal file
8
src/app/deals/components/shared/views/TableView.tsx
Normal file
@ -0,0 +1,8 @@
|
||||
import DealsTable from "@/app/deals/components/desktop/DealsTable/DealsTable";
|
||||
import PageBlock from "@/components/layout/PageBlock/PageBlock";
|
||||
|
||||
export const TableView = () => (
|
||||
<PageBlock>
|
||||
<DealsTable />
|
||||
</PageBlock>
|
||||
);
|
||||
3
src/app/deals/components/shared/views/index.ts
Normal file
3
src/app/deals/components/shared/views/index.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export { BoardView } from "./BoardView";
|
||||
export { TableView } from "./TableView";
|
||||
export { ScheduleView } from "./ScheduleView";
|
||||
Reference in New Issue
Block a user