김건희

[Merge] 'feature/recommandpage' into 'frontend'

...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
14 "nodemon": "^2.0.16", 14 "nodemon": "^2.0.16",
15 "react": "^18.1.0", 15 "react": "^18.1.0",
16 "react-dom": "^18.1.0", 16 "react-dom": "^18.1.0",
17 - "react-redux": "^8.0.1", 17 + "react-redux": "^8.0.2",
18 "react-router-dom": "^6.3.0", 18 "react-router-dom": "^6.3.0",
19 "react-scripts": "5.0.1", 19 "react-scripts": "5.0.1",
20 "redux": "^4.1.2", 20 "redux": "^4.1.2",
......
...@@ -2,6 +2,7 @@ import './App.css'; ...@@ -2,6 +2,7 @@ import './App.css';
2 import RegisterPage from './component/views/RegisterPage/RegisterPage'; 2 import RegisterPage from './component/views/RegisterPage/RegisterPage';
3 import LoginPage from './component/views/LoginPage/LoginPage'; 3 import LoginPage from './component/views/LoginPage/LoginPage';
4 import MainPage from './component/views/MainPage/MainPage'; 4 import MainPage from './component/views/MainPage/MainPage';
5 +import RecommandPage from './component/views/RecommandPage/RecommandPage';
5 import { Route, Routes } from 'react-router-dom'; 6 import { Route, Routes } from 'react-router-dom';
6 import WeatherPage from './component/views/WeatherPage/WeatherPage'; 7 import WeatherPage from './component/views/WeatherPage/WeatherPage';
7 8
...@@ -13,6 +14,7 @@ function App() { ...@@ -13,6 +14,7 @@ function App() {
13 <Route exact path = "/register" element = {<RegisterPage/>}/> 14 <Route exact path = "/register" element = {<RegisterPage/>}/>
14 <Route exact path = "/main" element = {<MainPage/>}/> 15 <Route exact path = "/main" element = {<MainPage/>}/>
15 <Route exact path = "/weather" element = {<WeatherPage/>}/> 16 <Route exact path = "/weather" element = {<WeatherPage/>}/>
17 + <Route exact path = "/recommand" element = {<RecommandPage/>}/>
16 </Routes> 18 </Routes>
17 </div> 19 </div>
18 ); 20 );
......
1 +import React, { useCallback, useEffect, useState } from "react";
2 +import { useDispatch, useSelector } from "react-redux";
3 +import { useNavigate } from "react-router-dom";
4 +import "../style/RecommandPage.scss"
5 +
6 +function RecommandPage(props) {
7 +
8 + const clothesResult = useSelector((state) => state.clothes.clothesRecommend);
9 +
10 + const [IsRain, setIsRain] = useState("");
11 + const [TopPath, setTopPath] = useState('');
12 + const [BottomPath, setBottomPath] = useState('');
13 +
14 + useEffect(() => {
15 + clothesResult.then((result) => {
16 + console.log(result);
17 + console.log(result.top);
18 + console.log(result.bottom);
19 +
20 + if (result.umbrella == 1) {
21 + setIsRain("비 예보가 있습니다. 우산을 꼭 챙겨주세요!");
22 + }
23 + else {
24 + setIsRain("비 예보가 없습니다!");
25 + }
26 +
27 + setTopPath(result.top);
28 + setBottomPath(result.bottom);
29 + })
30 + }, [clothesResult])
31 +
32 + const navigate = useNavigate();
33 +
34 + const [Time, setTime] = useState("00:00:00");
35 +
36 + const currentTime = () => {
37 + const date = new Date();
38 + const hours = String(date.getHours()).padStart(2, "0");
39 + const minutes = String(date.getMinutes()).padStart(2, "0");
40 + const seconds = String(date.getSeconds()).padStart(2, "0");
41 + setTime(hours+":"+minutes+":"+seconds);
42 + }
43 +
44 + const startTimer = () => {
45 + setInterval(currentTime, 1000)
46 + }
47 +
48 + startTimer()
49 +
50 + const navigate_login = useCallback((event) => {
51 + navigate('../login');
52 + })
53 +
54 + const navigate_register = useCallback((event) => {
55 + navigate('../register');
56 + })
57 +
58 + return (
59 + <>
60 + <dir id = "header">
61 + <dir className="clock">
62 + <h1 id="clock">{Time}</h1>
63 + </dir>
64 + <dir className="title">
65 + <h1>Weather_Briefing</h1>
66 + </dir>
67 + <dir className="Login-Register">
68 + <button type="button" onClick={navigate_login}>Login</button>
69 + <button type="button" onClick={navigate_register}>Register</button>
70 + </dir>
71 + </dir>
72 +
73 + <div id = "recommand_body">
74 + <dir className="fashion_recommand">
75 + <dir className="rainOrnot">{IsRain}</dir>
76 + <dir className="clothes">
77 + <dir className="Top">
78 + <h1>TOP</h1>
79 + <img src={TopPath} className='Top_Image' />
80 + </dir>
81 + <dir className="Bottom">
82 + <h1>BOTTOM</h1>
83 + <img src={BottomPath} className='Bottom_Image' />
84 + </dir>
85 + {/* <dir className="Head">
86 + <h1>HEAD</h1>
87 + <img src="../../../img/조거팬츠.jpg" className='Head_Image' />
88 + </dir>
89 + <dir className="Shoes">
90 + <h1>SHOES</h1>
91 + <img src="../../../../src/img/조거팬츠.jpg" className='Shoes_Image' />
92 + </dir> */}
93 + </dir>
94 + </dir>
95 + </div>
96 +
97 + <dir id = "footer">
98 + <dir className="footer_logo">
99 + <h1>logo</h1>
100 + </dir>
101 + <dir className="footer_info">
102 + <p>경희대학교</p>
103 + <p>컴퓨터공학과 김건희ㅣ오석진ㅣ손수민</p>
104 + </dir>
105 + </dir>
106 + </>
107 + );
108 +};
109 +
110 +export default RecommandPage;
111 +
1 +* {
2 + margin: 0;
3 + padding: 0;
4 + box-sizing: border-box;
5 + background-color: rgb(245, 235, 223);
6 + }
7 + img {
8 + width: 300px;
9 + height: 300px;
10 + object-fit: cover;
11 + }
12 +
13 + #recommand_body {
14 + display: flex;
15 + justify-content: center;
16 + align-items: center;
17 + border-top: 2px solid;
18 + border-bottom: 2px solid;
19 +
20 + .fashion_recommand {
21 + border: 2px solid;
22 + width: 90%;
23 + height: 200%;
24 + margin-top: 150px;
25 + margin-bottom: 30px;
26 +
27 + .rainOrnot {
28 + display: flex;
29 + justify-content: center;
30 + align-items: center;
31 + margin-top: 20px;
32 + margin-left: 100px;
33 + margin-right: 100px;
34 + font-size :30px;
35 + font-weight: bold;
36 + }
37 + .clothes{
38 + display:flex;
39 + justify-content: space-between;
40 + align-items: space-between;
41 +
42 + .Top{
43 + display:flex;
44 + flex-wrap: wrap;
45 + flex-direction: column;
46 + font-size: 30px;
47 + border: 2px solid;
48 + color:rgb(0, 0, 0);
49 + justify-content: center;
50 + align-items: center;
51 + margin-top: 50px;
52 + margin-bottom: 50px;
53 + margin-left: 1%;
54 + margin-right: 1%;
55 + }
56 +
57 + .Bottom{
58 + display:flex;
59 + flex-wrap: wrap;
60 + flex-direction: column;
61 + font-size: 30px;
62 + border: 2px solid;
63 + color:rgb(0, 0, 0);
64 + justify-content: center;
65 + align-items: center;
66 + margin-top: 50px;
67 + margin-bottom: 50px;
68 + margin-left: 1%;
69 + margin-right: 1%;
70 + }
71 +
72 + .Head{
73 + display:flex;
74 + flex-wrap: wrap;
75 + flex-direction: column;
76 + font-size: 30px;
77 + border: 2px solid;
78 + color:rgb(0, 0, 0);
79 + justify-content: center;
80 + align-items: center;
81 + margin-top: 50px;
82 + margin-bottom: 50px;
83 + margin-left: 1%;
84 + margin-right: 1%;
85 + }
86 + .Shoes{
87 + display:flex;
88 + flex-wrap: wrap;
89 + flex-direction: column;
90 + font-size: 30px;
91 + border: 2px solid;
92 + color:rgb(0, 0, 0);
93 + justify-content: center;
94 + align-items: center;
95 + margin-top: 50px;
96 + margin-bottom: 50px;
97 + margin-left: 1%;
98 + margin-right: 1%;
99 + }
100 + }
101 + }
102 +}
103 +
...\ No newline at end of file ...\ No newline at end of file
...@@ -3,7 +3,6 @@ import axios from 'axios'; ...@@ -3,7 +3,6 @@ import axios from 'axios';
3 const USER_REGISTER = 'user/REGISTER'; 3 const USER_REGISTER = 'user/REGISTER';
4 const USER_LOGIN = 'user/LOGIN'; 4 const USER_LOGIN = 'user/LOGIN';
5 const USER_LOGOUT = 'user/LOGOUT'; 5 const USER_LOGOUT = 'user/LOGOUT';
6 -const USER_DATA = 'user/DATA';
7 6
8 export function register (dataToSubmit) { 7 export function register (dataToSubmit) {
9 8
...@@ -32,9 +31,8 @@ export function logout(dataToSubmit) { ...@@ -32,9 +31,8 @@ export function logout(dataToSubmit) {
32 31
33 return { 32 return {
34 type: USER_LOGOUT, 33 type: USER_LOGOUT,
35 - payload: req,
36 } 34 }
37 -}; 35 + }
38 36
39 export default function (state = {}, action) { 37 export default function (state = {}, action) {
40 switch (action.type) { 38 switch (action.type) {
......