diff --git a/web/app/[workspaceSlug]/(projects)/notifications/layout.tsx b/web/app/[workspaceSlug]/(projects)/notifications/layout.tsx index eb65bb2ab9..e3d7303636 100644 --- a/web/app/[workspaceSlug]/(projects)/notifications/layout.tsx +++ b/web/app/[workspaceSlug]/(projects)/notifications/layout.tsx @@ -6,7 +6,7 @@ import { NotificationsSidebarRoot } from "@/components/workspace-notifications"; export default function ProjectInboxIssuesLayout({ children }: { children: React.ReactNode }) { return (
- +
{children}
); diff --git a/web/ee/components/workspace-notifications/root.tsx b/web/ee/components/workspace-notifications/root.tsx index 6eea5a16e9..f926084b7e 100644 --- a/web/ee/components/workspace-notifications/root.tsx +++ b/web/ee/components/workspace-notifications/root.tsx @@ -1,106 +1,31 @@ -"use client"; +// export * from "./sidebar"; -import { FC } from "react"; -import { observer } from "mobx-react"; +import React, { useMemo } from "react"; +import dynamic from "next/dynamic"; import { useParams } from "next/navigation"; -// components -import { Header, Row, ERowVariant, EHeaderVariant, ContentWrapper } from "@plane/ui"; -import { CountChip } from "@/components/common"; -import { - NotificationsLoader, - NotificationEmptyState, - NotificationSidebarHeader, - AppliedFilters, -} from "@/components/workspace-notifications"; -// constants -import { NOTIFICATION_TABS } from "@/constants/notification"; -// helpers -import { cn } from "@/helpers/common.helper"; -import { getNumberCount } from "@/helpers/string.helper"; -// hooks -import { useWorkspace, useWorkspaceNotifications } from "@/hooks/store"; -// plane web components -import { NotificationCardListRoot } from "@/plane-web/components/workspace-notifications"; +import { useFlag } from "@/plane-web/hooks/store"; -export const NotificationsSidebar: FC = observer(() => { +export const NotificationsSidebarRoot = () => { const { workspaceSlug } = useParams(); - // hooks - const { getWorkspaceBySlug } = useWorkspace(); - const { - currentSelectedNotificationId, - unreadNotificationsCount, - loader, - notificationIssueIdsByWorkspaceId, - currentNotificationTab, - setCurrentNotificationTab, - } = useWorkspaceNotifications(); - // derived values - const workspace = workspaceSlug ? getWorkspaceBySlug(workspaceSlug.toString()) : undefined; - const groupedNotificationIssueIds = workspace ? notificationIssueIdsByWorkspaceId(workspace.id) : undefined; - - if (!workspaceSlug || !workspace) return <>; - - return ( -
-
- - - - -
- {NOTIFICATION_TABS.map((tab) => ( -
currentNotificationTab != tab.value && setCurrentNotificationTab(tab.value)} - > -
-
{tab.label}
- {tab.count(unreadNotificationsCount) > 0 && ( - - )} -
- {currentNotificationTab === tab.value && ( -
- )} -
- ))} -
- - {/* applied filters */} - - - {/* rendering notifications */} - {loader === "init-loader" ? ( -
- -
- ) : ( - <> - {groupedNotificationIssueIds && groupedNotificationIssueIds.length > 0 ? ( - - - - ) : ( -
- -
- )} - - )} -
-
+ const isFeatureEnabled = useFlag(workspaceSlug.toString(), "INBOX_STACKING"); + const NotificationsSideBarRoot = useMemo( + () => + dynamic( + () => + isFeatureEnabled + ? import(`ee/components/workspace-notifications/sidebar`).then((module) => ({ + default: module["NotificationsSidebar"], + })) + : import("ce/components/workspace-notifications/root").then((module) => ({ + default: module["NotificationsSidebar"], + })), + { + // TODO: Add loading component + loading: () => <>, + } + ), + [isFeatureEnabled] ); -}); + + return ; +}; diff --git a/web/ee/components/workspace-notifications/sidebar.tsx b/web/ee/components/workspace-notifications/sidebar.tsx new file mode 100644 index 0000000000..6eea5a16e9 --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar.tsx @@ -0,0 +1,106 @@ +"use client"; + +import { FC } from "react"; +import { observer } from "mobx-react"; +import { useParams } from "next/navigation"; +// components +import { Header, Row, ERowVariant, EHeaderVariant, ContentWrapper } from "@plane/ui"; +import { CountChip } from "@/components/common"; +import { + NotificationsLoader, + NotificationEmptyState, + NotificationSidebarHeader, + AppliedFilters, +} from "@/components/workspace-notifications"; +// constants +import { NOTIFICATION_TABS } from "@/constants/notification"; +// helpers +import { cn } from "@/helpers/common.helper"; +import { getNumberCount } from "@/helpers/string.helper"; +// hooks +import { useWorkspace, useWorkspaceNotifications } from "@/hooks/store"; +// plane web components +import { NotificationCardListRoot } from "@/plane-web/components/workspace-notifications"; + +export const NotificationsSidebar: FC = observer(() => { + const { workspaceSlug } = useParams(); + // hooks + const { getWorkspaceBySlug } = useWorkspace(); + const { + currentSelectedNotificationId, + unreadNotificationsCount, + loader, + notificationIssueIdsByWorkspaceId, + currentNotificationTab, + setCurrentNotificationTab, + } = useWorkspaceNotifications(); + // derived values + const workspace = workspaceSlug ? getWorkspaceBySlug(workspaceSlug.toString()) : undefined; + const groupedNotificationIssueIds = workspace ? notificationIssueIdsByWorkspaceId(workspace.id) : undefined; + + if (!workspaceSlug || !workspace) return <>; + + return ( +
+
+ + + + +
+ {NOTIFICATION_TABS.map((tab) => ( +
currentNotificationTab != tab.value && setCurrentNotificationTab(tab.value)} + > +
+
{tab.label}
+ {tab.count(unreadNotificationsCount) > 0 && ( + + )} +
+ {currentNotificationTab === tab.value && ( +
+ )} +
+ ))} +
+ + {/* applied filters */} + + + {/* rendering notifications */} + {loader === "init-loader" ? ( +
+ +
+ ) : ( + <> + {groupedNotificationIssueIds && groupedNotificationIssueIds.length > 0 ? ( + + + + ) : ( +
+ +
+ )} + + )} +
+
+ ); +}); diff --git a/web/ee/hooks/store/use-flag.ts b/web/ee/hooks/store/use-flag.ts index 530cf6d405..bd89653ea4 100644 --- a/web/ee/hooks/store/use-flag.ts +++ b/web/ee/hooks/store/use-flag.ts @@ -24,6 +24,7 @@ export enum E_FEATURE_FLAGS { FILE_SIZE_LIMIT_PRO = "FILE_SIZE_LIMIT_PRO", NO_LOAD = "NO_LOAD", TIMELINE_DEPENDENCY = "TIMELINE_DEPENDENCY", + INBOX_STACKING = "INBOX_STACKING", // integrations SILO_IMPORTERS = "SILO_IMPORTERS", SILO_INTEGRATIONS = "SILO_INTEGRATIONS",