plane/web/components/issue-layouts/list/group-header.tsx

32 lines
1.2 KiB
TypeScript
Raw Normal View History

2023-09-15 10:07:47 +00:00
import { FC } from "react";
// lib
import { useMobxStore } from "lib/mobx/store-provider";
import { RootStore } from "store/root";
export interface IIssueListGroupHeader {
groupId: string;
groupBy: string;
}
export const IssueListGroupHeader: FC<IIssueListGroupHeader> = (props) => {
const { groupId, groupBy } = props;
2023-09-19 07:20:27 +00:00
const { issueFilters: issueFilterStore }: RootStore = useMobxStore();
2023-09-15 10:07:47 +00:00
return (
<div>
{groupBy === "state" && <>{issueFilterStore.getProjectStateById(groupId)?.name}</>}
{groupBy === "state_detail.group" && <>{groupId}</>}
{groupBy === "priority" && <>{groupId}</>}
2023-09-19 07:20:27 +00:00
{groupBy === "project" && <>{issueFilterStore.workspaceProjects?.find((p) => (p.id = groupId))}</>}
{groupBy === "labels" && <>{issueFilterStore.projectLabels?.find((p) => p.id === groupId)?.name || " None"}</>}
2023-09-15 10:07:47 +00:00
{groupBy === "assignees" && (
2023-09-19 07:20:27 +00:00
<>{issueFilterStore.projectMembers?.find((p) => p?.member?.id === groupId)?.member?.display_name || " None"}</>
2023-09-15 10:07:47 +00:00
)}
{groupBy === "created_by" && (
2023-09-19 07:20:27 +00:00
<>{issueFilterStore.projectMembers?.find((p) => p?.member?.id === groupId)?.member?.display_name || " None"}</>
2023-09-15 10:07:47 +00:00
)}
</div>
);
};