Skip to content

Commit 7112cc0

Browse files
Feat/ScheduleDetail/Error Debugging
1 parent 6ee2306 commit 7112cc0

File tree

3 files changed

+47
-30
lines changed

3 files changed

+47
-30
lines changed

src/components/Schedule/ScheduleDetail.jsx

+25-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const ScheduleDetail = () => {
2222
await axios
2323
// .get(`https://eb.jxxhxxx.shop/v2/events/5`, {
2424
.get(`https://eb.jxxhxxx.shop/events/${id}`, {
25-
// .get("http://localhost:3001/todos", {
2625
headers: {
2726
Authorization: localStorage.getItem("Authorization"),
2827
},
@@ -31,14 +30,25 @@ const ScheduleDetail = () => {
3130
setSchedule(appData.data.data);
3231
}, []);
3332
};
33+
const time = schedule.time?.split(":", 2).join(":");
34+
3435
// const subject = schedule.data.subject;
3536
// const [index, setIndex] = useState("0");
3637
// setIndex(id);
3738
useEffect(() => {
3839
fetchTodos();
3940
}, [id]);
4041
console.log(schedule);
41-
const time = schedule.time?.split(":", 2).join(":");
42+
43+
const numberOfJoiner = schedule.invitees.length;
44+
console.log(numberOfJoiner);
45+
46+
const joinerList = [];
47+
for (let i = 0; i < numberOfJoiner; i++) {
48+
joinerList.push(
49+
<div className="ml-[5px]">{schedule.invitees[i].username}</div>
50+
);
51+
}
4252

4353
return (
4454
<div className="bg-[#EDF7FF] h-[734px] width-[375px]">
@@ -59,7 +69,7 @@ const ScheduleDetail = () => {
5969
/>
6070
</div>
6171
<div className="flex space-x-3 text-[18px] mt-[-18px] font-light ">
62-
<div>{schedule.date}</div> <div> {time}</div>{" "}
72+
<div>{schedule.date}</div> <div> {time}</div>
6373
</div>
6474
<div className="mt-[28px] font-semibold text-[24px]">
6575
{schedule.subject}
@@ -70,7 +80,18 @@ const ScheduleDetail = () => {
7080
</div>
7181
</div>
7282
<div className="text-[#12396F]">
73-
<ScheduleDetailParticipants />
83+
<div>
84+
{numberOfJoiner !== 1 ? (
85+
<div className="mt-[30px] h-[98px] ml-[20px]">
86+
참여자{" "}
87+
<div className="bg-[#CEE4F8] h-[50px] w-[335px] mt-[20px] p-[15px] shadow flex rounded-lg">
88+
{joinerList}
89+
</div>
90+
</div>
91+
) : (
92+
<div />
93+
)}
94+
</div>
7495
<div className="h-[234px] mt-[30px] mb-[8px] ml-[20px]">
7596
일정내용{" "}
7697
<div className="bg-[#CEE4F8] shadow h-[186px] w-[335px] mt-[20px] p-[15px] flex rounded-lg">

src/components/Schedule/ScheduleDetailParticipants.jsx

+21-25
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,39 @@
11
import axios from "axios";
22
import React, { memo, useCallback, useEffect, useState } from "react";
33

4-
const ScheduleDetailParticipants = () => {
5-
const [schedule, setSchedule] = useState([]);
4+
const ScheduleDetailParticipants = (numberOfJoiner, joinerList) => {
5+
// const [schedule, setSchedule] = useState([]);
66

7-
const fetchTodos = async () => {
8-
await axios
9-
.get(`https://eb.jxxhxxx.shop/v2/events/5`, {
10-
// .get(`https://eb.jxxhxxx.shop/events/${id}`, {
11-
// .get("http://localhost:3001/todos", {
12-
headers: {
13-
Authorization: localStorage.getItem("Authorization"),
14-
},
15-
})
16-
.then((appData) => {
17-
setSchedule(appData.data.data);
18-
console.log(schedule);
19-
}, []);
20-
};
21-
// const a = schedule.invitees.length;
22-
// const [index, setIndex] = useState("0");
7+
// const fetchTodos = async () => {
8+
// await axios
9+
// // .get(`https://eb.jxxhxxx.shop/v2/events/5`, {
10+
// .get(`https://eb.jxxhxxx.shop/events/${id}`, {
11+
// // .get("http://localhost:3001/todos", {
12+
// headers: {
13+
// Authorization: localStorage.getItem("Authorization"),
14+
// },
15+
// })
16+
// .then((appData) => {
17+
// setSchedule(appData.data.data);
18+
// console.log(schedule);
19+
// }, []);
20+
// };
2321
// setIndex(id);
2422
useEffect(() => {
25-
fetchTodos();
23+
// fetchTodos();
2624
}, []);
2725
// console.log(schedule);
2826
// console.log(schedule.invitees.length);
2927
// console.log(schedule.invitees);
30-
// console.log(a.length);
31-
const invitees = schedule.invitees;
32-
console.log(schedule);
33-
console.log(invitees);
28+
// console.log(schedule);
29+
3430
return (
3531
<div>
36-
{[schedule.invitees].length !== 1 ? (
32+
{numberOfJoiner !== 1 ? (
3733
<div className="mt-[30px] h-[98px] ml-[20px]">
3834
참여자{" "}
3935
<div className="bg-[#CEE4F8] h-[50px] w-[335px] mt-[20px] p-[15px] shadow flex rounded-lg">
40-
{/* {schedule.invitees} */}
36+
{/* {joinerList} */}
4137
</div>
4238
</div>
4339
) : (

src/components/layout/BottomNavi.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const BottomNavi = () => {
88
const navigate = useNavigate();
99
return (
1010
<div className="relative">
11-
<div className="fixed top-[617px] w-[375px] h-[50px] bg-white opacity-80">
11+
<div className="fixed bottom-0 min-w-[375px] h-[50px] bg-white opacity-80">
1212
<div className="flex gap-[77px] pt-[13px] justify-center">
1313
<div
1414
onClick={() => {

0 commit comments

Comments
 (0)