Skip to content

Commit

Permalink
chore: clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Carsten Koch committed Dec 9, 2024
1 parent 5ada6af commit fcb3d0f
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 38 deletions.
17 changes: 17 additions & 0 deletions components/planning/week/ProcessCrmUpdates.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import useMrrLatestUpload from "@/api/useLatestUploadsWork";
import ImportProjectData from "@/components/crm/import-project-data";
import PlanWeekAction from "@/components/planning/week/PlanWeekAction";
import { FC } from "react";

interface ProcessCrmUpdatesProps {
mutateSfdc: ReturnType<typeof useMrrLatestUpload>["mutateSfdc"];
}

const ProcessCrmUpdates: FC<ProcessCrmUpdatesProps> = ({ mutateSfdc }) => (
<>
<PlanWeekAction label="Upload Salesforce Opportunities" />
<ImportProjectData reloader={mutateSfdc} />
</>
);

export default ProcessCrmUpdates;
25 changes: 25 additions & 0 deletions components/planning/week/ProcessFinancialUpdates.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import useMrrLatestUpload from "@/api/useLatestUploadsWork";
import InstructionsUploadMrr from "@/components/analytics/instructions/instructions-upload-mrr";
import { MrrFilterProvider } from "@/components/analytics/useMrrFilter";
import PlanWeekAction from "@/components/planning/week/PlanWeekAction";
import { Accordion } from "@/components/ui/accordion";
import { FC } from "react";

interface ProcessFinancialUpdatesProps {
mutateMrr: ReturnType<typeof useMrrLatestUpload>["mutateMrr"];
}

const ProcessFinancialUpdates: FC<ProcessFinancialUpdatesProps> = ({
mutateMrr,
}) => (
<>
<PlanWeekAction label="Upload Customer Financials" />
<MrrFilterProvider>
<Accordion type="single" collapsible>
<InstructionsUploadMrr reloader={mutateMrr} />
</Accordion>
</MrrFilterProvider>
</>
);

export default ProcessFinancialUpdates;
11 changes: 11 additions & 0 deletions components/planning/week/ProcessInbox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import ProcessInboxItem from "@/components/inbox/ProcessInboxItem";
import PlanWeekAction from "@/components/planning/week/PlanWeekAction";

const ProcessInbox = () => (
<>
<PlanWeekAction label="Process Inbox Items" />
<ProcessInboxItem />
</>
);

export default ProcessInbox;
29 changes: 29 additions & 0 deletions components/planning/week/ProcessProjects.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { PlanningProjectFilterProvider } from "@/components/planning/usePlanningProjectFilter";
import PlanWeekAction from "@/components/planning/week/PlanWeekAction";
import PlanWeekContextNotWork from "@/components/planning/week/PlanWeekContextNotWork";
import PlanWeekContextWork from "@/components/planning/week/PlanWeekContextWork";
import PlanWeekFilter from "@/components/planning/week/PlanWeekFilter";
import PlanWeekStatistics from "@/components/planning/week/PlanWeekStatistics";
import { useContextContext } from "@/contexts/ContextContext";
import { FC } from "react";

interface ProcessProjectsProps {}

const ProcessProjects: FC<ProcessProjectsProps> = (props) => {
const { context } = useContextContext();
return (
<>
<PlanWeekAction label="Review Projects" />
<PlanningProjectFilterProvider>
<PlanWeekStatistics />

<PlanWeekFilter />

{context !== "work" && <PlanWeekContextNotWork />}
{context === "work" && <PlanWeekContextWork />}
</PlanningProjectFilterProvider>
</>
);
};

export default ProcessProjects;
46 changes: 8 additions & 38 deletions pages/planweek.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
import useInbox from "@/api/useInbox";
import useMrrLatestUpload from "@/api/useLatestUploadsWork";
import InstructionsUploadMrr from "@/components/analytics/instructions/instructions-upload-mrr";
import { MrrFilterProvider } from "@/components/analytics/useMrrFilter";
import ImportProjectData from "@/components/crm/import-project-data";
import ProcessInboxItem from "@/components/inbox/ProcessInboxItem";
import ApiLoadingError from "@/components/layouts/ApiLoadingError";
import MainLayout from "@/components/layouts/MainLayout";
import ContextSwitcher from "@/components/navigation-menu/ContextSwitcher";
import { PlanningProjectFilterProvider } from "@/components/planning/usePlanningProjectFilter";
import {
useWeekPlanContext,
withWeekPlan,
} from "@/components/planning/useWeekPlanContext";
import PlanWeekAction from "@/components/planning/week/PlanWeekAction";
import PlanWeekContextNotWork from "@/components/planning/week/PlanWeekContextNotWork";
import PlanWeekContextWork from "@/components/planning/week/PlanWeekContextWork";
import PlanWeekFilter from "@/components/planning/week/PlanWeekFilter";
import PlanWeekForm from "@/components/planning/week/PlanWeekForm";
import PlanWeekStatistics from "@/components/planning/week/PlanWeekStatistics";
import { Accordion } from "@/components/ui/accordion";
import ProcessCrmUpdates from "@/components/planning/week/ProcessCrmUpdates";
import ProcessFinancialUpdates from "@/components/planning/week/ProcessFinancialUpdates";
import ProcessInbox from "@/components/planning/week/ProcessInbox";
import ProcessProjects from "@/components/planning/week/ProcessProjects";
import { useContextContext } from "@/contexts/ContextContext";

const WeeklyPlanningPage = () => {
Expand All @@ -40,36 +33,13 @@ const WeeklyPlanningPage = () => {
</div>

{inbox && inbox.length > 0 ? (
<>
<PlanWeekAction label="Process Inbox Items" />
<ProcessInboxItem />
</>
<ProcessInbox />
) : context === "work" && mrrUploadTooOld ? (
<>
<PlanWeekAction label="Upload Customer Financials" />
<MrrFilterProvider>
<Accordion type="single" collapsible>
<InstructionsUploadMrr reloader={mutateMrr} />
</Accordion>
</MrrFilterProvider>
</>
<ProcessFinancialUpdates {...{ mutateMrr }} />
) : context === "work" && sfdcUploadTooOld ? (
<>
<PlanWeekAction label="Upload Salesforce Opportunities" />
<ImportProjectData reloader={mutateSfdc} />
</>
<ProcessCrmUpdates {...{ mutateSfdc }} />
) : (
<>
<PlanWeekAction label="Review Projects" />
<PlanningProjectFilterProvider>
<PlanWeekStatistics />

<PlanWeekFilter />

{context !== "work" && <PlanWeekContextNotWork />}
{context === "work" && <PlanWeekContextWork />}
</PlanningProjectFilterProvider>
</>
<ProcessProjects />
)}
</div>
</MainLayout>
Expand Down

0 comments on commit fcb3d0f

Please sign in to comment.