하단 배너
This commit is contained in:
@@ -17,6 +17,9 @@ import {
|
||||
} from '@/widgets/sub-layout/use-sub-layout';
|
||||
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';
|
||||
|
||||
export let homeReloadKey = 1;
|
||||
export const setHomeReloadKey = () => {
|
||||
@@ -25,6 +28,7 @@ export const setHomeReloadKey = () => {
|
||||
|
||||
export const HomePage = () => {
|
||||
const { openBiometricRegistrationPopup } = useAppBridge();
|
||||
const { mutateAsync: homeBannerList } = useHomeBannerListMutation();
|
||||
|
||||
useSetHeaderTitle('');
|
||||
useSetHeaderType(HeaderType.Home);
|
||||
@@ -37,7 +41,35 @@ export const HomePage = () => {
|
||||
const [bottomBannerOn, setBottomBannerOn] = useState<boolean>(false);
|
||||
const [authRegisterOn, setAuthRegisterOn] = useState<boolean>(false);
|
||||
const [favoriteItems, setFavoriteItems] = useState<Array<UserFavorite>>([]);
|
||||
const [bannerList, setBannerList] = useState<Array<BannerList>>([]);
|
||||
|
||||
const callHomeBannerList = () => {
|
||||
let params: HomeBannerListParams = {
|
||||
bannerType: BannerType.BOTTOM
|
||||
};
|
||||
|
||||
homeBannerList(params).then((rs: HomeBannerListResponse) => {
|
||||
console.log(rs);
|
||||
if(rs.bannerList && rs.bannerList.length > 0){
|
||||
setBannerList(rs.bannerList);
|
||||
}
|
||||
else{
|
||||
setBannerList([]);
|
||||
}
|
||||
}).finally(() => {
|
||||
/*
|
||||
let items = [
|
||||
{title: '배너 이미지1', imageUrl: IMAGE_ROOT + '/sample_banner_0.png', linkUrl: 'http://www.google.com', order: 3},
|
||||
{title: '배너 이미지2', imageUrl: IMAGE_ROOT + '/home-banner01.png', linkUrl: 'http://www.naver.com', order: 1},
|
||||
{title: '배너 이미지3', imageUrl: IMAGE_ROOT + '/home-banner01.png', linkUrl: 'http://www.daum.net', order: 2},
|
||||
];
|
||||
items.sort((a, b) => a.order - b.order);
|
||||
setBannerList(items);
|
||||
*/
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
const checkBottomBannerOpen = () => {
|
||||
if(!!bannerToday){
|
||||
bannerToday = bannerToday.toString();
|
||||
@@ -74,6 +106,7 @@ export const HomePage = () => {
|
||||
|
||||
let userFavorite = useStore.getState().UserStore.userFavorite;
|
||||
setFavoriteItems(userFavorite);
|
||||
callHomeBannerList();
|
||||
|
||||
}, []);
|
||||
|
||||
@@ -103,11 +136,14 @@ export const HomePage = () => {
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
<HomeBottomBanner
|
||||
setBottomBannerOn={ setBottomBannerEffect }
|
||||
bottomBannerOn={ bottomBannerOn }
|
||||
></HomeBottomBanner>
|
||||
{ (!bottomBannerOn) &&
|
||||
{ !!bannerList && bannerList.length > 0 &&
|
||||
<HomeBottomBanner
|
||||
setBottomBannerOn={ setBottomBannerEffect }
|
||||
bottomBannerOn={ bottomBannerOn }
|
||||
bannerList={ bannerList }
|
||||
></HomeBottomBanner>
|
||||
}
|
||||
{ (!bottomBannerOn) &&
|
||||
<AuthRegister
|
||||
setAuthRegisterOn={ setAuthRegisterOn }
|
||||
authRegisterOn={ authRegisterOn }
|
||||
|
||||
Reference in New Issue
Block a user