@@ -3,13 +3,13 @@ import { observer } from "mobx-react";
33import { useParams } from "next/navigation" ;
44import { Earth , Lock } from "lucide-react" ;
55// types
6- import { EViewAccess , EUserPermissions , EUserPermissionsLevel } from "@plane/constants" ;
6+ import { EViewAccess , EUserPermissions , EUserPermissionsLevel , IS_FAVORITE_MENU_OPEN } from "@plane/constants" ;
7+ import { useLocalStorage } from "@plane/hooks" ;
78import { IProjectView } from "@plane/types" ;
89// ui
910import { Tooltip , FavoriteStar } from "@plane/ui" ;
1011// components
1112import { DeleteProjectViewModal , CreateUpdateProjectViewModal , ViewQuickActions } from "@/components/views" ;
12- // constants
1313// helpers
1414import { calculateTotalFilters } from "@/helpers/filter.helper" ;
1515import { getPublishViewLink } from "@/helpers/project-views.helpers" ;
@@ -37,6 +37,12 @@ export const ViewListItemAction: FC<Props> = observer((props) => {
3737 const { addViewToFavorites, removeViewFromFavorites } = useProjectView ( ) ;
3838 const { getUserDetails } = useMember ( ) ;
3939
40+ // local storage
41+ const { setValue : toggleFavoriteMenu , storedValue : isFavoriteOpen } = useLocalStorage < boolean > (
42+ IS_FAVORITE_MENU_OPEN ,
43+ false
44+ ) ;
45+
4046 // derived values
4147 const isEditingAllowed = allowPermissions (
4248 [ EUserPermissions . ADMIN , EUserPermissions . MEMBER ] ,
@@ -50,10 +56,11 @@ export const ViewListItemAction: FC<Props> = observer((props) => {
5056 const publishLink = getPublishViewLink ( view ?. anchor ) ;
5157
5258 // handlers
53- const handleAddToFavorites = ( ) => {
59+ const handleAddToFavorites = async ( ) => {
5460 if ( ! workspaceSlug || ! projectId ) return ;
5561
56- addViewToFavorites ( workspaceSlug . toString ( ) , projectId . toString ( ) , view . id ) ;
62+ await addViewToFavorites ( workspaceSlug . toString ( ) , projectId . toString ( ) , view . id ) ;
63+ if ( ! isFavoriteOpen ) toggleFavoriteMenu ( true ) ;
5764 } ;
5865
5966 const handleRemoveFromFavorites = ( ) => {
0 commit comments