mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
[WEB-2554] improvement: dashboard sidebar list items. (#5970)
This commit is contained in:
@@ -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",
|
||||
|
||||
5
web/ce/helpers/dashboard.helper.ts
Normal file
5
web/ce/helpers/dashboard.helper.ts
Normal 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;
|
||||
1
web/ce/types/dashboard.ts
Normal file
1
web/ce/types/dashboard.ts
Normal file
@@ -0,0 +1 @@
|
||||
export type TSidebarUserMenuItemKeys = "home" | "your-work" | "notifications" | "drafts";
|
||||
@@ -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
|
||||
|
||||
1
web/ee/helpers/dashboard.helper.ts
Normal file
1
web/ee/helpers/dashboard.helper.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "ce/helpers/dashboard.helper";
|
||||
1
web/ee/types/dashboard.ts
Normal file
1
web/ee/types/dashboard.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "ce/types/dashboard";
|
||||
Reference in New Issue
Block a user