Skip to content

Commit

Permalink
Merge pull request #266 from cabcookie:fix-weekly-planning
Browse files Browse the repository at this point in the history
chore: clean up
  • Loading branch information
cabcookie authored Dec 9, 2024
2 parents 5ada6af + 130414b commit 028d146
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 50 deletions.
2 changes: 1 addition & 1 deletion components/planning/DecisionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ const DecisionButton: FC<DecisionButtonProps> = ({
disabled,
}) => (
<Button
size="sm"
onClick={makeDecision}
variant={selected ? "default" : "outline"}
disabled={!!isLoading || disabled}
className="px-2 h-8"
>
{isLoading && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
{label}
Expand Down
2 changes: 1 addition & 1 deletion components/planning/DecisionSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const DecisionSection: FC<DecisionSectionProps> = ({
return (
weekPlan && (
<div className={cn(className)}>
<Label htmlFor={`${project.id}-decision`} className="font-semibold">
<Label htmlFor={`${project.id}-decision`}>
Can you make progress on this project this week?
</Label>

Expand Down
2 changes: 1 addition & 1 deletion components/planning/project/MakeProjectDecision.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const MakeProjectDecision: FC<MakeProjectDecisionProps> = ({

<DecisionSection
project={project}
className="flex flex-col space-y-2"
className="mx-1 md:mx-2 flex flex-col space-y-2"
saveOnHoldDate={saveOnHoldDate}
/>
</div>
Expand Down
20 changes: 11 additions & 9 deletions components/planning/week/PlanWeekContextWork.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ const PlanWeekContextWork = () => {
value={id}
>
<Accordion type="single" collapsible>
{projects.map((project) => (
<MakeProjectDecision
key={project.id}
project={project}
saveOnHoldDate={(onHoldTill) =>
saveProjectDates({ projectId: project.id, onHoldTill })
}
/>
))}
<div className="space-y-6">
{projects.map((project) => (
<MakeProjectDecision
key={project.id}
project={project}
saveOnHoldDate={(onHoldTill) =>
saveProjectDates({ projectId: project.id, onHoldTill })
}
/>
))}
</div>
</Accordion>
</DefaultAccordionItem>
))}
Expand Down
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;
31 changes: 31 additions & 0 deletions components/planning/week/ProcessProjects.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import useWeekPlan from "@/api/useWeekPlan";
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";

const ProcessProjects = () => {
const { context } = useContextContext();
const { weekPlan } = useWeekPlan();

return (
weekPlan && (
<>
<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 028d146

Please sign in to comment.