{
- if (data?.id) {
- navigate(`/support/list/${data.id}`);
- } else {
- navigate("/support/list");
- }
- }}
+ onClick={handleClick}
>
{/* 상단: 날짜 & D-day */}
diff --git a/src/pages/support/components/FOAItem.jsx b/src/pages/support/components/FOAItem.jsx
index f4e89fb..f03c709 100644
--- a/src/pages/support/components/FOAItem.jsx
+++ b/src/pages/support/components/FOAItem.jsx
@@ -1,31 +1,8 @@
import { useNavigate } from "react-router-dom";
-
+import { formatEndDate, calculateDday } from "@/pages/support/utils/dateFunc";
const FOAItem = ({ data }) => {
const navigate = useNavigate();
- // 날짜 형식인지 확인하고 "M월 D일까지"로 변환
- const formatEndDate = (raw) => {
- const match = raw?.match(/^(\d{4})-(\d{2})-(\d{2})$/);
- if (!match) return raw;
- const [, , mm, dd] = match;
- return `${parseInt(mm, 10)}월 ${parseInt(dd, 10)}일까지`;
- };
-
- // 날짜 형식이면 D-day 계산, 아니면 null 반환
- const calculateDday = (raw) => {
- const match = raw?.match(/^(\d{4})-(\d{2})-(\d{2})$/);
- if (!match) return null;
-
- const targetDate = new Date(`${match[1]}-${match[2]}-${match[3]}`);
- const today = new Date();
- today.setHours(0, 0, 0, 0); // 자정 기준
- targetDate.setHours(0, 0, 0, 0);
-
- const diffTime = targetDate - today;
- const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
- return diffDays >= 0 ? `D-${diffDays}` : null;
- };
-
const formattedEndDate = formatEndDate(data.endDate);
const dday = calculateDday(data.endDate);
diff --git a/src/pages/support/components/step/Step6.jsx b/src/pages/support/components/step/Step6.jsx
index 550c23c..4c6b7c0 100644
--- a/src/pages/support/components/step/Step6.jsx
+++ b/src/pages/support/components/step/Step6.jsx
@@ -36,7 +36,6 @@ const Step6 = ({ onNext, defaultValue, userInfo, setRecommendResult }) => {
{isLoading && (
)}
diff --git a/src/pages/support/utils/dateFunc.js b/src/pages/support/utils/dateFunc.js
new file mode 100644
index 0000000..25d2906
--- /dev/null
+++ b/src/pages/support/utils/dateFunc.js
@@ -0,0 +1,20 @@
+export const formatEndDate = (raw) => {
+ const match = raw?.match(/^(\d{4})-(\d{2})-(\d{2})$/);
+ if (!match) return raw;
+ const [, , mm, dd] = match;
+ return `${parseInt(mm, 10)}월 ${parseInt(dd, 10)}일까지`;
+};
+
+export const calculateDday = (raw) => {
+ const match = raw?.match(/^(\d{4})-(\d{2})-(\d{2})$/);
+ if (!match) return null;
+
+ const targetDate = new Date(`${match[1]}-${match[2]}-${match[3]}`);
+ const today = new Date();
+ today.setHours(0, 0, 0, 0);
+ targetDate.setHours(0, 0, 0, 0);
+
+ const diffTime = targetDate - today;
+ const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
+ return diffDays >= 0 ? `D-${diffDays}` : null;
+};
diff --git a/src/routes/router.jsx b/src/routes/router.jsx
index 522ff8d..14274db 100644
--- a/src/routes/router.jsx
+++ b/src/routes/router.jsx
@@ -8,7 +8,6 @@ import StoreReviewPage from "@pages/review/StoreReviewPage";
import SearchPage from "@pages/search/SearchPage";
import StoryPage from "@pages/story/StoryPage";
import SupportPage from "@pages/support/SupportPage";
-import ErrorPage from "@pages/error/ErrorPage";
import StoryDetail from "@pages/story/components/StoryDetail";
import WriteReviewPage from "@/pages/writeReview/WriteReviewPage";
import SignUp from "@pages/join/SignUp";
@@ -17,11 +16,11 @@ import SupportItemPage from "@pages/support/SupportItemPage";
import SupportRecommendPage from "@pages/support/SupportRecommendPage";
import FinancialProductList from "@pages/support/FinancialProductListPage";
import FinancialProductDetailPage from "@pages/support/FinancialProductDetailPage";
+import MyPageDetailPage from "@/pages/myPageDetail/MyPageDetailPage";
const router = createBrowserRouter([
{
element:
, // 하단 탭이 있는 Layout
- errorElement:
,
children: [
{
path: "/",
@@ -43,6 +42,10 @@ const router = createBrowserRouter([
path: "/mypage",
element:
,
},
+ {
+ path: "/mypage/detail",
+ element:
,
+ },
{
path: "/review/:companyId",
element:
,
diff --git a/src/store/useLikeStore.js b/src/store/useLikeStore.js
new file mode 100644
index 0000000..af42f2d
--- /dev/null
+++ b/src/store/useLikeStore.js
@@ -0,0 +1,14 @@
+import { create } from "zustand";
+
+const useLikeStore = create((set) => ({
+ likedMap: {},
+ setLike: (companyId, liked) =>
+ set((state) => ({
+ likedMap: {
+ ...state.likedMap,
+ [companyId]: liked,
+ },
+ })),
+}));
+
+export default useLikeStore;
diff --git a/src/store/userInfoStore.js b/src/store/userInfoStore.js
new file mode 100644
index 0000000..53f7237
--- /dev/null
+++ b/src/store/userInfoStore.js
@@ -0,0 +1,19 @@
+import { create } from "zustand";
+
+const useUserInfoStore = create((set) => ({
+ userInfo: {
+ name: "",
+ address: "",
+ profileColor: "",
+ },
+ setUserInfo: (name, address, profileColor) =>
+ set(() => ({
+ userInfo: {
+ name,
+ address,
+ profileColor,
+ },
+ })),
+}));
+
+export default useUserInfoStore;
diff --git a/src/styles/spinner.css b/src/styles/spinner.css
index e274cf4..2598f14 100644
--- a/src/styles/spinner.css
+++ b/src/styles/spinner.css
@@ -1,5 +1,3 @@
-/* /src/styles/spinner.css */
-
.loader {
width: 50px;
aspect-ratio: 1;