..
This commit is contained in:
@@ -6,16 +6,8 @@ import { IMAGE_ROOT } from '@/shared/constants/common';
|
|||||||
import { UserFavorite } from '@/entities/user/model/types';
|
import { UserFavorite } from '@/entities/user/model/types';
|
||||||
import { useStore } from '@/shared/model/store';
|
import { useStore } from '@/shared/model/store';
|
||||||
import { useTranslation } from 'react-i18next';
|
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 {
|
export interface FavoriteWrapperProps {
|
||||||
usingType: 'home' | 'menu',
|
usingType: 'home' | 'menu',
|
||||||
editMode?: boolean,
|
editMode?: boolean,
|
||||||
@@ -33,11 +25,12 @@ export const FavoriteWrapper = ({
|
|||||||
}: FavoriteWrapperProps) => {
|
}: FavoriteWrapperProps) => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
const { i18n, t } = useTranslation();
|
const { i18n, t } = useTranslation();
|
||||||
|
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
||||||
|
|
||||||
const [favoriteItems, setFavoriteItems] = useState<Array<UserFavorite>>([]);
|
const [favoriteItems, setFavoriteItems] = useState<Array<UserFavorite>>([]);
|
||||||
|
|
||||||
const itemAdd: UserFavorite = {
|
const itemAdd: UserFavorite = {
|
||||||
menuId: 0,
|
menuId: -1,
|
||||||
menuName: t('favorite.edit'),
|
menuName: t('favorite.edit'),
|
||||||
menuNameEng: t('favorite.edit'),
|
menuNameEng: t('favorite.edit'),
|
||||||
iconFilePath: IMAGE_ROOT + '/ico_menu_plus.svg',
|
iconFilePath: IMAGE_ROOT + '/ico_menu_plus.svg',
|
||||||
@@ -49,14 +42,26 @@ export const FavoriteWrapper = ({
|
|||||||
setEditMode(true);
|
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(!!path){
|
if(menuId && checkGrant(menuId)){
|
||||||
navigate(path);
|
if(!!path){
|
||||||
if(setMenuOn){
|
navigate(path);
|
||||||
setMenuOn(false);
|
if(setMenuOn){
|
||||||
|
setMenuOn(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else{
|
||||||
|
showAlert('권한이 없습니다.');
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFavoriteList = () => {
|
const getFavoriteList = () => {
|
||||||
@@ -75,7 +80,7 @@ export const FavoriteWrapper = ({
|
|||||||
<SwiperSlide key={ `favorite-slide-key-${i}` }>
|
<SwiperSlide key={ `favorite-slide-key-${i}` }>
|
||||||
<div
|
<div
|
||||||
className="swiper-item"
|
className="swiper-item"
|
||||||
onClick={ () => !editMode && onClickToNavigate(favoriteItems[i]?.programPath) }
|
onClick={ () => !editMode && onClickToNavigate(favoriteItems[i]?.menuId, favoriteItems[i]?.programPath) }
|
||||||
>
|
>
|
||||||
<div className="swiper-icon coin-icon">
|
<div className="swiper-icon coin-icon">
|
||||||
<img
|
<img
|
||||||
|
|||||||
@@ -18,8 +18,12 @@ import {
|
|||||||
import { useStore } from '@/shared/model/store';
|
import { useStore } from '@/shared/model/store';
|
||||||
import { UserFavorite } from '@/entities/user/model/types';
|
import { UserFavorite } from '@/entities/user/model/types';
|
||||||
import { useHomeBannerListMutation } from '@/entities/home/api/use-home-banner-list-mutation';
|
import { useHomeBannerListMutation } from '@/entities/home/api/use-home-banner-list-mutation';
|
||||||
import { BannerList, BannerType, HomeBannerListParams, HomeBannerListResponse } from '@/entities/home/model/types';
|
import {
|
||||||
import { IMAGE_ROOT } from '@/shared/constants/common';
|
BannerList,
|
||||||
|
BannerType,
|
||||||
|
HomeBannerListParams,
|
||||||
|
HomeBannerListResponse
|
||||||
|
} from '@/entities/home/model/types';
|
||||||
|
|
||||||
export let homeReloadKey = 1;
|
export let homeReloadKey = 1;
|
||||||
export const setHomeReloadKey = () => {
|
export const setHomeReloadKey = () => {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ main {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
z-index: 999;
|
z-index: 1010;
|
||||||
display: unset;
|
display: unset;
|
||||||
/* overflow-y: auto; */
|
/* overflow-y: auto; */
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
@@ -468,4 +468,7 @@ main.pop{
|
|||||||
.detail-divider{
|
.detail-divider{
|
||||||
margin-left: -16px;
|
margin-left: -16px;
|
||||||
margin-right: -16px;
|
margin-right: -16px;
|
||||||
|
}
|
||||||
|
.bottomsheet{
|
||||||
|
z-index: 1030;
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ const StyledSnackBar = styled(ToastContainer)`
|
|||||||
bottom: 30px;
|
bottom: 30px;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
margin-bottom: calc(env(safe-area-inset-top) / 3);
|
margin-bottom: calc(env(safe-area-inset-top) / 3);
|
||||||
z-index: 1000;
|
z-index: 2000;
|
||||||
}
|
}
|
||||||
.Toastify__toast {
|
.Toastify__toast {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import {
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useAppBridge } from '@/hooks';
|
import { useAppBridge } from '@/hooks';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useStore } from '@/shared/model/store';
|
||||||
|
import { showAlert } from '../show-alert';
|
||||||
|
|
||||||
export const FooterNavigation = ({
|
export const FooterNavigation = ({
|
||||||
setMenuOn,
|
setMenuOn,
|
||||||
@@ -16,11 +18,26 @@ export const FooterNavigation = ({
|
|||||||
}: FooterProps) => {
|
}: FooterProps) => {
|
||||||
const { navigate } = useNavigate();
|
const { navigate } = useNavigate();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const menuGrantsByKey = useStore.getState().UserStore.menuGrantsByKey;
|
||||||
|
|
||||||
const [isFooterOn, setIsFooterOn] = useState<boolean>(true);
|
const [isFooterOn, setIsFooterOn] = useState<boolean>(true);
|
||||||
|
|
||||||
const onClickToNavigate = (path?: string) => {
|
const checkGrant = (menuId?: number) => {
|
||||||
if(!!path){
|
const myGrants = menuGrantsByKey['' + menuId];
|
||||||
navigate(path);
|
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 = () => {
|
const onClickToOpenMenu = () => {
|
||||||
@@ -33,6 +50,7 @@ export const FooterNavigation = ({
|
|||||||
activeIcon: IMAGE_ROOT + '/home-active.svg',
|
activeIcon: IMAGE_ROOT + '/home-active.svg',
|
||||||
inactiveIcon: IMAGE_ROOT + '/home.svg',
|
inactiveIcon: IMAGE_ROOT + '/home.svg',
|
||||||
path: PATHS.home,
|
path: PATHS.home,
|
||||||
|
menuId: -1,
|
||||||
activeKey: FooterItemActiveKey.Home,
|
activeKey: FooterItemActiveKey.Home,
|
||||||
title: t('footer.home')
|
title: t('footer.home')
|
||||||
},
|
},
|
||||||
@@ -40,6 +58,7 @@ export const FooterNavigation = ({
|
|||||||
activeIcon: IMAGE_ROOT + '/chart-active.svg',
|
activeIcon: IMAGE_ROOT + '/chart-active.svg',
|
||||||
inactiveIcon: IMAGE_ROOT + '/chart.svg',
|
inactiveIcon: IMAGE_ROOT + '/chart.svg',
|
||||||
path: PATHS.transaction.allTransaction.list,
|
path: PATHS.transaction.allTransaction.list,
|
||||||
|
menuId: 31,
|
||||||
activeKey: FooterItemActiveKey.Transaction,
|
activeKey: FooterItemActiveKey.Transaction,
|
||||||
title: t('footer.transaction')
|
title: t('footer.transaction')
|
||||||
},
|
},
|
||||||
@@ -47,6 +66,7 @@ export const FooterNavigation = ({
|
|||||||
activeIcon: IMAGE_ROOT + '/money-active.svg',
|
activeIcon: IMAGE_ROOT + '/money-active.svg',
|
||||||
inactiveIcon: IMAGE_ROOT + '/money.svg',
|
inactiveIcon: IMAGE_ROOT + '/money.svg',
|
||||||
path: PATHS.settlement.list,
|
path: PATHS.settlement.list,
|
||||||
|
menuId: 36,
|
||||||
activeKey: FooterItemActiveKey.Settlement,
|
activeKey: FooterItemActiveKey.Settlement,
|
||||||
title: t('footer.settlement')
|
title: t('footer.settlement')
|
||||||
},
|
},
|
||||||
@@ -54,6 +74,7 @@ export const FooterNavigation = ({
|
|||||||
activeIcon: IMAGE_ROOT + '/users-active.svg',
|
activeIcon: IMAGE_ROOT + '/users-active.svg',
|
||||||
inactiveIcon: IMAGE_ROOT + '/users.svg',
|
inactiveIcon: IMAGE_ROOT + '/users.svg',
|
||||||
path: PATHS.account.user.manage,
|
path: PATHS.account.user.manage,
|
||||||
|
menuId: 45,
|
||||||
activeKey: FooterItemActiveKey.Account,
|
activeKey: FooterItemActiveKey.Account,
|
||||||
title: t('footer.account')
|
title: t('footer.account')
|
||||||
},
|
},
|
||||||
@@ -76,7 +97,7 @@ export const FooterNavigation = ({
|
|||||||
data-inactive-icon={ buttonItems[i]?.inactiveIcon }
|
data-inactive-icon={ buttonItems[i]?.inactiveIcon }
|
||||||
onClick={ () => {
|
onClick={ () => {
|
||||||
if(!!buttonItems[i]?.path){
|
if(!!buttonItems[i]?.path){
|
||||||
onClickToNavigate(buttonItems[i]?.path);
|
onClickToNavigate(buttonItems[i]?.menuId, buttonItems[i]?.path);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
onClickToOpenMenu();
|
onClickToOpenMenu();
|
||||||
|
|||||||
Reference in New Issue
Block a user