forked from github/plane
chore: group by assignees option for project issues (#1957)
* dev: group by assignees option for project issues * fix: no assignee title --------- Co-authored-by: Aaryan Khandelwal <aaryan610@Aaryans-MacBook-Pro.local>
This commit is contained in:
parent
d18ac83909
commit
38934e8b99
@ -12,7 +12,7 @@ import useProjects from "hooks/use-projects";
|
|||||||
// component
|
// component
|
||||||
import { Avatar, Icon } from "components/ui";
|
import { Avatar, Icon } from "components/ui";
|
||||||
// icons
|
// icons
|
||||||
import { ArrowsPointingInIcon, ArrowsPointingOutIcon, PlusIcon } from "@heroicons/react/24/outline";
|
import { PlusIcon } from "@heroicons/react/24/outline";
|
||||||
import { getPriorityIcon, getStateGroupIcon } from "components/icons";
|
import { getPriorityIcon, getStateGroupIcon } from "components/icons";
|
||||||
// helpers
|
// helpers
|
||||||
import { addSpaceIfCamelCase } from "helpers/string.helper";
|
import { addSpaceIfCamelCase } from "helpers/string.helper";
|
||||||
@ -56,10 +56,10 @@ export const BoardHeader: React.FC<Props> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
const { data: members } = useSWR(
|
const { data: members } = useSWR(
|
||||||
workspaceSlug && projectId && selectedGroup === "created_by"
|
workspaceSlug && projectId && (selectedGroup === "created_by" || selectedGroup === "assignees")
|
||||||
? PROJECT_MEMBERS(projectId.toString())
|
? PROJECT_MEMBERS(projectId.toString())
|
||||||
: null,
|
: null,
|
||||||
workspaceSlug && projectId && selectedGroup === "created_by"
|
workspaceSlug && projectId && (selectedGroup === "created_by" || selectedGroup === "assignees")
|
||||||
? () => projectService.projectMembers(workspaceSlug.toString(), projectId.toString())
|
? () => projectService.projectMembers(workspaceSlug.toString(), projectId.toString())
|
||||||
: null
|
: null
|
||||||
);
|
);
|
||||||
@ -79,9 +79,11 @@ export const BoardHeader: React.FC<Props> = ({
|
|||||||
case "project":
|
case "project":
|
||||||
title = projects?.find((p) => p.id === groupTitle)?.name ?? "None";
|
title = projects?.find((p) => p.id === groupTitle)?.name ?? "None";
|
||||||
break;
|
break;
|
||||||
|
case "assignees":
|
||||||
case "created_by":
|
case "created_by":
|
||||||
const member = members?.find((member) => member.member.id === groupTitle)?.member;
|
const member = members?.find((member) => member.member.id === groupTitle)?.member;
|
||||||
title = member?.display_name ?? "";
|
title = member ? member.display_name : "None";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,9 +124,10 @@ export const BoardHeader: React.FC<Props> = ({
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case "assignees":
|
||||||
case "created_by":
|
case "created_by":
|
||||||
const member = members?.find((member) => member.member.id === groupTitle)?.member;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -514,7 +514,8 @@ export const IssuesView: React.FC<Props> = ({
|
|||||||
dragDisabled={
|
dragDisabled={
|
||||||
selectedGroup === "created_by" ||
|
selectedGroup === "created_by" ||
|
||||||
selectedGroup === "labels" ||
|
selectedGroup === "labels" ||
|
||||||
selectedGroup === "state_detail.group"
|
selectedGroup === "state_detail.group" ||
|
||||||
|
selectedGroup === "assignees"
|
||||||
}
|
}
|
||||||
emptyState={{
|
emptyState={{
|
||||||
title: cycleId
|
title: cycleId
|
||||||
|
@ -94,9 +94,10 @@ export const SingleList: React.FC<Props> = ({
|
|||||||
case "project":
|
case "project":
|
||||||
title = projects?.find((p) => p.id === groupTitle)?.name ?? "None";
|
title = projects?.find((p) => p.id === groupTitle)?.name ?? "None";
|
||||||
break;
|
break;
|
||||||
|
case "assignees":
|
||||||
case "created_by":
|
case "created_by":
|
||||||
const member = members?.find((member) => member.member.id === groupTitle)?.member;
|
const member = members?.find((member) => member.member.id === groupTitle)?.member;
|
||||||
title = member?.display_name ?? "";
|
title = member ? member.display_name : "None";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,9 +138,10 @@ export const SingleList: React.FC<Props> = ({
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case "assignees":
|
||||||
case "created_by":
|
case "created_by":
|
||||||
const member = members?.find((member) => member.member.id === groupTitle)?.member;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,11 @@ export const MyIssuesViewOptions: React.FC = () => {
|
|||||||
>
|
>
|
||||||
{GROUP_BY_OPTIONS.map((option) => {
|
{GROUP_BY_OPTIONS.map((option) => {
|
||||||
if (issueView === "kanban" && option.key === null) return null;
|
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 null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -183,7 +183,11 @@ export const ProfileIssuesViewOptions: React.FC = () => {
|
|||||||
>
|
>
|
||||||
{GROUP_BY_OPTIONS.map((option) => {
|
{GROUP_BY_OPTIONS.map((option) => {
|
||||||
if (issueView === "kanban" && option.key === null) return null;
|
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 null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -7,6 +7,7 @@ export const GROUP_BY_OPTIONS: Array<{
|
|||||||
{ name: "Priority", key: "priority" },
|
{ name: "Priority", key: "priority" },
|
||||||
{ name: "Project", key: "project" },
|
{ name: "Project", key: "project" },
|
||||||
{ name: "Labels", key: "labels" },
|
{ name: "Labels", key: "labels" },
|
||||||
|
{ name: "Assignees", key: "assignees" },
|
||||||
{ name: "Created by", key: "created_by" },
|
{ name: "Created by", key: "created_by" },
|
||||||
{ name: "None", key: null },
|
{ name: "None", key: null },
|
||||||
];
|
];
|
||||||
|
1
apps/app/types/issues.d.ts
vendored
1
apps/app/types/issues.d.ts
vendored
@ -234,6 +234,7 @@ export type TIssueGroupByOptions =
|
|||||||
| "created_by"
|
| "created_by"
|
||||||
| "state_detail.group"
|
| "state_detail.group"
|
||||||
| "project"
|
| "project"
|
||||||
|
| "assignees"
|
||||||
| null;
|
| null;
|
||||||
|
|
||||||
export type TIssueOrderByOptions =
|
export type TIssueOrderByOptions =
|
||||||
|
Loading…
Reference in New Issue
Block a user