diff --git a/src/entities/menu/model/types.ts b/src/entities/menu/model/types.ts index 75276de..9b5258e 100644 --- a/src/entities/menu/model/types.ts +++ b/src/entities/menu/model/types.ts @@ -16,6 +16,4 @@ export interface MenuCategoryProps { setMenuOn?: (menuOn: boolean) => void; editMode?: boolean; setChangeMenuId: (menuId?: string) => void; - buttonRef: any - btnRef?: any; }; diff --git a/src/entities/menu/ui/menu-category.tsx b/src/entities/menu/ui/menu-category.tsx index cd794c5..a0237de 100644 --- a/src/entities/menu/ui/menu-category.tsx +++ b/src/entities/menu/ui/menu-category.tsx @@ -12,8 +12,7 @@ export const MenuCategory = ({ subMenu, setMenuOn, editMode, - setChangeMenuId, - buttonRef,btnRef + setChangeMenuId }: MenuCategoryProps) => { const { navigate } = useNavigate(); @@ -40,7 +39,7 @@ export const MenuCategory = ({ ...userFavorite, { title: title, - img: IMAGE_ROOT + '/ico_menu_0'+randomNum+'.svg', + img: `${IMAGE_ROOT}/ico_menu_0${randomNum}.svg`, path: path, menuId: menuId } @@ -106,7 +105,6 @@ export const MenuCategory = ({
  • onClickToNavigate(subMenu[i]?.path) } - >{ subMenu[i]?.menuName }
  • ); } @@ -119,13 +117,8 @@ export const MenuCategory = ({ return ( <> -
    -
    +
    +
    { menuName }
    diff --git a/src/entities/merchant/model/types.ts b/src/entities/merchant/model/types.ts index a358678..d25b28b 100644 --- a/src/entities/merchant/model/types.ts +++ b/src/entities/merchant/model/types.ts @@ -54,7 +54,7 @@ export enum InfoWrapKeys { Escrow = 'Escrow' }; export interface MerchantMidParams { - mid: string; + mid?: string; }; export interface MerchantMidResponse { memberCompanyId?: string; @@ -82,7 +82,7 @@ export interface MerchantMidResponse { accountHolderName?: string; }; export interface MerchantMidStatusParams { - mid: string; + mid?: string; }; export interface MerchantMidStatusResponse { onlineInfomation: OnlineInfomation; diff --git a/src/entities/merchant/ui/info-wrap.tsx b/src/entities/merchant/ui/info-wrap.tsx index aaf9c49..048394c 100644 --- a/src/entities/merchant/ui/info-wrap.tsx +++ b/src/entities/merchant/ui/info-wrap.tsx @@ -8,35 +8,51 @@ import { MerchantMidParams, MerchantMidResponse } from '../model/types'; +import { useStore } from '@/shared/model/store'; export const InfoWrap = () => { + const userMids = useStore.getState().UserStore.userMids; + const midOptions = useStore.getState().UserStore.selectOptionsMids; - const [mid, setMid] = useState('nictest00m'); + const [mid, setMid] = useState(userMids[0]); const [data, setData] = useState(); const [openChild, setOpenChild] = useState(null); + const { mutateAsync: merchantMid } = useMerchantMidMutation(); - const callInfo = () => { + const callInfo = (selectedMid?: string) => { let params: MerchantMidParams = { - mid: mid, + mid: selectedMid || mid }; merchantMid(params).then((rs: MerchantMidResponse) => { setData(rs); }); }; + const onChangeMid = (value: string) => { + setMid(value); + callInfo(value); + }; + useEffect(() => { - // callInfo(); + callInfo(); }, []); return ( <>
    - onChangeMid(e.target.value) } + > + { + midOptions.map((value, index) => ( + + )) + }
    diff --git a/src/entities/merchant/ui/registration-status-wrap.tsx b/src/entities/merchant/ui/registration-status-wrap.tsx index 4b8a60f..34bde7b 100644 --- a/src/entities/merchant/ui/registration-status-wrap.tsx +++ b/src/entities/merchant/ui/registration-status-wrap.tsx @@ -12,10 +12,13 @@ import { import { OnlineInfoWrap } from './info-wrap/online-info-wrap'; import { CardInfoWrap } from './info-wrap/card-info-wrap'; import { EscrowInfoWrap } from './info-wrap/escrow-info-wrap'; +import { useStore } from '@/shared/model/store'; export const RegistrationStatusWrap = () => { + const userMids = useStore.getState().UserStore.userMids; + const midOptions = useStore.getState().UserStore.selectOptionsMids; - const [mid, setMid] = useState('nictest00m'); + const [mid, setMid] = useState(userMids[0]); const [onlineInfomation, setOnlineInfomation] = useState(); const [offlineInfomation, setOfflineInfomation] = useState(); const [cardApplications, setCardApplications] = useState>(); @@ -24,9 +27,9 @@ export const RegistrationStatusWrap = () => { const [openChild, setOpenChild] = useState(null); const { mutateAsync: merchantMidStatus } = useMerchantMidStatusMutation(); - const callInfo = () => { + const callInfo = (selectedMid?: string) => { let params: MerchantMidStatusParams = { - mid: mid + mid: selectedMid || mid }; merchantMidStatus(params).then((rs: MerchantMidStatusResponse) => { setOnlineInfomation(rs.onlineInfomation); @@ -36,17 +39,29 @@ export const RegistrationStatusWrap = () => { }); }; + const onChangeMid = (value: string) => { + setMid(value); + callInfo(value); + }; + useEffect(() => { - // callInfo(); + callInfo(); }, []); return ( <>
    - onChangeMid(e.target.value) } + > + { + midOptions.map((value, index) => ( + + )) + }
    diff --git a/src/shared/ui/menu/index.tsx b/src/shared/ui/menu/index.tsx index bd68c20..fc6624d 100644 --- a/src/shared/ui/menu/index.tsx +++ b/src/shared/ui/menu/index.tsx @@ -28,7 +28,7 @@ export const Menu = ({ const [changeMenuId, setChangeMenuId] = useState(); const buttonRefs = useRef>([]); - const btnRef = useRef(null); + const scrollRef = useRef(null); const onClickToNavigate = (path: string) => { onClickToMenuClose(); @@ -42,21 +42,6 @@ export const Menu = ({ behavior: 'smooth' }); */ - if(index === 1){ - /* - btnRef.current?.scrollTo({ - top: 300, - behavior: "smooth" - }); - */ - btnRef.current?.scrollIntoView({ - block: 'start', - behavior: 'smooth' - }); - - } - - }; const onClickToMenuClose = () => { if(editMode){ @@ -70,8 +55,7 @@ export const Menu = ({ const getMenuCategory = () => { let rs = []; for(let i=0;i ); - } - else{ - rs.push( - - ); - } - } return rs; }; @@ -121,12 +85,7 @@ export const Menu = ({ useEffect(() => { shortBtnsSetting(); - const handleScroll = (e: Event) => { - // console.log(e, window.scrollY); - }; - window.addEventListener('scroll', handleScroll); }, []); - return ( <> @@ -194,7 +153,10 @@ export const Menu = ({
    -
    +
    { getMenuCategory() }