From 3211866ed1f0d85b30adac917a3e909a831f2a51 Mon Sep 17 00:00:00 2001 From: vamsi krishna Date: Wed, 27 Nov 2024 20:03:16 +0530 Subject: [PATCH 1/3] re arranged files for notifications card --- web/ce/components/workspace-notifications/index.ts | 1 + .../workspace-notifications/sidebar/index.ts | 1 + .../sidebar/notification-card/index.ts | 0 .../sidebar/notification-card/item.tsx | 2 +- .../sidebar/notification-card/options/archive.tsx | 6 +++--- .../sidebar/notification-card/options/button.tsx | 0 .../sidebar/notification-card/options/index.ts | 0 .../sidebar/notification-card/options/read.tsx | 6 +++--- .../sidebar/notification-card/options/root.tsx | 10 +++++----- .../sidebar/notification-card/options/snooze/index.ts | 0 .../sidebar/notification-card/options/snooze/modal.tsx | 0 .../sidebar/notification-card/options/snooze/root.tsx | 6 +++--- .../sidebar/notification-card/root.tsx | 4 ++-- web/{core => ce}/store/notifications/notification.ts | 7 ++++--- .../notifications/workspace-notifications.store.ts | 8 ++++---- web/ce/store/root.store.ts | 8 +++++++- .../workspace-notifications/sidebar/index.ts | 2 +- .../workspace-notifications/sidebar/root.tsx | 3 ++- web/core/hooks/store/notifications/use-notification.ts | 2 +- .../store/notifications/use-workspace-notifications.ts | 2 +- web/core/store/root.store.ts | 4 ---- .../workspace-notifications.store.ts | 1 + 22 files changed, 40 insertions(+), 33 deletions(-) create mode 100644 web/ce/components/workspace-notifications/index.ts create mode 100644 web/ce/components/workspace-notifications/sidebar/index.ts rename web/{core => ce}/components/workspace-notifications/sidebar/notification-card/index.ts (100%) rename web/{core => ce}/components/workspace-notifications/sidebar/notification-card/item.tsx (98%) rename web/{core => ce}/components/workspace-notifications/sidebar/notification-card/options/archive.tsx (91%) rename web/{core => ce}/components/workspace-notifications/sidebar/notification-card/options/button.tsx (100%) rename web/{core => ce}/components/workspace-notifications/sidebar/notification-card/options/index.ts (100%) rename web/{core => ce}/components/workspace-notifications/sidebar/notification-card/options/read.tsx (90%) rename web/{core => ce}/components/workspace-notifications/sidebar/notification-card/options/root.tsx (96%) rename web/{core => ce}/components/workspace-notifications/sidebar/notification-card/options/snooze/index.ts (100%) rename web/{core => ce}/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx (100%) rename web/{core => ce}/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx (96%) rename web/{core => ce}/components/workspace-notifications/sidebar/notification-card/root.tsx (95%) rename web/{core => ce}/store/notifications/notification.ts (99%) rename web/{core => ce}/store/notifications/workspace-notifications.store.ts (98%) create mode 100644 web/ee/store/workspace-notifications/workspace-notifications.store.ts diff --git a/web/ce/components/workspace-notifications/index.ts b/web/ce/components/workspace-notifications/index.ts new file mode 100644 index 00000000000..4606e997da8 --- /dev/null +++ b/web/ce/components/workspace-notifications/index.ts @@ -0,0 +1 @@ +export * from './sidebar' \ No newline at end of file diff --git a/web/ce/components/workspace-notifications/sidebar/index.ts b/web/ce/components/workspace-notifications/sidebar/index.ts new file mode 100644 index 00000000000..4c09731e2ba --- /dev/null +++ b/web/ce/components/workspace-notifications/sidebar/index.ts @@ -0,0 +1 @@ +export * from './notification-card' \ No newline at end of file diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/index.ts b/web/ce/components/workspace-notifications/sidebar/notification-card/index.ts similarity index 100% rename from web/core/components/workspace-notifications/sidebar/notification-card/index.ts rename to web/ce/components/workspace-notifications/sidebar/notification-card/index.ts diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/item.tsx b/web/ce/components/workspace-notifications/sidebar/notification-card/item.tsx similarity index 98% rename from web/core/components/workspace-notifications/sidebar/notification-card/item.tsx rename to web/ce/components/workspace-notifications/sidebar/notification-card/item.tsx index c4dc7b2e7c9..8e79c3ea924 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/item.tsx +++ b/web/ce/components/workspace-notifications/sidebar/notification-card/item.tsx @@ -5,7 +5,6 @@ import { observer } from "mobx-react"; import { Clock } from "lucide-react"; import { Avatar, Row } from "@plane/ui"; // components -import { NotificationOption } from "@/components/workspace-notifications"; // helpers import { cn } from "@/helpers/common.helper"; import { calculateTimeAgo, renderFormattedDate, renderFormattedTime } from "@/helpers/date-time.helper"; @@ -14,6 +13,7 @@ import { sanitizeCommentForNotification } from "@/helpers/notification.helper"; import { replaceUnderscoreIfSnakeCase, stripAndTruncateHTML } from "@/helpers/string.helper"; // hooks import { useIssueDetail, useNotification, useWorkspaceNotifications } from "@/hooks/store"; +import { NotificationOption } from "@/plane-web/components/workspace-notifications"; type TNotificationItem = { workspaceSlug: string; diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/archive.tsx b/web/ce/components/workspace-notifications/sidebar/notification-card/options/archive.tsx similarity index 91% rename from web/core/components/workspace-notifications/sidebar/notification-card/options/archive.tsx rename to web/ce/components/workspace-notifications/sidebar/notification-card/options/archive.tsx index 651404a2f7c..7340e968335 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/options/archive.tsx +++ b/web/ce/components/workspace-notifications/sidebar/notification-card/options/archive.tsx @@ -4,14 +4,14 @@ import { FC } from "react"; import { observer } from "mobx-react"; import { ArchiveRestore } from "lucide-react"; import { ArchiveIcon, TOAST_TYPE, setToast } from "@plane/ui"; -// components -import { NotificationItemOptionButton } from "@/components/workspace-notifications"; // constants import { NOTIFICATION_ARCHIVED } from "@/constants/event-tracker"; // hooks import { useEventTracker, useWorkspaceNotifications } from "@/hooks/store"; +// components +import { NotificationItemOptionButton } from "@/plane-web/components/workspace-notifications"; // store -import { INotification } from "@/store/notifications/notification"; +import { INotification } from "@/plane-web/store/notifications/notification"; type TNotificationItemArchiveOption = { workspaceSlug: string; diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/button.tsx b/web/ce/components/workspace-notifications/sidebar/notification-card/options/button.tsx similarity index 100% rename from web/core/components/workspace-notifications/sidebar/notification-card/options/button.tsx rename to web/ce/components/workspace-notifications/sidebar/notification-card/options/button.tsx diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/index.ts b/web/ce/components/workspace-notifications/sidebar/notification-card/options/index.ts similarity index 100% rename from web/core/components/workspace-notifications/sidebar/notification-card/options/index.ts rename to web/ce/components/workspace-notifications/sidebar/notification-card/options/index.ts diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/read.tsx b/web/ce/components/workspace-notifications/sidebar/notification-card/options/read.tsx similarity index 90% rename from web/core/components/workspace-notifications/sidebar/notification-card/options/read.tsx rename to web/ce/components/workspace-notifications/sidebar/notification-card/options/read.tsx index 42b4e29f07c..9dfc8bf746e 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/options/read.tsx +++ b/web/ce/components/workspace-notifications/sidebar/notification-card/options/read.tsx @@ -4,14 +4,14 @@ import { FC } from "react"; import { observer } from "mobx-react"; import { MessageSquare } from "lucide-react"; import { TOAST_TYPE, setToast } from "@plane/ui"; -// components -import { NotificationItemOptionButton } from "@/components/workspace-notifications"; // constants import { NOTIFICATIONS_READ } from "@/constants/event-tracker"; // hooks import { useEventTracker, useWorkspaceNotifications } from "@/hooks/store"; +// components +import { NotificationItemOptionButton } from "@/plane-web/components/workspace-notifications"; // store -import { INotification } from "@/store/notifications/notification"; +import { INotification } from "@/plane-web/store/notifications/notification"; type TNotificationItemReadOption = { workspaceSlug: string; diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/root.tsx b/web/ce/components/workspace-notifications/sidebar/notification-card/options/root.tsx similarity index 96% rename from web/core/components/workspace-notifications/sidebar/notification-card/options/root.tsx rename to web/ce/components/workspace-notifications/sidebar/notification-card/options/root.tsx index 2017c0db8d6..e0dac924599 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/options/root.tsx +++ b/web/ce/components/workspace-notifications/sidebar/notification-card/options/root.tsx @@ -2,16 +2,16 @@ import { FC, Dispatch, SetStateAction } from "react"; import { observer } from "mobx-react"; +// helpers +import { cn } from "@/helpers/common.helper"; +// hooks +import { useNotification } from "@/hooks/store"; // components import { NotificationItemReadOption, NotificationItemArchiveOption, NotificationItemSnoozeOption, -} from "@/components/workspace-notifications"; -// helpers -import { cn } from "@/helpers/common.helper"; -// hooks -import { useNotification } from "@/hooks/store"; +} from "@/plane-web/components/workspace-notifications"; type TNotificationOption = { workspaceSlug: string; diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/index.ts b/web/ce/components/workspace-notifications/sidebar/notification-card/options/snooze/index.ts similarity index 100% rename from web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/index.ts rename to web/ce/components/workspace-notifications/sidebar/notification-card/options/snooze/index.ts diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx b/web/ce/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx similarity index 100% rename from web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx rename to web/ce/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx b/web/ce/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx similarity index 96% rename from web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx rename to web/ce/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx index 003175500c8..1fdc81127f4 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx +++ b/web/ce/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx @@ -5,16 +5,16 @@ import { observer } from "mobx-react"; import { Clock } from "lucide-react"; import { Popover, Transition } from "@headlessui/react"; import { Tooltip, setToast, TOAST_TYPE } from "@plane/ui"; -// components -import { NotificationSnoozeModal } from "@/components/workspace-notifications"; // constants import { NOTIFICATION_SNOOZE_OPTIONS } from "@/constants/notification"; import { cn } from "@/helpers/common.helper"; // hooks import { useWorkspaceNotifications } from "@/hooks/store"; import { usePlatformOS } from "@/hooks/use-platform-os"; +// components +import { NotificationSnoozeModal } from "@/plane-web/components/workspace-notifications"; // store -import { INotification } from "@/store/notifications/notification"; +import { INotification } from "@/plane-web/store/notifications/notification"; type TNotificationItemSnoozeOption = { workspaceSlug: string; diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/root.tsx b/web/ce/components/workspace-notifications/sidebar/notification-card/root.tsx similarity index 95% rename from web/core/components/workspace-notifications/sidebar/notification-card/root.tsx rename to web/ce/components/workspace-notifications/sidebar/notification-card/root.tsx index bfff113bafe..85051d1a59f 100644 --- a/web/core/components/workspace-notifications/sidebar/notification-card/root.tsx +++ b/web/ce/components/workspace-notifications/sidebar/notification-card/root.tsx @@ -2,12 +2,12 @@ import { FC } from "react"; import { observer } from "mobx-react"; -// components -import { NotificationItem } from "@/components/workspace-notifications"; // constants import { ENotificationLoader, ENotificationQueryParamType } from "@/constants/notification"; // hooks import { useWorkspaceNotifications } from "@/hooks/store"; +// components +import { NotificationItem } from "@/plane-web/components/workspace-notifications"; type TNotificationCardListRoot = { workspaceSlug: string; diff --git a/web/core/store/notifications/notification.ts b/web/ce/store/notifications/notification.ts similarity index 99% rename from web/core/store/notifications/notification.ts rename to web/ce/store/notifications/notification.ts index dff2755fdcb..417a1f0c89f 100644 --- a/web/core/store/notifications/notification.ts +++ b/web/ce/store/notifications/notification.ts @@ -2,10 +2,11 @@ import set from "lodash/set"; import { action, computed, makeObservable, observable, runInAction } from "mobx"; import { IUserLite, TNotification, TNotificationData } from "@plane/types"; +// store +import { RootStore } from "@/plane-web/store/root.store"; // services import workspaceNotificationService from "@/services/workspace-notification.service"; -// store -import { CoreRootStore } from "../root.store"; + export interface INotification extends TNotification { // observables @@ -51,7 +52,7 @@ export class Notification implements INotification { updated_by: string | undefined = undefined; constructor( - private store: CoreRootStore, + private store: RootStore, private notification: TNotification ) { makeObservable(this, { diff --git a/web/core/store/notifications/workspace-notifications.store.ts b/web/ce/store/notifications/workspace-notifications.store.ts similarity index 98% rename from web/core/store/notifications/workspace-notifications.store.ts rename to web/ce/store/notifications/workspace-notifications.store.ts index 59f0dbc0332..791a0ccf7a6 100644 --- a/web/core/store/notifications/workspace-notifications.store.ts +++ b/web/ce/store/notifications/workspace-notifications.store.ts @@ -21,11 +21,11 @@ import { } from "@/constants/notification"; // helpers import { convertToEpoch } from "@/helpers/date-time.helper"; +// store +import { Notification, INotification } from "@/plane-web/store/notifications/notification"; // services import workspaceNotificationService from "@/services/workspace-notification.service"; -// store -import { Notification, INotification } from "@/store/notifications/notification"; -import { CoreRootStore } from "@/store/root.store"; +import { RootStore } from "../root.store"; type TNotificationLoader = ENotificationLoader | undefined; type TNotificationQueryParamType = ENotificationQueryParamType; @@ -84,7 +84,7 @@ export class WorkspaceNotificationStore implements IWorkspaceNotificationStore { read: false, }; - constructor(private store: CoreRootStore) { + constructor(private store: RootStore) { makeObservable(this, { // observables loader: observable.ref, diff --git a/web/ce/store/root.store.ts b/web/ce/store/root.store.ts index 01e6513dc05..026c580c2f8 100644 --- a/web/ce/store/root.store.ts +++ b/web/ce/store/root.store.ts @@ -1,13 +1,19 @@ // store import { CoreRootStore } from "@/store/root.store"; import { ITimelineStore, TimeLineStore } from "./timeline"; +import { IWorkspaceNotificationStore, WorkspaceNotificationStore } from "./notifications/workspace-notifications.store"; export class RootStore extends CoreRootStore { timelineStore: ITimelineStore; + workspaceNotification: IWorkspaceNotificationStore; constructor() { super(); - + this.workspaceNotification = new WorkspaceNotificationStore(this) this.timelineStore = new TimeLineStore(this); } + + resetOnSignOut() { + this.workspaceNotification = new WorkspaceNotificationStore(this); + } } diff --git a/web/core/components/workspace-notifications/sidebar/index.ts b/web/core/components/workspace-notifications/sidebar/index.ts index d8ab5c4ed50..e9ea896e917 100644 --- a/web/core/components/workspace-notifications/sidebar/index.ts +++ b/web/core/components/workspace-notifications/sidebar/index.ts @@ -7,4 +7,4 @@ export * from "./header"; export * from "./filters"; -export * from "./notification-card"; +// export * from "./notification-card"; diff --git a/web/core/components/workspace-notifications/sidebar/root.tsx b/web/core/components/workspace-notifications/sidebar/root.tsx index 767b96f42aa..8cc11fed6d8 100644 --- a/web/core/components/workspace-notifications/sidebar/root.tsx +++ b/web/core/components/workspace-notifications/sidebar/root.tsx @@ -11,7 +11,6 @@ import { NotificationEmptyState, NotificationSidebarHeader, AppliedFilters, - NotificationCardListRoot, } from "@/components/workspace-notifications"; // constants import { NOTIFICATION_TABS } from "@/constants/notification"; @@ -21,6 +20,8 @@ import { getNumberCount } from "@/helpers/string.helper"; // hooks import { useWorkspace, useWorkspaceNotifications } from "@/hooks/store"; +import { NotificationCardListRoot } from "@/plane-web/components/workspace-notifications"; + export const NotificationsSidebar: FC = observer(() => { const { workspaceSlug } = useParams(); // hooks diff --git a/web/core/hooks/store/notifications/use-notification.ts b/web/core/hooks/store/notifications/use-notification.ts index 9df87dd5c14..6560ae7e308 100644 --- a/web/core/hooks/store/notifications/use-notification.ts +++ b/web/core/hooks/store/notifications/use-notification.ts @@ -2,7 +2,7 @@ import { useContext } from "react"; // mobx store import { StoreContext } from "@/lib/store-context"; // mobx store -import { INotification } from "@/store/notifications/notification"; +import { INotification } from "@/plane-web/store/notifications/notification"; export const useNotification = (notificationId: string | undefined): INotification => { const context = useContext(StoreContext); diff --git a/web/core/hooks/store/notifications/use-workspace-notifications.ts b/web/core/hooks/store/notifications/use-workspace-notifications.ts index f882d67161f..85d17279e92 100644 --- a/web/core/hooks/store/notifications/use-workspace-notifications.ts +++ b/web/core/hooks/store/notifications/use-workspace-notifications.ts @@ -2,7 +2,7 @@ import { useContext } from "react"; // context import { StoreContext } from "@/lib/store-context"; // mobx store -import { IWorkspaceNotificationStore } from "@/store/notifications/workspace-notifications.store"; +import { IWorkspaceNotificationStore } from "@/plane-web/store/notifications/workspace-notifications.store"; export const useWorkspaceNotifications = (): IWorkspaceNotificationStore => { const context = useContext(StoreContext); diff --git a/web/core/store/root.store.ts b/web/core/store/root.store.ts index af38f51b28c..370b0a60753 100644 --- a/web/core/store/root.store.ts +++ b/web/core/store/root.store.ts @@ -16,7 +16,6 @@ import { IMemberRootStore, MemberRootStore } from "./member"; import { IModuleStore, ModulesStore } from "./module.store"; import { IModuleFilterStore, ModuleFilterStore } from "./module_filter.store"; import { IMultipleSelectStore, MultipleSelectStore } from "./multiple_select.store"; -import { IWorkspaceNotificationStore, WorkspaceNotificationStore } from "./notifications/workspace-notifications.store"; import { IProjectPageStore, ProjectPageStore } from "./pages/project-page.store"; import { IProjectRootStore, ProjectRootStore } from "./project"; import { IProjectViewStore, ProjectViewStore } from "./project-view.store"; @@ -53,7 +52,6 @@ export class CoreRootStore { projectInbox: IProjectInboxStore; projectEstimate: IProjectEstimateStore; multipleSelect: IMultipleSelectStore; - workspaceNotification: IWorkspaceNotificationStore; favorite: IFavoriteStore; transient: ITransientStore; @@ -81,7 +79,6 @@ export class CoreRootStore { this.projectInbox = new ProjectInboxStore(this); this.projectPages = new ProjectPageStore(this); this.projectEstimate = new ProjectEstimateStore(this); - this.workspaceNotification = new WorkspaceNotificationStore(this); this.favorite = new FavoriteStore(this); this.transient = new TransientStore(); } @@ -112,7 +109,6 @@ export class CoreRootStore { this.projectPages = new ProjectPageStore(this); this.multipleSelect = new MultipleSelectStore(); this.projectEstimate = new ProjectEstimateStore(this); - this.workspaceNotification = new WorkspaceNotificationStore(this); this.favorite = new FavoriteStore(this); this.transient = new TransientStore(); } diff --git a/web/ee/store/workspace-notifications/workspace-notifications.store.ts b/web/ee/store/workspace-notifications/workspace-notifications.store.ts new file mode 100644 index 00000000000..0286ed988be --- /dev/null +++ b/web/ee/store/workspace-notifications/workspace-notifications.store.ts @@ -0,0 +1 @@ +export * from '@/plane-web/store/notifications/workspace-notifications.store' \ No newline at end of file From 87cf5f115a9fc9a92e5defa4fec8ad316657ffef Mon Sep 17 00:00:00 2001 From: vamsi krishna Date: Thu, 28 Nov 2024 12:03:38 +0530 Subject: [PATCH 2/3] re arranged files for notifications card --- .../(projects)/notifications/layout.tsx | 4 +- .../workspace-notifications/sidebar/index.ts | 3 +- .../workspace-notifications/sidebar/root.tsx | 106 +++++++++++++++++ .../workspace-notifications/sidebar/root.tsx | 107 +----------------- .../workspace-notifications/index.ts | 1 + .../workspace-notifications/sidebar/index.ts | 2 + .../sidebar/notification-card/index.ts | 3 + .../sidebar/notification-card/item.tsx | 1 + .../notification-card/options/archive.tsx | 1 + .../notification-card/options/button.tsx | 1 + .../notification-card/options/index.ts | 7 ++ .../notification-card/options/read.tsx | 1 + .../notification-card/options/root.tsx | 1 + .../notification-card/options/snooze/index.ts | 2 + .../options/snooze/modal.tsx | 1 + .../notification-card/options/snooze/root.tsx | 1 + .../sidebar/notification-card/root.tsx | 1 + .../workspace-notifications/sidebar/root.tsx | 1 + 18 files changed, 136 insertions(+), 108 deletions(-) create mode 100644 web/ce/components/workspace-notifications/sidebar/root.tsx create mode 100644 web/ee/components/workspace-notifications/index.ts create mode 100644 web/ee/components/workspace-notifications/sidebar/index.ts create mode 100644 web/ee/components/workspace-notifications/sidebar/notification-card/index.ts create mode 100644 web/ee/components/workspace-notifications/sidebar/notification-card/item.tsx create mode 100644 web/ee/components/workspace-notifications/sidebar/notification-card/options/archive.tsx create mode 100644 web/ee/components/workspace-notifications/sidebar/notification-card/options/button.tsx create mode 100644 web/ee/components/workspace-notifications/sidebar/notification-card/options/index.ts create mode 100644 web/ee/components/workspace-notifications/sidebar/notification-card/options/read.tsx create mode 100644 web/ee/components/workspace-notifications/sidebar/notification-card/options/root.tsx create mode 100644 web/ee/components/workspace-notifications/sidebar/notification-card/options/snooze/index.ts create mode 100644 web/ee/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx create mode 100644 web/ee/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx create mode 100644 web/ee/components/workspace-notifications/sidebar/notification-card/root.tsx create mode 100644 web/ee/components/workspace-notifications/sidebar/root.tsx diff --git a/web/app/[workspaceSlug]/(projects)/notifications/layout.tsx b/web/app/[workspaceSlug]/(projects)/notifications/layout.tsx index b8b80b4d279..e3d73036361 100644 --- a/web/app/[workspaceSlug]/(projects)/notifications/layout.tsx +++ b/web/app/[workspaceSlug]/(projects)/notifications/layout.tsx @@ -1,12 +1,12 @@ "use client"; // components -import { NotificationsSidebar } from "@/components/workspace-notifications"; +import { NotificationsSidebarRoot } from "@/components/workspace-notifications"; export default function ProjectInboxIssuesLayout({ children }: { children: React.ReactNode }) { return (
- +
{children}
); diff --git a/web/ce/components/workspace-notifications/sidebar/index.ts b/web/ce/components/workspace-notifications/sidebar/index.ts index 4c09731e2ba..71bdf7c831f 100644 --- a/web/ce/components/workspace-notifications/sidebar/index.ts +++ b/web/ce/components/workspace-notifications/sidebar/index.ts @@ -1 +1,2 @@ -export * from './notification-card' \ No newline at end of file +export * from './notification-card' +export * from './root' \ No newline at end of file diff --git a/web/ce/components/workspace-notifications/sidebar/root.tsx b/web/ce/components/workspace-notifications/sidebar/root.tsx new file mode 100644 index 00000000000..8cc11fed6d8 --- /dev/null +++ b/web/ce/components/workspace-notifications/sidebar/root.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"; + +import { NotificationCardListRoot } from "@/plane-web/components/workspace-notifications"; + +export const NotificationsSidebar: FC = observer(() => { + const { workspaceSlug } = useParams(); + // hooks + const { getWorkspaceBySlug } = useWorkspace(); + const { + currentSelectedNotificationId, + unreadNotificationsCount, + loader, + notificationIdsByWorkspaceId, + currentNotificationTab, + setCurrentNotificationTab, + } = useWorkspaceNotifications(); + // derived values + const workspace = workspaceSlug ? getWorkspaceBySlug(workspaceSlug.toString()) : undefined; + const notificationIds = workspace ? notificationIdsByWorkspaceId(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" ? ( +
+ +
+ ) : ( + <> + {notificationIds && notificationIds.length > 0 ? ( + + + + ) : ( +
+ +
+ )} + + )} +
+
+ ); +}); diff --git a/web/core/components/workspace-notifications/sidebar/root.tsx b/web/core/components/workspace-notifications/sidebar/root.tsx index 8cc11fed6d8..4cad35974f2 100644 --- a/web/core/components/workspace-notifications/sidebar/root.tsx +++ b/web/core/components/workspace-notifications/sidebar/root.tsx @@ -1,106 +1,3 @@ "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"; - -import { NotificationCardListRoot } from "@/plane-web/components/workspace-notifications"; - -export const NotificationsSidebar: FC = observer(() => { - const { workspaceSlug } = useParams(); - // hooks - const { getWorkspaceBySlug } = useWorkspace(); - const { - currentSelectedNotificationId, - unreadNotificationsCount, - loader, - notificationIdsByWorkspaceId, - currentNotificationTab, - setCurrentNotificationTab, - } = useWorkspaceNotifications(); - // derived values - const workspace = workspaceSlug ? getWorkspaceBySlug(workspaceSlug.toString()) : undefined; - const notificationIds = workspace ? notificationIdsByWorkspaceId(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" ? ( -
- -
- ) : ( - <> - {notificationIds && notificationIds.length > 0 ? ( - - - - ) : ( -
- -
- )} - - )} -
-
- ); -}); +import { NotificationsSidebar } from "@/plane-web/components/workspace-notifications"; +export const NotificationsSidebarRoot = () => diff --git a/web/ee/components/workspace-notifications/index.ts b/web/ee/components/workspace-notifications/index.ts new file mode 100644 index 00000000000..4606e997da8 --- /dev/null +++ b/web/ee/components/workspace-notifications/index.ts @@ -0,0 +1 @@ +export * from './sidebar' \ No newline at end of file diff --git a/web/ee/components/workspace-notifications/sidebar/index.ts b/web/ee/components/workspace-notifications/sidebar/index.ts new file mode 100644 index 00000000000..71bdf7c831f --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar/index.ts @@ -0,0 +1,2 @@ +export * from './notification-card' +export * from './root' \ No newline at end of file diff --git a/web/ee/components/workspace-notifications/sidebar/notification-card/index.ts b/web/ee/components/workspace-notifications/sidebar/notification-card/index.ts new file mode 100644 index 00000000000..d4000aa9e7f --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar/notification-card/index.ts @@ -0,0 +1,3 @@ +export * from "./root"; +export * from "./item"; +export * from "./options"; diff --git a/web/ee/components/workspace-notifications/sidebar/notification-card/item.tsx b/web/ee/components/workspace-notifications/sidebar/notification-card/item.tsx new file mode 100644 index 00000000000..7889dcb5897 --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar/notification-card/item.tsx @@ -0,0 +1 @@ +export { NotificationItem } from "ce/components/workspace-notifications"; \ No newline at end of file diff --git a/web/ee/components/workspace-notifications/sidebar/notification-card/options/archive.tsx b/web/ee/components/workspace-notifications/sidebar/notification-card/options/archive.tsx new file mode 100644 index 00000000000..64a40deb94b --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar/notification-card/options/archive.tsx @@ -0,0 +1 @@ +export { NotificationItemArchiveOption } from "ce/components/workspace-notifications"; \ No newline at end of file diff --git a/web/ee/components/workspace-notifications/sidebar/notification-card/options/button.tsx b/web/ee/components/workspace-notifications/sidebar/notification-card/options/button.tsx new file mode 100644 index 00000000000..e5d818311c7 --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar/notification-card/options/button.tsx @@ -0,0 +1 @@ +export { NotificationItemOptionButton } from "@/plane-web/components/workspace-notifications"; \ No newline at end of file diff --git a/web/ee/components/workspace-notifications/sidebar/notification-card/options/index.ts b/web/ee/components/workspace-notifications/sidebar/notification-card/options/index.ts new file mode 100644 index 00000000000..47dff31929e --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar/notification-card/options/index.ts @@ -0,0 +1,7 @@ +export * from "./root"; + +export * from "./read"; +export * from "./archive"; +export * from "./snooze"; + +export * from "./button"; diff --git a/web/ee/components/workspace-notifications/sidebar/notification-card/options/read.tsx b/web/ee/components/workspace-notifications/sidebar/notification-card/options/read.tsx new file mode 100644 index 00000000000..dd1b9a9d076 --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar/notification-card/options/read.tsx @@ -0,0 +1 @@ +export { NotificationItemReadOption } from "ce/components/workspace-notifications"; \ No newline at end of file diff --git a/web/ee/components/workspace-notifications/sidebar/notification-card/options/root.tsx b/web/ee/components/workspace-notifications/sidebar/notification-card/options/root.tsx new file mode 100644 index 00000000000..881dd26231f --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar/notification-card/options/root.tsx @@ -0,0 +1 @@ +export { NotificationOption } from "ce/components/workspace-notifications"; diff --git a/web/ee/components/workspace-notifications/sidebar/notification-card/options/snooze/index.ts b/web/ee/components/workspace-notifications/sidebar/notification-card/options/snooze/index.ts new file mode 100644 index 00000000000..5238728d7c5 --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar/notification-card/options/snooze/index.ts @@ -0,0 +1,2 @@ +export * from "./root"; +export * from "./modal"; diff --git a/web/ee/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx b/web/ee/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx new file mode 100644 index 00000000000..d738fdf902e --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx @@ -0,0 +1 @@ +export { NotificationSnoozeModal } from "ce/components/workspace-notifications"; diff --git a/web/ee/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx b/web/ee/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx new file mode 100644 index 00000000000..80a63602c67 --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar/notification-card/options/snooze/root.tsx @@ -0,0 +1 @@ +export { NotificationItemSnoozeOption } from "ce/components/workspace-notifications"; \ No newline at end of file diff --git a/web/ee/components/workspace-notifications/sidebar/notification-card/root.tsx b/web/ee/components/workspace-notifications/sidebar/notification-card/root.tsx new file mode 100644 index 00000000000..b00c3c9f962 --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar/notification-card/root.tsx @@ -0,0 +1 @@ +export { NotificationCardListRoot } from "ce/components/workspace-notifications"; \ No newline at end of file diff --git a/web/ee/components/workspace-notifications/sidebar/root.tsx b/web/ee/components/workspace-notifications/sidebar/root.tsx new file mode 100644 index 00000000000..8277155ca06 --- /dev/null +++ b/web/ee/components/workspace-notifications/sidebar/root.tsx @@ -0,0 +1 @@ +export { NotificationsSidebar } from "ce/components/workspace-notifications" \ No newline at end of file From 834de34dad574ef2696a07388f7d88693bbaff97 Mon Sep 17 00:00:00 2001 From: vamsi krishna Date: Thu, 28 Nov 2024 12:48:47 +0530 Subject: [PATCH 3/3] enhanced code --- .../workspace-notifications/sidebar/root.tsx | 13 ++++++++++--- .../notifications/workspace-notifications.store.ts | 2 +- web/ce/store/root.store.ts | 3 ++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/web/ce/components/workspace-notifications/sidebar/root.tsx b/web/ce/components/workspace-notifications/sidebar/root.tsx index 8cc11fed6d8..d6471851296 100644 --- a/web/ce/components/workspace-notifications/sidebar/root.tsx +++ b/web/ce/components/workspace-notifications/sidebar/root.tsx @@ -1,6 +1,6 @@ "use client"; -import { FC } from "react"; +import { FC, useCallback } from "react"; import { observer } from "mobx-react"; import { useParams } from "next/navigation"; // components @@ -13,7 +13,7 @@ import { AppliedFilters, } from "@/components/workspace-notifications"; // constants -import { NOTIFICATION_TABS } from "@/constants/notification"; +import { NOTIFICATION_TABS, TNotificationTab } from "@/constants/notification"; // helpers import { cn } from "@/helpers/common.helper"; import { getNumberCount } from "@/helpers/string.helper"; @@ -38,6 +38,13 @@ export const NotificationsSidebar: FC = observer(() => { const workspace = workspaceSlug ? getWorkspaceBySlug(workspaceSlug.toString()) : undefined; const notificationIds = workspace ? notificationIdsByWorkspaceId(workspace.id) : undefined; + const handleTabClick = useCallback((tabValue: TNotificationTab)=>{ + if(currentSelectedNotificationId !== tabValue) { + setCurrentNotificationTab(tabValue); + } + },[ setCurrentNotificationTab, currentSelectedNotificationId ]); + + if (!workspaceSlug || !workspace) return <>; return ( @@ -57,7 +64,7 @@ export const NotificationsSidebar: FC = observer(() => {
currentNotificationTab != tab.value && setCurrentNotificationTab(tab.value)} + onClick={() => handleTabClick(tab.value)} >