2023-08-11 11:48:33 +00:00
|
|
|
// interfaces
|
|
|
|
import {
|
|
|
|
// priority
|
|
|
|
TIssuePriorityKey,
|
|
|
|
// state groups
|
|
|
|
TIssueGroupKey,
|
|
|
|
IIssuePriorityFilters,
|
|
|
|
IIssueGroup,
|
2023-09-01 11:12:30 +00:00
|
|
|
} from "types/issue";
|
2023-08-11 11:48:33 +00:00
|
|
|
|
|
|
|
// all issue views
|
2023-09-01 11:12:30 +00:00
|
|
|
export const issueViews: any = {
|
|
|
|
list: {
|
2023-08-11 11:48:33 +00:00
|
|
|
title: "List View",
|
|
|
|
icon: "format_list_bulleted",
|
|
|
|
className: "",
|
|
|
|
},
|
2023-09-01 11:12:30 +00:00
|
|
|
kanban: {
|
2023-08-11 11:48:33 +00:00
|
|
|
title: "Board View",
|
|
|
|
icon: "grid_view",
|
|
|
|
className: "",
|
|
|
|
},
|
2023-09-01 11:12:30 +00:00
|
|
|
};
|
2023-08-11 11:48:33 +00:00
|
|
|
|
|
|
|
// issue priority filters
|
|
|
|
export const issuePriorityFilters: IIssuePriorityFilters[] = [
|
|
|
|
{
|
|
|
|
key: "urgent",
|
|
|
|
title: "Urgent",
|
2023-09-01 11:12:30 +00:00
|
|
|
className: "bg-red-500 border-red-500 text-white",
|
2023-08-11 11:48:33 +00:00
|
|
|
icon: "error",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "high",
|
|
|
|
title: "High",
|
2023-09-01 11:12:30 +00:00
|
|
|
className: "text-orange-500 border-custom-border-300",
|
2023-08-11 11:48:33 +00:00
|
|
|
icon: "signal_cellular_alt",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "medium",
|
|
|
|
title: "Medium",
|
2023-09-01 11:12:30 +00:00
|
|
|
className: "text-yellow-500 border-custom-border-300",
|
2023-08-11 11:48:33 +00:00
|
|
|
icon: "signal_cellular_alt_2_bar",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "low",
|
|
|
|
title: "Low",
|
2023-09-01 11:12:30 +00:00
|
|
|
className: "text-green-500 border-custom-border-300",
|
2023-08-11 11:48:33 +00:00
|
|
|
icon: "signal_cellular_alt_1_bar",
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "none",
|
|
|
|
title: "None",
|
2023-09-01 11:12:30 +00:00
|
|
|
className: "text-gray-500 border-custom-border-300",
|
2023-08-11 11:48:33 +00:00
|
|
|
icon: "block",
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
export const issuePriorityFilter = (priorityKey: TIssuePriorityKey): IIssuePriorityFilters | null => {
|
|
|
|
const currentIssuePriority: IIssuePriorityFilters | undefined | null =
|
|
|
|
issuePriorityFilters && issuePriorityFilters.length > 0
|
|
|
|
? issuePriorityFilters.find((_priority) => _priority.key === priorityKey)
|
|
|
|
: null;
|
|
|
|
|
|
|
|
if (currentIssuePriority === undefined || currentIssuePriority === null) return null;
|
|
|
|
return { ...currentIssuePriority };
|
|
|
|
};
|
|
|
|
|
|
|
|
// issue group filters
|
|
|
|
export const issueGroupColors: {
|
|
|
|
[key: string]: string;
|
|
|
|
} = {
|
|
|
|
backlog: "#d9d9d9",
|
|
|
|
unstarted: "#3f76ff",
|
|
|
|
started: "#f59e0b",
|
|
|
|
completed: "#16a34a",
|
|
|
|
cancelled: "#dc2626",
|
|
|
|
};
|
|
|
|
|
|
|
|
export const issueGroups: IIssueGroup[] = [
|
|
|
|
{
|
|
|
|
key: "backlog",
|
|
|
|
title: "Backlog",
|
|
|
|
color: "#d9d9d9",
|
2023-09-01 11:12:30 +00:00
|
|
|
className: `text-[#d9d9d9] bg-[#d9d9d9]/10`,
|
2023-08-11 11:48:33 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "unstarted",
|
|
|
|
title: "Unstarted",
|
|
|
|
color: "#3f76ff",
|
2023-09-01 11:12:30 +00:00
|
|
|
className: `text-[#3f76ff] bg-[#3f76ff]/10`,
|
2023-08-11 11:48:33 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "started",
|
|
|
|
title: "Started",
|
|
|
|
color: "#f59e0b",
|
2023-09-01 11:12:30 +00:00
|
|
|
className: `text-[#f59e0b] bg-[#f59e0b]/10`,
|
2023-08-11 11:48:33 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "completed",
|
|
|
|
title: "Completed",
|
|
|
|
color: "#16a34a",
|
2023-09-01 11:12:30 +00:00
|
|
|
className: `text-[#16a34a] bg-[#16a34a]/10`,
|
2023-08-11 11:48:33 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
key: "cancelled",
|
|
|
|
title: "Cancelled",
|
|
|
|
color: "#dc2626",
|
2023-09-01 11:12:30 +00:00
|
|
|
className: `text-[#dc2626] bg-[#dc2626]/10`,
|
2023-08-11 11:48:33 +00:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
export const issueGroupFilter = (issueKey: TIssueGroupKey): IIssueGroup | null => {
|
|
|
|
const currentIssueStateGroup: IIssueGroup | undefined | null =
|
|
|
|
issueGroups && issueGroups.length > 0 ? issueGroups.find((group) => group.key === issueKey) : null;
|
|
|
|
|
|
|
|
if (currentIssueStateGroup === undefined || currentIssueStateGroup === null) return null;
|
|
|
|
return { ...currentIssueStateGroup };
|
|
|
|
};
|