diff --git a/.env b/.env new file mode 100644 index 0000000..87a5b60 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +REACT_APP_KAKAO_API_KEY = b1d6aed50bab9834340e45aa8d0a6b67 diff --git a/package-lock.json b/package-lock.json index 585621a..3fdabd9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19303,4 +19303,4 @@ } } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index d6a4e1a..83c81e1 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "react-scripts": "^5.0.1", "react-time-picker": "^7.0.0", "styled-components": "^6.1.12", + "tailwind": "^4.0.0", "tailwindcss": "^3.4.9", "web-vitals": "^2.1.4", "xlsx": "^0.18.5" diff --git a/src/App.js b/src/App.js index 2ce4115..47acb02 100644 --- a/src/App.js +++ b/src/App.js @@ -1,10 +1,5 @@ import React from 'react'; -import { - BrowserRouter as Router, - Route, - Routes, - useLocation, -} from 'react-router-dom'; +import { BrowserRouter as Router, Route, Routes, useLocation } from 'react-router-dom'; import Main from './pages/Main'; import Home from './pages/Home'; import Login from './pages/Login'; @@ -14,9 +9,7 @@ import MyLocationList from './pages/MyLocationList'; import Setting from './pages/Setting'; import MakePlanRoom1 from './pages/MakePlanRoom1'; import MakePlanRoom2 from './pages/MakePlanRoom2'; -import PlanRoomResult from './pages/PlanRoomResult'; import PlanRoom1 from './pages/PlanRoom1'; -import PlanRoom2 from './pages/PlanRoom2'; import NotFound from './pages/NotFound'; import Navbar from './components/Navbar'; import Sidebar from './components/Sidebar'; @@ -25,9 +18,12 @@ import FindPassword from './pages/FindPassword'; import FindPasswordSend from './pages/FindPasswordsend'; import EmailCheck from './pages/emailcheck'; import StartPlanRoom from './pages/StartPlanRoom'; -import Notice from './pages/Notice'; -import PrNavbar from './components/PrNavbar'; +import PrNavbar from './components/PrNavbar'; import MainNavbar from './components/MainNavbar'; +import Home2 from './pages/home2'; +import Notice from './pages/Notice'; +import PlanRoom2 from './pages/PlanRoom2'; + const AppContainer = styled.div` display: flex; @@ -40,35 +36,14 @@ const ContentContainer = styled.div` function App() { const location = useLocation(); - const MainNavBarPages = [ - '/', - '/login', - '/SignUp', - '/emailcheck', - '/findpassword', - ]; - const sideBarPages = [ - '/Home', - '/MakePlanRoom1', - '/MakePlanRoom2', - '/StartPlanRoom', - '/MyPage', - '/MyPage2', - '/MyPage3', - '/Notice', - '/Setting', - '/MyLocationList', - ]; + const MainNavBarPages=['/','/login','/SignUp','/emailcheck','/findpassword']; + const sideBarPages=['/Home','/MakePlanRoom1','/MakePlanRoom2','/StartPlanRoom', + '/MyPage','/MyPage2','/MyPage3','/Notice','/Setting','/MyLocationList' ]; return ( <> - {MainNavBarPages.includes(location.pathname) ? ( - - ) : location.pathname === '/PlanRoom1' ? ( - - ) : ( - - )} + {MainNavBarPages.includes(location.pathname) ? : + (location.pathname==='/PlanRoom1' ? : )} {sideBarPages.includes(location.pathname) && } @@ -81,17 +56,17 @@ function App() { } /> } /> } /> - } /> } /> + } /> } /> } /> } /> } /> } /> } /> - } /> - } /> } /> + } /> + } /> } /> @@ -108,4 +83,4 @@ function AppWrapper() { ); } -export default AppWrapper; +export default AppWrapper; \ No newline at end of file diff --git a/src/buttonimage/exdown.png b/src/buttonimage/exdown.png new file mode 100644 index 0000000..8082ec8 Binary files /dev/null and b/src/buttonimage/exdown.png differ diff --git a/src/pages/Home.jsx b/src/pages/Home.jsx index bbfb31b..32b3725 100644 --- a/src/pages/Home.jsx +++ b/src/pages/Home.jsx @@ -1,24 +1,58 @@ -import React from 'react'; +import React, { useEffect, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import sea from '../assets/images/sea.png'; function Home() { const navigate = useNavigate(); + const [travelPlans, setTravelPlans] = useState([]); + // 백엔드에서 데이터 가져오기 + useEffect(() => { + const fetchTravelPlans = async () => { + try { + const response = await fetch('https://your-backend-server-address/travel-plans/myRooms', { + method: 'GET', + headers: { + 'Authorization': 'Bearer ' + } + }); + + if (response.ok) { + const data = await response.json(); + setTravelPlans(data); + } else { + console.error('Failed to fetch data'); + } + } catch (error) { + console.error('Error:', error); + } + }; + + fetchTravelPlans(); + }, []); + + // 계획 만들기 버튼 클릭 핸들러 const handleCreatePlan = () => { navigate('/MakePlanRoom1'); }; return ( -
+

내가 참여한 여행

- +
-
@@ -29,15 +63,24 @@ function Home() {
- {Array(9).fill(0).map((_, index) => ( -
+ {travelPlans.map((plan, index) => ( +
여행
- 강원도 -

여행 제목

-

2024. 07. 13 - 2024. 8. 27

+ + {plan.region} + +

{plan.title}

+

+ {new Date(plan.start_date).toLocaleDateString()} -{' '} + {new Date(plan.end_date).toLocaleDateString()} +

diff --git a/src/pages/Main.jsx b/src/pages/Main.jsx index b09a533..3d1ac10 100644 --- a/src/pages/Main.jsx +++ b/src/pages/Main.jsx @@ -1,6 +1,13 @@ import React from 'react'; -import { useNavigate } from 'react-router-dom'; +import { useNavigate } from 'react-router-dom'; // useHistory 대신 useNavigate 사용 + const Main = () => { + const navigate = useNavigate(); // useHistory 대신 useNavigate 사용 + + const handleButtonClick = () => { + navigate('/startplanroom'); // startplanroom으로 이동 + }; + const containerStyle = { display: 'flex', flexDirection: 'column', @@ -32,94 +39,147 @@ const Main = () => { }; const videoContainerStyle = { - marginBottom: '40px', - height: '300px', - backgroundColor: '#ccc', + marginBottom: '50px', + height: '450px', display: 'flex', alignItems: 'center', justifyContent: 'center', - fontSize: '1.5em', - color: 'black', }; - const cardContainerStyle = { - display: 'flex', - flexWrap: 'wrap', - justifyContent: 'center', - marginTop: '40px', + const videoStyle = { + width: '100%', + height: '100%', + borderRadius: '10px', + boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)', }; - const cardStyle = { + const footerStyle = { + marginTop: '40px', + padding: '20px', backgroundColor: '#343a40', color: 'white', + textAlign: 'center', + width: '100%', + }; + + // 카드 컨테이너 1 + const cardContainer1Style = { + backgroundColor: '#f8f9fa', + color: 'black', + borderRadius: '10px', + padding: '15px', + margin: '10px', + width: '350px', + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + marginRight: '500px', + }; + + // 카드 컨테이너 2 + const cardContainer2Style = { + backgroundColor: '#f8f9fa', + color: 'black', borderRadius: '10px', padding: '20px', margin: '10px', width: '300px', - boxShadow: '0 4px 8px rgba(0, 0, 0, 0.2)', display: 'flex', flexDirection: 'column', alignItems: 'center', + marginLeft: '500px', + marginTop:'-180px', }; - const footerStyle = { - marginTop: '40px', + // 카드 컨테이너 3 + const cardContainer3Style = { + backgroundColor: '#f8f9fa', + color: 'black', + borderRadius: '10px', padding: '20px', - backgroundColor: '#343a40', - color: 'white', - textAlign: 'center', - width: '100%', + margin: '10px', + width: '300px', + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + marginRight: '500px', + marginTop:'-150px', }; - const navigate = useNavigate(); + + + +// 이미지 스타일 추가 +const image1Style = { + width: '100%', // 원하는 크기로 조정 + height: '300PX', + position: 'relative', // 부모 요소의 position을 relative로 설정 + left: '500px', // 카드 컨테이너와 같은 위치로 설정 + top: '-250px', // 이미지 위치를 위로 올리기 위해 음수 값 설정 +}; + + +const image2Style={ + width:'100%', + height:'300px', + position:'relative', + right:'480px', + top:'-250px', +}; + +const image3Style={ + width:'100%', + height:'300px', + position:'relative', + left:'480px', + top:'-270px', +}; - const handleOutClick = () => { - navigate('/MakePlanRoom1'); - }; return (

국내 여행을 계획하고 있으신가요?

-

- 가볼까?와 동행자와 함께 여행을 빠르고 쉽게 계획할 수 있어요! -

- +

가볼까?와 동행자와 함께 여행을 빠르고 쉽게 계획할 수 있어요!

+ -
(서비스 소개 영상)
+
+ +
-
-
+
+

여행 동행자와 함께 여행 계획을!

-

- 가볼까에서는 모두 다함께 참여할 수 있어요! 더 이상 따로 찾고 따로 - 계획하지 않아도 돼요! -

+

가볼까에서는 모두 다함께 참여할 수 있어요! 더 이상 따로 찾고 따로 계획하지 않아도 돼요!

+ {/* 이미지 추가 */}
-
+ +

가볼까의 주요 장점 제목 222

가볼까의 장점 설명글 가볼까의 장점 설명글 가볼까의 장점 설명글

+
-
+ +

가볼까의 주요 장점 제목 444

가볼까의 장점 설명글 가볼까의 장점 설명글 가볼까의 장점 설명글

+
- UMC 6기 타이거지부 ‘가볼까’ -
- 메일: 010711yj@swu.ac.kr | 고객센터: 0000-0000 -
- 서울시 OO구 OO로OO길 OO OOOO (우편번호00000) -
© GABOLKKA ALL RIGHTS RESERVED. + UMC 6기 타이거지부 ‘가볼까’
+ 메일: 010711yj@swu.ac.kr | 고객센터: 0000-0000
+ 서울시 OO구 OO로OO길 OO OOOO (우편번호00000)
+ © GABOLKKA ALL RIGHTS RESERVED.
); }; -export default Main; +export default Main; \ No newline at end of file diff --git a/src/pages/MakePlanRoom1.jsx b/src/pages/MakePlanRoom1.jsx index c5f79ba..7256075 100644 --- a/src/pages/MakePlanRoom1.jsx +++ b/src/pages/MakePlanRoom1.jsx @@ -8,6 +8,7 @@ import 'react-calendar/dist/Calendar.css'; import 'react-time-picker/dist/TimePicker.css'; import { format } from 'date-fns'; import moment from 'moment'; +import axios from 'axios'; /*컨테이너 및 구역 나눔*/ const FullContainner = styled.div` @@ -181,16 +182,22 @@ const Time = styled.div``; function MakePlanRoom1() { const [image, setImage] = useState(ImgUpload); + const [title, setTitle] = useState(''); // 여행 제목 상태 관리 + const [explain, setExplain] = useState(''); // 여행 설명 상태 관리 const [dateRange, setDateRange] = useState([new Date(), new Date()]); const [startDate, endDate] = dateRange; const [startTime, setStartTime] = useState('00:00'); const [endTime, setEndTime] = useState('00:00'); const [showTime, setShowTime] = useState(false); + const [imageFile, setImageFile] = useState(null); const fileInputRef = useRef(null); + const region='지역'; // MakePlanRoom2 이전에 미리 초기값 설정 (formData 넘기려고..) + const status=1; const handleImageUpload = (event) => { const file = event.target.files[0]; if (file) { + setImageFile(file); setImage(URL.createObjectURL(file)); } }; @@ -205,9 +212,48 @@ function MakePlanRoom1() { const navigate = useNavigate(); - const handleLink = () => { - navigate('/MakePlanroom2'); + const handleLink = async (travelId) => { + const [startDate, endDate] = dateRange; + const token = localStorage.getItem('token'); + console.log('JWT Token:', JSON.stringify(token)); + // FormData 생성 + const formData = new FormData(); + formData.append('title', title); + formData.append('start_date', format(startDate, 'yyyy-MM-dd')); + formData.append('end_date', format(endDate, 'yyyy-MM-dd')); + formData.append('explain', explain); + formData.append('start_time', showTime ? startTime : '00:00'); + formData.append('end_time', showTime ? endTime : '00:00'); + formData.append('region', region); // 추가된 지역 + formData.append('status', status); + + if (image) { + formData.append('travel_image', imageFile); // 선택된 파일 추가 + + try { + const response = await axios.post('http://43.200.238.249:5000/travel-plans/makeRoom', formData, { + headers: { + 'Authorization': `Bearer ${token}`, + 'Content-Type': 'multipart/form-data', + }, + }); + + const travelId = response.data.travel_id; + console.log('응답 데이터(FormData):', response.data); + console.log('여행 계획방 ID:', travelId); + + navigate('/MakePlanroom2', { state: { travelId } }); + + } catch (error) { + console.error('에러 발생:', error.response ? error.response.data : error.message); + if (error.response) { + console.error('서버 응답 오류:', error.response.data); + } + } + } }; + + return (

여행 계획방 만들기 (1/2)

@@ -241,12 +287,13 @@ function MakePlanRoom1() {
여행 제목
- + {setTitle(e.target.value)}}/>
여행 설명