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-2382]chore:notification files restructuring (#6181)

Vamsi Krishna134644fdf12a
diff --git a/packages/types/src/workspace-notifications.d.ts b/packages/types/src/workspace-notifications.d.ts
index 7d960015b9..0e0e15af17 100644
--- a/packages/types/src/workspace-notifications.d.ts
+++ b/packages/types/src/workspace-notifications.d.ts
@@ -35,7 +35,7 @@ export type TNotificationData = {
};
export type TNotification = {
- id: string | undefined;
+ id: string;
title: string | undefined;
data: TNotificationData | undefined;
entity_identifier: string | undefined;
diff --git a/web/app/[workspaceSlug]/(projects)/notifications/layout.tsx b/web/app/[workspaceSlug]/(projects)/notifications/layout.tsx
index 7d71948d83..e3d7303636 100644
--- a/web/app/[workspaceSlug]/(projects)/notifications/layout.tsx
+++ b/web/app/[workspaceSlug]/(projects)/notifications/layout.tsx
@@ -1,7 +1,7 @@
"use client";
// components
-import { NotificationsSidebarRoot } from "@/plane-web/components/workspace-notifications";
+import { NotificationsSidebarRoot } from "@/components/workspace-notifications";
export default function ProjectInboxIssuesLayout({ children }: { children: React.ReactNode }) {
return (
diff --git a/web/ce/components/workspace-notifications/index.ts b/web/ce/components/workspace-notifications/index.ts
index c8711b96a4..18c4afa968 100644
--- a/web/ce/components/workspace-notifications/index.ts
+++ b/web/ce/components/workspace-notifications/index.ts
@@ -1 +1 @@
-export * from './root'
\ No newline at end of file
+export * from "./notification-card/root";
diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/root.tsx b/web/ce/components/workspace-notifications/notification-card/root.tsx
similarity index 100%
rename from web/core/components/workspace-notifications/sidebar/notification-card/root.tsx
rename to web/ce/components/workspace-notifications/notification-card/root.tsx
diff --git a/web/core/components/workspace-notifications/index.ts b/web/core/components/workspace-notifications/index.ts
index 2682c9114f..8bc361a7c9 100644
--- a/web/core/components/workspace-notifications/index.ts
+++ b/web/core/components/workspace-notifications/index.ts
@@ -1,2 +1,3 @@
export * from "./notification-app-sidebar-option";
export * from "./sidebar";
+export * from "./root";
diff --git a/web/ce/components/workspace-notifications/root.tsx b/web/core/components/workspace-notifications/root.tsx
similarity index 97%
rename from web/ce/components/workspace-notifications/root.tsx
rename to web/core/components/workspace-notifications/root.tsx
index 35c61263df..fa17060d59 100644
--- a/web/ce/components/workspace-notifications/root.tsx
+++ b/web/core/components/workspace-notifications/root.tsx
@@ -11,7 +11,6 @@ import {
NotificationEmptyState,
NotificationSidebarHeader,
AppliedFilters,
- NotificationCardListRoot,
} from "@/components/workspace-notifications";
// constants
import { NOTIFICATION_TABS, TNotificationTab } 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 NotificationsSidebarRoot: FC = observer(() => {
const { workspaceSlug } = useParams();
// hooks
diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/index.ts b/web/core/components/workspace-notifications/sidebar/notification-card/index.ts
index d4000aa9e7..8c086a5a81 100644
--- a/web/core/components/workspace-notifications/sidebar/notification-card/index.ts
+++ b/web/core/components/workspace-notifications/sidebar/notification-card/index.ts
@@ -1,3 +1,2 @@
-export * from "./root";
export * from "./item";
export * from "./options";
diff --git a/web/core/store/notifications/notification.ts b/web/core/store/notifications/notification.ts
index dff2755fdc..74c0bf38cd 100644
--- a/web/core/store/notifications/notification.ts
+++ b/web/core/store/notifications/notification.ts
@@ -26,7 +26,7 @@ export interface INotification extends TNotification {
export class Notification implements INotification {
// observables
- id: string | undefined = undefined;
+ id: string;
title: string | undefined = undefined;
data: TNotificationData | undefined = undefined;
entity_identifier: string | undefined = undefined;
@@ -54,6 +54,7 @@ export class Notification implements INotification {
private store: CoreRootStore,
private notification: TNotification
) {
+ this.id = this.notification.id;
makeObservable(this, {
// observables
id: observable.ref,
@@ -90,7 +91,6 @@ export class Notification implements INotification {
snoozeNotification: action,
unSnoozeNotification: action,
});
- this.id = this.notification.id;
this.title = this.notification.title;
this.data = this.notification.data;
this.entity_identifier = this.notification.entity_identifier;
@@ -169,8 +169,6 @@ export class Notification implements INotification {
workspaceSlug: string,
payload: Partial<TNotification>
): Promise<TNotification | undefined> => {
- if (!this.id) return undefined;
-
try {
const notification = await workspaceNotificationService.updateNotificationById(workspaceSlug, this.id, payload);
if (notification) {
@@ -188,8 +186,6 @@ export class Notification implements INotification {
* @returns { TNotification | undefined }
*/
markNotificationAsRead = async (workspaceSlug: string): Promise<TNotification | undefined> => {
- if (!this.id) return undefined;
-
const currentNotificationReadAt = this.read_at;
try {
const payload: Partial<TNotification> = {
@@ -215,8 +211,6 @@ export class Notification implements INotification {
* @returns { TNotification | undefined }
*/
markNotificationAsUnRead = async (workspaceSlug: string): Promise<TNotification | undefined> => {
- if (!this.id) return undefined;
-
const currentNotificationReadAt = this.read_at;
try {
const payload: Partial<TNotification> = {
@@ -242,8 +236,6 @@ export class Notification implements INotification {
* @returns { TNotification | undefined }
*/
archiveNotification = async (workspaceSlug: string): Promise<TNotification | undefined> => {
- if (!this.id) return undefined;
-
const currentNotificationArchivedAt = this.archived_at;
try {
const payload: Partial<TNotification> = {
@@ -267,8 +259,6 @@ export class Notification implements INotification {
* @returns { TNotification | undefined }
*/
unArchiveNotification = async (workspaceSlug: string): Promise<TNotification | undefined> => {
- if (!this.id) return undefined;
-
const currentNotificationArchivedAt = this.archived_at;
try {
const payload: Partial<TNotification> = {
@@ -293,8 +283,6 @@ export class Notification implements INotification {
* @returns { TNotification | undefined }
*/
snoozeNotification = async (workspaceSlug: string, snoozeTill: Date): Promise<TNotification | undefined> => {
- if (!this.id) return undefined;
-
const currentNotificationSnoozeTill = this.snoozed_till;
try {
const payload: Partial<TNotification> = {
@@ -315,8 +303,6 @@ export class Notification implements INotification {
* @returns { TNotification | undefined }
*/
unSnoozeNotification = async (workspaceSlug: string): Promise<TNotification | undefined> => {
- if (!this.id) return undefined;
-
const currentNotificationSnoozeTill = this.snoozed_till;
try {
const payload: Partial<TNotification> = {