From edf8ced12c46c78e424f9b04877097cad3c763c4 Mon Sep 17 00:00:00 2001 From: Jay Sheen Date: Fri, 24 Oct 2025 10:14:16 +0900 Subject: [PATCH] =?UTF-8?q?=EC=A6=90=EA=B2=A8=EC=B0=BE=EA=B8=B0=20?= =?UTF-8?q?=EB=A9=94=EB=89=B4=20=ED=8E=B8=EC=A7=91=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 즐겨찾기가 1개 남았을 때 해제 방지 - 편집 모드에서 메뉴 클릭 기능 비활성화 - 즐겨찾기 변경 시 모든 카테고리의 체크박스 상태 동기화 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/entities/home/ui/favorite-wrapper.tsx | 2 +- src/entities/menu/ui/menu-category.tsx | 18 ++++++++++++++---- src/shared/ui/menu/index.tsx | 1 + 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/entities/home/ui/favorite-wrapper.tsx b/src/entities/home/ui/favorite-wrapper.tsx index c214c53..f5824e3 100644 --- a/src/entities/home/ui/favorite-wrapper.tsx +++ b/src/entities/home/ui/favorite-wrapper.tsx @@ -70,7 +70,7 @@ export const FavoriteWrapper = ({
onClickToNavigate(favoriteItems[i]?.programPath) } + onClick={ () => !editMode && onClickToNavigate(favoriteItems[i]?.programPath) } >
; setMenuOn?: (menuOn: boolean) => void; editMode?: boolean; + changeMenuId?: string; setChangeMenuId: (menuIdChecked?: string) => void; buttonRefs: RefObject>; itemIndex: number; @@ -25,6 +26,7 @@ export const MenuCategory = ({ subMenu, setMenuOn, editMode, + changeMenuId, setChangeMenuId, buttonRefs, itemIndex @@ -68,6 +70,11 @@ export const MenuCategory = ({ ]; } else{ + // 즐겨찾기가 1개 남았을 때는 해제하지 않음 + if(userFavorite.length <= 1){ + callFavoiteItems(); + return; + } userFavorite = userFavorite.filter((value, _) => { return value.menuId !== menuId }); @@ -76,7 +83,7 @@ export const MenuCategory = ({ setChangeMenuId(`${menuId}-${checked}`); callFavoiteItems(); // if(location.pathname === PATHS.home){ - + // } }; @@ -93,11 +100,15 @@ export const MenuCategory = ({ callFavoiteItems(); }, []); + useEffect(() => { + callFavoiteItems(); + }, [changeMenuId]); + useEffect(() => { if(menuIds.length > 0) { // callShortcutSave(); } - + }, [menuIds]); const getMenuItems = () => { @@ -138,9 +149,8 @@ export const MenuCategory = ({ rs.push(
  • onClickToNavigate(subMenu[i]?.programPath) } >{ subMenu[i]?.menuName }
  • - ); + ); } } diff --git a/src/shared/ui/menu/index.tsx b/src/shared/ui/menu/index.tsx index b7a74f7..0e0a45a 100644 --- a/src/shared/ui/menu/index.tsx +++ b/src/shared/ui/menu/index.tsx @@ -151,6 +151,7 @@ export const Menu = ({ subMenu={ MenuItems[i]?.subMenu } setMenuOn={ setMenuOn } editMode={ editMode } + changeMenuId={ changeMenuId } setChangeMenuId= { setChangeMenuId } buttonRefs={ buttonRefs } itemIndex={ i }