From 8b7b5c54b9e795c7987a6561e80bca41ccf32cdf Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Tue, 31 Oct 2023 12:06:11 +0530 Subject: [PATCH] fix: global views bugs (#2563) --- web/components/headers/global-issues.tsx | 1 + .../issues/issue-layouts/kanban/block.tsx | 6 ++-- .../issue-layouts/kanban/blocks-list.tsx | 8 ++--- .../issues/issue-layouts/kanban/default.tsx | 24 ++++++------- .../issue-layouts/kanban/properties.tsx | 34 ++++++++++++------- .../issue-layouts/kanban/roots/cycle-root.tsx | 6 ++-- .../kanban/roots/module-root.tsx | 6 ++-- .../kanban/roots/profile-issues-root.tsx | 6 ++-- .../kanban/roots/project-root.tsx | 6 ++-- .../issues/issue-layouts/kanban/swimlanes.tsx | 24 ++++++------- .../roots/global-view-layout-root.tsx | 14 +++++--- .../roots/project-layout-root.tsx | 2 ++ .../spreadsheet/columns/created-on-column.tsx | 2 +- .../spreadsheet/columns/updated-on-column.tsx | 2 +- web/components/workspace/views/form.tsx | 1 + .../global-view/global_view_issues.store.ts | 27 +++++++++++++++ 16 files changed, 106 insertions(+), 63 deletions(-) diff --git a/web/components/headers/global-issues.tsx b/web/components/headers/global-issues.tsx index b80dd45a1..5f0f1c054 100644 --- a/web/components/headers/global-issues.tsx +++ b/web/components/headers/global-issues.tsx @@ -134,6 +134,7 @@ export const GlobalIssuesHeader: React.FC = observer((props) => { handleFiltersUpdate={handleFiltersUpdate} layoutDisplayFiltersOptions={ISSUE_DISPLAY_FILTERS_BY_LAYOUT.my_issues.spreadsheet} labels={workspaceStore.workspaceLabels ?? undefined} + members={workspaceStore.workspaceMembers?.map((m) => m.member) ?? undefined} projects={workspaceSlug ? projectStore.projects[workspaceSlug.toString()] : undefined} /> diff --git a/web/components/issues/issue-layouts/kanban/block.tsx b/web/components/issues/issue-layouts/kanban/block.tsx index 3cbb4e7d5..51197c45d 100644 --- a/web/components/issues/issue-layouts/kanban/block.tsx +++ b/web/components/issues/issue-layouts/kanban/block.tsx @@ -2,7 +2,7 @@ import { Draggable } from "@hello-pangea/dnd"; // components import { KanBanProperties } from "./properties"; // types -import { IEstimatePoint, IIssue, IIssueLabels, IState, IUserLite } from "types"; +import { IEstimatePoint, IIssue, IIssueDisplayProperties, IIssueLabels, IState, IUserLite } from "types"; interface IssueBlockProps { sub_group_id: string; @@ -17,7 +17,7 @@ interface IssueBlockProps { action: "update" | "delete" ) => void; quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode; - displayProperties: any; + displayProperties: IIssueDisplayProperties; states: IState[] | null; labels: IIssueLabels[] | null; members: IUserLite[] | null; @@ -81,7 +81,7 @@ export const KanbanIssueBlock: React.FC = (props) => { columnId={columnId} issue={issue} handleIssues={updateIssue} - display_properties={displayProperties} + displayProperties={displayProperties} states={states} labels={labels} members={members} diff --git a/web/components/issues/issue-layouts/kanban/blocks-list.tsx b/web/components/issues/issue-layouts/kanban/blocks-list.tsx index 0e921638a..7c6e55f81 100644 --- a/web/components/issues/issue-layouts/kanban/blocks-list.tsx +++ b/web/components/issues/issue-layouts/kanban/blocks-list.tsx @@ -1,6 +1,6 @@ // components import { KanbanIssueBlock } from "components/issues"; -import { IEstimatePoint, IIssue, IIssueLabels, IState, IUserLite } from "types"; +import { IEstimatePoint, IIssue, IIssueDisplayProperties, IIssueLabels, IState, IUserLite } from "types"; interface IssueBlocksListProps { sub_group_id: string; @@ -14,7 +14,7 @@ interface IssueBlocksListProps { action: "update" | "delete" ) => void; quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode; - display_properties: any; + displayProperties: IIssueDisplayProperties; states: IState[] | null; labels: IIssueLabels[] | null; members: IUserLite[] | null; @@ -29,7 +29,7 @@ export const KanbanIssueBlocksList: React.FC = (props) => isDragDisabled, handleIssues, quickActions, - display_properties, + displayProperties, states, labels, members, @@ -47,7 +47,7 @@ export const KanbanIssueBlocksList: React.FC = (props) => issue={issue} handleIssues={handleIssues} quickActions={quickActions} - displayProperties={display_properties} + displayProperties={displayProperties} columnId={columnId} sub_group_id={sub_group_id} isDragDisabled={isDragDisabled} diff --git a/web/components/issues/issue-layouts/kanban/default.tsx b/web/components/issues/issue-layouts/kanban/default.tsx index 354cf011f..f441d3e22 100644 --- a/web/components/issues/issue-layouts/kanban/default.tsx +++ b/web/components/issues/issue-layouts/kanban/default.tsx @@ -7,7 +7,7 @@ import { useMobxStore } from "lib/mobx/store-provider"; import { KanBanGroupByHeaderRoot } from "./headers/group-by-root"; import { KanbanIssueBlocksList, BoardInlineCreateIssueForm } from "components/issues"; // types -import { IEstimatePoint, IIssue, IIssueLabels, IProject, IState, IUserLite } from "types"; +import { IEstimatePoint, IIssue, IIssueDisplayProperties, IIssueLabels, IProject, IState, IUserLite } from "types"; // constants import { ISSUE_STATE_GROUPS, ISSUE_PRIORITIES, getValueFromObject } from "constants/issue"; @@ -26,7 +26,7 @@ export interface IGroupByKanBan { action: "update" | "delete" ) => void; quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode; - display_properties: any; + displayProperties: IIssueDisplayProperties; kanBanToggle: any; handleKanBanToggle: any; enableQuickIssueCreate?: boolean; @@ -48,7 +48,7 @@ const GroupByKanBan: React.FC = observer((props) => { isDragDisabled, handleIssues, quickActions, - display_properties, + displayProperties, kanBanToggle, handleKanBanToggle, states, @@ -104,7 +104,7 @@ const GroupByKanBan: React.FC = observer((props) => { isDragDisabled={isDragDisabled} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} states={states} labels={labels} members={members} @@ -151,7 +151,7 @@ export interface IKanBan { action: "update" | "delete" ) => void; quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode; - display_properties: any; + displayProperties: IIssueDisplayProperties; kanBanToggle: any; handleKanBanToggle: any; states: IState[] | null; @@ -172,7 +172,7 @@ export const KanBan: React.FC = observer((props) => { sub_group_id = "null", handleIssues, quickActions, - display_properties, + displayProperties, kanBanToggle, handleKanBanToggle, states, @@ -200,7 +200,7 @@ export const KanBan: React.FC = observer((props) => { isDragDisabled={!issueKanBanViewStore?.canUserDragDrop} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={kanBanToggle} handleKanBanToggle={handleKanBanToggle} enableQuickIssueCreate={enableQuickIssueCreate} @@ -223,7 +223,7 @@ export const KanBan: React.FC = observer((props) => { isDragDisabled={!issueKanBanViewStore?.canUserDragDrop} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={kanBanToggle} handleKanBanToggle={handleKanBanToggle} enableQuickIssueCreate={enableQuickIssueCreate} @@ -246,7 +246,7 @@ export const KanBan: React.FC = observer((props) => { isDragDisabled={!issueKanBanViewStore?.canUserDragDrop} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={kanBanToggle} handleKanBanToggle={handleKanBanToggle} enableQuickIssueCreate={enableQuickIssueCreate} @@ -269,7 +269,7 @@ export const KanBan: React.FC = observer((props) => { isDragDisabled={!issueKanBanViewStore?.canUserDragDrop} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={kanBanToggle} handleKanBanToggle={handleKanBanToggle} enableQuickIssueCreate={enableQuickIssueCreate} @@ -292,7 +292,7 @@ export const KanBan: React.FC = observer((props) => { isDragDisabled={!issueKanBanViewStore?.canUserDragDrop} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={kanBanToggle} handleKanBanToggle={handleKanBanToggle} enableQuickIssueCreate={enableQuickIssueCreate} @@ -315,7 +315,7 @@ export const KanBan: React.FC = observer((props) => { isDragDisabled={!issueKanBanViewStore?.canUserDragDrop} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={kanBanToggle} handleKanBanToggle={handleKanBanToggle} enableQuickIssueCreate={enableQuickIssueCreate} diff --git a/web/components/issues/issue-layouts/kanban/properties.tsx b/web/components/issues/issue-layouts/kanban/properties.tsx index e321094d4..4ab4613aa 100644 --- a/web/components/issues/issue-layouts/kanban/properties.tsx +++ b/web/components/issues/issue-layouts/kanban/properties.tsx @@ -10,14 +10,22 @@ import { IssuePropertyAssignee } from "../properties/assignee"; import { IssuePropertyEstimates } from "../properties/estimates"; import { IssuePropertyDate } from "../properties/date"; import { Tooltip } from "@plane/ui"; -import { IEstimatePoint, IIssue, IIssueLabels, IState, IUserLite, TIssuePriorities } from "types"; +import { + IEstimatePoint, + IIssue, + IIssueDisplayProperties, + IIssueLabels, + IState, + IUserLite, + TIssuePriorities, +} from "types"; export interface IKanBanProperties { sub_group_id: string; columnId: string; issue: IIssue; handleIssues: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => void; - display_properties: any; + displayProperties: IIssueDisplayProperties; states: IState[] | null; labels: IIssueLabels[] | null; members: IUserLite[] | null; @@ -30,7 +38,7 @@ export const KanBanProperties: React.FC = observer((props) => columnId: group_id, issue, handleIssues, - display_properties, + displayProperties, states, labels, members, @@ -97,7 +105,7 @@ export const KanBanProperties: React.FC = observer((props) =>
{/* basic properties */} {/* state */} - {display_properties && display_properties?.state && ( + {displayProperties && displayProperties?.state && ( = observer((props) => )} {/* priority */} - {display_properties && display_properties?.priority && ( + {displayProperties && displayProperties?.priority && ( = observer((props) => )} {/* label */} - {display_properties && display_properties?.labels && ( + {displayProperties && displayProperties?.labels && ( = observer((props) => )} {/* assignee */} - {display_properties && display_properties?.assignee && ( + {displayProperties && displayProperties?.assignee && ( = observer((props) => )} {/* start date */} - {display_properties && display_properties?.start_date && ( + {displayProperties && displayProperties?.start_date && ( handleStartDate(date)} @@ -150,7 +158,7 @@ export const KanBanProperties: React.FC = observer((props) => )} {/* target/due date */} - {display_properties && display_properties?.due_date && ( + {displayProperties && displayProperties?.due_date && ( handleTargetDate(date)} @@ -160,7 +168,7 @@ export const KanBanProperties: React.FC = observer((props) => )} {/* estimates */} - {display_properties && display_properties?.estimate && ( + {displayProperties && displayProperties?.estimate && ( = observer((props) => {/* extra render properties */} {/* sub-issues */} - {display_properties && display_properties?.sub_issue_count && ( + {displayProperties && displayProperties?.sub_issue_count && (
@@ -182,7 +190,7 @@ export const KanBanProperties: React.FC = observer((props) => )} {/* attachments */} - {display_properties && display_properties?.attachment_count && ( + {displayProperties && displayProperties?.attachment_count && (
@@ -192,7 +200,7 @@ export const KanBanProperties: React.FC = observer((props) => )} {/* link */} - {display_properties && display_properties?.link && ( + {displayProperties && displayProperties?.link && (
diff --git a/web/components/issues/issue-layouts/kanban/roots/cycle-root.tsx b/web/components/issues/issue-layouts/kanban/roots/cycle-root.tsx index 188e27a68..ed54b0213 100644 --- a/web/components/issues/issue-layouts/kanban/roots/cycle-root.tsx +++ b/web/components/issues/issue-layouts/kanban/roots/cycle-root.tsx @@ -35,7 +35,7 @@ export const CycleKanBanLayout: React.FC = observer(() => { const group_by: string | null = issueFilterStore?.userDisplayFilters?.group_by || null; - const display_properties = issueFilterStore?.userDisplayProperties || null; + const displayProperties = issueFilterStore?.userDisplayProperties || null; const currentKanBanView: "swimlanes" | "default" = issueFilterStore?.userDisplayFilters?.sub_group_by ? "swimlanes" @@ -113,7 +113,7 @@ export const CycleKanBanLayout: React.FC = observer(() => { handleRemoveFromCycle={async () => handleIssues(sub_group_by, group_by, issue, "remove")} /> )} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={cycleIssueKanBanViewStore?.kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} @@ -138,7 +138,7 @@ export const CycleKanBanLayout: React.FC = observer(() => { handleRemoveFromCycle={async () => handleIssues(sub_group_by, group_by, issue, "remove")} /> )} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={cycleIssueKanBanViewStore?.kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} diff --git a/web/components/issues/issue-layouts/kanban/roots/module-root.tsx b/web/components/issues/issue-layouts/kanban/roots/module-root.tsx index 754693d11..cebfc8f81 100644 --- a/web/components/issues/issue-layouts/kanban/roots/module-root.tsx +++ b/web/components/issues/issue-layouts/kanban/roots/module-root.tsx @@ -35,7 +35,7 @@ export const ModuleKanBanLayout: React.FC = observer(() => { const group_by: string | null = issueFilterStore?.userDisplayFilters?.group_by || null; - const display_properties = issueFilterStore?.userDisplayProperties || null; + const displayProperties = issueFilterStore?.userDisplayProperties || null; const currentKanBanView: "swimlanes" | "default" = issueFilterStore?.userDisplayFilters?.sub_group_by ? "swimlanes" @@ -113,7 +113,7 @@ export const ModuleKanBanLayout: React.FC = observer(() => { handleRemoveFromModule={async () => handleIssues(sub_group_by, group_by, issue, "remove")} /> )} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={moduleIssueKanBanViewStore?.kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} @@ -138,7 +138,7 @@ export const ModuleKanBanLayout: React.FC = observer(() => { handleRemoveFromModule={async () => handleIssues(sub_group_by, group_by, issue, "remove")} /> )} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={moduleIssueKanBanViewStore?.kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} diff --git a/web/components/issues/issue-layouts/kanban/roots/profile-issues-root.tsx b/web/components/issues/issue-layouts/kanban/roots/profile-issues-root.tsx index d2346120a..eaa37bb91 100644 --- a/web/components/issues/issue-layouts/kanban/roots/profile-issues-root.tsx +++ b/web/components/issues/issue-layouts/kanban/roots/profile-issues-root.tsx @@ -34,7 +34,7 @@ export const ProfileIssuesKanBanLayout: FC = observer(() => { const group_by: string | null = profileIssueFiltersStore?.userDisplayFilters?.group_by || null; - const display_properties = profileIssueFiltersStore?.userDisplayProperties || null; + const displayProperties = profileIssueFiltersStore?.userDisplayProperties || null; const currentKanBanView: "swimlanes" | "default" = profileIssueFiltersStore?.userDisplayFilters?.sub_group_by ? "swimlanes" @@ -96,7 +96,7 @@ export const ProfileIssuesKanBanLayout: FC = observer(() => { handleUpdate={async (data) => handleIssues(sub_group_by, group_by, data, "update")} /> )} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={issueKanBanViewStore?.kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} @@ -120,7 +120,7 @@ export const ProfileIssuesKanBanLayout: FC = observer(() => { handleUpdate={async (data) => handleIssues(sub_group_by, group_by, data, "update")} /> )} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={issueKanBanViewStore?.kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} diff --git a/web/components/issues/issue-layouts/kanban/roots/project-root.tsx b/web/components/issues/issue-layouts/kanban/roots/project-root.tsx index ab087e5c8..7a003842c 100644 --- a/web/components/issues/issue-layouts/kanban/roots/project-root.tsx +++ b/web/components/issues/issue-layouts/kanban/roots/project-root.tsx @@ -35,7 +35,7 @@ export const KanBanLayout: React.FC = observer(() => { const group_by: string | null = issueFilterStore?.userDisplayFilters?.group_by || null; - const display_properties = issueFilterStore?.userDisplayProperties || null; + const displayProperties = issueFilterStore?.userDisplayProperties || null; const currentKanBanView: "swimlanes" | "default" = issueFilterStore?.userDisplayFilters?.sub_group_by ? "swimlanes" @@ -103,7 +103,7 @@ export const KanBanLayout: React.FC = observer(() => { handleUpdate={async (data) => handleIssues(sub_group_by, group_by, data, "update")} /> )} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={issueKanBanViewStore?.kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} @@ -128,7 +128,7 @@ export const KanBanLayout: React.FC = observer(() => { handleUpdate={async (data) => handleIssues(sub_group_by, group_by, data, "update")} /> )} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={issueKanBanViewStore?.kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} diff --git a/web/components/issues/issue-layouts/kanban/swimlanes.tsx b/web/components/issues/issue-layouts/kanban/swimlanes.tsx index 7a3126cb2..104f89dc3 100644 --- a/web/components/issues/issue-layouts/kanban/swimlanes.tsx +++ b/web/components/issues/issue-layouts/kanban/swimlanes.tsx @@ -7,7 +7,7 @@ import { KanBanGroupByHeaderRoot } from "./headers/group-by-root"; import { KanBanSubGroupByHeaderRoot } from "./headers/sub-group-by-root"; import { KanBan } from "./default"; // types -import { IEstimatePoint, IIssue, IIssueLabels, IProject, IState, IUserLite } from "types"; +import { IEstimatePoint, IIssue, IIssueDisplayProperties, IIssueLabels, IProject, IState, IUserLite } from "types"; // constants import { ISSUE_STATE_GROUPS, ISSUE_PRIORITIES, getValueFromObject } from "constants/issue"; @@ -73,7 +73,7 @@ interface ISubGroupSwimlane extends ISubGroupSwimlaneHeader { action: "update" | "delete" ) => void; quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode; - display_properties: any; + displayProperties: IIssueDisplayProperties; kanBanToggle: any; handleKanBanToggle: any; states: IState[] | null; @@ -93,7 +93,7 @@ const SubGroupSwimlane: React.FC = observer((props) => { listKey, handleIssues, quickActions, - display_properties, + displayProperties, kanBanToggle, handleKanBanToggle, states, @@ -143,7 +143,7 @@ const SubGroupSwimlane: React.FC = observer((props) => { sub_group_id={getValueFromObject(_list, listKey) as string} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} @@ -174,7 +174,7 @@ export interface IKanBanSwimLanes { action: "update" | "delete" ) => void; quickActions: (sub_group_by: string | null, group_by: string | null, issue: IIssue) => React.ReactNode; - display_properties: any; + displayProperties: IIssueDisplayProperties; kanBanToggle: any; handleKanBanToggle: any; states: IState[] | null; @@ -193,7 +193,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { group_by, handleIssues, quickActions, - display_properties, + displayProperties, kanBanToggle, handleKanBanToggle, states, @@ -322,7 +322,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { listKey={`id`} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} @@ -344,7 +344,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { listKey={`key`} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} @@ -366,7 +366,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { listKey={`key`} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} @@ -388,7 +388,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { listKey={`id`} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} @@ -410,7 +410,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { listKey={`member.id`} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} @@ -432,7 +432,7 @@ export const KanBanSwimLanes: React.FC = observer((props) => { listKey={`member.id`} handleIssues={handleIssues} quickActions={quickActions} - display_properties={display_properties} + displayProperties={displayProperties} kanBanToggle={kanBanToggle} handleKanBanToggle={handleKanBanToggle} states={states} diff --git a/web/components/issues/issue-layouts/roots/global-view-layout-root.tsx b/web/components/issues/issue-layouts/roots/global-view-layout-root.tsx index e7adcf0e9..77b3b6ee5 100644 --- a/web/components/issues/issue-layouts/roots/global-view-layout-root.tsx +++ b/web/components/issues/issue-layouts/roots/global-view-layout-root.tsx @@ -25,6 +25,7 @@ export const GlobalViewLayoutRoot: React.FC = observer((props) => { globalViewFilters: globalViewFiltersStore, workspaceFilter: workspaceFilterStore, workspace: workspaceStore, + issueDetail: issueDetailStore, } = useMobxStore(); const viewDetails = globalViewId ? globalViewsStore.globalViewDetails[globalViewId.toString()] : undefined; @@ -62,14 +63,17 @@ export const GlobalViewLayoutRoot: React.FC = observer((props) => { const handleUpdateIssue = useCallback( (issue: IIssue, data: Partial) => { - if (!workspaceSlug) return; + if (!workspaceSlug || !globalViewId) return; - console.log("issue", issue); - console.log("data", data); + const payload = { + ...issue, + ...data, + }; - // TODO: add update issue logic here + globalViewIssuesStore.updateIssueStructure(globalViewId.toString(), payload); + issueDetailStore.updateIssue(workspaceSlug.toString(), issue.project, issue.id, data); }, - [workspaceSlug] + [globalViewId, globalViewIssuesStore, workspaceSlug, issueDetailStore] ); const issues = type diff --git a/web/components/issues/issue-layouts/roots/project-layout-root.tsx b/web/components/issues/issue-layouts/roots/project-layout-root.tsx index 0cd5911a5..1826eb344 100644 --- a/web/components/issues/issue-layouts/roots/project-layout-root.tsx +++ b/web/components/issues/issue-layouts/roots/project-layout-root.tsx @@ -33,6 +33,8 @@ export const ProjectLayoutRoot: React.FC = observer(() => { const issueCount = issueStore.getIssuesCount; + console.log("issueCount", issueCount); + return (
diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/created-on-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/created-on-column.tsx index 54a8ffee5..b1a7c3fef 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/created-on-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/created-on-column.tsx @@ -19,7 +19,7 @@ export const SpreadsheetCreatedOnColumn: React.FC = ({ issue, expandedIss return ( <> - {renderLongDetailDateFormat(issue.created_at)} +
{renderLongDetailDateFormat(issue.created_at)}
{isExpanded && !isLoading && diff --git a/web/components/issues/issue-layouts/spreadsheet/columns/updated-on-column.tsx b/web/components/issues/issue-layouts/spreadsheet/columns/updated-on-column.tsx index b2892f2a9..225657d34 100644 --- a/web/components/issues/issue-layouts/spreadsheet/columns/updated-on-column.tsx +++ b/web/components/issues/issue-layouts/spreadsheet/columns/updated-on-column.tsx @@ -21,7 +21,7 @@ export const SpreadsheetUpdatedOnColumn: React.FC = (props) => { return ( <> - {renderLongDetailDateFormat(issue.updated_at)} +
{renderLongDetailDateFormat(issue.updated_at)}
{isExpanded && !isLoading && diff --git a/web/components/workspace/views/form.tsx b/web/components/workspace/views/form.tsx index 5524555e0..8b5112eb9 100644 --- a/web/components/workspace/views/form.tsx +++ b/web/components/workspace/views/form.tsx @@ -143,6 +143,7 @@ export const WorkspaceViewForm: React.FC = observer((props) => { }} layoutDisplayFiltersOptions={ISSUE_DISPLAY_FILTERS_BY_LAYOUT.my_issues.spreadsheet} labels={workspaceStore.workspaceLabels ?? undefined} + members={workspaceStore.workspaceMembers?.map((m) => m.member) ?? undefined} projects={workspaceSlug ? projectStore.projects[workspaceSlug.toString()] : undefined} /> diff --git a/web/store/global-view/global_view_issues.store.ts b/web/store/global-view/global_view_issues.store.ts index dc8e9717b..006c9b380 100644 --- a/web/store/global-view/global_view_issues.store.ts +++ b/web/store/global-view/global_view_issues.store.ts @@ -7,6 +7,7 @@ import { handleIssueQueryParamsByLayout } from "helpers/issue.helper"; // types import { RootStore } from "../root"; import { IIssue, IIssueFilterOptions, TStaticViewTypes } from "types"; +import { sortArrayByDate, sortArrayByPriority } from "constants/kanban-helpers"; export interface IGlobalViewIssuesStore { // states @@ -21,6 +22,7 @@ export interface IGlobalViewIssuesStore { // actions fetchViewIssues: (workspaceSlug: string, viewId: string, filters: IIssueFilterOptions) => Promise; fetchStaticIssues: (workspaceSlug: string, type: TStaticViewTypes) => Promise; + updateIssueStructure: (viewId: string, issue: IIssue) => Promise; } export class GlobalViewIssuesStore implements IGlobalViewIssuesStore { @@ -52,6 +54,7 @@ export class GlobalViewIssuesStore implements IGlobalViewIssuesStore { // actions fetchViewIssues: action, fetchStaticIssues: action, + updateIssueStructure: action, }); this.rootStore = _rootStore; @@ -174,4 +177,28 @@ export class GlobalViewIssuesStore implements IGlobalViewIssuesStore { throw error; } }; + + updateIssueStructure = async (viewId: string, issue: IIssue) => { + let issues = this.viewIssues[viewId]; + + if (!issues) return null; + + const _currentIssueId = issues?.find((_i) => _i?.id === issue.id); + issues = _currentIssueId + ? issues?.map((i: IIssue) => (i?.id === issue?.id ? { ...i, ...issue } : i)) + : [...(issues ?? []), issue]; + + const orderBy = this.rootStore?.workspaceFilter?.workspaceDisplayFilters?.order_by || ""; + if (orderBy === "-created_at") issues = sortArrayByDate(issues as any, "created_at"); + + if (orderBy === "-updated_at") issues = sortArrayByDate(issues as any, "updated_at"); + + if (orderBy === "start_date") issues = sortArrayByDate(issues as any, "updated_at"); + + if (orderBy === "priority") issues = sortArrayByPriority(issues as any, "priority"); + + runInAction(() => { + this.viewIssues = { ...this.viewIssues, [viewId]: issues }; + }); + }; }