diff --git a/web/components/issues/issue-layouts/calendar/base-calendar-root.tsx b/web/components/issues/issue-layouts/calendar/base-calendar-root.tsx index e4aa079b5..c1fcaad62 100644 --- a/web/components/issues/issue-layouts/calendar/base-calendar-root.tsx +++ b/web/components/issues/issue-layouts/calendar/base-calendar-root.tsx @@ -16,7 +16,6 @@ import { IViewIssuesFilterStore, IViewIssuesStore, } from "store/issues"; -import { IIssueCalendarViewStore } from "store/issue"; import { IQuickActionProps } from "../list/list-view-types"; import { EIssueActions } from "../types"; import { IGroupedIssues } from "store/issues/types"; @@ -28,7 +27,6 @@ interface IBaseCalendarRoot { | IModuleIssuesFilterStore | ICycleIssuesFilterStore | IViewIssuesFilterStore; - calendarViewStore: IIssueCalendarViewStore; QuickActions: FC; issueActions: { [EIssueActions.DELETE]: (issue: IIssue) => Promise; @@ -77,13 +75,14 @@ export const BaseCalendarRoot = observer((props: IBaseCalendarRoot) => {
( handleIssues(issue.target_date ?? "", issue, EIssueActions.DELETE)} handleUpdate={ diff --git a/web/components/issues/issue-layouts/calendar/calendar.tsx b/web/components/issues/issue-layouts/calendar/calendar.tsx index 0240a8ebe..7b9787f81 100644 --- a/web/components/issues/issue-layouts/calendar/calendar.tsx +++ b/web/components/issues/issue-layouts/calendar/calendar.tsx @@ -10,8 +10,19 @@ import { Spinner } from "@plane/ui"; import { ICalendarWeek } from "./types"; import { IIssue } from "types"; import { IGroupedIssues, IIssueResponse } from "store/issues/types"; +import { + ICycleIssuesFilterStore, + IModuleIssuesFilterStore, + IProjectIssuesFilterStore, + IViewIssuesFilterStore, +} from "store/issues"; type Props = { + issuesFilterStore: + | IProjectIssuesFilterStore + | IModuleIssuesFilterStore + | ICycleIssuesFilterStore + | IViewIssuesFilterStore; issues: IIssueResponse | undefined; groupedIssueIds: IGroupedIssues; layout: "month" | "week" | undefined; @@ -27,7 +38,8 @@ type Props = { }; export const CalendarChart: React.FC = observer((props) => { - const { issues, groupedIssueIds, layout, showWeekends, quickActions, quickAddCallback, viewId } = props; + const { issuesFilterStore, issues, groupedIssueIds, layout, showWeekends, quickActions, quickAddCallback, viewId } = + props; const { calendar: calendarStore } = useMobxStore(); @@ -45,7 +57,7 @@ export const CalendarChart: React.FC = observer((props) => { return ( <>
- +
{layout === "month" && ( @@ -53,6 +65,7 @@ export const CalendarChart: React.FC = observer((props) => { {allWeeksOfActiveMonth && Object.values(allWeeksOfActiveMonth).map((week: ICalendarWeek, weekIndex) => ( = observer((props) => { )} {layout === "week" && ( = observer((props) => { - const { date, issues, groupedIssueIds, quickActions, enableQuickIssueCreate, quickAddCallback, viewId } = props; + const { + issuesFilterStore, + date, + issues, + groupedIssueIds, + quickActions, + enableQuickIssueCreate, + quickAddCallback, + viewId, + } = props; - const { issueFilter: issueFilterStore } = useMobxStore(); - - const calendarLayout = issueFilterStore.userDisplayFilters.calendar?.layout ?? "month"; + const calendarLayout = issuesFilterStore?.issueFilters?.displayFilters?.calendar?.layout ?? "month"; const issueIdList = groupedIssueIds ? groupedIssueIds[renderDateFormat(date.date)] : null; diff --git a/web/components/issues/issue-layouts/calendar/dropdowns/options-dropdown.tsx b/web/components/issues/issue-layouts/calendar/dropdowns/options-dropdown.tsx index f9fb48f21..61f61ca02 100644 --- a/web/components/issues/issue-layouts/calendar/dropdowns/options-dropdown.tsx +++ b/web/components/issues/issue-layouts/calendar/dropdowns/options-dropdown.tsx @@ -13,12 +13,29 @@ import { Check, ChevronUp } from "lucide-react"; import { TCalendarLayouts } from "types"; // constants import { CALENDAR_LAYOUTS } from "constants/calendar"; +import { EFilterType } from "store/issues/types"; +import { + ICycleIssuesFilterStore, + IModuleIssuesFilterStore, + IProjectIssuesFilterStore, + IViewIssuesFilterStore, +} from "store/issues"; + +interface ICalendarHeader { + issuesFilterStore: + | IProjectIssuesFilterStore + | IModuleIssuesFilterStore + | ICycleIssuesFilterStore + | IViewIssuesFilterStore; +} + +export const CalendarOptionsDropdown: React.FC = observer((props) => { + const { issuesFilterStore } = props; -export const CalendarOptionsDropdown: React.FC = observer(() => { const router = useRouter(); const { workspaceSlug, projectId } = router.query; - const { issueFilter: issueFilterStore, calendar: calendarStore } = useMobxStore(); + const { calendar: calendarStore } = useMobxStore(); const [referenceElement, setReferenceElement] = useState(null); const [popperElement, setPopperElement] = useState(null); @@ -35,18 +52,16 @@ export const CalendarOptionsDropdown: React.FC = observer(() => { ], }); - const calendarLayout = issueFilterStore.userDisplayFilters.calendar?.layout ?? "month"; - const showWeekends = issueFilterStore.userDisplayFilters.calendar?.show_weekends ?? false; + const calendarLayout = issuesFilterStore.issueFilters?.displayFilters?.calendar?.layout ?? "month"; + const showWeekends = issuesFilterStore.issueFilters?.displayFilters?.calendar?.show_weekends ?? false; const handleLayoutChange = (layout: TCalendarLayouts) => { if (!workspaceSlug || !projectId) return; - issueFilterStore.updateUserFilters(workspaceSlug.toString(), projectId.toString(), { - display_filters: { - calendar: { - ...issueFilterStore.userDisplayFilters.calendar, - layout, - }, + issuesFilterStore.updateFilters(workspaceSlug.toString(), projectId.toString(), EFilterType.DISPLAY_FILTERS, { + calendar: { + ...issuesFilterStore.issueFilters?.displayFilters?.calendar, + layout, }, }); @@ -56,16 +71,14 @@ export const CalendarOptionsDropdown: React.FC = observer(() => { }; const handleToggleWeekends = () => { - const showWeekends = issueFilterStore.userDisplayFilters.calendar?.show_weekends ?? false; + const showWeekends = issuesFilterStore.issueFilters?.displayFilters?.calendar?.show_weekends ?? false; if (!workspaceSlug || !projectId) return; - issueFilterStore.updateUserFilters(workspaceSlug.toString(), projectId.toString(), { - display_filters: { - calendar: { - ...issueFilterStore.userDisplayFilters.calendar, - show_weekends: !showWeekends, - }, + issuesFilterStore.updateFilters(workspaceSlug.toString(), projectId.toString(), EFilterType.DISPLAY_FILTERS, { + calendar: { + ...issuesFilterStore.issueFilters?.displayFilters?.calendar, + show_weekends: !showWeekends, }, }); }; diff --git a/web/components/issues/issue-layouts/calendar/header.tsx b/web/components/issues/issue-layouts/calendar/header.tsx index 034be98c4..ac54aa6d2 100644 --- a/web/components/issues/issue-layouts/calendar/header.tsx +++ b/web/components/issues/issue-layouts/calendar/header.tsx @@ -6,8 +6,24 @@ import { useMobxStore } from "lib/mobx/store-provider"; import { CalendarMonthsDropdown, CalendarOptionsDropdown } from "components/issues"; // icons import { ChevronLeft, ChevronRight } from "lucide-react"; +import { + ICycleIssuesFilterStore, + IModuleIssuesFilterStore, + IProjectIssuesFilterStore, + IViewIssuesFilterStore, +} from "store/issues"; + +interface ICalendarHeader { + issuesFilterStore: + | IProjectIssuesFilterStore + | IModuleIssuesFilterStore + | ICycleIssuesFilterStore + | IViewIssuesFilterStore; +} + +export const CalendarHeader: React.FC = observer((props) => { + const { issuesFilterStore } = props; -export const CalendarHeader: React.FC = observer(() => { const { issueFilter: issueFilterStore, calendar: calendarStore } = useMobxStore(); const calendarLayout = issueFilterStore.userDisplayFilters.calendar?.layout ?? "month"; @@ -91,7 +107,7 @@ export const CalendarHeader: React.FC = observer(() => { > Today - +
); diff --git a/web/components/issues/issue-layouts/calendar/roots/cycle-root.tsx b/web/components/issues/issue-layouts/calendar/roots/cycle-root.tsx index 784e9a830..9830b871f 100644 --- a/web/components/issues/issue-layouts/calendar/roots/cycle-root.tsx +++ b/web/components/issues/issue-layouts/calendar/roots/cycle-root.tsx @@ -13,7 +13,6 @@ export const CycleCalendarLayout: React.FC = observer(() => { const { cycleIssues: cycleIssueStore, cycleIssuesFilter: cycleIssueFilterStore, - cycleIssueCalendarView: cycleIssueCalendarViewStore, calendarHelpers: { handleDragDrop: handleCalenderDragDrop }, } = useMobxStore(); @@ -62,7 +61,6 @@ export const CycleCalendarLayout: React.FC = observer(() => { { const { moduleIssues: moduleIssueStore, moduleIssuesFilter: moduleIssueFilterStore, - moduleIssueCalendarView: moduleIssueCalendarViewStore, calendarHelpers: { handleDragDrop: handleCalenderDragDrop }, } = useMobxStore(); @@ -56,7 +55,6 @@ export const ModuleCalendarLayout: React.FC = observer(() => { { const { projectIssues: issueStore, - issueCalendarView: issueCalendarViewStore, projectIssuesFilter: projectIssueFiltersStore, calendarHelpers: { handleDragDrop: handleCalenderDragDrop }, } = useMobxStore(); @@ -49,7 +48,6 @@ export const CalendarLayout: React.FC = observer(() => { { const { viewIssues: projectViewIssuesStore, viewIssuesFilter: projectIssueViewFiltersStore, - projectViewIssueCalendarView: projectViewIssueCalendarViewStore, calendarHelpers: { handleDragDrop: handleCalenderDragDrop }, } = useMobxStore(); @@ -50,7 +49,6 @@ export const ProjectViewCalendarLayout: React.FC = observer(() => { = observer((props) => { - const { issues, groupedIssueIds, week, quickActions, enableQuickIssueCreate, quickAddCallback, viewId } = props; + const { + issuesFilterStore, + issues, + groupedIssueIds, + week, + quickActions, + enableQuickIssueCreate, + quickAddCallback, + viewId, + } = props; - const { issueFilter: issueFilterStore } = useMobxStore(); - - const calendarLayout = issueFilterStore.userDisplayFilters.calendar?.layout ?? "month"; - const showWeekends = issueFilterStore.userDisplayFilters.calendar?.show_weekends ?? false; + const calendarLayout = issuesFilterStore?.issueFilters?.displayFilters?.calendar?.layout ?? "month"; + const showWeekends = issuesFilterStore?.issueFilters?.displayFilters?.calendar?.show_weekends ?? false; if (!week) return null; @@ -47,6 +62,7 @@ export const CalendarWeekDays: React.FC = observer((props) => { return ( = observer((props) => {
)} - -
- {enableQuickIssueCreate && ( - - )} +
+ {enableQuickIssueCreate && ( + + )} +
{/* {isDragStarted && isDragDisabled && (