From 4765b6aa5142481dcf7b0bff9b46ec788ea38b64 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 11 Feb 2025 16:12:50 +0530 Subject: [PATCH 1/2] fix: dashboard recent item redirection --- web/core/components/home/widgets/recents/issue.tsx | 5 ++++- web/core/components/home/widgets/recents/page.tsx | 2 +- web/core/components/home/widgets/recents/project.tsx | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/web/core/components/home/widgets/recents/issue.tsx b/web/core/components/home/widgets/recents/issue.tsx index af08942818b..50b19bf11c2 100644 --- a/web/core/components/home/widgets/recents/issue.tsx +++ b/web/core/components/home/widgets/recents/issue.tsx @@ -25,11 +25,14 @@ export const RecentIssue = (props: BlockProps) => { // derived values const issueDetails: TIssueEntityData = activity.entity_data as TIssueEntityData; const state = getStateById(issueDetails?.state); + const workItemLink = `/${workspaceSlug}/projects/${issueDetails.project_id}/${issueDetails ? "epics" : "issues"}/${ + issueDetails.id + }`; return ( diff --git a/web/core/components/home/widgets/recents/page.tsx b/web/core/components/home/widgets/recents/page.tsx index 95f78737ae8..bb0c00bf4fc 100644 --- a/web/core/components/home/widgets/recents/page.tsx +++ b/web/core/components/home/widgets/recents/page.tsx @@ -36,7 +36,7 @@ export const RecentPage = (props: BlockProps) => { return ( diff --git a/web/core/components/home/widgets/recents/project.tsx b/web/core/components/home/widgets/recents/project.tsx index 1663b6bf474..f3708f3a661 100644 --- a/web/core/components/home/widgets/recents/project.tsx +++ b/web/core/components/home/widgets/recents/project.tsx @@ -20,11 +20,12 @@ export const RecentProject = (props: BlockProps) => { const router = useRouter(); // derived values const projectDetails: TProjectEntityData = activity.entity_data as TProjectEntityData; + const projectLink = `/${workspaceSlug}/projects/${projectDetails?.id}/issues`; return ( @@ -69,7 +70,7 @@ export const RecentProject = (props: BlockProps) => { onItemClick={(e) => { e.preventDefault(); e.stopPropagation(); - router.push(`/${workspaceSlug}/projects/${projectDetails?.id}/issues`); + router.push(projectLink); }} /> ); From f2d7217d1907617ce436629252346253cd42f9e0 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Tue, 11 Feb 2025 16:24:36 +0530 Subject: [PATCH 2/2] chore: code refactor --- web/core/components/home/widgets/recents/issue.tsx | 7 ++++--- web/core/components/home/widgets/recents/page.tsx | 3 +++ web/core/components/home/widgets/recents/project.tsx | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/web/core/components/home/widgets/recents/issue.tsx b/web/core/components/home/widgets/recents/issue.tsx index 50b19bf11c2..0c3f9ac6a1b 100644 --- a/web/core/components/home/widgets/recents/issue.tsx +++ b/web/core/components/home/widgets/recents/issue.tsx @@ -24,10 +24,11 @@ export const RecentIssue = (props: BlockProps) => { const { setPeekIssue } = useIssueDetail(); // derived values const issueDetails: TIssueEntityData = activity.entity_data as TIssueEntityData; + + if (!issueDetails) return <>; + const state = getStateById(issueDetails?.state); - const workItemLink = `/${workspaceSlug}/projects/${issueDetails.project_id}/${issueDetails ? "epics" : "issues"}/${ - issueDetails.id - }`; + const workItemLink = `/${workspaceSlug}/projects/${issueDetails?.project_id}/issues/${issueDetails.id}`; return ( { const { getUserDetails } = useMember(); // derived values const pageDetails = activity.entity_data as TPageEntityData; + + if (!pageDetails) return <>; + const ownerDetails = getUserDetails(pageDetails?.owned_by); const pageLink = pageDetails.project_id ? `/${workspaceSlug}/projects/${pageDetails.project_id}/pages/${pageDetails.id}` diff --git a/web/core/components/home/widgets/recents/project.tsx b/web/core/components/home/widgets/recents/project.tsx index f3708f3a661..9321a017f4e 100644 --- a/web/core/components/home/widgets/recents/project.tsx +++ b/web/core/components/home/widgets/recents/project.tsx @@ -20,6 +20,9 @@ export const RecentProject = (props: BlockProps) => { const router = useRouter(); // derived values const projectDetails: TProjectEntityData = activity.entity_data as TProjectEntityData; + + if (!projectDetails) return <>; + const projectLink = `/${workspaceSlug}/projects/${projectDetails?.id}/issues`; return (