[WEB-2382]chore:notification snooze modal (#6164)

* modified notification store

* notification snooze types fix

* handled promise

* modified notifications layout

* incresed pagination count for notifications
This commit is contained in:
Vamsi Krishna 2024-12-06 16:27:45 +05:30 committed by GitHub
parent 4499a5fa25
commit 666ddf73b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 10 additions and 12 deletions

View file

@ -1,12 +1,12 @@
"use client"; "use client";
// components // components
import { NotificationsSidebar } from "@/plane-web/components/workspace-notifications"; import { NotificationsSidebarRoot } from "@/plane-web/components/workspace-notifications";
export default function ProjectInboxIssuesLayout({ children }: { children: React.ReactNode }) { export default function ProjectInboxIssuesLayout({ children }: { children: React.ReactNode }) {
return ( return (
<div className="relative w-full h-full overflow-hidden flex items-center"> <div className="relative w-full h-full overflow-hidden flex items-center">
<NotificationsSidebar /> <NotificationsSidebarRoot />
<div className="w-full h-full overflow-hidden overflow-y-auto">{children}</div> <div className="w-full h-full overflow-hidden overflow-y-auto">{children}</div>
</div> </div>
); );

View file

@ -21,7 +21,7 @@ import { getNumberCount } from "@/helpers/string.helper";
// hooks // hooks
import { useWorkspace, useWorkspaceNotifications } from "@/hooks/store"; import { useWorkspace, useWorkspaceNotifications } from "@/hooks/store";
export const NotificationsSidebar: FC = observer(() => { export const NotificationsSidebarRoot: FC = observer(() => {
const { workspaceSlug } = useParams(); const { workspaceSlug } = useParams();
// hooks // hooks
const { getWorkspaceBySlug } = useWorkspace(); const { getWorkspaceBySlug } = useWorkspace();
@ -65,7 +65,7 @@ export const NotificationsSidebar: FC = observer(() => {
<div <div
key={tab.value} key={tab.value}
className="h-full px-3 relative cursor-pointer" className="h-full px-3 relative cursor-pointer"
onClick={()=>handleTabClick(tab.value)} onClick={() => handleTabClick(tab.value)}
> >
<div <div
className={cn( className={cn(

View file

@ -17,7 +17,7 @@ import { getDate } from "@/helpers/date-time.helper";
type TNotificationSnoozeModal = { type TNotificationSnoozeModal = {
isOpen: boolean; isOpen: boolean;
onClose: () => void; onClose: () => void;
onSubmit: (dateTime?: Date | undefined) => Promise<TNotification | undefined>; onSubmit: (dateTime?: Date | undefined) => Promise<void>;
}; };
type FormValues = { type FormValues = {

View file

@ -34,25 +34,23 @@ export const NotificationItemSnoozeOption: FC<TNotificationItemSnoozeOption> = o
const handleNotificationSnoozeDate = async (snoozeTill: Date | undefined) => { const handleNotificationSnoozeDate = async (snoozeTill: Date | undefined) => {
if (snoozeTill) { if (snoozeTill) {
try { try {
const response = await snoozeNotification(workspaceSlug, snoozeTill); await snoozeNotification(workspaceSlug, snoozeTill);
setToast({ setToast({
title: "Success!", title: "Success!",
message: "Notification snoozed successfully", message: "Notification snoozed successfully",
type: TOAST_TYPE.SUCCESS, type: TOAST_TYPE.SUCCESS,
}); });
return response;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }
} else { } else {
try { try {
const response = await unSnoozeNotification(workspaceSlug); await unSnoozeNotification(workspaceSlug);
setToast({ setToast({
title: "Success!", title: "Success!",
message: "Notification un snoozed successfully", message: "Notification un snoozed successfully",
type: TOAST_TYPE.SUCCESS, type: TOAST_TYPE.SUCCESS,
}); });
return response;
} catch (e) { } catch (e) {
console.error(e); console.error(e);
} }

View file

@ -62,7 +62,7 @@ export interface IWorkspaceNotificationStore {
export class WorkspaceNotificationStore implements IWorkspaceNotificationStore { export class WorkspaceNotificationStore implements IWorkspaceNotificationStore {
// constants // constants
paginatedCount = 30; paginatedCount = 300;
// observables // observables
loader: TNotificationLoader = undefined; loader: TNotificationLoader = undefined;
unreadNotificationsCount: TUnreadNotificationsCount = { unreadNotificationsCount: TUnreadNotificationsCount = {
@ -84,7 +84,7 @@ export class WorkspaceNotificationStore implements IWorkspaceNotificationStore {
read: false, read: false,
}; };
constructor(private store: CoreRootStore) { constructor(protected store: CoreRootStore) {
makeObservable(this, { makeObservable(this, {
// observables // observables
loader: observable.ref, loader: observable.ref,

View file

@ -0,0 +1 @@
export * from "ce/components/workspace-notifications";

View file

@ -1 +0,0 @@
export {NotificationsSidebar} from 'ce/components/workspace-notifications'