Skip to content

Commit

Permalink
Merge branch 'FE/bugfix/#20-FrontPagesALl' into 'dev'
Browse files Browse the repository at this point in the history
Fe/bugfix/#20 front pages a ll

See merge request s09-webmobile1-sub2/S09P12C201!195
  • Loading branch information
wink4u committed Aug 17, 2023
2 parents 977794c + 8ce42ae commit e43db72
Show file tree
Hide file tree
Showing 30 changed files with 157 additions and 99 deletions.
4 changes: 0 additions & 4 deletions frontend/refill/src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,6 @@ const Navbar = React.forwardRef<HTMLDivElement>((props, ref) => {
} else {
setMenuList([["로그인|회원가입", "/loginsignup"]]);
}

console.log(isAdmin);
console.log(menuList);
console.log(isLogin);
}, []);

const handleMenuToggle = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const WaitingHospitalList: React.FC = () => {
},
},
);
console.log(response.data);
console.log("ok");
setHospitals(response.data);
} else {
navigate("/");
Expand Down
6 changes: 3 additions & 3 deletions frontend/refill/src/components/aidiagnosis/DiagnosisItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const DiagnosisItem: React.FC<DiagnosisItemProps> = ({
</span>
</div>
<div className="grid grid-cols-2">
<div className="flex items-center justify-start">
<div className="flex items-center justify-center">
<input
type="radio"
id={`option1-${title}`} // 유니크한 ID 생성
Expand All @@ -37,7 +37,7 @@ const DiagnosisItem: React.FC<DiagnosisItemProps> = ({
onChange={handleOptionChange}
className="form-radio h-5 w-5 text-blue-500"
/>
<label htmlFor={`option1-${title}`} className="ml-2">
<label htmlFor={`option1-${title}`} className="ml-2 text-lg">
네 그렇습니다.
</label>
</div>
Expand All @@ -51,7 +51,7 @@ const DiagnosisItem: React.FC<DiagnosisItemProps> = ({
onChange={handleOptionChange}
className="form-radio h-5 w-5 text-blue-500"
/>
<label htmlFor={`option2-${title}`} className="ml-2">
<label htmlFor={`option2-${title}`} className="ml-2 text-lg">
아니오 그렇지 않습니다.
</label>
</div>
Expand Down
12 changes: 8 additions & 4 deletions frontend/refill/src/components/aidiagnosis/NextPrevButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { RootState } from "store/reducers";
import { useSelector } from "react-redux";
import LoaderModal from "components/LoaderModal";
import NotCheckModal from "./children/NotCheckModal";
import AiServerError from "./children/AiServerError";

interface LinkProps {
nextLink: string;
Expand All @@ -23,6 +24,8 @@ const NextPrevButtons: React.FC<LinkProps> = ({
const [openModal, setOpenModal] = useState(false);
const [notCheckedNumbers, setNotCheckedNumbers] = useState<number[]>(Array);
const [isValid, setIsValid] = useState(false);

const [isError, setIsError] = useState(false)

const [loading, setLoading] = useState(false);
const navigate = useNavigate();
Expand All @@ -32,6 +35,7 @@ const NextPrevButtons: React.FC<LinkProps> = ({

const token = useSelector((state: RootState) => state.login.token);
const handleSubmit = () => {
setLoading(true);
const aiDiagnosisRequest = {
surveyResult: arrayString,
};
Expand All @@ -42,8 +46,6 @@ const NextPrevButtons: React.FC<LinkProps> = ({
const formData = new FormData();
formData.append("aiDiagnosisRequest", jsonBlob);

setLoading(true);

if (imgFile) {
const convertToEnglishName = (filename: string) => {
const extension = filename.split(".").pop();
Expand All @@ -57,10 +59,8 @@ const NextPrevButtons: React.FC<LinkProps> = ({

return `${englishName}.${extension}`;
};

const newFileName = convertToEnglishName(imgFile.name);
const newFile = new File([imgFile], newFileName, { type: imgFile.type });
console.log(newFile);
formData.append("hairImg", newFile);
}
axios
Expand All @@ -70,6 +70,7 @@ const NextPrevButtons: React.FC<LinkProps> = ({
},
})
.then((response) => {

console.log("ok");
return response.data;
})
Expand All @@ -80,6 +81,8 @@ const NextPrevButtons: React.FC<LinkProps> = ({
navigate(nextLink, { state: { jsonDataString: newJsonDataString } });
})
.catch((err) => {
setLoading(false)
setIsError(true)
console.log(err.response.data);
});
};
Expand Down Expand Up @@ -117,6 +120,7 @@ const NextPrevButtons: React.FC<LinkProps> = ({
return (
<div className="flex justify-center mt-2.5">
{loading ? <LoaderModal /> : <></>}
{isError ? <AiServerError setIsError={setIsError}/> : <></>}
{openModal ? (
<NotCheckModal
notCheckedNumbers={notCheckedNumbers}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import AidImgBox from "./children/AidImgBox";

const PhotoGuideLine: React.FC = () => {
return (
<div className="aid-pgl-box grid lg:grid-cols-4 lg: gap-6 md:grid-cols-3 md: gap-6 sm: grid-cols-2 sm: gap-6 font-black text-white">
<div className="aid-pgl-box grid lg:grid-cols-4 lg:gap-6 md:grid-cols-3 md:gap-6 sm: grid-cols-2 sm:gap-6 font-black text-white">
<AidImgBox
src={Right}
title="올바른 사진 등록 예시"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React from "react";
import "styles/Modal.css";
import DangerousIcon from '@mui/icons-material/Dangerous';
import CloseIcon from '@mui/icons-material/Close';


interface ErrorProps {
setIsError: (error: boolean) => void;
}

const AiServerError: React.FC<ErrorProps> = ({ setIsError }) => {
return (
<div className="modal-overlay">
<div className="error-modal">
<div className="error-modal-top-box flex justify-between items-center p-2">
<p className="text-6xl ml-10 text-white font-black">Error</p>
<button onClick={() => {setIsError(false)}}><CloseIcon sx={{ fontSize: 60}} color="primary"/></button>
</div>
<div>
<div className="error-modal-middle-box p-10 flex">
<div className="error-modal-left-box"><DangerousIcon color="primary" sx={{ fontSize: 100 }} /></div>
<div className="error-modal-right-box">
<p className="text-2xl font-black">
AI 서버에서 에러가 발생했습니다. RGBA파일이 아닌 RGB파일을
사용하시거나 머리 사진을 업로드해주세요.
</p>
</div>
</div>
<div className="error-modal-bottom-box flex justify-center">
<button onClick={() => {setIsError(false)}} className="error-btn text-4xl font-black">OK</button>
</div>
</div>
</div>
</div>
);
};
export default AiServerError;
35 changes: 35 additions & 0 deletions frontend/refill/src/components/consultReservation/NotSuccess.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from "react"
import "styles/Modal.css";
import DangerousIcon from '@mui/icons-material/Dangerous';
import CloseIcon from '@mui/icons-material/Close';

interface ErrorProps {
setIsError: (error: boolean) => void;
}

const NotSuccess: React.FC<ErrorProps> = ({setIsError}) => {
return (
<div className="modal-overlay">
<div className="error-modal">
<div className="error-modal-top-box flex justify-between items-center p-2">
<p className="text-6xl ml-10 text-white font-black">Error</p>
<button onClick={() => {setIsError(false)}}><CloseIcon sx={{ fontSize: 60}} color="primary"/></button>
</div>
<div>
<div className="error-modal-middle-box p-10 flex">
<div className="error-modal-left-box"><DangerousIcon color="primary" sx={{ fontSize: 100 }} /></div>
<div className="error-modal-right-box">
<p className="text-2xl font-black">
동일한 예약시간이 있어서 예약이 완료되지 못했습니다. 다른 날짜로 다시 예약해주세요.
</p>
</div>
</div>
<div className="error-modal-bottom-box flex justify-center">
<button onClick={() => {setIsError(false)}} className="error-btn text-4xl font-black">OK</button>
</div>
</div>
</div>
</div>
)
}
export default NotSuccess
12 changes: 5 additions & 7 deletions frontend/refill/src/components/consultReservation/UploadImg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import axios from "axios";
import { RootState } from "store/reducers";
import { useSelector } from "react-redux";
import { useParams } from "react-router-dom";
import NotSuccess from "./NotSuccess"

interface UploadImgProps {
doctorName: string;
Expand All @@ -25,11 +26,7 @@ const UploadImg: React.FC<UploadImgProps> = ({
hospitalName,
doctorId,
}) => {
// hospitalId undefined인 경우 axios로 호출
const { newHospitalId } = useParams();

// if (hospitalName === "")

const [isError, setIsError] = useState(false)
const [imgFile, setImgFile] = useState<File | null>(null);
const [preview, setPreview] = useState<string | null>(null);
const [modalOpen, setModalOpen] = useState(false);
Expand Down Expand Up @@ -58,12 +55,12 @@ const UploadImg: React.FC<UploadImgProps> = ({
})
.then((response) => {
console.log("ok");
setModalOpen(true);
})
.catch((error) => {
setIsError(true)
console.error(error.response.data.message);
});

setModalOpen(true);
return;
};

Expand Down Expand Up @@ -96,6 +93,7 @@ const UploadImg: React.FC<UploadImgProps> = ({

return (
<div>
{isError ? <NotSuccess setIsError={setIsError}/> : <></>}
<CompleteCompo
hospitalName={hospitalName}
ModalOpen={modalOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const DetailPatient: React.FC<DetailPatientProps> = ({
},
},
);
console.log(response.data);
console.log("ok");
setMyJoinToken((prev) => [...prev, response.data]);
if (response.data.sessionId) {
setCanJoin(true);
Expand Down
1 change: 0 additions & 1 deletion frontend/refill/src/components/find/FindSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const FindSelect: React.FC<checkSelect> = ({ isfindid, handdleSelect }) => {

const handleCheck = () => {
setIsChecked(!ischeck);
console.log(ischeck);
handdleSelect();
};

Expand Down
11 changes: 2 additions & 9 deletions frontend/refill/src/components/loginsignup/HospitalSignup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ const HospitalSignup: React.FC<SignUpType> = (props) => {
status: any,
) {
if (status === window.kakao.maps.services.Status.OK && result.length > 0) {
console.log(result[0].x, result[0].y);
await setLonlat([result[0].x, result[0].y]);
} else {
alert("올바르지 않은 주소 접근입니다.");
Expand Down Expand Up @@ -111,10 +110,6 @@ const HospitalSignup: React.FC<SignUpType> = (props) => {
const checkemail = () => {
if (checkCode === code) setCheck(true);
else setCheck(false);

console.log(code);
console.log(checkCode);
console.log(check);
};

// 이메일 인증 요청
Expand All @@ -130,7 +125,7 @@ const HospitalSignup: React.FC<SignUpType> = (props) => {
},
})
.then((response) => {
console.log(response.data);
console.log("ok");
setCheckCode(response.data.code);
})
.catch((err) => {
Expand Down Expand Up @@ -299,7 +294,6 @@ const HospitalSignup: React.FC<SignUpType> = (props) => {

const formData = new FormData();
formData.append("hospitalJoinRequest", jsonBlob);
console.log(hospitalJoinRequest);

if (inputImage.profileImg) {
formData.append("profileImg", inputImage.profileImg);
Expand All @@ -308,15 +302,14 @@ const HospitalSignup: React.FC<SignUpType> = (props) => {
if (inputImage.regImg) {
formData.append("regImg", inputImage.regImg);
}
console.log(inputImage.profileImg);
axios
.post("api/v1/account/hospital/join", formData, {
headers: {
"Content-Type": "multipart/form-data",
},
})
.then((response) => {
console.log(response.data);
console.log("ok");
props.handleChecklogin();
})
.catch((err) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ interface Error {
}

const LoginSignupModal: React.FC<Error> = ({ message, open, onClose }) => {
console.log(open);
console.log("success");
return (
<div>
Expand Down
11 changes: 2 additions & 9 deletions frontend/refill/src/components/loginsignup/MemberSignup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ const MemberSignup: React.FC<SignUpType> = (props) => {
) {
setValidBD(false);
} else {
console.log(1);
setValidBD(true);
}
}
Expand Down Expand Up @@ -146,10 +145,6 @@ const MemberSignup: React.FC<SignUpType> = (props) => {
const checkemail = () => {
if (checkCode === code) setCheck(true);
else setCheck(false);

console.log(code);
console.log(checkCode);
console.log(check);
};

// 도로명 주소 추가
Expand All @@ -168,16 +163,14 @@ const MemberSignup: React.FC<SignUpType> = (props) => {
const emailCertify = async (event: React.MouseEvent<HTMLButtonElement>) => {
event.preventDefault();
const data = { email: inputData.email };
console.log(data);

axios
.post("api/v1/account/verify/join", data, {
headers: {
"Content-Type": "application/json",
},
})
.then((response) => {
console.log(response.data);
console.log("ok");
setCheckCode(response.data.code);
})
.catch((err) => {
Expand Down Expand Up @@ -264,7 +257,7 @@ const MemberSignup: React.FC<SignUpType> = (props) => {
},
})
.then((response) => {
console.log(response.data);
console.log("ok");
props.handleChecklogin();
})
.catch((err) => {
Expand Down
6 changes: 1 addition & 5 deletions frontend/refill/src/components/myPage/ConsultingList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,16 @@ const ConsultingList: React.FC<ConsultingListProps> = ({ loginId }) => {
const token = useSelector((state: RootState) => state.login.token);
// ConsultingList 받기
const [consList, setConsList] = useState<consultData[]>();

// axios 호출 함수
const getConsultingList = () => {
console.log("도는건가");
axios
.get(`/api/v1/consulting/${loginId}`, {
headers: {
Authorization: `Bearer ${token}`,
},
})
.then((res) => {
console.log("ok123");
console.log(loginId);
console.log(res.data);
console.log("ok");
setConsList(res.data);
})
.catch((err) => {
Expand Down
Loading

0 comments on commit e43db72

Please sign in to comment.