diff --git a/web/components/issues/issue-layouts/kanban/default.tsx b/web/components/issues/issue-layouts/kanban/default.tsx index c9619fe87..67aadbef7 100644 --- a/web/components/issues/issue-layouts/kanban/default.tsx +++ b/web/components/issues/issue-layouts/kanban/default.tsx @@ -53,6 +53,7 @@ const GroupByKanBan: React.FC = observer(
; -export const AssigneesHeader: React.FC = observer( - ({ column_id, sub_group_by, group_by, header_type, issues_count, kanBanToggle, handleKanBanToggle }) => { - const { project: projectStore }: RootStore = useMobxStore(); +export const AssigneesHeader: FC = observer((props) => { + const { + column_id, + column_value, + sub_group_by, + group_by, + header_type, + issues_count, + kanBanToggle, + handleKanBanToggle, + } = props; - const assignee = (column_id && projectStore?.getProjectMemberByUserId(column_id)) ?? null; + const assignee = column_value ?? null; - return ( - <> - {assignee && - (sub_group_by && header_type === "sub_group_by" ? ( - } - title={assignee?.member?.display_name || ""} - count={issues_count} - kanBanToggle={kanBanToggle} - handleKanBanToggle={handleKanBanToggle} - /> - ) : ( - } - title={assignee?.member?.display_name || ""} - count={issues_count} - kanBanToggle={kanBanToggle} - handleKanBanToggle={handleKanBanToggle} - /> - ))} - - ); - } -); + return ( + <> + {assignee && + (sub_group_by && header_type === "sub_group_by" ? ( + } + title={assignee?.member?.display_name || ""} + count={issues_count} + kanBanToggle={kanBanToggle} + handleKanBanToggle={handleKanBanToggle} + /> + ) : ( + } + title={assignee?.member?.display_name || ""} + count={issues_count} + kanBanToggle={kanBanToggle} + handleKanBanToggle={handleKanBanToggle} + /> + ))} + + ); +}); diff --git a/web/components/issues/issue-layouts/kanban/headers/created_by.tsx b/web/components/issues/issue-layouts/kanban/headers/created_by.tsx index 678837d1b..aad256c10 100644 --- a/web/components/issues/issue-layouts/kanban/headers/created_by.tsx +++ b/web/components/issues/issue-layouts/kanban/headers/created_by.tsx @@ -1,15 +1,13 @@ -// mobx +import { FC } from "react"; import { observer } from "mobx-react-lite"; // components import { HeaderGroupByCard } from "./group-by-card"; import { HeaderSubGroupByCard } from "./sub-group-by-card"; import { Icon } from "./assignee"; -// store -import { useMobxStore } from "lib/mobx/store-provider"; -import { RootStore } from "store/root"; export interface ICreatedByHeader { column_id: string; + column_value: any; sub_group_by: string | null; group_by: string | null; header_type: "group_by" | "sub_group_by"; @@ -18,37 +16,44 @@ export interface ICreatedByHeader { handleKanBanToggle: any; } -export const CreatedByHeader: React.FC = observer( - ({ column_id, sub_group_by, group_by, header_type, issues_count, kanBanToggle, handleKanBanToggle }) => { - const { project: projectStore }: RootStore = useMobxStore(); +export const CreatedByHeader: FC = observer((props) => { + const { + column_id, + column_value, + sub_group_by, + group_by, + header_type, + issues_count, + kanBanToggle, + handleKanBanToggle, + } = props; - const createdBy = (column_id && projectStore?.getProjectMemberByUserId(column_id)) ?? null; + const createdBy = column_value ?? null; - return ( - <> - {createdBy && - (sub_group_by && header_type === "sub_group_by" ? ( - } - title={createdBy?.member?.display_name || ""} - count={issues_count} - kanBanToggle={kanBanToggle} - handleKanBanToggle={handleKanBanToggle} - /> - ) : ( - } - title={createdBy?.member?.display_name || ""} - count={issues_count} - kanBanToggle={kanBanToggle} - handleKanBanToggle={handleKanBanToggle} - /> - ))} - - ); - } -); + return ( + <> + {createdBy && + (sub_group_by && header_type === "sub_group_by" ? ( + } + title={createdBy?.member?.display_name || ""} + count={issues_count} + kanBanToggle={kanBanToggle} + handleKanBanToggle={handleKanBanToggle} + /> + ) : ( + } + title={createdBy?.member?.display_name || ""} + count={issues_count} + kanBanToggle={kanBanToggle} + handleKanBanToggle={handleKanBanToggle} + /> + ))} + + ); +}); diff --git a/web/components/issues/issue-layouts/kanban/headers/group-by-root.tsx b/web/components/issues/issue-layouts/kanban/headers/group-by-root.tsx index 25d4b6c8c..01e7ac8b5 100644 --- a/web/components/issues/issue-layouts/kanban/headers/group-by-root.tsx +++ b/web/components/issues/issue-layouts/kanban/headers/group-by-root.tsx @@ -1,4 +1,5 @@ // components +import { ProjectHeader } from "./project"; import { StateHeader } from "./state"; import { StateGroupHeader } from "./state-group"; import { AssigneesHeader } from "./assignee"; @@ -10,6 +11,7 @@ import { observer } from "mobx-react-lite"; export interface IKanBanGroupByHeaderRoot { column_id: string; + column_value: any; sub_group_by: string | null; group_by: string | null; issues_count: number; @@ -18,11 +20,25 @@ export interface IKanBanGroupByHeaderRoot { } export const KanBanGroupByHeaderRoot: React.FC = observer( - ({ column_id, sub_group_by, group_by, issues_count, kanBanToggle, handleKanBanToggle }) => ( + ({ column_id, column_value, sub_group_by, group_by, issues_count, kanBanToggle, handleKanBanToggle }) => ( <> + {group_by && group_by === "project" && ( + + )} + {group_by && group_by === "state" && ( = obser {group_by && group_by === "state_detail.group" && ( = obser {group_by && group_by === "priority" && ( = obser {group_by && group_by === "labels" && ( = obser {group_by && group_by === "assignees" && ( = obser {group_by && group_by === "created_by" && ( (
); -export const LabelHeader: React.FC = observer( - ({ column_id, sub_group_by, group_by, header_type, issues_count, kanBanToggle, handleKanBanToggle }) => { - const { project: projectStore }: RootStore = useMobxStore(); +export const LabelHeader: FC = observer((props) => { + const { + column_id, + column_value, + sub_group_by, + group_by, + header_type, + issues_count, + kanBanToggle, + handleKanBanToggle, + } = props; - const label = (column_id && projectStore?.getProjectLabelById(column_id)) ?? null; + const label = column_value ?? null; - return ( - <> - {label && - (sub_group_by && header_type === "sub_group_by" ? ( - } - title={label?.name || ""} - count={issues_count} - kanBanToggle={kanBanToggle} - handleKanBanToggle={handleKanBanToggle} - /> - ) : ( - } - title={label?.name || ""} - count={issues_count} - kanBanToggle={kanBanToggle} - handleKanBanToggle={handleKanBanToggle} - /> - ))} - - ); - } -); + return ( + <> + {label && + (sub_group_by && header_type === "sub_group_by" ? ( + } + title={label?.name || ""} + count={issues_count} + kanBanToggle={kanBanToggle} + handleKanBanToggle={handleKanBanToggle} + /> + ) : ( + } + title={label?.name || ""} + count={issues_count} + kanBanToggle={kanBanToggle} + handleKanBanToggle={handleKanBanToggle} + /> + ))} + + ); +}); diff --git a/web/components/issues/issue-layouts/kanban/headers/priority.tsx b/web/components/issues/issue-layouts/kanban/headers/priority.tsx index 1dda5f587..34f46e86b 100644 --- a/web/components/issues/issue-layouts/kanban/headers/priority.tsx +++ b/web/components/issues/issue-layouts/kanban/headers/priority.tsx @@ -1,13 +1,13 @@ +import { FC } from "react"; import { observer } from "mobx-react-lite"; import { AlertCircle, SignalHigh, SignalMedium, SignalLow, Ban } from "lucide-react"; // components import { HeaderGroupByCard } from "./group-by-card"; import { HeaderSubGroupByCard } from "./sub-group-by-card"; -// constants -import { issuePriorityByKey } from "constants/issue"; export interface IPriorityHeader { column_id: string; + column_value: any; sub_group_by: string | null; group_by: string | null; header_type: "group_by" | "sub_group_by"; @@ -42,10 +42,19 @@ const Icon = ({ priority }: any) => (
); -export const PriorityHeader: React.FC = observer((props) => { - const { column_id, sub_group_by, group_by, header_type, issues_count, kanBanToggle, handleKanBanToggle } = props; +export const PriorityHeader: FC = observer((props) => { + const { + column_id, + column_value, + sub_group_by, + group_by, + header_type, + issues_count, + kanBanToggle, + handleKanBanToggle, + } = props; - const priority = column_id && issuePriorityByKey(column_id); + const priority = column_value || null; return ( <> diff --git a/web/components/issues/issue-layouts/kanban/headers/project.tsx b/web/components/issues/issue-layouts/kanban/headers/project.tsx new file mode 100644 index 000000000..68412769c --- /dev/null +++ b/web/components/issues/issue-layouts/kanban/headers/project.tsx @@ -0,0 +1,62 @@ +import { FC } from "react"; +import { observer } from "mobx-react-lite"; +// components +import { HeaderGroupByCard } from "./group-by-card"; +import { HeaderSubGroupByCard } from "./sub-group-by-card"; +// emoji helper +import { renderEmoji } from "helpers/emoji.helper"; + +export interface IProjectHeader { + column_id: string; + column_value: any; + sub_group_by: string | null; + group_by: string | null; + header_type: "group_by" | "sub_group_by"; + issues_count: number; + kanBanToggle: any; + handleKanBanToggle: any; +} + +const Icon = ({ emoji }: any) =>
{renderEmoji(emoji)}
; + +export const ProjectHeader: FC = observer((props) => { + const { + column_id, + column_value, + sub_group_by, + group_by, + header_type, + issues_count, + kanBanToggle, + handleKanBanToggle, + } = props; + + const project = column_value ?? null; + + return ( + <> + {project && + (sub_group_by && header_type === "sub_group_by" ? ( + } + title={project?.name || ""} + count={issues_count} + kanBanToggle={kanBanToggle} + handleKanBanToggle={handleKanBanToggle} + /> + ) : ( + } + title={project?.name || ""} + count={issues_count} + kanBanToggle={kanBanToggle} + handleKanBanToggle={handleKanBanToggle} + /> + ))} + + ); +}); diff --git a/web/components/issues/issue-layouts/kanban/headers/state-group.tsx b/web/components/issues/issue-layouts/kanban/headers/state-group.tsx index 0ed233615..3733a0c71 100644 --- a/web/components/issues/issue-layouts/kanban/headers/state-group.tsx +++ b/web/components/issues/issue-layouts/kanban/headers/state-group.tsx @@ -1,14 +1,13 @@ -// mobx +import { FC } from "react"; import { observer } from "mobx-react-lite"; // components import { HeaderGroupByCard } from "./group-by-card"; import { HeaderSubGroupByCard } from "./sub-group-by-card"; import { StateGroupIcon } from "@plane/ui"; -// constants -import { issueStateGroupByKey } from "constants/issue"; export interface IStateGroupHeader { column_id: string; + column_value: any; sub_group_by: string | null; group_by: string | null; header_type: "group_by" | "sub_group_by"; @@ -23,37 +22,44 @@ export const Icon = ({ stateGroup, color }: { stateGroup: any; color?: any }) =>
); -export const StateGroupHeader: React.FC = observer( - ({ column_id, sub_group_by, group_by, header_type, issues_count, kanBanToggle, handleKanBanToggle }) => { - const stateGroup = column_id && issueStateGroupByKey(column_id); +export const StateGroupHeader: FC = observer((props) => { + const { + column_id, + column_value, + sub_group_by, + group_by, + header_type, + issues_count, + kanBanToggle, + handleKanBanToggle, + } = props; - console.log("stateGroup", stateGroup); + const stateGroup = column_value || null; - return ( - <> - {stateGroup && - (sub_group_by && header_type === "sub_group_by" ? ( - } - title={stateGroup?.key || ""} - count={issues_count} - kanBanToggle={kanBanToggle} - handleKanBanToggle={handleKanBanToggle} - /> - ) : ( - } - title={stateGroup?.key || ""} - count={issues_count} - kanBanToggle={kanBanToggle} - handleKanBanToggle={handleKanBanToggle} - /> - ))} - - ); - } -); + return ( + <> + {stateGroup && + (sub_group_by && header_type === "sub_group_by" ? ( + } + title={stateGroup?.key || ""} + count={issues_count} + kanBanToggle={kanBanToggle} + handleKanBanToggle={handleKanBanToggle} + /> + ) : ( + } + title={stateGroup?.key || ""} + count={issues_count} + kanBanToggle={kanBanToggle} + handleKanBanToggle={handleKanBanToggle} + /> + ))} + + ); +}); diff --git a/web/components/issues/issue-layouts/kanban/headers/state.tsx b/web/components/issues/issue-layouts/kanban/headers/state.tsx index f95ad3592..913049c01 100644 --- a/web/components/issues/issue-layouts/kanban/headers/state.tsx +++ b/web/components/issues/issue-layouts/kanban/headers/state.tsx @@ -1,15 +1,13 @@ -// mobx +import { FC } from "react"; import { observer } from "mobx-react-lite"; // components import { HeaderGroupByCard } from "./group-by-card"; import { HeaderSubGroupByCard } from "./sub-group-by-card"; import { Icon } from "./state-group"; -// store -import { useMobxStore } from "lib/mobx/store-provider"; -import { RootStore } from "store/root"; export interface IStateHeader { column_id: string; + column_value: any; sub_group_by: string | null; group_by: string | null; header_type: "group_by" | "sub_group_by"; @@ -18,37 +16,44 @@ export interface IStateHeader { handleKanBanToggle: any; } -export const StateHeader: React.FC = observer( - ({ column_id, sub_group_by, group_by, header_type, issues_count, kanBanToggle, handleKanBanToggle }) => { - const { project: projectStore }: RootStore = useMobxStore(); +export const StateHeader: FC = observer((props) => { + const { + column_id, + column_value, + sub_group_by, + group_by, + header_type, + issues_count, + kanBanToggle, + handleKanBanToggle, + } = props; - const state = (column_id && projectStore?.getProjectStateById(column_id)) ?? null; + const state = column_value ?? null; - return ( - <> - {state && - (sub_group_by && header_type === "sub_group_by" ? ( - } - title={state?.name || ""} - count={issues_count} - kanBanToggle={kanBanToggle} - handleKanBanToggle={handleKanBanToggle} - /> - ) : ( - } - title={state?.name || ""} - count={issues_count} - kanBanToggle={kanBanToggle} - handleKanBanToggle={handleKanBanToggle} - /> - ))} - - ); - } -); + return ( + <> + {state && + (sub_group_by && header_type === "sub_group_by" ? ( + } + title={state?.name || ""} + count={issues_count} + kanBanToggle={kanBanToggle} + handleKanBanToggle={handleKanBanToggle} + /> + ) : ( + } + title={state?.name || ""} + count={issues_count} + kanBanToggle={kanBanToggle} + handleKanBanToggle={handleKanBanToggle} + /> + ))} + + ); +}); diff --git a/web/components/issues/issue-layouts/kanban/headers/sub-group-by-root.tsx b/web/components/issues/issue-layouts/kanban/headers/sub-group-by-root.tsx index 1ae724a27..3546e73d5 100644 --- a/web/components/issues/issue-layouts/kanban/headers/sub-group-by-root.tsx +++ b/web/components/issues/issue-layouts/kanban/headers/sub-group-by-root.tsx @@ -10,6 +10,7 @@ import { CreatedByHeader } from "./created_by"; export interface IKanBanSubGroupByHeaderRoot { column_id: string; + column_value: any; sub_group_by: string | null; group_by: string | null; issues_count: number; @@ -17,12 +18,15 @@ export interface IKanBanSubGroupByHeaderRoot { handleKanBanToggle: any; } -export const KanBanSubGroupByHeaderRoot: React.FC = observer( - ({ column_id, sub_group_by, group_by, issues_count, kanBanToggle, handleKanBanToggle }) => ( +export const KanBanSubGroupByHeaderRoot: React.FC = observer((props) => { + const { column_id, column_value, sub_group_by, group_by, issues_count, kanBanToggle, handleKanBanToggle } = props; + + return ( <> {sub_group_by && sub_group_by === "state" && ( = {sub_group_by && sub_group_by === "state_detail.group" && ( = {sub_group_by && sub_group_by === "priority" && ( = {sub_group_by && sub_group_by === "labels" && ( = {sub_group_by && sub_group_by === "assignees" && ( = {sub_group_by && sub_group_by === "created_by" && ( = /> )} - ) -); + ); +}); diff --git a/web/components/issues/issue-layouts/kanban/swimlanes.tsx b/web/components/issues/issue-layouts/kanban/swimlanes.tsx index 161b53ecb..cb7082d62 100644 --- a/web/components/issues/issue-layouts/kanban/swimlanes.tsx +++ b/web/components/issues/issue-layouts/kanban/swimlanes.tsx @@ -46,6 +46,7 @@ const SubGroupSwimlaneHeader: React.FC = ({
= observer((props) => {