2024-06-10 13:36:10 +05:30
|
|
|
"use client";
|
|
|
|
|
|
2024-01-18 15:49:54 +05:30
|
|
|
import { linearGradientDef } from "@nivo/core";
|
2024-06-10 13:36:10 +05:30
|
|
|
// icons
|
2024-07-18 12:56:33 +05:30
|
|
|
import { BarChart2, Briefcase, Home, Inbox, Layers } from "lucide-react";
|
2024-06-10 13:36:10 +05:30
|
|
|
// types
|
|
|
|
|
import { TIssuesListTypes, TStateGroups } from "@plane/types";
|
|
|
|
|
// ui
|
2024-07-18 12:56:33 +05:30
|
|
|
import { ContrastIcon, UserActivityIcon } from "@plane/ui";
|
2024-03-19 20:08:35 +05:30
|
|
|
import { Props } from "@/components/icons/types";
|
2024-06-10 13:36:10 +05:30
|
|
|
// assets
|
2024-06-11 14:39:52 +05:30
|
|
|
import CompletedIssuesDark from "@/public/empty-state/dashboard/dark/completed-issues.svg";
|
|
|
|
|
import OverdueIssuesDark from "@/public/empty-state/dashboard/dark/overdue-issues.svg";
|
|
|
|
|
import UpcomingIssuesDark from "@/public/empty-state/dashboard/dark/upcoming-issues.svg";
|
|
|
|
|
import CompletedIssuesLight from "@/public/empty-state/dashboard/light/completed-issues.svg";
|
|
|
|
|
import OverdueIssuesLight from "@/public/empty-state/dashboard/light/overdue-issues.svg";
|
|
|
|
|
import UpcomingIssuesLight from "@/public/empty-state/dashboard/light/upcoming-issues.svg";
|
2024-01-19 16:05:52 +05:30
|
|
|
// constants
|
|
|
|
|
import { EUserWorkspaceRoles } from "./workspace";
|
2024-01-18 15:49:54 +05:30
|
|
|
|
|
|
|
|
// gradients for issues by priority widget graph bars
|
|
|
|
|
export const PRIORITY_GRAPH_GRADIENTS = [
|
|
|
|
|
linearGradientDef(
|
|
|
|
|
"gradientUrgent",
|
|
|
|
|
[
|
|
|
|
|
{ offset: 0, color: "#A90408" },
|
|
|
|
|
{ offset: 100, color: "#DF4D51" },
|
|
|
|
|
],
|
|
|
|
|
{
|
|
|
|
|
x1: 1,
|
|
|
|
|
y1: 0,
|
|
|
|
|
x2: 0,
|
|
|
|
|
y2: 0,
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
linearGradientDef(
|
|
|
|
|
"gradientHigh",
|
|
|
|
|
[
|
|
|
|
|
{ offset: 0, color: "#FE6B00" },
|
|
|
|
|
{ offset: 100, color: "#FFAC88" },
|
|
|
|
|
],
|
|
|
|
|
{
|
|
|
|
|
x1: 1,
|
|
|
|
|
y1: 0,
|
|
|
|
|
x2: 0,
|
|
|
|
|
y2: 0,
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
linearGradientDef(
|
|
|
|
|
"gradientMedium",
|
|
|
|
|
[
|
|
|
|
|
{ offset: 0, color: "#F5AC00" },
|
|
|
|
|
{ offset: 100, color: "#FFD675" },
|
|
|
|
|
],
|
|
|
|
|
{
|
|
|
|
|
x1: 1,
|
|
|
|
|
y1: 0,
|
|
|
|
|
x2: 0,
|
|
|
|
|
y2: 0,
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
linearGradientDef(
|
|
|
|
|
"gradientLow",
|
|
|
|
|
[
|
|
|
|
|
{ offset: 0, color: "#1B46DE" },
|
|
|
|
|
{ offset: 100, color: "#4F9BF4" },
|
|
|
|
|
],
|
|
|
|
|
{
|
|
|
|
|
x1: 1,
|
|
|
|
|
y1: 0,
|
|
|
|
|
x2: 0,
|
|
|
|
|
y2: 0,
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
linearGradientDef(
|
|
|
|
|
"gradientNone",
|
|
|
|
|
[
|
|
|
|
|
{ offset: 0, color: "#A0A1A9" },
|
|
|
|
|
{ offset: 100, color: "#B9BBC6" },
|
|
|
|
|
],
|
|
|
|
|
{
|
|
|
|
|
x1: 1,
|
|
|
|
|
y1: 0,
|
|
|
|
|
x2: 0,
|
|
|
|
|
y2: 0,
|
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// colors for issues by state group widget graph arcs
|
|
|
|
|
export const STATE_GROUP_GRAPH_GRADIENTS = [
|
|
|
|
|
linearGradientDef("gradientBacklog", [
|
|
|
|
|
{ offset: 0, color: "#DEDEDE" },
|
|
|
|
|
{ offset: 100, color: "#BABABE" },
|
|
|
|
|
]),
|
|
|
|
|
linearGradientDef("gradientUnstarted", [
|
|
|
|
|
{ offset: 0, color: "#D4D4D4" },
|
|
|
|
|
{ offset: 100, color: "#878796" },
|
|
|
|
|
]),
|
|
|
|
|
linearGradientDef("gradientStarted", [
|
|
|
|
|
{ offset: 0, color: "#FFD300" },
|
|
|
|
|
{ offset: 100, color: "#FAE270" },
|
|
|
|
|
]),
|
|
|
|
|
linearGradientDef("gradientCompleted", [
|
|
|
|
|
{ offset: 0, color: "#0E8B1B" },
|
|
|
|
|
{ offset: 100, color: "#37CB46" },
|
|
|
|
|
]),
|
|
|
|
|
linearGradientDef("gradientCanceled", [
|
|
|
|
|
{ offset: 0, color: "#C90004" },
|
|
|
|
|
{ offset: 100, color: "#FF7679" },
|
|
|
|
|
]),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export const STATE_GROUP_GRAPH_COLORS: Record<TStateGroups, string> = {
|
|
|
|
|
backlog: "#CDCED6",
|
|
|
|
|
unstarted: "#80838D",
|
|
|
|
|
started: "#FFC53D",
|
|
|
|
|
completed: "#3E9B4F",
|
|
|
|
|
cancelled: "#E5484D",
|
|
|
|
|
};
|
|
|
|
|
|
2024-03-06 18:46:36 +05:30
|
|
|
export enum EDurationFilters {
|
|
|
|
|
NONE = "none",
|
|
|
|
|
TODAY = "today",
|
|
|
|
|
THIS_WEEK = "this_week",
|
|
|
|
|
THIS_MONTH = "this_month",
|
|
|
|
|
THIS_YEAR = "this_year",
|
|
|
|
|
CUSTOM = "custom",
|
|
|
|
|
}
|
|
|
|
|
|
2024-01-18 15:49:54 +05:30
|
|
|
// filter duration options
|
|
|
|
|
export const DURATION_FILTER_OPTIONS: {
|
2024-03-06 14:24:36 +05:30
|
|
|
key: EDurationFilters;
|
2024-01-18 15:49:54 +05:30
|
|
|
label: string;
|
|
|
|
|
}[] = [
|
2024-02-05 19:12:33 +05:30
|
|
|
{
|
2024-03-06 14:24:36 +05:30
|
|
|
key: EDurationFilters.NONE,
|
2024-04-30 13:38:18 -05:00
|
|
|
label: "All time",
|
2024-02-05 19:12:33 +05:30
|
|
|
},
|
2024-01-18 15:49:54 +05:30
|
|
|
{
|
2024-03-06 14:24:36 +05:30
|
|
|
key: EDurationFilters.TODAY,
|
2024-02-05 19:12:33 +05:30
|
|
|
label: "Due today",
|
2024-01-18 15:49:54 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-03-06 14:24:36 +05:30
|
|
|
key: EDurationFilters.THIS_WEEK,
|
|
|
|
|
label: "Due this week",
|
2024-01-18 15:49:54 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-03-06 14:24:36 +05:30
|
|
|
key: EDurationFilters.THIS_MONTH,
|
2024-02-05 19:12:33 +05:30
|
|
|
label: "Due this month",
|
2024-01-18 15:49:54 +05:30
|
|
|
},
|
|
|
|
|
{
|
2024-03-06 14:24:36 +05:30
|
|
|
key: EDurationFilters.THIS_YEAR,
|
2024-02-05 19:12:33 +05:30
|
|
|
label: "Due this year",
|
2024-01-18 15:49:54 +05:30
|
|
|
},
|
2024-03-06 14:24:36 +05:30
|
|
|
{
|
|
|
|
|
key: EDurationFilters.CUSTOM,
|
|
|
|
|
label: "Custom",
|
|
|
|
|
},
|
2024-01-18 15:49:54 +05:30
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// random background colors for project cards
|
|
|
|
|
export const PROJECT_BACKGROUND_COLORS = [
|
|
|
|
|
"bg-gray-500/20",
|
|
|
|
|
"bg-green-500/20",
|
|
|
|
|
"bg-red-500/20",
|
|
|
|
|
"bg-orange-500/20",
|
|
|
|
|
"bg-blue-500/20",
|
|
|
|
|
"bg-yellow-500/20",
|
|
|
|
|
"bg-pink-500/20",
|
|
|
|
|
"bg-purple-500/20",
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
// assigned and created issues widgets tabs list
|
2024-02-05 19:12:33 +05:30
|
|
|
export const FILTERED_ISSUES_TABS_LIST: {
|
2024-01-18 15:49:54 +05:30
|
|
|
key: TIssuesListTypes;
|
|
|
|
|
label: string;
|
|
|
|
|
}[] = [
|
|
|
|
|
{
|
|
|
|
|
key: "upcoming",
|
|
|
|
|
label: "Upcoming",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "overdue",
|
|
|
|
|
label: "Overdue",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "completed",
|
2024-01-24 19:41:02 +05:30
|
|
|
label: "Marked completed",
|
2024-01-18 15:49:54 +05:30
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2024-02-05 19:12:33 +05:30
|
|
|
// assigned and created issues widgets tabs list
|
|
|
|
|
export const UNFILTERED_ISSUES_TABS_LIST: {
|
|
|
|
|
key: TIssuesListTypes;
|
|
|
|
|
label: string;
|
|
|
|
|
}[] = [
|
|
|
|
|
{
|
|
|
|
|
key: "pending",
|
|
|
|
|
label: "Pending",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: "completed",
|
|
|
|
|
label: "Marked completed",
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2024-01-18 15:49:54 +05:30
|
|
|
export const ASSIGNED_ISSUES_EMPTY_STATES = {
|
2024-02-05 19:12:33 +05:30
|
|
|
pending: {
|
|
|
|
|
title: "Issues assigned to you that are pending\nwill show up here.",
|
|
|
|
|
darkImage: UpcomingIssuesDark,
|
|
|
|
|
lightImage: UpcomingIssuesLight,
|
|
|
|
|
},
|
2024-01-18 15:49:54 +05:30
|
|
|
upcoming: {
|
2024-01-24 19:41:02 +05:30
|
|
|
title: "Upcoming issues assigned to\nyou will show up here.",
|
|
|
|
|
darkImage: UpcomingIssuesDark,
|
|
|
|
|
lightImage: UpcomingIssuesLight,
|
2024-01-18 15:49:54 +05:30
|
|
|
},
|
|
|
|
|
overdue: {
|
2024-01-24 19:41:02 +05:30
|
|
|
title: "Issues assigned to you that are past\ntheir due date will show up here.",
|
|
|
|
|
darkImage: OverdueIssuesDark,
|
|
|
|
|
lightImage: OverdueIssuesLight,
|
2024-01-18 15:49:54 +05:30
|
|
|
},
|
|
|
|
|
completed: {
|
2024-01-24 19:41:02 +05:30
|
|
|
title: "Issues assigned to you that you have\nmarked Completed will show up here.",
|
|
|
|
|
darkImage: CompletedIssuesDark,
|
|
|
|
|
lightImage: CompletedIssuesLight,
|
2024-01-18 15:49:54 +05:30
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const CREATED_ISSUES_EMPTY_STATES = {
|
2024-02-05 19:12:33 +05:30
|
|
|
pending: {
|
|
|
|
|
title: "Issues created by you that are pending\nwill show up here.",
|
|
|
|
|
darkImage: UpcomingIssuesDark,
|
|
|
|
|
lightImage: UpcomingIssuesLight,
|
|
|
|
|
},
|
2024-01-18 15:49:54 +05:30
|
|
|
upcoming: {
|
2024-01-24 19:41:02 +05:30
|
|
|
title: "Upcoming issues you created\nwill show up here.",
|
|
|
|
|
darkImage: UpcomingIssuesDark,
|
|
|
|
|
lightImage: UpcomingIssuesLight,
|
2024-01-18 15:49:54 +05:30
|
|
|
},
|
|
|
|
|
overdue: {
|
2024-01-24 19:41:02 +05:30
|
|
|
title: "Issues created by you that are past their\ndue date will show up here.",
|
|
|
|
|
darkImage: OverdueIssuesDark,
|
|
|
|
|
lightImage: OverdueIssuesLight,
|
2024-01-18 15:49:54 +05:30
|
|
|
},
|
|
|
|
|
completed: {
|
2024-01-24 19:41:02 +05:30
|
|
|
title: "Issues created by you that you have\nmarked completed will show up here.",
|
|
|
|
|
darkImage: CompletedIssuesDark,
|
|
|
|
|
lightImage: CompletedIssuesLight,
|
2024-01-18 15:49:54 +05:30
|
|
|
},
|
|
|
|
|
};
|
2024-01-19 16:05:52 +05:30
|
|
|
|
2024-06-24 20:10:30 +05:30
|
|
|
export const SIDEBAR_WORKSPACE_MENU_ITEMS: {
|
2024-01-19 16:05:52 +05:30
|
|
|
key: string;
|
|
|
|
|
label: string;
|
|
|
|
|
href: string;
|
|
|
|
|
access: EUserWorkspaceRoles;
|
|
|
|
|
highlight: (pathname: string, baseUrl: string) => boolean;
|
|
|
|
|
Icon: React.FC<Props>;
|
|
|
|
|
}[] = [
|
|
|
|
|
{
|
|
|
|
|
key: "projects",
|
|
|
|
|
label: "Projects",
|
|
|
|
|
href: `/projects`,
|
|
|
|
|
access: EUserWorkspaceRoles.GUEST,
|
2024-06-18 16:59:15 +05:30
|
|
|
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/projects/`,
|
2024-01-19 16:05:52 +05:30
|
|
|
Icon: Briefcase,
|
|
|
|
|
},
|
2024-07-18 12:56:33 +05:30
|
|
|
{
|
|
|
|
|
key: "all-issues",
|
|
|
|
|
label: "Views",
|
|
|
|
|
href: `/workspace-views/all-issues`,
|
|
|
|
|
access: EUserWorkspaceRoles.GUEST,
|
|
|
|
|
highlight: (pathname: string, baseUrl: string) => pathname.includes(`${baseUrl}/workspace-views/`),
|
|
|
|
|
Icon: Layers,
|
|
|
|
|
},
|
2024-01-24 19:37:49 +05:30
|
|
|
{
|
|
|
|
|
key: "active-cycles",
|
2024-07-18 12:56:33 +05:30
|
|
|
label: "Cycles",
|
2024-01-24 19:37:49 +05:30
|
|
|
href: `/active-cycles`,
|
|
|
|
|
access: EUserWorkspaceRoles.GUEST,
|
2024-06-18 16:59:15 +05:30
|
|
|
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/active-cycles/`,
|
2024-01-24 19:37:49 +05:30
|
|
|
Icon: ContrastIcon,
|
|
|
|
|
},
|
2024-06-24 20:10:30 +05:30
|
|
|
{
|
|
|
|
|
key: "analytics",
|
|
|
|
|
label: "Analytics",
|
|
|
|
|
href: `/analytics`,
|
|
|
|
|
access: EUserWorkspaceRoles.MEMBER,
|
|
|
|
|
highlight: (pathname: string, baseUrl: string) => pathname.includes(`${baseUrl}/analytics/`),
|
|
|
|
|
Icon: BarChart2,
|
|
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
export const SIDEBAR_USER_MENU_ITEMS: {
|
|
|
|
|
key: string;
|
|
|
|
|
label: string;
|
|
|
|
|
href: string;
|
|
|
|
|
access: EUserWorkspaceRoles;
|
|
|
|
|
highlight: (pathname: string, baseUrl: string) => boolean;
|
|
|
|
|
Icon: React.FC<Props>;
|
|
|
|
|
}[] = [
|
|
|
|
|
{
|
|
|
|
|
key: "home",
|
|
|
|
|
label: "Home",
|
|
|
|
|
href: ``,
|
|
|
|
|
access: EUserWorkspaceRoles.GUEST,
|
|
|
|
|
highlight: (pathname: string, baseUrl: string) => pathname === `${baseUrl}/`,
|
|
|
|
|
Icon: Home,
|
|
|
|
|
},
|
2024-07-18 12:56:33 +05:30
|
|
|
{
|
|
|
|
|
key: "my-work",
|
|
|
|
|
label: "My Work",
|
|
|
|
|
href: "/profile",
|
|
|
|
|
access: EUserWorkspaceRoles.GUEST,
|
|
|
|
|
highlight: (pathname: string, baseUrl: string) => pathname.includes(`${baseUrl}/profile/`),
|
|
|
|
|
Icon: UserActivityIcon,
|
|
|
|
|
},
|
2024-06-28 19:00:48 +05:30
|
|
|
{
|
|
|
|
|
key: "notifications",
|
2024-07-18 12:56:33 +05:30
|
|
|
label: "Inbox",
|
2024-06-28 19:00:48 +05:30
|
|
|
href: `/notifications`,
|
|
|
|
|
access: EUserWorkspaceRoles.GUEST,
|
2024-07-18 12:56:33 +05:30
|
|
|
highlight: (pathname: string, baseUrl: string) => pathname.includes(`${baseUrl}/notifications/`),
|
|
|
|
|
Icon: Inbox,
|
2024-06-28 19:00:48 +05:30
|
|
|
},
|
2024-01-19 16:05:52 +05:30
|
|
|
];
|