..
This commit is contained in:
@@ -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<UserFavorite> = [
|
||||
{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<Array<UserFavorite>>([]);
|
||||
|
||||
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) => {
|
||||
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 = ({
|
||||
<SwiperSlide key={ `favorite-slide-key-${i}` }>
|
||||
<div
|
||||
className="swiper-item"
|
||||
onClick={ () => !editMode && onClickToNavigate(favoriteItems[i]?.programPath) }
|
||||
onClick={ () => !editMode && onClickToNavigate(favoriteItems[i]?.menuId, favoriteItems[i]?.programPath) }
|
||||
>
|
||||
<div className="swiper-icon coin-icon">
|
||||
<img
|
||||
|
||||
@@ -18,8 +18,12 @@ import {
|
||||
import { useStore } from '@/shared/model/store';
|
||||
import { UserFavorite } from '@/entities/user/model/types';
|
||||
import { useHomeBannerListMutation } from '@/entities/home/api/use-home-banner-list-mutation';
|
||||
import { BannerList, BannerType, HomeBannerListParams, HomeBannerListResponse } from '@/entities/home/model/types';
|
||||
import { IMAGE_ROOT } from '@/shared/constants/common';
|
||||
import {
|
||||
BannerList,
|
||||
BannerType,
|
||||
HomeBannerListParams,
|
||||
HomeBannerListResponse
|
||||
} from '@/entities/home/model/types';
|
||||
|
||||
export let homeReloadKey = 1;
|
||||
export const setHomeReloadKey = () => {
|
||||
|
||||
@@ -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;
|
||||
@@ -469,3 +469,6 @@ main.pop{
|
||||
margin-left: -16px;
|
||||
margin-right: -16px;
|
||||
}
|
||||
.bottomsheet{
|
||||
z-index: 1030;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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,12 +18,27 @@ export const FooterNavigation = ({
|
||||
}: FooterProps) => {
|
||||
const { navigate } = useNavigate();
|
||||
const { t } = useTranslation();
|
||||
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
||||
|
||||
const [isFooterOn, setIsFooterOn] = useState<boolean>(true);
|
||||
|
||||
const onClickToNavigate = (path?: string) => {
|
||||
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 = () => {
|
||||
setFavoriteEdit(false);
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user