diff --git a/react-whenMeet/src/components/CalendarWeek2.jsx b/react-whenMeet/src/components/CalendarWeek2.jsx index 175d5a937f783ae85408767212720ab3eba5e6c7..9aa194dfde2d6cb932d77d37ddea994c113296a9 100644 --- a/react-whenMeet/src/components/CalendarWeek2.jsx +++ b/react-whenMeet/src/components/CalendarWeek2.jsx @@ -83,7 +83,7 @@ function CaculateWeek({ nowYear, nowMonth, week, availableSchedules, availableTi const d = (week - 1) * 7 + j - firstDay+1; const newDate = new Date(nowYear, nowMonth-1, d,9); - if(i===0){ + if(i===startTime){ let cn = "cella"; if(d < 1)cn = "cellb" else if(d > lastDate)cn = "cellb" diff --git a/react-whenMeet/src/components/HomeParticipateForm.js b/react-whenMeet/src/components/HomeParticipateForm.js index 4e2eee2b26f784b69c6e6eb2a7fe62da1a604e2f..912536fe6864c41505a67b0affbf068b44f9ff50 100644 --- a/react-whenMeet/src/components/HomeParticipateForm.js +++ b/react-whenMeet/src/components/HomeParticipateForm.js @@ -57,10 +57,12 @@ function HomeParticipateForm() { const response = await axios.get(`http://localhost:3000/meetings/${id}/`); const startDate = response.data.startDate; const endDate = response.data.endDate; + const startTime = response.data.availableVotingStartTime; + const endTime = response.data.availableVotingEndTime; try{ const response = await axios.get(`http://localhost:3000/meetings/${id}/my/schedules`); // console.log(startDate, endDate); - navigate('UserTimeInfo', { state: { id:id, startDate: startDate, endDate: endDate, schedules:response.data.schedules }}); + navigate('UserTimeInfo', { state: { id:id, startTime:startTime, endTime:endTime, startDate: startDate, endDate: endDate, schedules:response.data.schedules }}); } catch(e){ console.log(e); @@ -114,10 +116,12 @@ function HomeParticipateForm() { const response = await axios.get(`http://localhost:3000/meetings/${id}/`); const startDate = response.data.startDate; const endDate = response.data.endDate; + const startTime = response.data.availableVotingStartTime; + const endTime = response.data.availableVotingEndTime; try{ const response = await axios.get(`http://localhost:3000/meetings/${id}/my/schedules`); // console.log(startDate, endDate); - navigate('UserTimeInfo', { state: { id:id, startDate: startDate, endDate: endDate, schedules:response.data.schedules }}); + navigate('UserTimeInfo', { state: { id:id, startTime:startTime, endTime:endTime, startDate: startDate, endDate: endDate, schedules:response.data.schedules }}); } catch(e){ console.log(e); diff --git a/react-whenMeet/src/routes/UserTimeInfo.js b/react-whenMeet/src/routes/UserTimeInfo.js index 50497a56e505a3484496a155c398468cb453ba72..67fa4359afd315419fa27b738d200ed69192cc92 100644 --- a/react-whenMeet/src/routes/UserTimeInfo.js +++ b/react-whenMeet/src/routes/UserTimeInfo.js @@ -21,8 +21,23 @@ function UserTimeInfo() { const [availableTimes, setAvailableTimes] = useState(at); const {id} = useParams(); - const [startTime, setStartTime] = useState(0); - const [endTime, setEndTime] = useState(10); + let st = 0; + let et = 48; + + if(location.state.startTime){ + st = location.state.startTime; + const sta = st.split(':'); + st = sta[0]*2+sta[1]/30; + } + if(location.state.endTime){ + et = location.state.endTime; + const eta = et.split(':'); + et = eta[0]*2+eta[1]/30; + } + + const [startTime, setStartTime] = useState(st); + const [endTime, setEndTime] = useState(et); + const [today, setToday] = useState(new Date(location.state.startDate)); const [startDate, setStartDate] = useState(new Date(location.state.startDate)); @@ -69,7 +84,6 @@ function UserTimeInfo() { sat.push(...availableTimes); } sat.sort(); - console.log(state, sat); const aa = []; let t = []; @@ -104,6 +118,7 @@ function UserTimeInfo() { const response = await axios.put(`http://localhost:3000/meetings/${id}/my/schedules/bulk`,{ schedules: compressedData }); + alert("ì œì¶œ 완료"); } catch (error) { if (error.response) { @@ -121,6 +136,7 @@ function UserTimeInfo() { } else { console.error(error); } + alert("ì œì¶œ 실패"); } }