diff --git a/src/app/(auth)/_components/Register/Steps/UserConsentForm.tsx b/src/app/(auth)/_components/Register/Steps/UserConsentForm.tsx index a3afaec0b..a85faf740 100644 --- a/src/app/(auth)/_components/Register/Steps/UserConsentForm.tsx +++ b/src/app/(auth)/_components/Register/Steps/UserConsentForm.tsx @@ -3,7 +3,7 @@ import { useForm, Controller } from 'react-hook-form'; import { toast } from 'react-toastify'; import { REGISTER_CONSENT_LIST } from '@/constants/constants'; import { CheckMarkSVG } from '@/icons/svg'; -import StatusButton from '@/components/Button/StatusButton'; +import { Button } from '@/components/Button'; import { IMarketingConsent, IRegisterConsents } from '@/types/auth'; interface IUserConsentForm { @@ -233,16 +233,17 @@ const UserConsentForm = ({
- +
); diff --git a/src/app/(auth)/_components/Register/Steps/UserSetup.tsx b/src/app/(auth)/_components/Register/Steps/UserSetup.tsx index 362cc423e..1929c7bb5 100644 --- a/src/app/(auth)/_components/Register/Steps/UserSetup.tsx +++ b/src/app/(auth)/_components/Register/Steps/UserSetup.tsx @@ -3,7 +3,7 @@ import { useForm, FieldErrors } from 'react-hook-form'; import { toast } from 'react-toastify'; import { KaKaoTalkSVG, NaverSVG, GoogleSVG, CheckMarkSVG } from '@/icons/svg'; import { checkUserNickname } from '@/lib/apis/userApi'; -import StatusButton from '@/components/Button/StatusButton'; +import { Button } from '@/components/Button'; import { SignInResponse } from '@/types/auth'; import { IRegisterForm } from '@/types/form'; import { FetchError } from '@/types/types'; @@ -198,12 +198,13 @@ const UserSetup = ({
- 중복확인 - +
@@ -240,7 +241,8 @@ const UserSetup = ({
- 번호인증 - +
@@ -264,23 +266,28 @@ const UserSetup = ({ />
- 인증하기 - +
)}
- +
diff --git a/src/app/(auth)/_components/Register/UploadProfile.tsx b/src/app/(auth)/_components/Register/UploadProfile.tsx index 34710dbdf..7dd2dda84 100644 --- a/src/app/(auth)/_components/Register/UploadProfile.tsx +++ b/src/app/(auth)/_components/Register/UploadProfile.tsx @@ -5,7 +5,7 @@ import { toast } from 'react-toastify'; import { AddImageSVG, TrashcanSVG } from '@/../public/icons/svg'; import { postProfileImage } from '@/lib/apis/userApi'; import { useUserStore } from '@/store'; -import Button from '@/components/Button/Button'; +import { Button } from '@/components/Button'; const UploadProfile = () => { const [imgSrc, setImgSrc] = useState(null); diff --git a/src/app/(auth)/_components/Register/Welcome.tsx b/src/app/(auth)/_components/Register/Welcome.tsx index 29f5d3b2e..0c2a36e9d 100644 --- a/src/app/(auth)/_components/Register/Welcome.tsx +++ b/src/app/(auth)/_components/Register/Welcome.tsx @@ -1,7 +1,7 @@ 'use client'; import { useRouter } from 'next/navigation'; import { AuthWelcomeSVG, DoubleRightSVG } from '@/icons/svg'; -import Button from '@/components/Button/Button'; +import { Button } from '@/components/Button'; const Welcome = ({ nickname }: { nickname: string }) => { const router = useRouter(); diff --git a/src/app/api/post/class/review/route.ts b/src/app/api/post/review/class/route.ts similarity index 69% rename from src/app/api/post/class/review/route.ts rename to src/app/api/post/review/class/route.ts index 1746a892b..86e7f2de0 100644 --- a/src/app/api/post/class/review/route.ts +++ b/src/app/api/post/review/class/route.ts @@ -9,11 +9,20 @@ if (!END_POINT) { export const GET = async (request: NextRequest) => { const searchParams = request.nextUrl.searchParams; - const id = searchParams.get('id'); - const order = searchParams.get('orderBy'); - const token = request.cookies.get('userAccessToken')?.value; + const { + lectureId, + take, + currentPage, + targetPage, + firstItemId, + lastItemId, + orderBy, + } = Object.fromEntries(searchParams); + + const query = `take=${take}¤tPage=${currentPage}&targetPage=${targetPage}&firstItemId=${firstItemId}&lastItemId=${lastItemId}&orderBy=${orderBy}`; + const headers: Record = token ? { Authorization: `Bearer ${token}`, @@ -24,7 +33,7 @@ export const GET = async (request: NextRequest) => { }; const serverResponse = await fetch( - END_POINT + `/lecture-reviews/lectures/${id}?orderBy=${order}`, + END_POINT + `/lecture-reviews/lectures/${lectureId}?${query}`, { headers, }, diff --git a/src/app/api/post/review/instructor/route.ts b/src/app/api/post/review/instructor/route.ts index 4ef203852..295c527fe 100644 --- a/src/app/api/post/review/instructor/route.ts +++ b/src/app/api/post/review/instructor/route.ts @@ -9,21 +9,19 @@ if (!END_POINT) { export const GET = async (request: NextRequest) => { const searchParams = request.nextUrl.searchParams; - const lecturerId = searchParams.get('id'); - const order = searchParams.get('orderBy'); - const token = request.cookies.get('userAccessToken')?.value; const { - displayCount, + lecturerId, + take, currentPage, targetPage, firstItemId, lastItemId, - lecturerReviewType, + orderBy, } = Object.fromEntries(searchParams); - const query = `take=${displayCount}¤tPage=${currentPage}&targetPage=${targetPage}&firstItemId=${firstItemId}&lastItemId=${lastItemId}&lecturerReviewType=${lecturerReviewType}`; + const query = `take=${take}¤tPage=${currentPage}&targetPage=${targetPage}&firstItemId=${firstItemId}&lastItemId=${lastItemId}&orderBy=${orderBy}`; const headers: Record = token ? { diff --git a/src/app/class/@modal/(...)receipt/page.tsx b/src/app/class/@modal/(...)receipt/page.tsx index 78795876f..84f8ea986 100644 --- a/src/app/class/@modal/(...)receipt/page.tsx +++ b/src/app/class/@modal/(...)receipt/page.tsx @@ -1,118 +1,14 @@ -import { Fragment } from 'react'; -import { getReceipt } from '@/lib/apis/serverApis/paymentsApis'; -import { formatFullDateTime } from '@/utils/dateTimeUtils'; import Modal from '@/components/Modal/ReceiptModal'; -import { ISSUER_CODE } from '@/constants/constants'; +import Receipt from '@/components/uis/Receipt'; const ReceiptModalPage = async ({ searchParams, }: { searchParams: { [key: string]: string }; -}) => { - const { orderId } = searchParams; - const receiptData = await getReceipt(orderId); - if (receiptData instanceof Error) return; - - const { - orderName, - updatedAt, - originalPrice, - finalPrice, - cardPaymentInfo, - paymentCouponUsage, - } = receiptData; - - const issuer = cardPaymentInfo ? ISSUER_CODE[cardPaymentInfo.issuerCode] : ''; - - // 무통장, 패스권일 때 로직 추가 예정 - const paymentDetails = [ - { - type: '클래스명', - content: orderName, - }, - { - type: '승인일시', - content: formatFullDateTime(updatedAt), - }, - { - type: '승인번호', - content: cardPaymentInfo?.approveNo, - }, - { - type: '결제수단', - content: `${issuer} (${cardPaymentInfo?.number.slice(-4)})`, - }, - { - type: '결제구분', - content: - cardPaymentInfo?.installmentPlanMonths === 0 - ? '일시불' - : cardPaymentInfo?.installmentPlanMonths, - }, - - { - type: '클래스 금액', - content: `${originalPrice.toLocaleString()} 원`, - }, - ]; - - // 쿠폰 관련 추후 수정 필요 - const couponDetails = paymentCouponUsage - ? { - type: '적용 쿠폰', - content: ( - <> - - {paymentCouponUsage?.couponDiscountPrice?.toLocaleString()}원{' '} -
({paymentCouponUsage.couponTitle}) - {paymentCouponUsage.stackableCouponDiscountPrice && - paymentCouponUsage.stackableCouponTitle ? ( - <> -
- - {paymentCouponUsage.stackableCouponDiscountPrice.toLocaleString()} - 원
({paymentCouponUsage.stackableCouponTitle}) - - ) : null} - - ), - } - : {}; - - const receiptDetails = [...paymentDetails, couponDetails]; - - return ( - -
-

Connection

-

{orderId}

-
- -
    - {receiptDetails.map((detail, index) => ( - -
  • - {detail.type} -
  • -
  • {detail.content}
  • - {index === 0 || index === 4 ? ( -
    - ) : null} -
    - ))} -
-
-

총 결제금액

-

- {finalPrice.toLocaleString()}원 -

-
- - {/* 결제 취소 API 연동 필요 */} - -
-
- ); -}; +}) => ( + + + +); export default ReceiptModalPage; diff --git a/src/app/class/@modal/(...)report/page.tsx b/src/app/class/@modal/(...)report/page.tsx index f96606c43..52d33103b 100644 --- a/src/app/class/@modal/(...)report/page.tsx +++ b/src/app/class/@modal/(...)report/page.tsx @@ -1,100 +1,11 @@ 'use client'; -import { useSearchParams, useRouter } from 'next/navigation'; -import { useForm } from 'react-hook-form'; -import { toast } from 'react-toastify'; -import { postLecturerReport, postUserReport } from '@/lib/apis/reportApis'; -import { useUserStore } from '@/store'; -import UniqueButton from '@/components/Button/UniqueButton'; -import ReportCheckBox from '@/components/CheckBox/ReportCheckBox'; import RouterModal from '@/components/Modal/RouterModal'; -import { ReportFormData, ReportType, IReportRequest } from '@/types/report.d'; +import Report from '@/components/uis/Report'; -const ReportModalPage = () => { - const loggedInUserType = useUserStore((state) => state.userType); - const router = useRouter(); - const searchParams = useSearchParams(); - const { register, handleSubmit } = useForm(); - - const onSubmit = async (data: ReportFormData) => { - const reportTypes: ReportType[] = []; - - for (const [key, value] of Object.entries(data)) { - if (value === true) { - const reportTypeKey = Object.keys(ReportType).find( - (type) => ReportType[type as keyof typeof ReportType] === key, - ) as ReportType; - reportTypes.push(reportTypeKey); - } - } - - if (reportTypes.length === 0) { - toast.error('신고 유형을 한개 이상 입력해주세요!'); - return; - } - - const requestData: IReportRequest = { - reportTypes, - reason: data.reportDetail, - }; - - for (const [key, value] of searchParams.entries()) { - if ( - ['targetUserId', 'targetLecturerId', 'lectureReviewId'].includes(key) - ) { - requestData[ - key as 'targetUserId' | 'targetLecturerId' | 'lectureReviewId' - ] = Number(value); - } - } - - if (!requestData) return; - - const response = - loggedInUserType === 'user' - ? await postUserReport(requestData) - : await postLecturerReport(requestData); - - if (response === 201) { - toast.success('신고가 성공적으로 접수되었습니다!'); - router.back(); - } else if (response === 400) { - toast.error('이미 신고가 접수되었습니다!'); - } else { - toast.error(`신고 접수에 실패하였습니다. ${(
)}다시 시도해주세요!`); - } - }; - - return ( - -
-

- 신고하기 -

-
    - {Object.values(ReportType).map((reason, i) => ( - - ))} -
- -
-

신고사유

-