From 9d9c1a86bf2e92778c6bb3812e4489f91a6afba7 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Mon, 4 Sep 2023 13:02:47 +0530 Subject: [PATCH] fix: state group icon (#2072) --- space/components/icons/index.ts | 6 +--- .../backlog-state-icon.tsx | 0 .../cancelled-state-icon.tsx | 0 .../completed-state-icon.tsx | 0 space/components/icons/state-group/index.ts | 6 ++++ .../started-state-icon.tsx | 0 .../icons/state-group/state-group-icon.tsx | 29 +++++++++++++++++++ .../unstarted-state-icon.tsx | 0 .../issues/board-views/kanban/header.tsx | 6 ++-- .../issues/board-views/list/block.tsx | 6 ---- .../issues/board-views/list/header.tsx | 6 ++-- .../issues/board-views/list/index.tsx | 2 -- space/components/views/project-details.tsx | 2 +- 13 files changed, 43 insertions(+), 20 deletions(-) rename space/components/icons/{issue-group => state-group}/backlog-state-icon.tsx (100%) rename space/components/icons/{issue-group => state-group}/cancelled-state-icon.tsx (100%) rename space/components/icons/{issue-group => state-group}/completed-state-icon.tsx (100%) create mode 100644 space/components/icons/state-group/index.ts rename space/components/icons/{issue-group => state-group}/started-state-icon.tsx (100%) create mode 100644 space/components/icons/state-group/state-group-icon.tsx rename space/components/icons/{issue-group => state-group}/unstarted-state-icon.tsx (100%) diff --git a/space/components/icons/index.ts b/space/components/icons/index.ts index 5f23e0f3a..28162f591 100644 --- a/space/components/icons/index.ts +++ b/space/components/icons/index.ts @@ -1,5 +1 @@ -export * from "./issue-group/backlog-state-icon"; -export * from "./issue-group/unstarted-state-icon"; -export * from "./issue-group/started-state-icon"; -export * from "./issue-group/completed-state-icon"; -export * from "./issue-group/cancelled-state-icon"; +export * from "./state-group"; diff --git a/space/components/icons/issue-group/backlog-state-icon.tsx b/space/components/icons/state-group/backlog-state-icon.tsx similarity index 100% rename from space/components/icons/issue-group/backlog-state-icon.tsx rename to space/components/icons/state-group/backlog-state-icon.tsx diff --git a/space/components/icons/issue-group/cancelled-state-icon.tsx b/space/components/icons/state-group/cancelled-state-icon.tsx similarity index 100% rename from space/components/icons/issue-group/cancelled-state-icon.tsx rename to space/components/icons/state-group/cancelled-state-icon.tsx diff --git a/space/components/icons/issue-group/completed-state-icon.tsx b/space/components/icons/state-group/completed-state-icon.tsx similarity index 100% rename from space/components/icons/issue-group/completed-state-icon.tsx rename to space/components/icons/state-group/completed-state-icon.tsx diff --git a/space/components/icons/state-group/index.ts b/space/components/icons/state-group/index.ts new file mode 100644 index 000000000..6ede38df6 --- /dev/null +++ b/space/components/icons/state-group/index.ts @@ -0,0 +1,6 @@ +export * from "./backlog-state-icon"; +export * from "./cancelled-state-icon"; +export * from "./completed-state-icon"; +export * from "./started-state-icon"; +export * from "./state-group-icon"; +export * from "./unstarted-state-icon"; diff --git a/space/components/icons/issue-group/started-state-icon.tsx b/space/components/icons/state-group/started-state-icon.tsx similarity index 100% rename from space/components/icons/issue-group/started-state-icon.tsx rename to space/components/icons/state-group/started-state-icon.tsx diff --git a/space/components/icons/state-group/state-group-icon.tsx b/space/components/icons/state-group/state-group-icon.tsx new file mode 100644 index 000000000..1af523400 --- /dev/null +++ b/space/components/icons/state-group/state-group-icon.tsx @@ -0,0 +1,29 @@ +// icons +import { + BacklogStateIcon, + CancelledStateIcon, + CompletedStateIcon, + StartedStateIcon, + UnstartedStateIcon, +} from "components/icons"; +import { TIssueGroupKey } from "types/issue"; + +type Props = { + stateGroup: TIssueGroupKey; + color: string; + className?: string; + height?: string; + width?: string; +}; + +export const StateGroupIcon: React.FC = ({ stateGroup, className, color, height = "12px", width = "12px" }) => { + if (stateGroup === "backlog") + return ; + else if (stateGroup === "cancelled") + return ; + else if (stateGroup === "completed") + return ; + else if (stateGroup === "started") + return ; + else return ; +}; diff --git a/space/components/icons/issue-group/unstarted-state-icon.tsx b/space/components/icons/state-group/unstarted-state-icon.tsx similarity index 100% rename from space/components/icons/issue-group/unstarted-state-icon.tsx rename to space/components/icons/state-group/unstarted-state-icon.tsx diff --git a/space/components/issues/board-views/kanban/header.tsx b/space/components/issues/board-views/kanban/header.tsx index 69c252593..5645e2b3b 100644 --- a/space/components/issues/board-views/kanban/header.tsx +++ b/space/components/issues/board-views/kanban/header.tsx @@ -1,11 +1,11 @@ -"use client"; - // mobx react lite import { observer } from "mobx-react-lite"; // interfaces import { IIssueState } from "types/issue"; // constants import { issueGroupFilter } from "constants/data"; +// icons +import { StateGroupIcon } from "components/icons"; // mobx hook import { useMobxStore } from "lib/mobx/store-provider"; import { RootStore } from "store/root"; @@ -20,7 +20,7 @@ export const IssueListHeader = observer(({ state }: { state: IIssueState }) => { return (
- +
{state?.name}
diff --git a/space/components/issues/board-views/list/block.tsx b/space/components/issues/board-views/list/block.tsx index 2d1cdf9ba..bdf39b84f 100644 --- a/space/components/issues/board-views/list/block.tsx +++ b/space/components/issues/board-views/list/block.tsx @@ -6,15 +6,12 @@ import { IssueBlockPriority } from "components/issues/board-views/block-priority import { IssueBlockState } from "components/issues/board-views/block-state"; import { IssueBlockLabels } from "components/issues/board-views/block-labels"; import { IssueBlockDueDate } from "components/issues/board-views/block-due-date"; -import { IssueBlockUpVotes } from "components/issues/board-views/block-upvotes"; -import { IssueBlockDownVotes } from "components/issues/board-views/block-downvotes"; // mobx hook import { useMobxStore } from "lib/mobx/store-provider"; // interfaces import { IIssue } from "types/issue"; // store import { RootStore } from "store/root"; -import { IssueVotes } from "components/issues/peek-overview"; export const IssueListBlock: FC<{ issue: IIssue }> = observer((props) => { const { issue } = props; @@ -40,9 +37,6 @@ export const IssueListBlock: FC<{ issue: IIssue }> = observer((props) => { // router.push(`/${workspace_slug?.toString()}/${project_slug}?board=${board?.toString()}&peekId=${issue.id}`); }; - const totalUpVotes = issue.votes.filter((v) => v.vote === 1); - const totalDownVotes = issue.votes.filter((v) => v.vote === -1); - return (
diff --git a/space/components/issues/board-views/list/header.tsx b/space/components/issues/board-views/list/header.tsx index 546c20bf6..83312e7b9 100644 --- a/space/components/issues/board-views/list/header.tsx +++ b/space/components/issues/board-views/list/header.tsx @@ -1,9 +1,9 @@ -"use client"; - // mobx react lite import { observer } from "mobx-react-lite"; // interfaces import { IIssueState } from "types/issue"; +// icons +import { StateGroupIcon } from "components/icons"; // constants import { issueGroupFilter } from "constants/data"; // mobx hook @@ -20,7 +20,7 @@ export const IssueListHeader = observer(({ state }: { state: IIssueState }) => { return (
- +
{state?.name}
{store.issue.getCountOfIssuesByState(state.id)}
diff --git a/space/components/issues/board-views/list/index.tsx b/space/components/issues/board-views/list/index.tsx index 4d4701840..1c6900dd9 100644 --- a/space/components/issues/board-views/list/index.tsx +++ b/space/components/issues/board-views/list/index.tsx @@ -1,4 +1,3 @@ -import { useEffect } from "react"; import { observer } from "mobx-react-lite"; // components import { IssueListHeader } from "components/issues/board-views/list/header"; @@ -9,7 +8,6 @@ import { IIssueState, IIssue } from "types/issue"; import { useMobxStore } from "lib/mobx/store-provider"; // store import { RootStore } from "store/root"; -import { useRouter } from "next/router"; export const IssueListView = observer(() => { const { issue: issueStore }: RootStore = useMobxStore(); diff --git a/space/components/views/project-details.tsx b/space/components/views/project-details.tsx index bbf043130..c0756335f 100644 --- a/space/components/views/project-details.tsx +++ b/space/components/views/project-details.tsx @@ -67,7 +67,7 @@ export const ProjectDetailsView = observer(() => {
)} {projectStore?.activeBoard === "kanban" && ( -
+
)}