[WEB-4094]chore: workspace notifications refactor (#7061)
* chore: workspace notifications refactor * fix: url params * fix: added null checks to avoid run time errors * fix: notifications header color fix
This commit is contained in:
parent
1f1b421735
commit
07e937cd8e
13 changed files with 273 additions and 208 deletions
25
web/ce/hooks/use-notification-preview.tsx
Normal file
25
web/ce/hooks/use-notification-preview.tsx
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import { EIssueServiceType } from "@plane/constants";
|
||||
import { IWorkItemPeekOverview } from "@plane/types";
|
||||
import { IssuePeekOverview } from "@/components/issues";
|
||||
import { useIssueDetail } from "@/hooks/store";
|
||||
import { TPeekIssue } from "@/store/issue/issue-details/root.store";
|
||||
|
||||
export type TNotificationPreview = {
|
||||
isWorkItem: boolean;
|
||||
PeekOverviewComponent: React.ComponentType<IWorkItemPeekOverview>;
|
||||
setPeekWorkItem: (peekIssue: TPeekIssue | undefined) => void;
|
||||
};
|
||||
|
||||
/**
|
||||
* This function returns if the current active notification is related to work item or an epic.
|
||||
* @returns isWorkItem: boolean, peekOverviewComponent: IWorkItemPeekOverview, setPeekWorkItem
|
||||
*/
|
||||
export const useNotificationPreview = (): TNotificationPreview => {
|
||||
const { peekIssue, setPeekIssue } = useIssueDetail(EIssueServiceType.ISSUES);
|
||||
|
||||
return {
|
||||
isWorkItem: Boolean(peekIssue),
|
||||
PeekOverviewComponent: IssuePeekOverview,
|
||||
setPeekWorkItem: setPeekIssue,
|
||||
};
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue