π₯π₯π₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.
TypeScript boardsbug-trackerdjangodockerganttissue-trackerjirajira-alternativekanbanlinearpostgresqlproduct-managementproject-managementproject-planningpythonreactredistypesciptvitework-management
[WEB-2382]chore: notifications code improvement (#6172)
Vamsi Krishnad04619477b72
diff --git a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx b/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsxindex 36302aa5f0..e7bed66881 100644--- a/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx+++ b/web/core/components/workspace-notifications/sidebar/notification-card/options/snooze/modal.tsx@@ -5,7 +5,6 @@ import { useParams } from "next/navigation";import { useForm, Controller } from "react-hook-form";import { X } from "lucide-react";import { Transition, Dialog } from "@headlessui/react";-import { TNotification } from "@plane/types";import { Button, CustomSelect } from "@plane/ui";// componentsimport { DateDropdown } from "@/components/dropdowns";diff --git a/web/core/store/notifications/workspace-notifications.store.ts b/web/core/store/notifications/workspace-notifications.store.tsindex b3ba882035..a0de7bc0f6 100644--- a/web/core/store/notifications/workspace-notifications.store.ts+++ b/web/core/store/notifications/workspace-notifications.store.ts@@ -50,7 +50,7 @@ export interface IWorkspaceNotificationStore {// actionssetCurrentNotificationTab: (tab: TNotificationTab) => void;setCurrentSelectedNotificationId: (notificationId: string | undefined) => void;- setUnreadNotificationsCount: (type: "increment" | "decrement") => void;+ setUnreadNotificationsCount: (type: "increment" | "decrement", newCount?: number) => void;getUnreadNotificationsCount: (workspaceSlug: string) => Promise<TUnreadNotificationsCount | undefined>;getNotifications: (workspaceSlug: string,@@ -285,16 +285,22 @@ export class WorkspaceNotificationStore implements IWorkspaceNotificationStore {* @param { "increment" | "decrement" } type* @returns { void }*/- setUnreadNotificationsCount = (type: "increment" | "decrement"): void => {+ setUnreadNotificationsCount = (type: "increment" | "decrement", newCount: number = 1): void => {+ const validCount = Math.max(0, Math.abs(newCount));+switch (this.currentNotificationTab) {case ENotificationTab.ALL:- update(this.unreadNotificationsCount, "total_unread_notifications_count", (count: 0) =>- type === "increment" ? count + 1 : count - 1+ update(+ this.unreadNotificationsCount,+ "total_unread_notifications_count",+ (count: number) => +Math.max(0, type === "increment" ? count + validCount : count - validCount));break;case ENotificationTab.MENTIONS:- update(this.unreadNotificationsCount, "mention_unread_notifications_count", (count: 0) =>- type === "increment" ? count + 1 : count - 1+ update(+ this.unreadNotificationsCount,+ "mention_unread_notifications_count",+ (count: number) => +Math.max(0, type === "increment" ? count + validCount : count - validCount));break;default: