[WEB-2625] chore: workspace favorite and draft improvement (#5855)

* chore: favorite empty state updated

* chore: added draft issue count in workspace members

* chore: workspace draft count improvement

---------

Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
This commit is contained in:
Anmol Singh Bhatia 2024-10-17 17:02:25 +05:30 committed by GitHub
parent d552913171
commit a7b58e4a93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 55 additions and 10 deletions

View file

@ -1,4 +1,5 @@
import { FC, useEffect, useRef } from "react";
import isEmpty from "lodash/isEmpty";
import { observer } from "mobx-react";
// plane helpers
import { useOutsideClickDetector } from "@plane/helpers";
@ -16,8 +17,9 @@ import { SidebarFavoritesMenu } from "@/components/workspace/sidebar/favorites/f
import { cn } from "@/helpers/common.helper";
// hooks
import { useAppTheme, useUserPermissions } from "@/hooks/store";
// plane web components
import { useFavorite } from "@/hooks/store/use-favorite";
import useSize from "@/hooks/use-window-size";
// plane web components
import { SidebarAppSwitcher } from "@/plane-web/components/sidebar";
import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions";
@ -25,6 +27,7 @@ export const AppSidebar: FC = observer(() => {
// store hooks
const { allowPermissions } = useUserPermissions();
const { toggleSidebar, sidebarCollapsed } = useAppTheme();
const { groupedFavorites } = useFavorite();
const windowSize = useSize();
// refs
const ref = useRef<HTMLDivElement>(null);
@ -48,6 +51,8 @@ export const AppSidebar: FC = observer(() => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [windowSize]);
const isFavoriteEmpty = isEmpty(groupedFavorites);
return (
<div
className={cn(
@ -91,7 +96,7 @@ export const AppSidebar: FC = observer(() => {
"opacity-0": !sidebarCollapsed,
})}
/>
{canPerformWorkspaceMemberActions && <SidebarFavoritesMenu />}
{canPerformWorkspaceMemberActions && !isFavoriteEmpty && <SidebarFavoritesMenu />}
<SidebarProjectsList />
</div>