diff --git a/web/ce/constants/dashboard.ts b/web/ce/constants/dashboard.ts index 9f2c5b62fdd..8872982fc5b 100644 --- a/web/ce/constants/dashboard.ts +++ b/web/ce/constants/dashboard.ts @@ -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; -}[] = [ +}; + +export const SIDEBAR_USER_MENU_ITEMS: TSidebarUserMenuItems[] = [ { key: "home", label: "Home", diff --git a/web/ce/helpers/dashboard.helper.ts b/web/ce/helpers/dashboard.helper.ts new file mode 100644 index 00000000000..b2fba63adb0 --- /dev/null +++ b/web/ce/helpers/dashboard.helper.ts @@ -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; diff --git a/web/ce/types/dashboard.ts b/web/ce/types/dashboard.ts new file mode 100644 index 00000000000..d615ac4afce --- /dev/null +++ b/web/ce/types/dashboard.ts @@ -0,0 +1 @@ +export type TSidebarUserMenuItemKeys = "home" | "your-work" | "notifications" | "drafts"; diff --git a/web/core/components/workspace/sidebar/user-menu.tsx b/web/core/components/workspace/sidebar/user-menu.tsx index 0929f346190..3df26a87fe6 100644 --- a/web/core/components/workspace/sidebar/user-menu.tsx +++ b/web/core/components/workspace/sidebar/user-menu.tsx @@ -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()) && (