Skip to content

armgit / plane

Public Imported from GitHub
0

πŸ”₯πŸ”₯πŸ”₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.

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

Prateek Shourya7574206a41f0
diff --git a/web/ce/constants/dashboard.ts b/web/ce/constants/dashboard.ts
index 9f2c5b62fd..8872982fc5 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<Props>;
-}[] = [
+};
+
+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 0000000000..b2fba63adb
--- /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 0000000000..d615ac4afc
--- /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 0929f34619..3df26a87fe 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()) && (
<Tooltip
diff --git a/web/ee/helpers/dashboard.helper.ts b/web/ee/helpers/dashboard.helper.ts
new file mode 100644
index 0000000000..7f853699f4
--- /dev/null
+++ b/web/ee/helpers/dashboard.helper.ts
@@ -0,0 +1 @@
+export * from "ce/helpers/dashboard.helper";
diff --git a/web/ee/types/dashboard.ts b/web/ee/types/dashboard.ts
new file mode 100644
index 0000000000..359c46578c
--- /dev/null
+++ b/web/ee/types/dashboard.ts
@@ -0,0 +1 @@
+export * from "ce/types/dashboard";