From e8ac9b5af2031816af742f62bb7c267f6fc5c56a Mon Sep 17 00:00:00 2001 From: yougyung Date: Fri, 6 Sep 2024 21:15:50 +0900 Subject: [PATCH 01/23] feat: add graduate_result announce --- .../user/user-info-card/user-info-content.tsx | 11 ++--- .../user/user-info-card/user-info-message.tsx | 40 +++++++++++++++++++ 2 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 app/ui/user/user-info-card/user-info-message.tsx diff --git a/app/ui/user/user-info-card/user-info-content.tsx b/app/ui/user/user-info-card/user-info-content.tsx index e8751a5c..a5e1b1b3 100644 --- a/app/ui/user/user-info-card/user-info-content.tsx +++ b/app/ui/user/user-info-card/user-info-content.tsx @@ -3,6 +3,7 @@ import { MAJOR_NOTATION } from '@/app/utils/key/result-category.key'; import React from 'react'; import PieChart from '../../view/molecule/pie-chart/pie-chart'; import { getPercentage } from '@/app/utils/chart.util'; +import UserInfoMessage from './user-info-message'; interface UserInfoContentProps { data: UserInfoResponse; @@ -21,15 +22,11 @@ function UserInfoContent({ data }: UserInfoContentProps) { }); }; + const remainCredit = totalCredit - takenCredit; + return ( <> -

- 졸업필요학점보다{' '} - - {totalCredit - takenCredit} - - 학점이 부족합니다. -

+
-
2. 좌측 성적/졸업 메뉴 → 성적표(상담용,B4)클릭
-
3. 우측 상단 조회버튼 클릭 → 프린트 아이콘 클릭
-
4. 인쇄 정보의 대상(PDF로 저장) 설정 → 하단 저장 버튼 클릭
+
2. 좌측 성적/졸업 메뉴 → 성적표(상담용,B4)
+
3. 우측 상단 조회버튼 → 프린트 아이콘
+
4. 인쇄 정보의 대상(PDF로 저장) 설정 → 하단 저장 버튼
5. 저장한 파일 업로드
• 회원 가입한 학번과 일치하는 학번의 성적표를 입력해야 합니다. diff --git a/app/(sub-page)/tutorial/data.tsx b/app/(sub-page)/tutorial/data.tsx index 115c6bb9..e20e529b 100644 --- a/app/(sub-page)/tutorial/data.tsx +++ b/app/(sub-page)/tutorial/data.tsx @@ -1,66 +1,68 @@ -import featureImage1 from '@/public/assets/tutorial/tutorial-feature1.png'; -import featureImage2 from '@/public/assets/tutorial/tutorial-feature2.png'; -import featureImage3 from '@/public/assets/tutorial/tutorial-feature3.png'; +import featureImage1 from '@/public/assets/tutorial/tutorial-feature1.gif'; +import featureImage2 from '@/public/assets/tutorial/tutorial-feature2.gif'; +import featureImage3 from '@/public/assets/tutorial/tutorial-feature3.gif'; import uploadImage0 from '@/public/assets/tutorial/tutorial0.png'; import uploadImage1 from '@/public/assets/tutorial/tutorial1.png'; import uploadImage2 from '@/public/assets/tutorial/tutorial2.png'; import uploadImage3 from '@/public/assets/tutorial/tutorial3.png'; import uploadImage4 from '@/public/assets/tutorial/tutorial4.png'; +import file from '../../../public/assets/file.svg'; +import dimond from '../../../public/assets/dimond.svg'; import { StaticImageData } from 'next/image'; import Link from 'next/link'; +import { title } from 'process'; +import image from '@/public/assets/test.png'; -interface TutorialItem { +export interface TutorialItem { imageUrl: StaticImageData; - title: string; + icon?: StaticImageData; content: React.ReactNode; } export const TUTORIAL_FEATRUE: TutorialItem[] = [ { imageUrl: featureImage1, - title: 'first', + icon: file, content: '강의 커스텀을 통한 졸업 사정 예측', }, { imageUrl: featureImage2, - title: 'second', - content: '카테고리별(교양 / 전공) 수강 학점 현황 조회', + content: '영역(공통교양 등)별 수강 현황 조회', + icon: dimond, }, { imageUrl: featureImage3, - title: 'third', - content: '카테고리별(교양 / 전공) 미이수 과목 정보 및 잔여 학점 조회', + icon: dimond, + content: '카테고리(사고와 표현 등)별 기이수/미이수 과목 정보 및 학점 조회', }, ]; export const TUTORIAL_UPLOAD: TutorialItem[] = [ { imageUrl: uploadImage0, - title: '1.', content: ( - - MyiWeb MSI에 접속 후 로그인(PC환경 권장) - + <> + + 1. MyiWeb MSI + + 에 접속 후 로그인(PC환경) + ), }, { imageUrl: uploadImage1, - title: '2.', - content: '좌측 성적/졸업 메뉴 → 성적표(상담용,B4)클릭', + content: '2. 좌측 성적/졸업 메뉴 → 성적표(상담용, B4)', }, { imageUrl: uploadImage2, - title: '3.', - content: '우측 상단 조회버튼 클릭 → 프린트 아이콘 클릭 (모바일 환경에서는 뜨지 않을 수 있습니다.)', + content: '3. 우측 상단 조회버튼 → 프린트 아이콘 (모바일 지원 X)', }, { imageUrl: uploadImage3, - title: '4.', - content: '인쇄 정보의 대상(PDF로 저장) 설정 → 하단 저장 버튼 클릭 (비율이 깨지지 않도록 조심해주세요.)', + content: '4. 인쇄 정보의 대상(PDF로 저장) 설정 → 하단 저장 버튼', }, { imageUrl: uploadImage4, - title: '5.', - content: '저장한 파일 업로드', + content: '5. 저장한 파일 업로드', }, ]; diff --git a/public/assets/dimond.svg b/public/assets/dimond.svg new file mode 100644 index 00000000..14371df7 --- /dev/null +++ b/public/assets/dimond.svg @@ -0,0 +1,3 @@ + + + diff --git a/public/assets/file.svg b/public/assets/file.svg new file mode 100644 index 00000000..ca1b4456 --- /dev/null +++ b/public/assets/file.svg @@ -0,0 +1,6 @@ + + + + + + From 2598822221615d665a14057545aca21e8c17a04d Mon Sep 17 00:00:00 2001 From: yougyung Date: Wed, 11 Sep 2024 11:03:38 +0900 Subject: [PATCH 11/23] fix: remove unused component --- .../image-card/image-card.stories.tsx | 35 ------------------- .../view/molecule/image-card/image-card.tsx | 21 ----------- 2 files changed, 56 deletions(-) delete mode 100644 app/ui/view/molecule/image-card/image-card.stories.tsx delete mode 100644 app/ui/view/molecule/image-card/image-card.tsx diff --git a/app/ui/view/molecule/image-card/image-card.stories.tsx b/app/ui/view/molecule/image-card/image-card.stories.tsx deleted file mode 100644 index 82b7cf3c..00000000 --- a/app/ui/view/molecule/image-card/image-card.stories.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import featureIamge from '@/public/assets/tutorial/tutorial-feature1.png'; -import type { Meta, StoryObj } from '@storybook/react'; -import ImageCard, { ImageCardProps } from './image-card'; - -const meta = { - title: 'ui/view/molecule/ImageCard', - component: ImageCard, - tags: ['autodocs'], - parameters: { - componentSubtitle: '요소는 이미지, 제목 그리고 설명 제공되는 경우에 사용됩니다.', - }, - argTypes: { - image: { - description: 'ImageCard의 이미지를 설정할 수 있습니다.', - }, - title: { - description: 'ImageCard의 title 내용을 설정할 수 있습니다.', - }, - content: { - description: 'ImageCard의 content 내용을 설정할 수 있습니다.', - }, - }, -} as Meta; - -export default meta; -type Story = StoryObj; - -export const Default: Story = { - args: { - image: featureIamge, - title: 'first', - content: '강의 커스텀을 통한 졸업 사정 예측', - }, - render: (args: ImageCardProps) => , -}; diff --git a/app/ui/view/molecule/image-card/image-card.tsx b/app/ui/view/molecule/image-card/image-card.tsx deleted file mode 100644 index 03e5acd7..00000000 --- a/app/ui/view/molecule/image-card/image-card.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { cn } from '@/app/utils/shadcn/utils'; -import Image, { StaticImageData } from 'next/image'; - -export interface ImageCardProps { - image: StaticImageData; - title: string; - content: React.ReactNode; - className?: string; -} - -function ImageCard({ image, title, content, className }: ImageCardProps) { - return ( -
- {title} -
{title}
-

{content}

-
- ); -} - -export default ImageCard; From 162033712e4221f3ea7872c068ea7b23274fee23 Mon Sep 17 00:00:00 2001 From: yougyung Date: Wed, 11 Sep 2024 11:04:37 +0900 Subject: [PATCH 12/23] style: redesign tutorial page --- .../tutorial/components/TutorialContent.tsx | 39 ++++++++++++++ app/(sub-page)/tutorial/data.tsx | 2 - app/(sub-page)/tutorial/page.tsx | 51 ++++++++----------- 3 files changed, 60 insertions(+), 32 deletions(-) create mode 100644 app/(sub-page)/tutorial/components/TutorialContent.tsx diff --git a/app/(sub-page)/tutorial/components/TutorialContent.tsx b/app/(sub-page)/tutorial/components/TutorialContent.tsx new file mode 100644 index 00000000..e87aba74 --- /dev/null +++ b/app/(sub-page)/tutorial/components/TutorialContent.tsx @@ -0,0 +1,39 @@ +'use client'; +import Image from 'next/image'; +import { cn } from '@/app/utils/shadcn/utils'; +import { useState } from 'react'; +import { TutorialItem } from '../data'; + +interface TestContentProps { + data: TutorialItem[]; +} + +function TutorialContent({ data }: TestContentProps) { + const [item, setItem] = useState(data[0]); + + return ( +
+ tutorial-image +
    + {Object.values(data).map((tutorial, index) => { + const { icon, content } = tutorial; + return ( +
  • setItem(tutorial)} + > + {icon && icon} + {content} +
  • + ); + })} +
+
+ ); +} + +export default TutorialContent; diff --git a/app/(sub-page)/tutorial/data.tsx b/app/(sub-page)/tutorial/data.tsx index e20e529b..0c80143e 100644 --- a/app/(sub-page)/tutorial/data.tsx +++ b/app/(sub-page)/tutorial/data.tsx @@ -10,8 +10,6 @@ import file from '../../../public/assets/file.svg'; import dimond from '../../../public/assets/dimond.svg'; import { StaticImageData } from 'next/image'; import Link from 'next/link'; -import { title } from 'process'; -import image from '@/public/assets/test.png'; export interface TutorialItem { imageUrl: StaticImageData; diff --git a/app/(sub-page)/tutorial/page.tsx b/app/(sub-page)/tutorial/page.tsx index 029d5fe3..11f1a1f5 100644 --- a/app/(sub-page)/tutorial/page.tsx +++ b/app/(sub-page)/tutorial/page.tsx @@ -1,10 +1,9 @@ -import ImageCard from '@/app/ui/view/molecule/image-card/image-card'; -import TitleBox from '@/app/ui/view/molecule/title-box/title-box'; import { cn } from '@/app/utils/shadcn/utils'; -import Image from 'next/image'; import { TUTORIAL_FEATRUE, TUTORIAL_UPLOAD } from './data'; import ContentContainer from '@/app/ui/view/atom/content-container/content-container'; import type { Metadata } from 'next'; +import TutorialContent from './components/TutorialContent'; +import Link from 'next/link'; export const metadata: Metadata = { title: '튜토리얼', @@ -13,36 +12,28 @@ export const metadata: Metadata = { function TutorialPage() { return ( - +

튜토리얼

-

- 명지인을 위한 졸업 요건 충족도 확인 서비스 ‘졸업을부탁해’ 입니다.
- 우리 서비스의 주요 정보와 사용법을 확인해보세요 -

- -
- {TUTORIAL_FEATRUE.map((feature, index) => ( - {`feature-${index}`} - ))} +
+
+ 졸업 요건 충족도 확인 서비스 +
+ 졸업을 부탁해의  + + 주요 기능과 사용법을 소개해요
- -

- 정보 제공을 위해서는 여러분의 이수과목 정보가 필요합니다. -
PDF 업로드를 진행해주세요. -

- -
- {TUTORIAL_UPLOAD.map((feature, index) => ( - - ))} + +
+
+
+ + MYIWEB 성적표 + + 를 통해
+ 나만의 졸업사정결과를 확인해요
- + +
); } From 7d93ec3c232ee08f00fd9ba8a65b6a7caafacb2e Mon Sep 17 00:00:00 2001 From: yougyung Date: Wed, 11 Sep 2024 13:17:00 +0900 Subject: [PATCH 13/23] style: fix user-info department overflow issue --- app/ui/user/user-info-navigator/user-info-navigator.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/ui/user/user-info-navigator/user-info-navigator.tsx b/app/ui/user/user-info-navigator/user-info-navigator.tsx index c84aeb12..dea08a18 100644 --- a/app/ui/user/user-info-navigator/user-info-navigator.tsx +++ b/app/ui/user/user-info-navigator/user-info-navigator.tsx @@ -11,7 +11,7 @@ function formatUserInfo(userInfo: InitUserInfoResponse | UserInfoResponse | unde if (!userInfo) { return { name: '소중한 GUEST', - major: '성적표를 입력하고, 졸업 여부를 확인하세요', + major: '성적표 입력 후, 졸업 여부를 확인해요', studentNumber: '', }; } @@ -19,7 +19,7 @@ function formatUserInfo(userInfo: InitUserInfoResponse | UserInfoResponse | unde if (isInitUser(userInfo)) { return { name: '명지인', - major: '성적표를 입력하고, 졸업 여부를 확인하세요', + major: '성적표 입력 후, 졸업 여부를 확인해요', studentNumber: userInfo.studentNumber, }; } @@ -36,7 +36,7 @@ export default async function UserInfoNavigator() { return (
- +
{userInfo.name} From 2604545e7bb126b3e2e7a0c8ead245e0151a7f76 Mon Sep 17 00:00:00 2001 From: yougyung Date: Wed, 11 Sep 2024 23:51:57 +0900 Subject: [PATCH 14/23] refactor: change calculate remainCredit --- .../user/user-info-card/user-info-content.tsx | 5 +- .../user/user-info-card/user-info-message.tsx | 47 +++++++++---------- 2 files changed, 22 insertions(+), 30 deletions(-) diff --git a/app/ui/user/user-info-card/user-info-content.tsx b/app/ui/user/user-info-card/user-info-content.tsx index b1fbb748..2ecff8a6 100644 --- a/app/ui/user/user-info-card/user-info-content.tsx +++ b/app/ui/user/user-info-card/user-info-content.tsx @@ -11,7 +11,6 @@ interface UserInfoContentProps { function UserInfoContent({ data }: UserInfoContentProps) { const { studentNumber, studentName, completeDivision: majors, totalCredit, takenCredit, graduated } = data; - const percentage = getPercentage(takenCredit, totalCredit); const displaySeveralMajor = (notation: 'major' | 'title'): React.ReactNode => { @@ -22,11 +21,9 @@ function UserInfoContent({ data }: UserInfoContentProps) { }); }; - const remainCredit = totalCredit - takenCredit; - return ( <> - +
    diff --git a/app/ui/user/user-info-card/user-info-message.tsx b/app/ui/user/user-info-card/user-info-message.tsx index b7afbe7a..c6bb8092 100644 --- a/app/ui/user/user-info-card/user-info-message.tsx +++ b/app/ui/user/user-info-card/user-info-message.tsx @@ -1,38 +1,33 @@ +'use client'; +import { useFetchCredits } from '@/app/store/querys/result'; + interface UserInfoMessageProps { studentName: string; - graduated: boolean; - remainCredit: number; } -const graduateType = { - GRADUATED: 'GRADUATED', - STUDENT: 'STUDENT', - CANDIDATE: 'CANDIDATE', -} as const; +function UserInfoMessage({ studentName }: UserInfoMessageProps) { + const { data: categories } = useFetchCredits(); -function UserInfoMessage({ studentName, graduated, remainCredit }: UserInfoMessageProps) { - const graduateLevel = () => { - if (graduated) return graduateType.GRADUATED; - return remainCredit > 0 ? graduateType.STUDENT : graduateType.CANDIDATE; - }; + const remainCredit = categories.reduce((accumulator, category) => { + if (category.category === 'CHAPEL') return accumulator; - const graduate_message = { - GRADUATED: '졸업을 축하합니다 !', - CANDIDATE: '모든 영역의 기준학점을 달성해주세요.', - STUDENT: ( - <> - 졸업필요학점보다 - - {remainCredit} - - 학점이 부족합니다. - - ), - } as const; + return accumulator + (category.totalCredit - category.takenCredit); + }, 0); return (

    - {studentName}님, {graduate_message[graduateLevel()]} + {studentName}님, + {remainCredit > 0 ? ( + <> + 졸업필요학점보다 + + {remainCredit} + + 학점이 부족합니다. + + ) : ( + '졸업을 축하합니다 !' + )}

    ); } From 9e63bfb2d2db00801ffd762a2715e6baa6f70818 Mon Sep 17 00:00:00 2001 From: yougyung Date: Wed, 11 Sep 2024 23:56:45 +0900 Subject: [PATCH 15/23] fix: change announce text --- app/ui/user/user-info-card/user-info-message.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ui/user/user-info-card/user-info-message.tsx b/app/ui/user/user-info-card/user-info-message.tsx index c6bb8092..267f1ee4 100644 --- a/app/ui/user/user-info-card/user-info-message.tsx +++ b/app/ui/user/user-info-card/user-info-message.tsx @@ -19,11 +19,11 @@ function UserInfoMessage({ studentName }: UserInfoMessageProps) { {studentName}님, {remainCredit > 0 ? ( <> - 졸업필요학점보다 + 졸업까지 {remainCredit} - 학점이 부족합니다. + 학점 남았어요. ) : ( '졸업을 축하합니다 !' From fd28940dba8fedc1442fc4060a633fd1d04e3b9d Mon Sep 17 00:00:00 2001 From: yougyung Date: Thu, 12 Sep 2024 00:03:07 +0900 Subject: [PATCH 16/23] refactor: change calculate remainCredit --- app/ui/user/user-info-card/user-info-content.tsx | 13 +++++++++++-- app/ui/user/user-info-card/user-info-message.tsx | 14 ++------------ 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/app/ui/user/user-info-card/user-info-content.tsx b/app/ui/user/user-info-card/user-info-content.tsx index 2ecff8a6..deb0a675 100644 --- a/app/ui/user/user-info-card/user-info-content.tsx +++ b/app/ui/user/user-info-card/user-info-content.tsx @@ -1,17 +1,26 @@ +'use client'; import { UserInfoResponse } from '@/app/business/services/user/user.type'; import { MAJOR_NOTATION } from '@/app/utils/key/result-category.key'; import React from 'react'; import PieChart from '../../view/molecule/pie-chart/pie-chart'; import { getPercentage } from '@/app/utils/chart.util'; import UserInfoMessage from './user-info-message'; +import { useFetchCredits } from '@/app/store/querys/result'; interface UserInfoContentProps { data: UserInfoResponse; } function UserInfoContent({ data }: UserInfoContentProps) { + const { data: categories } = useFetchCredits(); const { studentNumber, studentName, completeDivision: majors, totalCredit, takenCredit, graduated } = data; - const percentage = getPercentage(takenCredit, totalCredit); + + const remainCredit = categories.reduce((accumulator, category) => { + if (category.category === 'CHAPEL') return accumulator; + return accumulator + (category.totalCredit - category.takenCredit); + }, 0); + + const percentage = getPercentage(totalCredit - remainCredit, totalCredit); const displaySeveralMajor = (notation: 'major' | 'title'): React.ReactNode => { return majors.map((major, index) => { @@ -23,7 +32,7 @@ function UserInfoContent({ data }: UserInfoContentProps) { return ( <> - +
      diff --git a/app/ui/user/user-info-card/user-info-message.tsx b/app/ui/user/user-info-card/user-info-message.tsx index 267f1ee4..061b2817 100644 --- a/app/ui/user/user-info-card/user-info-message.tsx +++ b/app/ui/user/user-info-card/user-info-message.tsx @@ -1,19 +1,9 @@ -'use client'; -import { useFetchCredits } from '@/app/store/querys/result'; - interface UserInfoMessageProps { studentName: string; + remainCredit: number; } -function UserInfoMessage({ studentName }: UserInfoMessageProps) { - const { data: categories } = useFetchCredits(); - - const remainCredit = categories.reduce((accumulator, category) => { - if (category.category === 'CHAPEL') return accumulator; - - return accumulator + (category.totalCredit - category.takenCredit); - }, 0); - +function UserInfoMessage({ studentName, remainCredit }: UserInfoMessageProps) { return (

      {studentName}님, From e68f51d322753cb95a3dfd2fe01d8d3585c4a1d4 Mon Sep 17 00:00:00 2001 From: yougyung Date: Thu, 12 Sep 2024 18:46:30 +0900 Subject: [PATCH 17/23] fix: grade-upload redirect resultpage --- app/business/services/lecture/taken-lecture.command.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/business/services/lecture/taken-lecture.command.ts b/app/business/services/lecture/taken-lecture.command.ts index 0c2086c4..a07fc6d9 100644 --- a/app/business/services/lecture/taken-lecture.command.ts +++ b/app/business/services/lecture/taken-lecture.command.ts @@ -29,7 +29,7 @@ export const registerUserGrade = async (prevState: FormState, formData: FormData message: 'fail upload grade', }; } - redirect('/my'); + redirect('/result'); }; export const parsePDFtoText = async (formData: FormData) => { From 1a71c609ca325882a9bc8dbaf68299e95b61998d Mon Sep 17 00:00:00 2001 From: yougyung Date: Thu, 12 Sep 2024 18:47:16 +0900 Subject: [PATCH 18/23] fix: remove unused import --- app/ui/result/result-category/result-category.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ui/result/result-category/result-category.tsx b/app/ui/result/result-category/result-category.tsx index f9d7ad9d..3d260e75 100644 --- a/app/ui/result/result-category/result-category.tsx +++ b/app/ui/result/result-category/result-category.tsx @@ -1,7 +1,7 @@ 'use client'; import { cn } from '@/app/utils/shadcn/utils'; import ResultCategoryCard from '../result-category-card/result-category-card'; -import { CreditResponse, useFetchCredits } from '@/app/store/querys/result'; +import { useFetchCredits } from '@/app/store/querys/result'; import { RESULT_CATEGORY } from '@/app/utils/key/result-category.key'; import { ResultCategoryKey } from '../result-category-detail-content/result-category-detail-content.stories'; From 7b753573baac3010b324e67827de487ddf1be077 Mon Sep 17 00:00:00 2001 From: yougyung Date: Thu, 12 Sep 2024 19:13:47 +0900 Subject: [PATCH 19/23] fix: redirect user by type --- middleware.ts | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/middleware.ts b/middleware.ts index 20e0f706..9ddc285e 100644 --- a/middleware.ts +++ b/middleware.ts @@ -27,16 +27,13 @@ async function getAuth(request: NextRequest): Promise<{ } const allowedOnlyGuestPath = ['/sign-in', '/sign-up', '/find-password', '/find-id']; -const allowedGuestPath = ['/tutorial', ...allowedOnlyGuestPath]; -const allowInitUserPath = ['/tutorial', '/grade-upload']; +const allowedGuestPath = ['/', '/tutorial', ...allowedOnlyGuestPath]; +const allowInitUserPath = ['/', '/tutorial', '/grade-upload']; function isAllowedGuestPath(path: string, strict: boolean = false) { - if (path === '/') { - return true; - } - const allowedPath = strict ? allowedOnlyGuestPath : allowedGuestPath; - return allowedPath.some((allowedPath) => path.startsWith(allowedPath)); + + return allowedPath.some((allowedPath) => path === allowedPath); } export async function middleware(request: NextRequest) { @@ -46,17 +43,22 @@ export async function middleware(request: NextRequest) { return await retryAuth(request); } - if (auth.role === 'init' && !allowInitUserPath.some((path) => request.nextUrl.pathname.startsWith(path))) { - return Response.redirect(new URL('/grade-upload', request.url)); - } - if (auth.role === 'guest' && !isAllowedGuestPath(request.nextUrl.pathname)) { + console.log(isAllowedGuestPath(request.nextUrl.pathname)); return Response.redirect(new URL('/sign-in', request.url)); } if (auth.role !== 'guest' && isAllowedGuestPath(request.nextUrl.pathname, true)) { return Response.redirect(new URL('/my', request.url)); } + + if (auth.role === 'init' && !allowInitUserPath.some((path) => request.nextUrl.pathname === path)) { + return Response.redirect(new URL('/grade-upload', request.url)); + } + + if (auth.role === 'user' && request.nextUrl.pathname === '/') { + return Response.redirect(new URL('/my', request.url)); + } } async function retryAuth(request: NextRequest) { From 235ffe57146133372483008b3ad33cb3b2b212ba Mon Sep 17 00:00:00 2001 From: yougyung Date: Thu, 12 Sep 2024 19:17:03 +0900 Subject: [PATCH 20/23] style: add margin in UserInfoMessage --- app/ui/user/user-info-card/user-info-message.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/ui/user/user-info-card/user-info-message.tsx b/app/ui/user/user-info-card/user-info-message.tsx index 061b2817..8a03d9f2 100644 --- a/app/ui/user/user-info-card/user-info-message.tsx +++ b/app/ui/user/user-info-card/user-info-message.tsx @@ -6,7 +6,7 @@ interface UserInfoMessageProps { function UserInfoMessage({ studentName, remainCredit }: UserInfoMessageProps) { return (

      - {studentName}님, + {studentName}님, {remainCredit > 0 ? ( <> 졸업까지 From 581f6adcdbca6d790ffc0f29d108f9387affef4c Mon Sep 17 00:00:00 2001 From: yougyung Date: Thu, 12 Sep 2024 19:56:59 +0900 Subject: [PATCH 21/23] chore: remove unused code --- middleware.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/middleware.ts b/middleware.ts index 9ddc285e..941185f9 100644 --- a/middleware.ts +++ b/middleware.ts @@ -44,7 +44,6 @@ export async function middleware(request: NextRequest) { } if (auth.role === 'guest' && !isAllowedGuestPath(request.nextUrl.pathname)) { - console.log(isAllowedGuestPath(request.nextUrl.pathname)); return Response.redirect(new URL('/sign-in', request.url)); } From 5a0c9ca2750de7f0b73c76263c940effef8883ae Mon Sep 17 00:00:00 2001 From: yougyung Date: Fri, 13 Sep 2024 13:24:51 +0900 Subject: [PATCH 22/23] fix: change credit text --- app/ui/user/user-info-card/user-info-content.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/ui/user/user-info-card/user-info-content.tsx b/app/ui/user/user-info-card/user-info-content.tsx index deb0a675..7592281c 100644 --- a/app/ui/user/user-info-card/user-info-content.tsx +++ b/app/ui/user/user-info-card/user-info-content.tsx @@ -39,8 +39,8 @@ function UserInfoContent({ data }: UserInfoContentProps) {

    • 이름
    • 학번
    • {displaySeveralMajor('title')} -
    • 졸업필요학점
    • -
    • 총 이수 학점
    • +
    • 졸업최소학점
    • +
    • 현재이수학점
    • 졸업가능여부
      From e8e5023ba32494e787c9c5bda3bea0482a6a9ff2 Mon Sep 17 00:00:00 2001 From: yougyung Date: Fri, 13 Sep 2024 13:30:37 +0900 Subject: [PATCH 23/23] refactor: change calculate remainCredit --- app/ui/user/user-info-card/user-info-content.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/ui/user/user-info-card/user-info-content.tsx b/app/ui/user/user-info-card/user-info-content.tsx index 7592281c..05908f9f 100644 --- a/app/ui/user/user-info-card/user-info-content.tsx +++ b/app/ui/user/user-info-card/user-info-content.tsx @@ -16,8 +16,10 @@ function UserInfoContent({ data }: UserInfoContentProps) { const { studentNumber, studentName, completeDivision: majors, totalCredit, takenCredit, graduated } = data; const remainCredit = categories.reduce((accumulator, category) => { - if (category.category === 'CHAPEL') return accumulator; - return accumulator + (category.totalCredit - category.takenCredit); + const { category: categoryName, totalCredit, takenCredit } = category; + if (categoryName === 'CHAPEL') return accumulator; + const categoryRemainCredit = totalCredit - takenCredit < 0 ? 0 : totalCredit - takenCredit; + return accumulator + categoryRemainCredit; }, 0); const percentage = getPercentage(totalCredit - remainCredit, totalCredit);