[WEB-1889] fix: handled tapping on a notification in Notifications from mobile in inbox issue and issue peek overview component (#5074)

* fix: handled tapping on a notification in Notifications from mobile in inbox issue and issue peekoverview component

* fix: code cleanup

* fix: code cleanup on workspace notification store

* fix: updated selected notification on workspace notification store
This commit is contained in:
guru_sainath 2024-07-08 18:52:30 +05:30 committed by GitHub
parent a623456e63
commit 7767be2e21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 131 additions and 99 deletions

View file

@ -17,6 +17,7 @@ import { useIssuesStore } from "@/hooks/use-issue-layout-store";
interface IIssuePeekOverview {
embedIssue?: boolean;
embedRemoveCurrentNotification?: () => void;
is_archived?: boolean;
is_draft?: boolean;
}
@ -45,7 +46,7 @@ export type TIssuePeekOperations = {
};
export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
const { embedIssue = false, is_archived = false, is_draft = false } = props;
const { embedIssue = false, embedRemoveCurrentNotification, is_archived = false, is_draft = false } = props;
// router
const pathname = usePathname();
const {
@ -362,6 +363,7 @@ export const IssuePeekOverview: FC<IIssuePeekOverview> = observer((props) => {
is_archived={is_archived}
disabled={!isEditable}
embedIssue={embedIssue}
embedRemoveCurrentNotification={embedRemoveCurrentNotification}
issueOperations={issueOperations}
/>
);

View file

@ -30,6 +30,7 @@ interface IIssueView {
is_archived: boolean;
disabled?: boolean;
embedIssue?: boolean;
embedRemoveCurrentNotification?: () => void;
issueOperations: TIssueOperations;
}
@ -43,6 +44,7 @@ export const IssueView: FC<IIssueView> = observer((props) => {
is_archived,
disabled = false,
embedIssue = false,
embedRemoveCurrentNotification,
issueOperations,
} = props;
// states
@ -64,13 +66,16 @@ export const IssueView: FC<IIssueView> = observer((props) => {
// remove peek id
const removeRoutePeekId = () => {
setPeekIssue(undefined);
if (embedIssue) embedRemoveCurrentNotification && embedRemoveCurrentNotification();
};
usePeekOverviewOutsideClickDetector(
issuePeekOverviewRef,
() => {
if (!isAnyModalOpen) {
removeRoutePeekId();
if (!embedIssue) {
if (!isAnyModalOpen) {
removeRoutePeekId();
}
}
},
issueId
@ -86,7 +91,7 @@ export const IssueView: FC<IIssueView> = observer((props) => {
}
};
useKeypress("Escape", handleKeyDown);
useKeypress("Escape", () => !embedIssue && handleKeyDown());
const handleRestore = async () => {
if (!issueOperations.restore) return;