diff --git a/apps/app/components/core/board-view/board-header.tsx b/apps/app/components/core/board-view/board-header.tsx index 3a7753366..9fe51b793 100644 --- a/apps/app/components/core/board-view/board-header.tsx +++ b/apps/app/components/core/board-view/board-header.tsx @@ -12,80 +12,97 @@ import { // helpers import { addSpaceIfCamelCase } from "helpers/string.helper"; // types -import { IIssue } from "types"; +import { IIssue, IProjectMember, NestedKeyOf } from "types"; type Props = { - isCollapsed: boolean; - setIsCollapsed: React.Dispatch>; groupedByIssues: { [key: string]: IIssue[]; }; + selectedGroup: NestedKeyOf | null; groupTitle: string; - createdBy: string | null; bgColor?: string; addIssueToState: () => void; + members: IProjectMember[] | undefined; + isCollapsed: boolean; + setIsCollapsed: React.Dispatch>; }; export const BoardHeader: React.FC = ({ - isCollapsed, - setIsCollapsed, groupedByIssues, + selectedGroup, groupTitle, - createdBy, bgColor, addIssueToState, -}) => ( -
-
-
-

{ + const createdBy = + selectedGroup === "created_by" + ? members?.find((m) => m.member.id === groupTitle)?.member.first_name ?? "loading..." + : null; + + let assignees: any; + if (selectedGroup === "assignees") { + assignees = groupTitle.split(","); + assignees = assignees + .map((a: string) => members?.find((m) => m.member.id === a)?.member.first_name) + .join(", "); + } + + return ( +
+
+
- {groupTitle === null || groupTitle === "null" - ? "None" - : createdBy - ? createdBy - : addSpaceIfCamelCase(groupTitle)} -

- {groupedByIssues[groupTitle].length} +

+ {selectedGroup === "created_by" + ? createdBy + : selectedGroup === "assignees" + ? assignees + : addSpaceIfCamelCase(groupTitle)} +

+ {groupedByIssues[groupTitle].length} +
+
+ +
+ +
- -
- - -
- -); + ); +}; diff --git a/apps/app/components/core/board-view/single-board.tsx b/apps/app/components/core/board-view/single-board.tsx index e7cb49798..e0e790da5 100644 --- a/apps/app/components/core/board-view/single-board.tsx +++ b/apps/app/components/core/board-view/single-board.tsx @@ -55,11 +55,6 @@ export const SingleBoard: React.FC = ({ const [properties] = useIssuesProperties(workspaceSlug as string, projectId as string); - const createdBy = - selectedGroup === "created_by" - ? members?.find((m) => m.member.id === groupTitle)?.member.first_name ?? "loading..." - : null; - if (selectedGroup === "priority") groupTitle === "high" ? (bgColor = "#dc2626") @@ -77,11 +72,12 @@ export const SingleBoard: React.FC = ({ {(provided, snapshot) => ( @@ -97,7 +93,9 @@ export const SingleBoard: React.FC = ({ key={issue.id} draggableId={issue.id} index={index} - isDragDisabled={isNotAllowed || selectedGroup === "created_by"} + isDragDisabled={ + isNotAllowed || selectedGroup === "created_by" || selectedGroup === "assignees" + } > {(provided, snapshot) => ( = ({ const createdBy = selectedGroup === "created_by" - ? members?.find((m) => m.member.id === groupTitle)?.member.first_name ?? "loading..." + ? members?.find((m) => m.member.id === groupTitle)?.member.first_name ?? "Loading..." : null; + let assignees: any; + if (selectedGroup === "assignees") { + assignees = groupTitle.split(","); + assignees = assignees + .map((a: string) => members?.find((m) => m.member.id === a)?.member.first_name) + .join(", "); + } + return ( {({ open }) => ( @@ -67,10 +75,10 @@ export const SingleList: React.FC = ({ {selectedGroup !== null ? (

- {groupTitle === null || groupTitle === "null" - ? "None" - : createdBy + {selectedGroup === "created_by" ? createdBy + : selectedGroup === "assignees" + ? assignees : addSpaceIfCamelCase(groupTitle)}

) : ( diff --git a/apps/app/components/issues/sidebar-select/cycle.tsx b/apps/app/components/issues/sidebar-select/cycle.tsx index 353bc5121..b1243fe98 100644 --- a/apps/app/components/issues/sidebar-select/cycle.tsx +++ b/apps/app/components/issues/sidebar-select/cycle.tsx @@ -82,14 +82,14 @@ export const SidebarCycleSelect: React.FC = ({ {cycles ? ( cycles.length > 0 ? ( <> - - None - {cycles.map((option) => ( {option.name} ))} + + None + ) : (
No cycles found
diff --git a/apps/app/components/issues/sidebar-select/module.tsx b/apps/app/components/issues/sidebar-select/module.tsx index e57688887..44bef4d62 100644 --- a/apps/app/components/issues/sidebar-select/module.tsx +++ b/apps/app/components/issues/sidebar-select/module.tsx @@ -81,14 +81,14 @@ export const SidebarModuleSelect: React.FC = ({ {modules ? ( modules.length > 0 ? ( <> - - None - {modules.map((option) => ( {option.name} ))} + + None + ) : (
No modules found
diff --git a/apps/app/components/issues/sidebar.tsx b/apps/app/components/issues/sidebar.tsx index c321f0a31..3ab331244 100644 --- a/apps/app/components/issues/sidebar.tsx +++ b/apps/app/components/issues/sidebar.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useState } from "react"; +import React, { useCallback, useEffect, useState } from "react"; import { useRouter } from "next/router"; @@ -144,6 +144,12 @@ export const IssueDetailsSidebar: React.FC = ({ [workspaceSlug, projectId, issueId, issueDetail] ); + useEffect(() => { + if (!createLabelForm) return; + + reset(); + }, [createLabelForm, reset]); + const isNotAllowed = userAuth.isGuest || userAuth.isViewer; return ( @@ -431,24 +437,25 @@ export const IssueDetailsSidebar: React.FC = ({ )} /> - + {!isNotAllowed && ( + + )} diff --git a/apps/app/components/modules/single-module-card.tsx b/apps/app/components/modules/single-module-card.tsx index 6bd59d14f..ed0d027b5 100644 --- a/apps/app/components/modules/single-module-card.tsx +++ b/apps/app/components/modules/single-module-card.tsx @@ -6,9 +6,10 @@ import { useRouter } from "next/router"; // components import { DeleteModuleModal } from "components/modules"; +// ui +import { AssigneesList, Avatar } from "components/ui"; // icons import { CalendarDaysIcon, TrashIcon } from "@heroicons/react/24/outline"; -import User from "public/user.png"; // helpers import { renderShortNumericDateFormat } from "helpers/date-time.helper"; // types @@ -21,10 +22,12 @@ type Props = { }; export const SingleModuleCard: React.FC = ({ module }) => { - const router = useRouter(); - const { workspaceSlug } = router.query; const [moduleDeleteModal, setModuleDeleteModal] = useState(false); const [selectedModuleForDelete, setSelectedModuleForDelete] = useState(); + + const router = useRouter(); + const { workspaceSlug } = router.query; + const handleDeleteModule = () => { if (!module) return; @@ -33,16 +36,7 @@ export const SingleModuleCard: React.FC = ({ module }) => { }; return ( -
-
- -
+ <> = ({ module }) => { setIsOpen={setModuleDeleteModal} data={selectedModuleForDelete} /> - - - {module.name} -
-
-
LEAD
-
- {module.lead ? ( - module.lead_detail?.avatar && module.lead_detail.avatar !== "" ? ( -
- {module.lead_detail.first_name} -
- ) : ( -
- {module.lead_detail?.first_name && module.lead_detail.first_name !== "" - ? module.lead_detail.first_name.charAt(0) - : module.lead_detail?.email.charAt(0)} -
- ) - ) : ( - "N/A" - )} +
- - -
+ + +
+ ); }; diff --git a/apps/app/components/states/single-state.tsx b/apps/app/components/states/single-state.tsx index ef558d302..d51684275 100644 --- a/apps/app/components/states/single-state.tsx +++ b/apps/app/components/states/single-state.tsx @@ -142,13 +142,16 @@ export const SingleState: React.FC = ({ }`} >
-
-
{addSpaceIfCamelCase(state.name)}
+
+
{addSpaceIfCamelCase(state.name)}
+

{state.description}

+
{index !== 0 && ( diff --git a/apps/app/components/ui/avatar/avatar.tsx b/apps/app/components/ui/avatar.tsx similarity index 96% rename from apps/app/components/ui/avatar/avatar.tsx rename to apps/app/components/ui/avatar.tsx index cb36d07b3..9d7e83700 100644 --- a/apps/app/components/ui/avatar/avatar.tsx +++ b/apps/app/components/ui/avatar.tsx @@ -13,7 +13,7 @@ import { IUser, IUserLite } from "types"; import { WORKSPACE_MEMBERS } from "constants/fetch-keys"; type AvatarProps = { - user: Partial | Partial | undefined; + user?: Partial | Partial | IUser | IUserLite | undefined | null; index?: number; }; diff --git a/apps/app/components/ui/avatar/index.ts b/apps/app/components/ui/avatar/index.ts deleted file mode 100644 index 90fdb226b..000000000 --- a/apps/app/components/ui/avatar/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./avatar"; diff --git a/apps/app/components/ui/index.ts b/apps/app/components/ui/index.ts index 1a16e2072..8311c0237 100644 --- a/apps/app/components/ui/index.ts +++ b/apps/app/components/ui/index.ts @@ -1,4 +1,3 @@ -// components export * from "./button"; export * from "./custom-listbox"; export * from "./custom-menu"; @@ -11,6 +10,6 @@ export * from "./outline-button"; export * from "./select"; export * from "./spinner"; export * from "./text-area"; -export * from "./tooltip"; export * from "./avatar"; export * from "./datepicker"; +export * from "./tooltip"; diff --git a/apps/app/constants/issue.ts b/apps/app/constants/issue.ts index 00bee0aa8..e37a8079d 100644 --- a/apps/app/constants/issue.ts +++ b/apps/app/constants/issue.ts @@ -5,6 +5,7 @@ export const GROUP_BY_OPTIONS: Array<{ name: string; key: NestedKeyOf | { name: "State", key: "state_detail.name" }, { name: "Priority", key: "priority" }, { name: "Created By", key: "created_by" }, + { name: "Assignee", key: "assignees" }, { name: "None", key: null }, ]; diff --git a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/states.tsx b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/states.tsx index f5cd0f37e..b4f12ddfb 100644 --- a/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/states.tsx +++ b/apps/app/pages/[workspaceSlug]/projects/[projectId]/settings/states.tsx @@ -80,7 +80,7 @@ const StatesSettings: NextPage = (props) => {

States

-

Manage the state of this project.

+

Manage the states of this project.

{states && projectDetails ? (