diff --git a/src/assets/scss/history_style/_history.scss b/src/assets/scss/history_style/_history.scss index dce116b..6b1c089 100644 --- a/src/assets/scss/history_style/_history.scss +++ b/src/assets/scss/history_style/_history.scss @@ -1,4 +1,5 @@ #historypage_contain { + height: calc(100vh - 150px); .top_list_style { display: flex; justify-content: space-between; @@ -81,7 +82,7 @@ .history_bottom_div { width: 100%; position: fixed; - bottom: 0; + bottom: 100px; padding: 7px 30px 0; background-color: #FFF; diff --git a/src/constant/routeConstants.js b/src/constant/routeConstants.js index 8eb93b4..1819f32 100644 --- a/src/constant/routeConstants.js +++ b/src/constant/routeConstants.js @@ -1,6 +1,5 @@ // src/constants/routeConstants.js export const ROUTE_PATHS = { - HOME: "/", MAIN: "/main", SIGNUP: "/signup", LOGIN: "/login", @@ -16,7 +15,7 @@ export const ROUTE_PATHS = { HOMECHECKFIX:"/home_check_fix", HOMEWRITE:"/home_write", HOMEWRITEFIX:"/home_write_fix", - SPLASH:"/splash", + SPLASH:"/", MYPAGE:"/mypage", ONBOARDING:"/onboarding", NOT_FOUND: "*", diff --git a/src/layouts/DefaultLayout.jsx b/src/layouts/DefaultLayout.jsx index f76046e..3506a41 100644 --- a/src/layouts/DefaultLayout.jsx +++ b/src/layouts/DefaultLayout.jsx @@ -5,7 +5,7 @@ import { Header } from "@components/layout/header/Header"; export const DefaultLayout = () => { const location = useLocation(); - const isHomePage = location.pathname === "/splash"; + const isHomePage = location.pathname === "/"; return ( <> diff --git a/src/pages/historypage/HistoryDetailPage.jsx b/src/pages/historypage/HistoryDetailPage.jsx index b7eb559..77d0a7e 100644 --- a/src/pages/historypage/HistoryDetailPage.jsx +++ b/src/pages/historypage/HistoryDetailPage.jsx @@ -45,26 +45,27 @@ const HistoryDetailPage = () => {

경험 기간

- +
- +

느낀 점

- +

발전 방향

-
수정하기
+
diff --git a/src/pages/historypage/Historypage.jsx b/src/pages/historypage/Historypage.jsx index 9f41e9c..8e9c702 100644 --- a/src/pages/historypage/Historypage.jsx +++ b/src/pages/historypage/Historypage.jsx @@ -6,6 +6,7 @@ import type_arrow from '../../assets/icons/history/type_arrow.svg' import close from '../../assets/icons/history/close.svg' import icon from '../../assets/icons/history/popup_icon.svg' import HistoryList from '@components/history/HistoryList' +import { MainFooter } from '@components/layout/footer/mainfooter/MainFooter'; const Historypage = () => { const [isPopupVisible, setIsPopupVisible] = useState(false); @@ -14,7 +15,7 @@ const Historypage = () => { const navigate = useNavigate(); const historyData = [ - { id: 1, title: '혼자 여행 떠나기', rating: 4.25, experienceType: '내가 따라한 경험' }, + { id: 1, title: '혼자 여행 떠나기', rating: 4.5, experienceType: '내가 따라한 경험' }, { id: 2, title: '요리 배우기', rating: 4.5, experienceType: '내가 작성한 경험' }, { id: 3, title: '마라톤 참가하기', rating: 5.0, experienceType: '내가 따라한 경험' }, ]; @@ -105,6 +106,7 @@ const Historypage = () => {
0 ? 'active' : 'inactive'}`} onClick={openPopup}>결산하기
+ {isPopupVisible && (
diff --git a/src/pages/homecheck/HomeCheck.jsx b/src/pages/homecheck/HomeCheck.jsx index e29ef1a..ae63ad1 100644 --- a/src/pages/homecheck/HomeCheck.jsx +++ b/src/pages/homecheck/HomeCheck.jsx @@ -1,18 +1,48 @@ -import React from 'react' +import React, { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; +import { instance } from '../../services/instance'; import card_img_r from '../../assets/icons/history/card_img_r.svg' import card_img_l from '../../assets/icons/history/card_img_l.svg' const HomeCheck = () => { const navigate = useNavigate(); + const [experienceData, setExperienceData] = useState(null); + const [startDate, setStartDate] = useState(''); + const [endDate, setEndDate] = useState(''); + + useEffect(() => { + const fetchExperienceData = async () => { + try { + const response = await instance.get('/cards/experience'); // ✅ 토큰이 자동으로 포함된 요청 + if (response.data.success) { + setExperienceData(response.data); + setStartDate(response.data.startDate); + setEndDate(response.data.endDate); + } + } catch (error) { + console.error('API 요청 실패:', error); + } + }; - const GotoFix = () => { - navigate('/home_check_fix'); - } + fetchExperienceData(); + }, []); + + const GotoFix = () => { + // ✅ 데이터 전달 + navigate('/home_check_fix', { + state: { + experienceData, + startDate, + endDate + } + }); + }; return (

홈 > 확인하기

-
+

혼자 여행 떠나기

@@ -22,9 +52,11 @@ const HomeCheck = () => {

목표 기간

- + setStartDate(e.target.value)} />
- + setEndDate(e.target.value)} />
diff --git a/src/pages/homecheck/HomeCheckFix.jsx b/src/pages/homecheck/HomeCheckFix.jsx index 22f3302..dc95591 100644 --- a/src/pages/homecheck/HomeCheckFix.jsx +++ b/src/pages/homecheck/HomeCheckFix.jsx @@ -1,6 +1,6 @@ import * as S from "./styled.js"; -import React from 'react' -import { useNavigate } from 'react-router-dom'; +import React, { useEffect, useState } from 'react'; +import { useNavigate, useLocation } from 'react-router-dom'; import card_img_r from '../../assets/icons/history/card_img_r.svg' import card_img_l from '../../assets/icons/history/card_img_l.svg' import plus from "/images/apply/plus.svg"; @@ -11,7 +11,11 @@ import { useSelect } from "@hooks/useSelect"; const HomeCheckFix = () => { const navigate = useNavigate(); + const location = useLocation(); // ✅ 데이터 받기 + const { experienceData, startDate: initialStartDate, endDate: initialEndDate } = location.state || {}; const { SelectData, SelectHandlers } = useSelect(); + const [startDate, setStartDate] = useState(initialStartDate || ''); + const [endDate, setEndDate] = useState(initialEndDate || ''); const GotoDone = () => { navigate('/home_check'); @@ -19,7 +23,7 @@ const HomeCheckFix = () => { return (

홈 > 확인하기

-
+

혼자 여행 떠나기

@@ -29,9 +33,9 @@ const HomeCheckFix = () => {

목표 기간

- + setStartDate(e.target.value)} />
- + setEndDate(e.target.value)} />

diff --git a/src/pages/homecheck/HomeWrite.jsx b/src/pages/homecheck/HomeWrite.jsx index 996cc03..f455cbc 100644 --- a/src/pages/homecheck/HomeWrite.jsx +++ b/src/pages/homecheck/HomeWrite.jsx @@ -9,6 +9,7 @@ import empty_star from '../../assets/icons/history/empty_star.svg' import plus from "/images/apply/plus.svg"; import { InputAndTitle } from "@components/common/inputs/inputandtitle/InputAndTitle"; import { useSelect } from "@hooks/useSelect"; +import { instance } from '../../services/instance'; const HomeWrite = () => { const navigate = useNavigate(); @@ -45,6 +46,16 @@ const HomeWrite = () => { setStarRatings(updatedStars); }; + + const calculateScore = () => { + let score = 0; + starRatings.forEach((rating) => { + if (rating === 'full') score += 1; + else if (rating === 'half') score += 0.5; + }); + return score; + }; + const handleImageUpload = (event) => { const files = event.target.files; const newImages = []; @@ -87,6 +98,40 @@ const HomeWrite = () => { const GotoDone = () => { navigate('/history_detail'); } + const handleSubmit = async () => { + const formData = new FormData(); + const score = calculateScore(); + + // ✅ 리뷰 정보 추가 + formData.append( + 'createReviewRequest', + new Blob( + [JSON.stringify({ + experienceId: 1, // 경험 ID + score: score, + endDate: endDate, + content: feelingText, + })], + { type: 'application/json' } // 명시적으로 JSON으로 설정 + ) + ); + + // ✅ 이미지 파일 추가 + uploadedImages.forEach((img) => { + formData.append('images', img.file); + }); + + try { + const response = await instance.post('/reviews', formData); + + if (response.status === 200) { + alert('리뷰가 성공적으로 등록되었습니다.'); + navigate('/history_detail'); + } + } catch (error) { + console.error('리뷰 등록 실패:', error); + } + }; return (
@@ -130,7 +175,7 @@ const HomeWrite = () => {
setStartDate(e.target.value)}/>
- setEndDate(e.target.value)}/> + setEndDate(e.target.value)}/>
@@ -202,7 +247,7 @@ const HomeWrite = () => {
-
등록하기
+
등록하기
diff --git a/src/pages/mainpage/MainPage.jsx b/src/pages/mainpage/MainPage.jsx index 96b00fd..3518862 100644 --- a/src/pages/mainpage/MainPage.jsx +++ b/src/pages/mainpage/MainPage.jsx @@ -165,7 +165,7 @@ export const MainPage = () => { goToPage("/history")} + onClick={() => goToPage("/home_write")} > 기록하기 diff --git a/src/pages/profile/Mypage.jsx b/src/pages/profile/Mypage.jsx index e31ab4c..405e159 100644 --- a/src/pages/profile/Mypage.jsx +++ b/src/pages/profile/Mypage.jsx @@ -4,6 +4,7 @@ import mypage2 from '../../assets/icons/history/mypage2.svg' import mypage3 from '../../assets/icons/history/mypage3.svg' import mypage4 from '../../assets/icons/history/mypage4.svg' import mypage_arrow from '../../assets/icons/history/mypage_arrow.svg' +import { MainFooter } from '@components/layout/footer/mainfooter/MainFooter' const Mypage = () => { return ( @@ -40,6 +41,7 @@ const Mypage = () => {
+
) diff --git a/vite.config.js b/vite.config.js index 3c40baf..83293a6 100644 --- a/vite.config.js +++ b/vite.config.js @@ -8,7 +8,7 @@ import dotenv from 'dotenv'; dotenv.config(); -export default defineConfig(({mode}) => { +export default defineConfig(({ mode }) => { const env = loadEnv(mode, process.cwd()); return { @@ -57,10 +57,14 @@ export default defineConfig(({mode}) => { } }, server: process.env.NODE_ENV === 'development' ? { - https: { + https: + { key: fs.readFileSync(path.resolve(__dirname, 'localhost-key.pem')), cert: fs.readFileSync(path.resolve(__dirname, 'localhost.pem')), - }, + } + , + port: 5173, // 강제로 5173 포트를 사용 + strictPort: true, proxy: { "/api": { target: env.VITE_BASE_URL, @@ -94,4 +98,4 @@ export default defineConfig(({mode}) => { }, }, } -}); +}); \ No newline at end of file