즐겨찾기 메뉴 편집 기능 개선

- 즐겨찾기가 1개 남았을 때 해제 방지
- 편집 모드에서 메뉴 클릭 기능 비활성화
- 즐겨찾기 변경 시 모든 카테고리의 체크박스 상태 동기화

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jay Sheen
2025-10-24 10:14:16 +09:00
parent d6bf2537d9
commit edf8ced12c
3 changed files with 16 additions and 5 deletions

View File

@@ -70,7 +70,7 @@ export const FavoriteWrapper = ({
<SwiperSlide key={ `favorite-slide-key-${i}` }>
<div
className="swiper-item"
onClick={ () => onClickToNavigate(favoriteItems[i]?.programPath) }
onClick={ () => !editMode && onClickToNavigate(favoriteItems[i]?.programPath) }
>
<div className="swiper-icon coin-icon">
<img

View File

@@ -13,6 +13,7 @@ export interface MenuCategoryProps {
subMenu?: Array<MenuItem>;
setMenuOn?: (menuOn: boolean) => void;
editMode?: boolean;
changeMenuId?: string;
setChangeMenuId: (menuIdChecked?: string) => void;
buttonRefs: RefObject<Array<HTMLDivElement>>;
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(
<li
key={ `menu-item-key-${i}` }
onClick={ () => onClickToNavigate(subMenu[i]?.programPath) }
>{ subMenu[i]?.menuName }</li>
);
);
}
}

View File

@@ -151,6 +151,7 @@ export const Menu = ({
subMenu={ MenuItems[i]?.subMenu }
setMenuOn={ setMenuOn }
editMode={ editMode }
changeMenuId={ changeMenuId }
setChangeMenuId= { setChangeMenuId }
buttonRefs={ buttonRefs }
itemIndex={ i }