chore: app sidebar behaviour (#5964)

This commit is contained in:
Anmol Singh Bhatia
2024-11-06 18:36:23 +05:30
committed by GitHub
parent e19cb012be
commit eebc327b10
3 changed files with 2 additions and 14 deletions

View File

@@ -6,7 +6,6 @@ import { useAppTheme } from "@/hooks/store";
import { usePlatformOS } from "@/hooks/use-platform-os";
type Props = {
projectId: string | null;
href: string;
title: string;
icon: JSX.Element;
@@ -14,7 +13,7 @@ type Props = {
};
export const FavoriteItemTitle: FC<Props> = observer((props) => {
const { projectId, href, title, icon, isSidebarCollapsed } = props;
const { href, title, icon, isSidebarCollapsed } = props;
// store hooks
const { toggleSidebar } = useAppTheme();
const { isMobile } = usePlatformOS();
@@ -24,10 +23,6 @@ export const FavoriteItemTitle: FC<Props> = observer((props) => {
"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" });
}
if (isMobile) toggleSidebar();
};

View File

@@ -91,13 +91,7 @@ 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}
projectId={favorite.project_id}
icon={itemIcon}
title={itemTitle}
isSidebarCollapsed={!!sidebarCollapsed}
/>
<FavoriteItemTitle href={itemLink} icon={itemIcon} title={itemTitle} isSidebarCollapsed={!!sidebarCollapsed} />
{!sidebarCollapsed && (
<FavoriteItemQuickAction
favorite={favorite}

View File

@@ -287,7 +287,6 @@ export const SidebarProjectsListItem: React.FC<Props> = observer((props) => {
useEffect(() => {
if (URLProjectId === project.id) setIsProjectListOpen(true);
else setIsProjectListOpen(false);
}, [URLProjectId]);
const handleItemClick = () => {