diff --git a/src/entities/home/ui/favorite-wrapper.tsx b/src/entities/home/ui/favorite-wrapper.tsx index 7167f65..9baef29 100644 --- a/src/entities/home/ui/favorite-wrapper.tsx +++ b/src/entities/home/ui/favorite-wrapper.tsx @@ -6,16 +6,8 @@ import { IMAGE_ROOT } from '@/shared/constants/common'; import { UserFavorite } from '@/entities/user/model/types'; import { useStore } from '@/shared/model/store'; import { useTranslation } from 'react-i18next'; +import { showAlert } from '@/widgets/show-alert'; -/* -const items: Array = [ - {img: IMAGE_ROOT + '/ico_menu_01.svg', title: '지급대행'}, - {img: IMAGE_ROOT + '/ico_menu_02.svg', title: '거래내역조회'}, - {img: IMAGE_ROOT + '/ico_menu_03.svg', title: '정산달력'}, - {img: IMAGE_ROOT + '/ico_menu_02.svg', title: '거래내역조회'}, - {img: IMAGE_ROOT + '/ico_menu_03.svg', title: '정산달력'} -]; -*/ export interface FavoriteWrapperProps { usingType: 'home' | 'menu', editMode?: boolean, @@ -33,11 +25,12 @@ export const FavoriteWrapper = ({ }: FavoriteWrapperProps) => { const { navigate } = useNavigate(); const { i18n, t } = useTranslation(); + const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey; const [favoriteItems, setFavoriteItems] = useState>([]); const itemAdd: UserFavorite = { - menuId: 0, + menuId: -1, menuName: t('favorite.edit'), menuNameEng: t('favorite.edit'), iconFilePath: IMAGE_ROOT + '/ico_menu_plus.svg', @@ -49,14 +42,26 @@ export const FavoriteWrapper = ({ setEditMode(true); } }; + const checkGrant = (menuId?: number) => { + const myGrants = menuGrantsByKey['' + menuId]; + if(myGrants?.includes('R') || menuId === -1){ + return true + } + return false; + }; - const onClickToNavigate = (path?: string) => { - if(!!path){ - navigate(path); - if(setMenuOn){ - setMenuOn(false); + const onClickToNavigate = (menuId?: number, path?: string) => { + if(menuId && checkGrant(menuId)){ + if(!!path){ + navigate(path); + if(setMenuOn){ + setMenuOn(false); + } } } + else{ + showAlert('권한이 없습니다.'); + } }; const getFavoriteList = () => { @@ -75,7 +80,7 @@ export const FavoriteWrapper = ({
!editMode && onClickToNavigate(favoriteItems[i]?.programPath) } + onClick={ () => !editMode && onClickToNavigate(favoriteItems[i]?.menuId, favoriteItems[i]?.programPath) } >
{ diff --git a/src/shared/ui/assets/css/style-fix.css b/src/shared/ui/assets/css/style-fix.css index f962389..7998d61 100644 --- a/src/shared/ui/assets/css/style-fix.css +++ b/src/shared/ui/assets/css/style-fix.css @@ -11,7 +11,7 @@ main { width: 100%; height: 100%; background: #fff; - z-index: 999; + z-index: 1010; display: unset; /* overflow-y: auto; */ overflow-y: scroll; @@ -468,4 +468,7 @@ main.pop{ .detail-divider{ margin-left: -16px; margin-right: -16px; +} +.bottomsheet{ + z-index: 1030; } \ No newline at end of file diff --git a/src/shared/ui/toasts/snack-bar.tsx b/src/shared/ui/toasts/snack-bar.tsx index 132cbfa..8834f23 100644 --- a/src/shared/ui/toasts/snack-bar.tsx +++ b/src/shared/ui/toasts/snack-bar.tsx @@ -10,7 +10,7 @@ const StyledSnackBar = styled(ToastContainer)` bottom: 30px; pointer-events: none; margin-bottom: calc(env(safe-area-inset-top) / 3); - z-index: 1000; + z-index: 2000; } .Toastify__toast { pointer-events: none; diff --git a/src/widgets/navigation/footer.tsx b/src/widgets/navigation/footer.tsx index 002963d..72edfef 100644 --- a/src/widgets/navigation/footer.tsx +++ b/src/widgets/navigation/footer.tsx @@ -8,6 +8,8 @@ import { import { useEffect, useState } from 'react'; import { useAppBridge } from '@/hooks'; import { useTranslation } from 'react-i18next'; +import { useStore } from '@/shared/model/store'; +import { showAlert } from '../show-alert'; export const FooterNavigation = ({ setMenuOn, @@ -16,11 +18,26 @@ export const FooterNavigation = ({ }: FooterProps) => { const { navigate } = useNavigate(); const { t } = useTranslation(); + const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey; + const [isFooterOn, setIsFooterOn] = useState(true); - const onClickToNavigate = (path?: string) => { - if(!!path){ - navigate(path); + const checkGrant = (menuId?: number) => { + const myGrants = menuGrantsByKey['' + menuId]; + if(myGrants?.includes('R') || menuId === -1){ + return true + } + return false; + }; + + const onClickToNavigate = (menuId?: number, path?: string) => { + if(menuId && checkGrant(menuId)){ + if(!!path){ + navigate(path); + } + } + else{ + showAlert('권한이 없습니다.'); } }; const onClickToOpenMenu = () => { @@ -33,6 +50,7 @@ export const FooterNavigation = ({ activeIcon: IMAGE_ROOT + '/home-active.svg', inactiveIcon: IMAGE_ROOT + '/home.svg', path: PATHS.home, + menuId: -1, activeKey: FooterItemActiveKey.Home, title: t('footer.home') }, @@ -40,6 +58,7 @@ export const FooterNavigation = ({ activeIcon: IMAGE_ROOT + '/chart-active.svg', inactiveIcon: IMAGE_ROOT + '/chart.svg', path: PATHS.transaction.allTransaction.list, + menuId: 31, activeKey: FooterItemActiveKey.Transaction, title: t('footer.transaction') }, @@ -47,6 +66,7 @@ export const FooterNavigation = ({ activeIcon: IMAGE_ROOT + '/money-active.svg', inactiveIcon: IMAGE_ROOT + '/money.svg', path: PATHS.settlement.list, + menuId: 36, activeKey: FooterItemActiveKey.Settlement, title: t('footer.settlement') }, @@ -54,6 +74,7 @@ export const FooterNavigation = ({ activeIcon: IMAGE_ROOT + '/users-active.svg', inactiveIcon: IMAGE_ROOT + '/users.svg', path: PATHS.account.user.manage, + menuId: 45, activeKey: FooterItemActiveKey.Account, title: t('footer.account') }, @@ -76,7 +97,7 @@ export const FooterNavigation = ({ data-inactive-icon={ buttonItems[i]?.inactiveIcon } onClick={ () => { if(!!buttonItems[i]?.path){ - onClickToNavigate(buttonItems[i]?.path); + onClickToNavigate(buttonItems[i]?.menuId, buttonItems[i]?.path); } else{ onClickToOpenMenu();