Skip to content

Commit

Permalink
Merge pull request #63 from HGU-WALAB/#56/Refactoring
Browse files Browse the repository at this point in the history
Refactoring : 콘솔창 삭제 및 버그 수정
  • Loading branch information
ohinhyuk authored Sep 4, 2023
2 parents 5b8466b + 199d0d8 commit 7a8b38e
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 67 deletions.
2 changes: 1 addition & 1 deletion histudy-front/src/components/Image/UploadImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function ImageUpload({ setValue, getValues }) {
onChange={onImageChange}
/>
<Box sx={{ display: "flex" }}>
<ImageList sx={{ width: "1000px" }} cols={5}>
<ImageList sx={{ width: "1000px" }} cols={2}>
{getValues("images")?.map((imageUrl, index) => (
<ImageListItem
sx={{ position: "relative", mt: "20px", mr: "20px" }}
Expand Down
2 changes: 1 addition & 1 deletion histudy-front/src/components/Manager/GroupSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default function GroupSelector({ team, setTeam }) {
// Autocomplete의 onChange는 (event, newValue)를 인자로 받습니다.
setTeam(newValue?.label?.slice(5));
}}
value={team}
value={"Group" + team + ""}
disablePortal
id="combo-box-demo"
options={groupData} // groupAutoComplete 값을 사용하도록 수정했습니다.
Expand Down
9 changes: 6 additions & 3 deletions histudy-front/src/components/Manager/GroupTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export default function GroupTables({
newGroupEdit[groupId] = !newGroupEdit[groupId];
setEdit(newGroupEdit);

console.log(index);
const newEdit = [...studentEdit];

newEdit[index] = !newEdit[index];
Expand Down Expand Up @@ -103,7 +102,7 @@ export default function GroupTables({
sx={{
display: "flex",
justifyContent: "space-between",
borderTop: 1,
// borderTop: 1,
borderColor: "primary.main",
px: "30px",
}}
Expand Down Expand Up @@ -221,7 +220,11 @@ export default function GroupTables({
}}
>
<IconButton
onClick={() => handleEdit(student.id, index)}
onClick={() => {
handleEdit(student.id, index);

setTeam(row.group);
}}
>
<Edit />
</IconButton>
Expand Down
2 changes: 0 additions & 2 deletions histudy-front/src/components/Manager/ReportTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export default function ReportTable({

const navigate = useNavigate();
const clickReport = (index) => {
console.log(index);

navigate("/reportDetail", { state: index });
};
const handleDeleteRow = (index) => {};
Expand Down
2 changes: 0 additions & 2 deletions histudy-front/src/components/Manager/StudentListTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export default function StudentListTable({
const [edit, setEdit] = useState([false]);

const handleEdit = (index) => {
console.log(index);
const newEdit = [...edit];
newEdit[index] = !newEdit[index];
setEdit(newEdit);
Expand All @@ -44,7 +43,6 @@ export default function StudentListTable({
const navigate = useNavigate();
const handleDeleteRow = (index) => {};
const handleClick = () => {
console.info("You clicked the Chip.");
navigate("/manageReport");
};
const handleSave = (id) => {
Expand Down
2 changes: 0 additions & 2 deletions histudy-front/src/components/Manager/StudyGroupTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ export default function StudyGroupTable({
const navigate = useNavigate();

const handleClick = (id) => {
console.info("You clicked the Chip.");
console.log("id: " + id);
navigate("/manageReport", { state: id });
};

Expand Down
26 changes: 14 additions & 12 deletions histudy-front/src/components/Manager/UnGroupTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,11 @@ export default function UnGroupTable({
</Box>

<Box sx={{ marginRight: "20px", py: "25px" }}>
<IconButton onClick={() => handleEdit(index)}>
<IconButton
onClick={() => {
handleEdit(index);
}}
>
<Edit />
</IconButton>

Expand Down Expand Up @@ -310,19 +314,17 @@ export default function UnGroupTable({
team: Number(team),
sid: !sid ? row.sid : sid,
name: row.name,
id: row.sub,
id: row.id,
};

editUser(newData).then((res) => {
alert("변경되었습니다!");
window.location.reload();
});

// alert("저장되었습니다!");
// handleEdit(index);

// setIsLoading(true);
// window.location.reload();
editUser(newData)
.then((res) => {
alert("변경되었습니다!");
window.location.reload();
})
.catch((err) => {
alert("변경에 실패했습니다!");
});
}}
label="저장"
/>{" "}
Expand Down
4 changes: 0 additions & 4 deletions histudy-front/src/components/Post/PostCourses.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ import { Controller } from "react-hook-form";
export default function PostCourses({ control, setValue, getValues }) {
const [teamMemberCourses, setTeamMemberCourses] = useState([]);
useEffect(() => {
// teamCourses().then((res) => console.log(res));
console.log(teamCourses().then((res) => console.log("dd", res)));
teamCourses().then((res) => setTeamMemberCourses(res.courses));
}, []);

const handleCheckboxChange = (event) => {
let { value, checked } = event.target;
// value = value.slice(value.length - 8, value.length);

console.log(event.target.value);

if (checked) {
setValue("courses", [...getValues("courses"), value]);
} else {
Expand Down
1 change: 0 additions & 1 deletion histudy-front/src/components/Post/PostMember.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default function PostMember({ control, setValue, getValues }) {
useEffect(() => {
getMyTeamUsers().then((res) => {
setTeamMember(res);
console.log("Tmembers", res);
});
}, []);

Expand Down
1 change: 1 addition & 0 deletions histudy-front/src/components/Rank/Item.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function Item({ item, itemsHover, index }) {
src={`${!item?.thumbnail ? "/img/mainImg2.png" : item?.thumbnail}`}
alt={item?.title}
loading="lazy"
style={{ objectFit: "cover", height: "300px", width: "300px" }}
/>
)}
<ImageListItemBar
Expand Down
1 change: 0 additions & 1 deletion histudy-front/src/pages/Manager/ManageGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export default function ManageGroup() {

cacheTime: 5 * 60 * 1000,
onSuccess: (data) => {
console.log("ungroup data", data);
setUngroupData(data);
},
},
Expand Down
4 changes: 0 additions & 4 deletions histudy-front/src/pages/Manager/ManageReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ export default function ManageReport() {
useEffect(() => {
if (state) {
readGroupReport(state).then((data) => {
console.log("data");
console.log(data);
setReportData(data);
});
}
Expand Down Expand Up @@ -96,8 +94,6 @@ export default function ManageReport() {
navigate(-1);
};
const clickReport = (index) => {
console.log(index);

navigate("/reportDetail", { state: index });
};
return (
Expand Down
25 changes: 11 additions & 14 deletions histudy-front/src/pages/Manager/ReportDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,13 @@ export default function ReportDetail() {
}
}, []);

console.log(state);

const navigate = useNavigate();

const moveToBefore = () => {
navigate(-1);
};

const handleClick = async (buttonId) => {
console.log(buttonId, "clicked");
if (buttonId === "modify") {
navigate(`/report/modify/${state.id}`, { state: state });
} else if (buttonId === "delete") {
Expand Down Expand Up @@ -133,13 +130,13 @@ export default function ReportDetail() {
sx={{
display: "flex",
width: "100%",
height: "40px",

mb: "1rem",
position: "relative",
alignItems: "center",
}}
>
<Box sx={{ width: "100px", color: "text.secondary" }}>
<Box sx={{ minWidth: "100px", color: "text.secondary" }}>
제목
</Box>
<Typography
Expand Down Expand Up @@ -168,11 +165,11 @@ export default function ReportDetail() {
sx={{
display: "flex",
width: "100%",
height: "40px",

mb: "1rem",
}}
>
<Box sx={{ width: "100px", color: "text.secondary" }}>
<Box sx={{ minWidth: "100px", color: "text.secondary" }}>
참여 멤버
</Box>
<Typography sx={{ flex: "10 1 auto", marginLeft: "10px" }}>
Expand All @@ -188,11 +185,11 @@ export default function ReportDetail() {
sx={{
display: "flex",
width: "100%",
height: "40px",

mb: "1rem",
}}
>
<Box sx={{ width: "100px", color: "text.secondary" }}>
<Box sx={{ minWidth: "100px", color: "text.secondary" }}>
스터디 과목
</Box>
<Typography sx={{ flex: "10 1 auto", marginLeft: "10px" }}>
Expand All @@ -208,11 +205,11 @@ export default function ReportDetail() {
sx={{
display: "flex",
width: "100%",
height: "40px",

mb: "1rem",
}}
>
<Box sx={{ width: "100px", color: "text.secondary" }}>
<Box sx={{ minWidth: "100px", color: "text.secondary" }}>
스터디 시간
</Box>
<Typography sx={{ flex: "10 1 auto", marginLeft: "10px" }}>
Expand All @@ -223,18 +220,18 @@ export default function ReportDetail() {
sx={{
display: "flex",
width: "100%",
height: "40px",

mb: "1rem",
}}
>
<Box sx={{ width: "100px", color: "text.secondary" }}>
<Box sx={{ minWidth: "100px", color: "text.secondary" }}>
보고서 내용
</Box>
<Typography sx={{ flex: "10 1 auto", marginLeft: "10px" }}>
{reportData.content}
</Typography>
</Box>
<Box sx={{ width: "100px", color: "text.secondary" }}>
<Box sx={{ minWidth: "100px", color: "text.secondary" }}>
인증 사진
</Box>
<Box
Expand Down
2 changes: 0 additions & 2 deletions histudy-front/src/pages/Post/Post.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { StyledColumnAlignLayout } from "../../components/common/StyledLayout";
export default function Post({ children }) {
const { state } = useLocation();

console.log("작성", state);
const [isCodeModal, setIsCodeModal] = useState(false);

const { handleSubmit, watch, setValue, getValues, control } = useForm({
Expand Down Expand Up @@ -60,7 +59,6 @@ export default function Post({ children }) {
images: formData.images,
courses: formData.courses,
};
console.log(newReport);
state ? modifyReport(state.id, newReport) : postReport(newReport);

alert("보고서 제출이 완료되었습니다.");
Expand Down
22 changes: 4 additions & 18 deletions histudy-front/src/pages/Rank/Rank.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,17 @@
import {
Avatar,
Chip,
Grid,
IconButton,
ImageList,
ImageListItemBar,
ListSubheader,
Typography,
styled,
} from "@mui/material";
import { Grid, ImageList, styled } from "@mui/material";

import { Box } from "@mui/system";
import CustomTable from "../../components/common/CustomTable";
import { InfoIcon } from "../../theme/overrides/CustomIcons";
import { useEffect, useState } from "react";
import { useState } from "react";
import { getAllTeamsForRank } from "../../apis/rank";

import LooksOneIcon from "@mui/icons-material/LooksOne";
import HoverBox from "../../components/Rank/HoverBox";
import { AnimatePresence, motion } from "framer-motion";
import { Image } from "@mui/icons-material";

import NoDataLottie from "../../components/common/NoDataLottie";
import { StyledColumnAlignLayout } from "../../components/common/StyledLayout";
import Title from "../../components/common/Title";
import { useQuery } from "react-query";
import ImageListItem from "../../components/Rank/Item";

import Item from "../../components/Rank/Item";

const StyledScrollBox = styled(Box)({
Expand All @@ -47,7 +34,6 @@ export default function Rank() {
casheTime: 10 * 60 * 1000,
onSuccess: (data) => {
setTeams(data.teams);
console.log(data.teams);
setItemsHover(new Array(data.teams.length).fill(false));
},
});
Expand Down

0 comments on commit 7a8b38e

Please sign in to comment.