Skip to content

Commit

Permalink
chore: group by assignees option for project issues (#1957)
Browse files Browse the repository at this point in the history
* dev: group by assignees option for project issues

* fix: no assignee title

---------

Co-authored-by: Aaryan Khandelwal <aaryan610@Aaryans-MacBook-Pro.local>
  • Loading branch information
aaryan610 and Aaryan Khandelwal authored Aug 24, 2023
1 parent d18ac83 commit 38934e8
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 10 deletions.
13 changes: 8 additions & 5 deletions apps/app/components/core/views/board-view/board-header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import useProjects from "hooks/use-projects";
// component
import { Avatar, Icon } from "components/ui";
// icons
import { ArrowsPointingInIcon, ArrowsPointingOutIcon, PlusIcon } from "@heroicons/react/24/outline";
import { PlusIcon } from "@heroicons/react/24/outline";
import { getPriorityIcon, getStateGroupIcon } from "components/icons";
// helpers
import { addSpaceIfCamelCase } from "helpers/string.helper";
Expand Down Expand Up @@ -56,10 +56,10 @@ export const BoardHeader: React.FC<Props> = ({
);

const { data: members } = useSWR(
workspaceSlug && projectId && selectedGroup === "created_by"
workspaceSlug && projectId && (selectedGroup === "created_by" || selectedGroup === "assignees")
? PROJECT_MEMBERS(projectId.toString())
: null,
workspaceSlug && projectId && selectedGroup === "created_by"
workspaceSlug && projectId && (selectedGroup === "created_by" || selectedGroup === "assignees")
? () => projectService.projectMembers(workspaceSlug.toString(), projectId.toString())
: null
);
Expand All @@ -79,9 +79,11 @@ export const BoardHeader: React.FC<Props> = ({
case "project":
title = projects?.find((p) => p.id === groupTitle)?.name ?? "None";
break;
case "assignees":
case "created_by":
const member = members?.find((member) => member.member.id === groupTitle)?.member;
title = member?.display_name ?? "";
title = member ? member.display_name : "None";

break;
}

Expand Down Expand Up @@ -122,9 +124,10 @@ export const BoardHeader: React.FC<Props> = ({
/>
);
break;
case "assignees":
case "created_by":
const member = members?.find((member) => member.member.id === groupTitle)?.member;
icon = <Avatar user={member} height="24px" width="24px" fontSize="12px" />;
icon = member ? <Avatar user={member} height="24px" width="24px" fontSize="12px" /> : <></>;

break;
}
Expand Down
3 changes: 2 additions & 1 deletion apps/app/components/core/views/issues-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,8 @@ export const IssuesView: React.FC<Props> = ({
dragDisabled={
selectedGroup === "created_by" ||
selectedGroup === "labels" ||
selectedGroup === "state_detail.group"
selectedGroup === "state_detail.group" ||
selectedGroup === "assignees"
}
emptyState={{
title: cycleId
Expand Down
6 changes: 4 additions & 2 deletions apps/app/components/core/views/list-view/single-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ export const SingleList: React.FC<Props> = ({
case "project":
title = projects?.find((p) => p.id === groupTitle)?.name ?? "None";
break;
case "assignees":
case "created_by":
const member = members?.find((member) => member.member.id === groupTitle)?.member;
title = member?.display_name ?? "";
title = member ? member.display_name : "None";
break;
}

Expand Down Expand Up @@ -137,9 +138,10 @@ export const SingleList: React.FC<Props> = ({
/>
);
break;
case "assignees":
case "created_by":
const member = members?.find((member) => member.member.id === groupTitle)?.member;
icon = <Avatar user={member} height="24px" width="24px" fontSize="12px" />;
icon = member ? <Avatar user={member} height="24px" width="24px" fontSize="12px" /> : <></>;

break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ export const MyIssuesViewOptions: React.FC = () => {
>
{GROUP_BY_OPTIONS.map((option) => {
if (issueView === "kanban" && option.key === null) return null;
if (option.key === "state" || option.key === "created_by")
if (
option.key === "state" ||
option.key === "created_by" ||
option.key === "assignees"
)
return null;

return (
Expand Down
6 changes: 5 additions & 1 deletion apps/app/components/profile/profile-issues-view-options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ export const ProfileIssuesViewOptions: React.FC = () => {
>
{GROUP_BY_OPTIONS.map((option) => {
if (issueView === "kanban" && option.key === null) return null;
if (option.key === "state" || option.key === "created_by")
if (
option.key === "state" ||
option.key === "created_by" ||
option.key === "assignees"
)
return null;

return (
Expand Down
1 change: 1 addition & 0 deletions apps/app/constants/issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const GROUP_BY_OPTIONS: Array<{
{ name: "Priority", key: "priority" },
{ name: "Project", key: "project" },
{ name: "Labels", key: "labels" },
{ name: "Assignees", key: "assignees" },
{ name: "Created by", key: "created_by" },
{ name: "None", key: null },
];
Expand Down
1 change: 1 addition & 0 deletions apps/app/types/issues.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ export type TIssueGroupByOptions =
| "created_by"
| "state_detail.group"
| "project"
| "assignees"
| null;

export type TIssueOrderByOptions =
Expand Down

1 comment on commit 38934e8

@vercel
Copy link

@vercel vercel bot commented on 38934e8 Aug 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-dev – ./apps/app

plane-dev.vercel.app
plane-dev-plane.vercel.app
plane-dev-git-develop-plane.vercel.app

Please sign in to comment.