π₯π₯π₯ Open-source Jira, Linear, Monday, and ClickUp alternative. Plane is a modern project management platform to manage tasks, sprints, docs, and triage.
TypeScript boardsbug-trackerdjangodockerganttissue-trackerjirajira-alternativekanbanlinearpostgresqlproduct-managementproject-managementproject-planningpythonreactredistypesciptvitework-management
[WEB-2221] fix: app sidebar and favorites improvement (#5357)
Anmol Singh Bhatiad9c9d85d385d
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.tsxindex d8fc0d0b3b..5b25b858a4 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> = (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 (- <Link href={href} className={isSidebarCollapsed ? collapsedClass : linkClass} draggable>+ <Link href={href} className={isSidebarCollapsed ? collapsedClass : linkClass} draggable onClick={handleOnClick}><span className="flex items-center justify-center size-5">{icon}</span>{!isSidebarCollapsed && <span className="text-sm leading-5 font-medium flex-1 truncate">{title}</span>}</Link>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.tsxindex 8f7fb9859e..e2f303afe7 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<string, string> = {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}`;};diff --git a/web/core/components/workspace/sidebar/favorites/favorite-items/root.tsx b/web/core/components/workspace/sidebar/favorites/favorite-items/root.tsxindex b001b7f69d..cb9449f94e 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<Props> = observer((props) => {<><FavoriteItemWrapper elementRef={elementRef} isMenuActive={isMenuActive} sidebarCollapsed={sidebarCollapsed}>{!sidebarCollapsed && <FavoriteItemDragHandle isDragging={isDragging} sort_order={favorite.sort_order} />}- <FavoriteItemTitle href={itemLink} icon={itemIcon} title={itemTitle} isSidebarCollapsed={!!sidebarCollapsed} />+ <FavoriteItemTitle+ href={itemLink}+ projectId={favorite.project_id}+ icon={itemIcon}+ title={itemTitle}+ isSidebarCollapsed={!!sidebarCollapsed}+ />{!sidebarCollapsed && (<FavoriteItemQuickActionfavorite={favorite}diff --git a/web/core/components/workspace/sidebar/projects-list-item.tsx b/web/core/components/workspace/sidebar/projects-list-item.tsxindex ea52fc29b6..a9fdb002a2 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<Props> = observer((props) => {useEffect(() => {if (URLProjectId === project.id) setIsProjectListOpen(true);+ else setIsProjectListOpen(false);}, [URLProjectId]);return (@@ -291,6 +292,7 @@ export const SidebarProjectsListItem: React.FC<Props> = observer((props) => {"p-0 size-8 aspect-square justify-center mx-auto": isSidebarCollapsed,})}+ id={`${project?.id}`}>{!disableDrag && (<Tooltipdiff --git a/web/core/hooks/use-favorite-item-details.tsx b/web/core/hooks/use-favorite-item-details.tsxindex 6e5c3b98de..8bf17b8a78 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 hooksconst { getViewById } = useProjectView();- const { currentProjectDetails } = useProject();+ const { getProjectById } = useProject();const { getCycleById } = useCycle();const { getModuleById } = useModule();@@ -23,6 +23,8 @@ export const useFavoriteItemDetails = (workspaceSlug: string, favorite: IFavoritconst cycleDetail = getCycleById(favoriteItemId ?? "");const moduleDetail = getModuleById(favoriteItemId ?? "");+ const currentProjectDetails = getProjectById(favorite.project_id ?? "");+let itemIcon;let itemTitle;const itemLink = generateFavoriteItemLink(workspaceSlug.toString(), favorite);