diff --git a/src/App.tsx b/src/App.tsx index 3aeee34..238e8cd 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,4 @@ -import { Routes, Route, useLocation } from 'react-router-dom'; +import { Routes, Route, useLocation, useSearchParams } from 'react-router-dom'; import Navbar from './components/layout/Navbar'; import Login from './pages/account/Login'; import Signup from './pages/account/Signup'; @@ -11,6 +11,12 @@ import ProfileForm from './pages/profile/ProfileForm'; import NoticeList from './pages/notice/NoticeList'; import Notice from './pages/notice/Notice'; +function SearchPage() { + const [params] = useSearchParams(); + const query = params.get('query') || ''; + return ; +} + export default function App() { const { pathname } = useLocation(); @@ -20,6 +26,7 @@ export default function App() { {/* 공통 페이지 */} } /> + } /> } /> } /> } /> diff --git a/src/components/common/Filter.tsx b/src/components/common/Filter.tsx index bf855d9..06e2411 100644 --- a/src/components/common/Filter.tsx +++ b/src/components/common/Filter.tsx @@ -29,9 +29,14 @@ export default function Filter({ const [address, setAddress] = useState( defaultValues?.address ?? [], ); - const [startsAt, setStartsAt] = useState( - defaultValues?.startsAt ?? '', - ); + + const [startsAt, setStartsAt] = useState(() => { + if (!defaultValues?.startsAt) return ''; + const utcDate = new Date(defaultValues.startsAt); + const kstDate = new Date(utcDate.getTime() + 9 * 60 * 60 * 1000); // UTC → KST + return kstDate.toISOString().slice(0, 10); // YYYY-MM-DD + }); + const [hourlyPay, setHourlyPay] = useState( defaultValues?.hourlyPay?.toString() ?? '', ); @@ -62,9 +67,20 @@ export default function Filter({ const handleApply = () => { const cleanPay = hourlyPay.replace(/,/g, ''); + + let startsAtISO: string | null = null; + + if (startsAt) { + const [year, month, day] = startsAt.split('-').map(Number); + const kstMidnight = new Date(Date.UTC(year, month - 1, day, 0, 0, 0)); + startsAtISO = new Date( + kstMidnight.getTime() - 9 * 60 * 60 * 1000, + ).toISOString(); // KST → UTC + } + onApply({ address, - startsAt: startsAt || null, + startsAt: startsAtISO, hourlyPay: cleanPay ? Number(cleanPay) : null, }); onClose(); @@ -73,7 +89,7 @@ export default function Filter({ if (!open) return null; return ( -
+

상세 필터

+ {filterOpen && ( +
+ setFilterOpen(false)} + onApply={handleApplyFilter} + defaultValues={filterValues} + /> +
+ )} +
+
+
+ {shouldShowEmpty && allNotices.length === 0 ? ( +
+ 등록된 게시물이 없습니다. +
+ ) : ( + <> +
+ {allNotices.map((notice) => ( +
+ +
+ ))} +
+ + + )} + + +