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 5b25b858a49..dfa939ce352 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 @@ -1,6 +1,9 @@ "use client"; import React, { FC } from "react"; +import { observer } from "mobx-react"; import Link from "next/link"; +import { useAppTheme } from "@/hooks/store"; +import { usePlatformOS } from "@/hooks/use-platform-os"; type Props = { projectId: string | null; @@ -10,8 +13,11 @@ type Props = { isSidebarCollapsed: boolean; }; -export const FavoriteItemTitle: FC = (props) => { +export const FavoriteItemTitle: FC = observer((props) => { const { projectId, href, title, icon, isSidebarCollapsed } = props; + // store hooks + const { toggleSidebar } = useAppTheme(); + const { isMobile } = usePlatformOS(); const linkClass = "flex items-center gap-1.5 truncate w-full"; const collapsedClass = @@ -22,6 +28,7 @@ export const FavoriteItemTitle: FC = (props) => { const projectItem = document.getElementById(`${projectId}`); projectItem?.scrollIntoView({ behavior: "smooth" }); } + if (isMobile) toggleSidebar(); }; return ( @@ -30,4 +37,4 @@ export const FavoriteItemTitle: FC = (props) => { {!isSidebarCollapsed && {title}} ); -}; +}); diff --git a/web/core/components/workspace/sidebar/projects-list-item.tsx b/web/core/components/workspace/sidebar/projects-list-item.tsx index 5feada1a8f4..edfbca401e4 100644 --- a/web/core/components/workspace/sidebar/projects-list-item.tsx +++ b/web/core/components/workspace/sidebar/projects-list-item.tsx @@ -8,7 +8,7 @@ import { setCustomNativeDragPreview } from "@atlaskit/pragmatic-drag-and-drop/el import { attachInstruction, extractInstruction } from "@atlaskit/pragmatic-drag-and-drop-hitbox/tree-item"; import { observer } from "mobx-react"; import Link from "next/link"; -import { useParams, usePathname } from "next/navigation"; +import { useParams, usePathname, useRouter } from "next/navigation"; import { createRoot } from "react-dom/client"; import { PenSquare, @@ -35,6 +35,7 @@ import { DropIndicator, DragHandle, Intake, + ControlLink, } from "@plane/ui"; // components import { Logo } from "@/components/common"; @@ -126,7 +127,8 @@ export const SidebarProjectsListItem: React.FC = observer((props) => { const actionSectionRef = useRef(null); const projectRef = useRef(null); const dragHandleRef = useRef(null); - // router params + // router + const router = useRouter(); const { workspaceSlug, projectId: URLProjectId } = useParams(); // pathname const pathname = usePathname(); @@ -281,11 +283,16 @@ export const SidebarProjectsListItem: React.FC = observer((props) => { else setIsProjectListOpen(false); }, [URLProjectId]); + const handleItemClick = () => { + if (!isProjectListOpen && !isMobile) router.push(`/${workspaceSlug}/projects/${project.id}/issues`); + setIsProjectListOpen((prev) => !prev); + }; + return ( <> setPublishModal(false)} /> setLeaveProjectModal(false)} /> - +
= observer((props) => { )} {isSidebarCollapsed ? ( - - setIsProjectListOpen(!isProjectListOpen)} - > +
- + ) : ( <> = observer((props) => { disabled={!isSidebarCollapsed} isMobile={isMobile} > - + setIsProjectListOpen(!isProjectListOpen)} >

{project.name}

- +