김건희

[Update] Connect Files

......@@ -27,7 +27,7 @@ function MainPage(props) {
const [checkSubmitError, setCheckSubmitError] = useState(false);
const CityAddSelectList = ["시/도 선택", "강원도", "경기도", "경상북도", "경상남도", "광주광역시", "대구광역시", "대전광역시", "부산광역시", "서울특별시", "울산광역시", "인천광역시", "전라북도", "전라남도", "제주특별자치도", "충청북도", "충청남도"];
const [GuAddSelectList, setGuAddselectList] = useState(["시/군/구 선택"]);
const [DongAddSelectList, setDongAddselectList] = useState(["읍/면/동 선택"]);
......@@ -171,9 +171,6 @@ function MainPage(props) {
return (
<>
<dir id = "header">
<dir className="header_clock">
<h1 id="clock">{Time}</h1>
</dir>
<dir className="header_title">
<h1>Weather_Briefing</h1>
</dir>
......
......@@ -93,16 +93,6 @@ function RecommandPage(props) {
</dir>
</dir>
</div>
<dir id = "footer">
<dir className="footer_logo">
<h1>logo</h1>
</dir>
<dir className="footer_info">
<p>경희대학교</p>
<p>컴퓨터공학과 김건희ㅣ오석진ㅣ손수민</p>
</dir>
</dir>
</>
);
};
......
......@@ -3,16 +3,12 @@ import { useDispatch, useSelector } from "react-redux";
import { useNavigate } from "react-router-dom";
import { recommend } from "../../../modules/clothes";
import "../style/WeatherPage.scss"
function WeatherPage(props) {
const dispatch = useDispatch();
const navigate = useNavigate();
const user = useSelector((state) => state.user.loginData);
const todayWeatherResult = useSelector((state) => state.weather.todayInformation);
const tommorrowWeatherResult = useSelector((state) => state.weather.tommorrowInformation);
const today = new Date();
const detailWeather = [];
let currentHour;
......@@ -20,7 +16,6 @@ function WeatherPage(props) {
const today_year = today.getFullYear();
const today_month = today.getMonth();
const today_date = today.getDate();
const [todayHighTemperature, setTodayHighTemperature] = useState(-100);
const [todayLowTemperature, setTodayLowTemperature] = useState(100);
const [todayWeatherSymbol, setTodayWeatherSymbol] = useState('☀️');
......@@ -31,13 +26,10 @@ function WeatherPage(props) {
const [tommorrowWeatherSymbol, setTommorrowWeatherSymbol] = useState('');
const [todayWeatherLevel, setTodayWeatherLevel] = useState('');
const [userGender, setUserGender] = useState('');
const [cityAdd, setCityAdd] = useState('');
const [guAdd, setGuAdd] = useState('');
const [dongAdd, setDongAdd] = useState('');
const [Time, setTime] = useState("00:00:00");
const currentTime = () => {
const date = new Date();
const hours = String(date.getHours()).padStart(2, "0");
......@@ -53,9 +45,7 @@ function WeatherPage(props) {
startTimer()
useEffect(() => {
todayWeatherResult.then((result) => {
let highTemperature = -100;
let lowTemperature = 100;
let symbol = '';
......@@ -68,11 +58,9 @@ function WeatherPage(props) {
setDongAdd(result[24].address3);
for (let i = 0; i<24; i++) {
if (i === 13) {
setTodayWeatherLevel(result[i].weather);
}
// 세부 시간 정보
if (i > Number(currentHour)) {
if (result[i].rainPer >= 50) {
......@@ -85,16 +73,13 @@ function WeatherPage(props) {
else {
symbol = '☀️';
}
const tempData = {
time : result[i].time,
temperature : result[i].temperature,
symbol : symbol,
}
detailWeather.push(tempData);
}
// 현재 시간 정보 다루는 부분
if (i === Number(currentHour)) {
if (result[i].rainPer >= 50) {
......@@ -109,17 +94,14 @@ function WeatherPage(props) {
setNowTemperature(result[i].temperature);
}
// 하루 온도 정보 다루는 부분
if (result[i].temperature < lowTemperature) {
lowTemperature = result[i].temperature;
}
if (result[i].temperature > highTemperature) {
highTemperature = result[i].temperature;
}
}
setTodayHighTemperature(highTemperature);
setTodayLowTemperature(lowTemperature);
})
......@@ -139,20 +121,16 @@ function WeatherPage(props) {
if (result[i].rainPer >= 50) {
symbol = '🌧️';
}
// 내일 온도 정보 다루는 부분
if (result[i].temperature < lowTemperature) {
lowTemperature = result[i].temperature;
}
if (result[i].temperature > highTemperature) {
highTemperature = result[i].temperature;
}
setTommorrowHighTemperature(highTemperature);
setTommorrowLowTemperature(lowTemperature);
setTommorrowWeatherSymbol(symbol);
}
})
}, [tommorrowWeatherResult])
......@@ -165,22 +143,19 @@ function WeatherPage(props) {
const onSubmitHandler = useCallback((event) => {
event.preventDefault(); //체크박스 미리 클릭 방지
let todayWeather = '';
let isRain = 0;
let tempData = [];
if (todayWeatherSymbol === '🌧️') {
isRain = 1;
}
tempData.push(isRain);
tempData.push(isRain);
console.log(todayWeatherLevel);
console.log(userGender);
console.log(isRain);
// 추천 페이지로 보낼 데이터
const sendData = {
gender : 0,
weather : "1",
......@@ -188,18 +163,15 @@ function WeatherPage(props) {
}
console.log(sendData);
dispatch(recommend(sendData))
navigate('/recommand')
}, [todayWeatherResult, user]);
return (
<>
<dir id = "header">
<dir className="clock">
<h1 id="clock">{Time}</h1>
</dir>
<dir className="title">
<dir className="header_title">
<h1>Weather_Briefing</h1>
</dir>
<dir className="Login-Register">
......@@ -207,7 +179,6 @@ function WeatherPage(props) {
<button type="button" >Register</button>
</dir>
</dir>
<div id = "body">
<div className="address">
<p>{cityAdd} {guAdd} {dongAdd}</p>
......@@ -258,5 +229,4 @@ function WeatherPage(props) {
</>
);
}
export default WeatherPage;
\ No newline at end of file
......
#header {
display: flex;
position: fixed;
justify-content: center;
align-items: center;
height: 15%;
width: 100%;
border-top: 2px solid;
border-bottom: 2px solid;
.header_title {
display: flex;
justify-content: center;
align-items: center;
margin-left: 300px;
margin-right: 300px;
h1 {
font-size: 50px;
font-family: 'Times New Roman', Times, serif;
color: rgb(0, 0, 0);
}
}
.header_choice_box {
display: flex;
justify-content: right;
align-items: right;
margin-right: 10x;
}
button {
width: 70px;
height: 25px;
font-size: 15px;
font-weight: bold;
cursor: pointer;
}
}
#body {
display: flex;
justify-content: center;
......