From 9e0bd99aa48c07e284fa86d6368741c21d7483c0 Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Mon, 12 Aug 2024 19:00:11 +0530 Subject: [PATCH 1/4] fix: project collapsible toggle --- web/core/components/workspace/sidebar/projects-list-item.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web/core/components/workspace/sidebar/projects-list-item.tsx b/web/core/components/workspace/sidebar/projects-list-item.tsx index ea52fc29b6f..a9fdb002a29 100644 --- a/web/core/components/workspace/sidebar/projects-list-item.tsx +++ b/web/core/components/workspace/sidebar/projects-list-item.tsx @@ -269,6 +269,7 @@ export const SidebarProjectsListItem: React.FC = observer((props) => { useEffect(() => { if (URLProjectId === project.id) setIsProjectListOpen(true); + else setIsProjectListOpen(false); }, [URLProjectId]); return ( @@ -291,6 +292,7 @@ export const SidebarProjectsListItem: React.FC = observer((props) => { "p-0 size-8 aspect-square justify-center mx-auto": isSidebarCollapsed, } )} + id={`${project?.id}`} > {!disableDrag && ( Date: Mon, 12 Aug 2024 19:02:39 +0530 Subject: [PATCH 2/4] fix: project favorite redirection --- .../sidebar/favorites/favorite-items/common/helper.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/core/components/workspace/sidebar/favorites/favorite-items/common/helper.tsx b/web/core/components/workspace/sidebar/favorites/favorite-items/common/helper.tsx index 8f7fb9859e2..e2f303afe78 100644 --- a/web/core/components/workspace/sidebar/favorites/favorite-items/common/helper.tsx +++ b/web/core/components/workspace/sidebar/favorites/favorite-items/common/helper.tsx @@ -44,6 +44,6 @@ const entityPaths: Record = { export const generateFavoriteItemLink = (workspaceSlug: string, favorite: IFavorite) => { const entityPath = entityPaths[favorite.entity_type]; return entityPath - ? `/${workspaceSlug}/projects/${favorite.project_id}/${entityPath}/${favorite.entity_identifier || ""}` + ? `/${workspaceSlug}/projects/${favorite.project_id}/${entityPath}/${entityPath === "issues" ? "" : favorite.entity_identifier || ""}` : `/${workspaceSlug}`; }; From 19d2c7f153f819a2e1901d0abec5940546b4312c Mon Sep 17 00:00:00 2001 From: Anmol Singh Bhatia Date: Mon, 12 Aug 2024 19:03:10 +0530 Subject: [PATCH 3/4] chore: favorite redirection scroll into view implementation --- .../favorite-items/common/favorite-item-title.tsx | 12 ++++++++++-- .../sidebar/favorites/favorite-items/root.tsx | 8 +++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-title.tsx b/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-title.tsx index d8fc0d0b3bf..5b25b858a49 100644 --- a/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-title.tsx +++ b/web/core/components/workspace/sidebar/favorites/favorite-items/common/favorite-item-title.tsx @@ -3,6 +3,7 @@ import React, { FC } from "react"; import Link from "next/link"; type Props = { + projectId: string | null; href: string; title: string; icon: JSX.Element; @@ -10,14 +11,21 @@ type Props = { }; export const FavoriteItemTitle: FC = (props) => { - const { href, title, icon, isSidebarCollapsed } = props; + const { projectId, href, title, icon, isSidebarCollapsed } = props; const linkClass = "flex items-center gap-1.5 truncate w-full"; const collapsedClass = "group/project-item cursor-pointer relative group w-full flex items-center justify-center gap-1.5 rounded px-2 py-1 outline-none text-custom-sidebar-text-200 hover:bg-custom-sidebar-background-90 active:bg-custom-sidebar-background-90 truncate p-0 size-8 aspect-square mx-auto"; + const handleOnClick = () => { + if (projectId) { + const projectItem = document.getElementById(`${projectId}`); + projectItem?.scrollIntoView({ behavior: "smooth" }); + } + }; + return ( - + {icon} {!isSidebarCollapsed && {title}} diff --git a/web/core/components/workspace/sidebar/favorites/favorite-items/root.tsx b/web/core/components/workspace/sidebar/favorites/favorite-items/root.tsx index b001b7f69de..cb9449f94ea 100644 --- a/web/core/components/workspace/sidebar/favorites/favorite-items/root.tsx +++ b/web/core/components/workspace/sidebar/favorites/favorite-items/root.tsx @@ -90,7 +90,13 @@ export const FavoriteRoot: FC = observer((props) => { <> {!sidebarCollapsed && } - + {!sidebarCollapsed && ( Date: Tue, 13 Aug 2024 20:21:13 +0530 Subject: [PATCH 4/4] fix: use favorite item details project details --- web/core/hooks/use-favorite-item-details.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/core/hooks/use-favorite-item-details.tsx b/web/core/hooks/use-favorite-item-details.tsx index 6e5c3b98def..8bf17b8a785 100644 --- a/web/core/hooks/use-favorite-item-details.tsx +++ b/web/core/hooks/use-favorite-item-details.tsx @@ -13,7 +13,7 @@ export const useFavoriteItemDetails = (workspaceSlug: string, favorite: IFavorit // store hooks const { getViewById } = useProjectView(); - const { currentProjectDetails } = useProject(); + const { getProjectById } = useProject(); const { getCycleById } = useCycle(); const { getModuleById } = useModule(); @@ -23,6 +23,8 @@ export const useFavoriteItemDetails = (workspaceSlug: string, favorite: IFavorit const cycleDetail = getCycleById(favoriteItemId ?? ""); const moduleDetail = getModuleById(favoriteItemId ?? ""); + const currentProjectDetails = getProjectById(favorite.project_id ?? ""); + let itemIcon; let itemTitle; const itemLink = generateFavoriteItemLink(workspaceSlug.toString(), favorite);