From 2014d9d5c22e16c20d8ab78ed9b874e388d334f9 Mon Sep 17 00:00:00 2001 From: HeeSeok-kim <106604926+HeeSeok-kim@users.noreply.github.com> Date: Sun, 3 Dec 2023 14:38:25 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=EC=8A=A4=EC=BC=80=EC=A4=84=20=ED=8E=98?= =?UTF-8?q?=EC=9D=B4=EC=A7=80=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95=20?= =?UTF-8?q?(#297)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 캘린더 api 호출시 규격에 안맞는 문제 해결 * fix: 스케줄이 2개 이상일때 화면이 가리는 문제 해결 * fix: api호출중일때 로딩바 추가 * fix: 오전 0시로 나오는 문제 수정 --- src/libs/api/schedule/scheduleApi.ts | 8 ++++++-- src/libs/utils/date.ts | 2 +- src/pages/schedule/Schedule.tsx | 8 +++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/libs/api/schedule/scheduleApi.ts b/src/libs/api/schedule/scheduleApi.ts index b78a3455..64a83b5e 100644 --- a/src/libs/api/schedule/scheduleApi.ts +++ b/src/libs/api/schedule/scheduleApi.ts @@ -13,7 +13,10 @@ export const getMonthScheduleAll = async ({ year, month }: CalendarPropsType): Promise => { - const res = await request.get(`/calendar/mark?year=${year}&month=${month}`) + const monthData = month > 9 ? month : `0${month}` + const res = await request.get( + `/calendar/mark?year=${year}&month=${monthData}` + ) return res.data } @@ -23,8 +26,9 @@ export const getDaySchedule = async ({ day }: CalendarDayPropsType): Promise => { const dayData = day > 9 ? day : `0${day}` + const monthData = month > 9 ? month : `0${month}` const res = await request.get( - `/calendar/date?date=${year}-${month}-${dayData}` + `/calendar/date?date=${year}-${monthData}-${dayData}` ) return res.data } diff --git a/src/libs/utils/date.ts b/src/libs/utils/date.ts index 8f7c280f..2bb59694 100644 --- a/src/libs/utils/date.ts +++ b/src/libs/utils/date.ts @@ -117,7 +117,7 @@ export const convertTo12HourFormat = (time: string) => { // 24시간 형식의 시간을 12시간 형식으로 변환합니다. const ampm = hours >= 12 ? '오후' : '오전' - const convertHours = hours === 0 ? 12 : hours % 12 + const convertHours = hours > 12 ? hours - 12 : hours const timeFormat = `${ampm} ${convertHours}시` // 변환된 시간을 "오후 2시 30분" 형식으로 반환합니다. diff --git a/src/pages/schedule/Schedule.tsx b/src/pages/schedule/Schedule.tsx index 219a6c37..bdeead58 100644 --- a/src/pages/schedule/Schedule.tsx +++ b/src/pages/schedule/Schedule.tsx @@ -2,6 +2,7 @@ import { useMemo, useState } from 'react' import { useNavigate } from 'react-router-dom' import { useQuery } from '@tanstack/react-query' import { CalenderType } from '../../types/date.ts' +import Loading from '@/components/Loading/Loading.tsx' import Calender from '@/components/common/calender/Calender.tsx' import Icon from '@/components/common/icon/Icon.tsx' import Profile from '@/components/common/profile/Profile.tsx' @@ -42,7 +43,7 @@ const Schedule = () => { month: calenderState.nowMonth }) }) - const { data: scheduleData } = useQuery({ + const { data: scheduleData, isLoading } = useQuery({ queryKey: ['scheduleData', calenderState.toDay], queryFn: () => getDaySchedule({ @@ -77,7 +78,8 @@ const Schedule = () => { holidays={monthSchedule?.holidays || []} /> -
+
+ {isLoading && } {scheduleData && scheduleData.dateResponses.map((data, index) => ( <> @@ -122,7 +124,7 @@ const Schedule = () => { ))} ))} - {!scheduleData && ( + {!scheduleData && !isLoading && ( {'생성된 스케줄이 없습니다. 스케줄을 생성해주세요!'} From 7a656b733cf999ecda2dcf91f6eceb3ff76e4ff0 Mon Sep 17 00:00:00 2001 From: HeeSeok-kim <106604926+HeeSeok-kim@users.noreply.github.com> Date: Sun, 3 Dec 2023 14:38:56 +0900 Subject: [PATCH 2/7] =?UTF-8?q?fix:=20SelectCity=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EB=84=93=EC=9D=B4=EA=B0=80=20=EC=84=9C=EB=A1=9C=20?= =?UTF-8?q?=EB=8B=A4=EB=A5=B8=20=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0=20?= =?UTF-8?q?(#298)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/selectcity/CityStep.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/selectcity/CityStep.tsx b/src/components/selectcity/CityStep.tsx index 168642f3..ac9be327 100644 --- a/src/components/selectcity/CityStep.tsx +++ b/src/components/selectcity/CityStep.tsx @@ -41,11 +41,11 @@ const CityStep = ({ return [PROVINCE_TEXT, CITY_TEXT, TOWN_TEXT] }, []) - useEffect(()=>{ - if(selectRef.current){ + useEffect(() => { + if (selectRef.current) { selectRef.current.selectedIndex = 0 } - },[currentStep]) + }, [currentStep]) return ( <> @@ -85,7 +85,7 @@ const CityStep = ({ text={StepQuestionTitle[currentStep - 1]} step={currentStep} /> -
+
( className={`${ fullWidth ? 'w-full h-[52px]' : 'w-[323px] h-[52px]' } rounded-[10px] ${ - field === 'email' && - !validate('email', inputValue) && + (field === 'email' || + field === 'nickname' || + field === 'childname') && + !validate(field, inputValue) && inputValue !== '' ? 'border border-red-600' - : field === 'nickname' && - !validate('nickname', inputValue) && - inputValue !== '' - ? 'border border-red-600' : 'border border-blue-350' } px-[20px] font-nsk text-black-800 bg-white-200 body-18 placeholder:text-gray-600 outline-none`} value={inputValue} @@ -54,8 +51,8 @@ const Input = forwardRef( />

{field === 'email' && - !validate('email', inputValue) && - inputValue !== '' + inputValue !== '' && + !validate('email', inputValue) ? (errorMessage = '잘못된 이메일입니다') : field === 'nickname' && !validate('nickname', inputValue) && diff --git a/src/pages/onboarding/OnbardingPage.tsx b/src/pages/onboarding/OnbardingPage.tsx index 03de5435..3ab0dc23 100644 --- a/src/pages/onboarding/OnbardingPage.tsx +++ b/src/pages/onboarding/OnbardingPage.tsx @@ -140,6 +140,7 @@ const Onboarding = () => { ref={selectRef} onChange={handleSelectChange} value={selectValue} + placeholder={'아이 학년을 선택해주세요'} /> ) : ( {

))}
-
    + +
      {PAGE_CONTENT[currentPage].buttonType.map( (buttonLabel, i) => buttonLabel && ( @@ -180,7 +182,6 @@ const Onboarding = () => { : 'Round-blue-500' } onClick={() => { - // 아무것도 입력을 하지 않았을 때! if ( inputRef.current?.value === '' || selectRef.current?.value === '' diff --git a/src/pages/onboarding/constants.ts b/src/pages/onboarding/constants.ts index 1712bb77..913a4802 100644 --- a/src/pages/onboarding/constants.ts +++ b/src/pages/onboarding/constants.ts @@ -85,7 +85,6 @@ export const PAGE_CONTENT = [ ] export const CHILD_GRADE = [ - '', '초등학교 1학년', '초등학교 2학년', '초등학교 3학년', From e216f1e99bf3f46f94d07252359730974d1bf41d Mon Sep 17 00:00:00 2001 From: Eugene Kim <67894159+eugene028@users.noreply.github.com> Date: Sun, 3 Dec 2023 14:44:58 +0900 Subject: [PATCH 4/7] =?UTF-8?q?[Bug]=20:=20=EC=95=84=EC=9D=B4=20=EC=82=AC?= =?UTF-8?q?=EC=A7=84=20=EC=88=98=EC=A0=95=20=EC=A0=95=EB=B3=B4=EA=B0=80=20?= =?UTF-8?q?=EB=B0=94=EB=A1=9C=20=EB=B0=98=EC=98=81=20=EC=95=88=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=ED=98=84=EC=83=81=20=ED=95=B4=EA=B2=B0=20(#302)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 사진 수정 버그 개선 * fix: 아이 사진 수정 바로 반영 안되는 현상해결 * fix: console 로그 지우기 --- src/components/common/header/Header.tsx | 7 ++++- src/components/common/profile/Profile.tsx | 36 +++++++++++----------- src/components/common/toast/index.tsx | 5 +-- src/pages/EditChildren/EditChildren.tsx | 35 +++++++++++++++++++-- src/pages/EditChildren/EditingChildren.tsx | 9 +++--- src/routes/index.tsx | 5 ++- 6 files changed, 69 insertions(+), 28 deletions(-) diff --git a/src/components/common/header/Header.tsx b/src/components/common/header/Header.tsx index 75dcc603..636b406e 100644 --- a/src/components/common/header/Header.tsx +++ b/src/components/common/header/Header.tsx @@ -66,7 +66,12 @@ const Header = ({ ) : headerType === 'CloseWithTitle' ? (
      - navigate(-1)}> + 0 + ? () => navigate(backUrl) + : () => navigate(-1) + }> {pageTitle} diff --git a/src/components/common/profile/Profile.tsx b/src/components/common/profile/Profile.tsx index c56587bc..0e6d3617 100644 --- a/src/components/common/profile/Profile.tsx +++ b/src/components/common/profile/Profile.tsx @@ -19,27 +19,27 @@ const Profile = ({ const handleImageChange = (editId: number) => { if (imgRef.current && imgRef.current?.files) { + setImage(URL.createObjectURL(imgRef.current.files[0])) const formData = new FormData() formData.append('file', imgRef.current.files[0], 'myfile') - try { - request - .post(`/children/${editId}/profile`, formData, { - headers: { - 'Content-Type': 'multipart/form-data' - } - }) - .then((res) => { - setImage(res.data.profileImageUrl) + request + .post(`/children/${editId}/profile`, formData, { + headers: { + 'Content-Type': 'multipart/form-data' + } + }) + .then(() => { + setToast({ + comment: '프로필 사진을 수정했어요.', + type: 'success' }) - .catch(() => { - setToast({ - comment: '파일 용량이 너무 커서 업로드를 실패했어요.', - type: 'error' - }) + }) + .catch(() => { + setToast({ + comment: '파일 용량이 너무 커서 업로드를 실패했어요.', + type: 'error' }) - } catch { - setToast({ comment: '파일 업로드를 실패했어요.', type: 'error' }) - } + }) } } return ( @@ -81,7 +81,7 @@ const Profile = ({ {imageLabel && (

      {imageLabel}

      diff --git a/src/components/common/toast/index.tsx b/src/components/common/toast/index.tsx index 5d15f848..e1bb0bd8 100644 --- a/src/components/common/toast/index.tsx +++ b/src/components/common/toast/index.tsx @@ -3,10 +3,11 @@ const Toast = () => { return ( { const navigate = useNavigate() + const { setToast } = useToastify() const location = useLocation() + const { open, close, Modal } = useModal() const [childInfo, setChildInfo] = useState() const id = location.state.childId const { data, isLoading } = useQuery({ @@ -84,10 +88,37 @@ const EditChildren = () => { buttonType={'Plain-red'} width={'LW'} height={'SH'} - label={'아이 삭제하기'} - onClick={() => childInfoMutation.mutate(id)} + label={'아이 정보 삭제하기'} + onClick={() => open()} />
      + +

      {'아이 정보를 삭제할까요?'}

      +
+ } + />
) } diff --git a/src/pages/EditChildren/EditingChildren.tsx b/src/pages/EditChildren/EditingChildren.tsx index 3eeaeda4..3721dfe3 100644 --- a/src/pages/EditChildren/EditingChildren.tsx +++ b/src/pages/EditChildren/EditingChildren.tsx @@ -36,15 +36,16 @@ const EditingChildren = () => { childId: data } }) + window.location.reload() + setToast({ comment: '아이 정보를 수정했어요', type: 'success' }) } }) - const regex = /^[\sA-Za-z가-힣]{1,10}$/ const handleChildrenName = (name: string) => { - if (regex.test(name)) { - setValid(true) - } else { + if (name.length > 10) { setValid(false) + } else { + setValid(true) } } return ( diff --git a/src/routes/index.tsx b/src/routes/index.tsx index c2750ffa..3a2f06c0 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -77,7 +77,10 @@ export const router = createBrowserRouter( path: 'edit/:childId/editing', element: ( <> -
+
) From 0db57b18d9d6dbbb592d0ebf5a13f052a9c37f02 Mon Sep 17 00:00:00 2001 From: Eugene Kim <67894159+eugene028@users.noreply.github.com> Date: Sun, 3 Dec 2023 14:45:51 +0900 Subject: [PATCH 5/7] =?UTF-8?q?[Bug]=20:=20Dashboard=20=EA=B4=80=EB=A0=A8?= =?UTF-8?q?=202=EC=B0=A8=20QA=20=EC=88=98=EC=A0=95=EC=82=AC=ED=95=AD=20?= =?UTF-8?q?=EB=B0=98=EC=98=81=20(#303)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 아이 이름 default 설정, 결제날짜 자동지정 * feat: 토글 on/off 토스트바 생성 * fix: 모달 생성 및 invalidateQuries 미반영 수정 * feat: 모달창 적용 --- package-lock.json | 39 +++++++ package.json | 1 + src/components/BottomSheet/Dimmer.tsx | 20 ++++ src/components/common/label/LabelType.ts | 2 +- .../common/scheduleBox/ScheduleBox.tsx | 8 +- .../common/scheduleBox/ScheduleBoxType.ts | 6 +- src/components/review/ReviewBottomSheet.tsx | 87 ++++++++++++--- src/libs/api/academy/AcademyType.ts | 61 +++++------ src/libs/api/dashboard/DashBoardApi.ts | 10 ++ src/libs/api/dashboard/DashBoardType.ts | 4 +- src/libs/hooks/useOutSideClick.ts | 28 +++++ src/pages/academy/AcademyDashboard.tsx | 44 +++++--- .../academyDetail/AcademyDetailClass.tsx | 15 ++- .../academyDetail/AcademyDetailHeader.tsx | 17 ++- .../academy/academyDetail/AcademySetting.tsx | 101 ++++++++++++------ .../academy/addSchedule/AddAcademyInfo.tsx | 4 +- .../academy/addSchedule/AddAcademyName.tsx | 4 +- src/pages/academy/addSchedule/index.tsx | 12 ++- src/routes/index.tsx | 5 +- 19 files changed, 350 insertions(+), 118 deletions(-) create mode 100644 src/components/BottomSheet/Dimmer.tsx create mode 100644 src/libs/hooks/useOutSideClick.ts diff --git a/package-lock.json b/package-lock.json index 76247f84..50df21c4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,6 +21,7 @@ "eslint-plugin-import": "^2.29.0", "eslint-plugin-prettier": "^5.0.1", "eslint-plugin-react": "^7.33.2", + "framer-motion": "^10.16.12", "jotai": "^2.4.3", "react": "^18.2.0", "react-datepicker": "^4.21.0", @@ -2427,6 +2428,21 @@ "node": ">=10.0.0" } }, + "node_modules/@emotion/is-prop-valid": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz", + "integrity": "sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==", + "optional": true, + "dependencies": { + "@emotion/memoize": "0.7.4" + } + }, + "node_modules/@emotion/memoize": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz", + "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==", + "optional": true + }, "node_modules/@emotion/use-insertion-effect-with-fallbacks": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.0.1.tgz", @@ -9692,6 +9708,29 @@ "url": "https://github.com/sponsors/rawify" } }, + "node_modules/framer-motion": { + "version": "10.16.12", + "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-10.16.12.tgz", + "integrity": "sha512-w7Yzx0OzQ5Uh6uNkxaX+4TuAPuOKz3haSbjmHpdrqDpGuCJCpq6YP9Dy7JJWdZ6mJjndrg3Ao3vUwDajKNikCA==", + "dependencies": { + "tslib": "^2.4.0" + }, + "optionalDependencies": { + "@emotion/is-prop-valid": "^0.8.2" + }, + "peerDependencies": { + "react": "^18.0.0", + "react-dom": "^18.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, "node_modules/fresh": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", diff --git a/package.json b/package.json index f35164e8..5d868cc9 100644 --- a/package.json +++ b/package.json @@ -30,6 +30,7 @@ "eslint-plugin-import": "^2.29.0", "eslint-plugin-prettier": "^5.0.1", "eslint-plugin-react": "^7.33.2", + "framer-motion": "^10.16.12", "jotai": "^2.4.3", "react": "^18.2.0", "react-datepicker": "^4.21.0", diff --git a/src/components/BottomSheet/Dimmer.tsx b/src/components/BottomSheet/Dimmer.tsx new file mode 100644 index 00000000..66171865 --- /dev/null +++ b/src/components/BottomSheet/Dimmer.tsx @@ -0,0 +1,20 @@ +import { MouseEventHandler, RefObject } from 'react' + +export type DimmerPropsType = { + dimmerRef: RefObject + onClick: MouseEventHandler +} + +const Dimmer = ({ dimmerRef, onClick }: DimmerPropsType) => { + return ( +
+ ) +} + +export default Dimmer diff --git a/src/components/common/label/LabelType.ts b/src/components/common/label/LabelType.ts index 87b80821..8bb34d53 100644 --- a/src/components/common/label/LabelType.ts +++ b/src/components/common/label/LabelType.ts @@ -20,7 +20,7 @@ export const LabelColorVariant = { export const LabelTextColorVariant = { default: { - medium: 'stroke-blue-500 text-blue-500 ', + medium: 'stroke-blue-500 text-blue-500', small: 'text-white-0' }, selected: { diff --git a/src/components/common/scheduleBox/ScheduleBox.tsx b/src/components/common/scheduleBox/ScheduleBox.tsx index ee9b3438..f924172d 100644 --- a/src/components/common/scheduleBox/ScheduleBox.tsx +++ b/src/components/common/scheduleBox/ScheduleBox.tsx @@ -37,8 +37,12 @@ const ScheduleBox = ({
{mainTitle}
)}
- - +
+ +
+
+ +
diff --git a/src/components/common/scheduleBox/ScheduleBoxType.ts b/src/components/common/scheduleBox/ScheduleBoxType.ts index 91160e47..1272a7b3 100644 --- a/src/components/common/scheduleBox/ScheduleBoxType.ts +++ b/src/components/common/scheduleBox/ScheduleBoxType.ts @@ -8,7 +8,7 @@ export interface ScheduleBoxProps extends ComponentProps<'div'> { rightBottomElement?: ReactNode // HTML태그를 넣을 수 있음! isRegister?: boolean cntOfChild?: number - handleToggle?: () => void - handleEdit?: () => void - handleDelete?: () => void + handleToggle?: (e: React.MouseEvent) => void + handleEdit?: (e: React.MouseEvent) => void + handleDelete?: (e: React.MouseEvent) => void } diff --git a/src/components/review/ReviewBottomSheet.tsx b/src/components/review/ReviewBottomSheet.tsx index 61505700..53106790 100644 --- a/src/components/review/ReviewBottomSheet.tsx +++ b/src/components/review/ReviewBottomSheet.tsx @@ -1,23 +1,37 @@ import { useEffect, useState } from 'react' import { useMutation } from '@tanstack/react-query' +import { motion } from 'framer-motion' +import Dimmer from '@/components/BottomSheet/Dimmer' import Button from '@/components/common/button/Button' import Label from '@/components/common/label/Label' import Spacing from '@/components/common/spacing/Spacing' +import { queryClient } from '@/libs/api/queryClient' import { postReview } from '@/libs/api/review/reviewApi' import { AcademyReview } from '@/libs/api/review/reviewType' import { ReviewRequestType } from '@/libs/api/review/reviewType' +import { useOutsideClick } from '@/libs/hooks/useOutSideClick' import useToastify from '@/libs/hooks/useToastify' const ReviewBottomSheet = ({ academyTitle, academyId, - setBottomSheetClose + bottomSheetState }: { academyTitle: string academyId: number - setBottomSheetClose: React.Dispatch> + bottomSheetState: boolean }) => { + const [isOpen, setOpen] = useState(false) + const [outsideRef, handleClickEditProfileDimmer] = useOutsideClick(() => + setOpen(false) + ) + + useEffect(() => { + setOpen(bottomSheetState) + }, [bottomSheetState]) + const { setToast } = useToastify() + const [reviewCount, setReviewCount] = useState([]) const [reviewState, setReviewState] = useState({ academyId: academyId, KINDNESS: false, @@ -29,34 +43,51 @@ const ReviewBottomSheet = ({ }) const reviewMutation = useMutation({ mutationFn: (reviewState: ReviewRequestType) => postReview(reviewState), + onSettled: (data) => { + queryClient.invalidateQueries({ + queryKey: ['isReview', data?.academyId] + }) + }, onSuccess: () => { - setBottomSheetClose(false) + setOpen(false) setToast({ comment: '리뷰를 성공적으로 남겼어요.', type: 'success' }) } }) - const handleMemo = (value: keyof ReviewRequestType) => { - if (reviewState[value]) { + const handleMemo = (value: string) => { + if (reviewCount.includes(value)) { setReviewState({ ...reviewState, [value]: false }) + setReviewCount(reviewCount.filter((data) => data !== value)) } else { setReviewState({ ...reviewState, [value]: true }) + setReviewCount([...reviewCount, value]) } } - useEffect(() => { - const valueAry = Object.values(reviewState) - const count = valueAry.filter(Boolean).length - if (count >= 4) - setToast({ comment: '리뷰는 4개 이상 남길 수 없어요.', type: 'warning' }) - }, [reviewState]) + return ( <> -
+ {isOpen ? ( + + ) : ( + '' + )} +
@@ -87,10 +118,27 @@ const ReviewBottomSheet = ({ return (
-
+ ) } diff --git a/src/libs/api/academy/AcademyType.ts b/src/libs/api/academy/AcademyType.ts index 86b7dab6..e1c6d491 100644 --- a/src/libs/api/academy/AcademyType.ts +++ b/src/libs/api/academy/AcademyType.ts @@ -121,40 +121,37 @@ export interface AcademyClassResponse { } export type ServerAcademyType = - | '예능(대)' - | '국제화' - | '입시, 검정 및 보습' - | '직업기술' - | '종합(대)' - | '독서실' - | '기예(대)' - | '기타(대)' - | '인문사회(대)' - | '정보' - -export type ClientAcademyType = - | '예능' - | '국제화' - | '입시' - | '직업기술' - | '종합' - | '독서실' - | '기예' + | '수학' + | '과학' + | '국어' + | '영어' + | '컴퓨터' + | '예체능' + | '외국어' + | '보습' | '기타' - | '인문사회' - | '정보' -export type AcademyType = Record +export type AcademyIconType = + | 'Math' + | 'Science' + | 'Korean' + | 'English' + | 'Computer' + | 'Music' + | 'Social' + | 'Synthesis' + | 'Etc' + +export type AcademyType = Record export const AcademyTypeData: AcademyType = { - '예능(대)': '예능', - 국제화: '국제화', - '입시, 검정 및 보습': '입시', - 직업기술: '직업기술', - '종합(대)': '종합', - 독서실: '독서실', - '기예(대)': '기예', - '기타(대)': '기타', - '인문사회(대)': '인문사회', - 정보: '정보' + 수학: 'Math', + 과학: 'Science', + 국어: 'Korean', + 영어: 'English', + 컴퓨터: 'Computer', + 예체능: 'Music', + 외국어: 'Social', + 보습: 'Synthesis', + 기타: 'Etc' } diff --git a/src/libs/api/dashboard/DashBoardApi.ts b/src/libs/api/dashboard/DashBoardApi.ts index 31a17de4..245b61bf 100644 --- a/src/libs/api/dashboard/DashBoardApi.ts +++ b/src/libs/api/dashboard/DashBoardApi.ts @@ -29,3 +29,13 @@ export const getDetailDashboard = async ( const res = await request.get(`/dashboards/${dashboardId}`) return res.data } + +export const getIsUserWroteReview = async ( + academyId: number +): Promise<{ + academyId: number + reviewable: boolean +}> => { + const res = await request.get(`/reviews/reviewable?academyId=${academyId}`) + return res.data +} diff --git a/src/libs/api/dashboard/DashBoardType.ts b/src/libs/api/dashboard/DashBoardType.ts index 8b2bbc82..69e771cc 100644 --- a/src/libs/api/dashboard/DashBoardType.ts +++ b/src/libs/api/dashboard/DashBoardType.ts @@ -32,10 +32,10 @@ interface AcademyInfoType { academyName: string contact: string fullAddress: string - shuttleAvailability: 'AVAILABLE' | 'DISAVAILABLE' + shuttleAvailability: 'AVAILABLE' | 'DISAVAILABLE' | 'NEED_INQUIRE' expectedFee: number updatedDate: string - areaOfExpertise: ServerAcademyType + categories: ServerAcademyType[] } export interface AcademyScheduleType { diff --git a/src/libs/hooks/useOutSideClick.ts b/src/libs/hooks/useOutSideClick.ts new file mode 100644 index 00000000..a4881d00 --- /dev/null +++ b/src/libs/hooks/useOutSideClick.ts @@ -0,0 +1,28 @@ +import { MouseEventHandler, RefObject, useEffect, useRef } from 'react' + +type UseOutsideFuncType = ( + close: () => void +) => [RefObject, MouseEventHandler] + +export const useOutsideClick: UseOutsideFuncType = (close) => { + const outsideRef: RefObject = useRef(null) + + const handleClickOutside = (event: MouseEvent) => { + if ( + outsideRef.current && + outsideRef.current.contains(event.target as Node) + ) { + close() + } + } + + useEffect(() => { + document.addEventListener('mousedown', handleClickOutside) + + return () => { + document.removeEventListener('mousedown', handleClickOutside) + } + }, [outsideRef, close]) + + return [outsideRef, () => handleClickOutside] +} diff --git a/src/pages/academy/AcademyDashboard.tsx b/src/pages/academy/AcademyDashboard.tsx index cc9257c9..a78f0ea3 100644 --- a/src/pages/academy/AcademyDashboard.tsx +++ b/src/pages/academy/AcademyDashboard.tsx @@ -56,6 +56,17 @@ const AcademyDashboard = () => { dashboardData.map((data) => { { if (data.dashboardId === res.dashboardId) { + if (data.isActive) { + setToast({ + comment: '학원을 그만둔 상태로 설정했어요', + type: 'success' + }) + } else { + setToast({ + comment: '학원을 다니는 중으로 설정했어요', + type: 'success' + }) + } const newData = dashboardData.map((data) => { if (data.dashboardId === res.dashboardId) { data.isActive = !data.isActive @@ -93,9 +104,9 @@ const AcademyDashboard = () => { {dashboardData.length === 0 ? (
- {'학원을 먼저 생성해주세요'} + {'아이가 다니는 학원 정보를 등록해주세요'}
) : (
{ rightBottomElement={
navigate('register')}> + onClick={() => + navigate('register', { + state: { + childId: childInfo.childId + } + }) + }>
{ className={ 'h-[200px] w-[370px] bg-white-0 p-[24px] px-[50px] flex flex-col items-center justify-between rounded-[15px]' }> -

{'일정을 삭제할까요?'}

+

{'학원 정보를 삭제할까요?'}

-
-
) } diff --git a/src/pages/academy/addSchedule/AddAcademyName.tsx b/src/pages/academy/addSchedule/AddAcademyName.tsx index 55462971..42285bbe 100644 --- a/src/pages/academy/addSchedule/AddAcademyName.tsx +++ b/src/pages/academy/addSchedule/AddAcademyName.tsx @@ -86,9 +86,7 @@ const AddAcademyName = ({
- {'찾는 학원이 없나요?'} -
+ }> {isModalOpen && (
{ const { setToast } = useToastify() @@ -22,6 +24,7 @@ const AddAcademy = () => { const childrenSelectRef = useRef(null) const classSelectRef = useRef(null) const navigate = useNavigate() + const { state } = useLocation() const dashboardMutation = useMutation({ mutationFn: postDashboardInfo, onSuccess: () => { @@ -33,7 +36,14 @@ const AddAcademy = () => { }) useEffect(() => { - setAcademyInfo({ ...initialAcademyInfoAtom }) + setAcademyInfo({ + ...initialAcademyInfoAtom, + childId: state.childId, + paymentInfo: { + ...academyInfo.paymentInfo, + paymentDay: getFormattingDate(new Date()) + } + }) }, []) return ( diff --git a/src/routes/index.tsx b/src/routes/index.tsx index 3a2f06c0..0511da82 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -170,7 +170,10 @@ export const router = createBrowserRouter( path: 'academies/:dashboardId/', element: ( <> -
+
), From 798991f753b877691d2ba2220080acf301494e09 Mon Sep 17 00:00:00 2001 From: sincerity developer <85999976+jisung24@users.noreply.github.com> Date: Sun, 3 Dec 2023 14:46:17 +0900 Subject: [PATCH 6/7] =?UTF-8?q?fix:=20=ED=8C=8C=EB=B9=84=EC=BD=98=20+=20?= =?UTF-8?q?=EC=A0=9C=EB=AA=A9=20=EC=88=98=EC=A0=95=20(#305)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index ed735bad..3fc1531d 100644 --- a/index.html +++ b/index.html @@ -2,10 +2,13 @@ - + - Vite + React + TS - + Studay +
From f6d41d77523de5315ebcf8863062a106e33aa62f Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sun, 3 Dec 2023 14:47:25 +0900 Subject: [PATCH 7/7] =?UTF-8?q?fix:=20=EB=B9=8C=EB=93=9C=EC=97=90=EB=9F=AC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/academy/AcademyDashboard.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/academy/AcademyDashboard.tsx b/src/pages/academy/AcademyDashboard.tsx index a78f0ea3..aa9a59d3 100644 --- a/src/pages/academy/AcademyDashboard.tsx +++ b/src/pages/academy/AcademyDashboard.tsx @@ -157,7 +157,7 @@ const AcademyDashboard = () => { setDashboardId(data.dashboardId) } }} - onClick={(e) => { + onClick={() => { navigate(`/academies/${data.dashboardId}`, { state: data.dashboardId })