[WEB-2554] improvement: dashboard sidebar list items. (#5970)

This commit is contained in:
Prateek Shourya
2024-11-07 15:31:28 +05:30
committed by GitHub
parent eebc327b10
commit 7574206a41
6 changed files with 19 additions and 5 deletions

View File

@@ -2,21 +2,24 @@
// icons
import { Home, Inbox, PenSquare } from "lucide-react";
// ui
import { UserActivityIcon } from "@plane/ui";
import { Props } from "@/components/icons/types";
import { TLinkOptions } from "@/constants/dashboard";
import { EUserPermissions } from "@/plane-web/constants/user-permissions";
// plane web types
import { TSidebarUserMenuItemKeys } from "@/plane-web/types/dashboard";
export const SIDEBAR_USER_MENU_ITEMS: {
key: string;
export type TSidebarUserMenuItems = {
key: TSidebarUserMenuItemKeys;
label: string;
href: string;
access: EUserPermissions[];
highlight: (pathname: string, baseUrl: string, options?: TLinkOptions) => boolean;
Icon: React.FC<Props>;
}[] = [
};
export const SIDEBAR_USER_MENU_ITEMS: TSidebarUserMenuItems[] = [
{
key: "home",
label: "Home",

View File

@@ -0,0 +1,5 @@
// plane web types
import { TSidebarUserMenuItemKeys } from "@/plane-web/types/dashboard";
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export const isUserFeatureEnabled = (featureKey: TSidebarUserMenuItemKeys) => true;

View File

@@ -0,0 +1 @@
export type TSidebarUserMenuItemKeys = "home" | "your-work" | "notifications" | "drafts";

View File

@@ -15,9 +15,11 @@ import { cn } from "@/helpers/common.helper";
// hooks
import { useAppTheme, useEventTracker, useUser, useUserPermissions } from "@/hooks/store";
import { usePlatformOS } from "@/hooks/use-platform-os";
// plane web constants
import { SIDEBAR_USER_MENU_ITEMS } from "@/plane-web/constants/dashboard";
import { EUserPermissionsLevel } from "@/plane-web/constants/user-permissions";
// plane web helpers
import { isUserFeatureEnabled } from "@/plane-web/helpers/dashboard.helper";
export const SidebarUserMenu = observer(() => {
// store hooks
@@ -61,6 +63,7 @@ export const SidebarUserMenu = observer(() => {
>
{SIDEBAR_USER_MENU_ITEMS.map((link) => {
if (link.key === "drafts" && draftIssueCount === 0) return null;
if (!isUserFeatureEnabled(link.key)) return null;
return (
allowPermissions(link.access, EUserPermissionsLevel.WORKSPACE, workspaceSlug.toString()) && (
<Tooltip

View File

@@ -0,0 +1 @@
export * from "ce/helpers/dashboard.helper";

View File

@@ -0,0 +1 @@
export * from "ce/types/dashboard";