diff --git a/frontend/src/component/layout/Layout.tsx b/frontend/src/component/layout/Layout.tsx index 7da62970..fc549503 100644 --- a/frontend/src/component/layout/Layout.tsx +++ b/frontend/src/component/layout/Layout.tsx @@ -2,21 +2,24 @@ import { Outlet } from 'react-router-dom'; import { LayoutHeader } from '@/component/layout/header/LayoutHeader.tsx'; import { HeaderDropdownProvider } from '@/component/header/HeaderDropdownProvider.tsx'; import { LayoutFooterProvider } from '@/component/layout/footer/LayoutFooterProvider'; +import { ToggleProvider } from '@/context/DropdownContext.tsx'; import { LayoutFooter } from './footer/LayoutFooter'; export const Layout = () => { return ( - -
- {/* LayoutHeader는 HeaderContext를 사용하므로 LayoutHeaderProvider로 감쌈 */} - + + +
+ {/* LayoutHeader는 HeaderContext를 사용하므로 LayoutHeaderProvider로 감쌈 */} + - {/* LayoutFooterProvider로 Outlet을 감싸서 FooterContext도 제공 */} - - - - -
-
+ {/* LayoutFooterProvider로 Outlet을 감싸서 FooterContext도 제공 */} + + + + +
+
+ ); }; diff --git a/frontend/src/pages/HostView.tsx b/frontend/src/pages/HostView.tsx index 2440bc98..69689761 100644 --- a/frontend/src/pages/HostView.tsx +++ b/frontend/src/pages/HostView.tsx @@ -118,6 +118,20 @@ export const HostView = () => { .then(res => { if (!res.data) throw new Error('🚀 Fetch Error: responsed undefined'); const transfromedData = transformTypeFromResToInfo(res.data); + + const orderedGuest: IGuest[] = []; + + markerDefaultColor.forEach(color => { + const guest = transfromedData.guests.find( + guestData => guestData.markerStyle.color === color, + ); + if (guest) { + orderedGuest.push(guest); + } + }); + + transfromedData.guests = orderedGuest; + setChannelInfo(transfromedData); }) .catch((err: any) => { @@ -147,14 +161,9 @@ export const HostView = () => { if (clickedId === '') { setMapProps([]); - const tmpMapProps: IGuestDataInMapProps[] = []; - // TODO : 차후 로직 개선하기 - channelInfo.guests?.map(guest => tmpMapProps.push(guest as IGuestDataInMapProps)); - const orderedMapProps: IGuestDataInMapProps[] = []; - markerDefaultColor.forEach(color => { - orderedMapProps.push(...tmpMapProps.filter(guest => guest.markerStyle.color === color)); - }); - setMapProps([...orderedMapProps]); + channelInfo.guests?.map(guest => + setMapProps(prev => [...prev, guest as IGuestDataInMapProps]), + ); } else { setMapProps(channelInfo.guests?.filter(guest => guest.id === clickedId)); }