-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: my page refactor #139
Changes from 6 commits
cb26311
456d58f
8bc604a
350c30f
6939479
e570614
3c6aa74
f8b52be
f0c4e62
f39b312
62d9865
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
'use client'; | ||
import useDialog from '@/app/hooks/useDialog'; | ||
import Button from '@/app/ui/view/atom/button/button'; | ||
import { AlertDialog, AlertDialogContent, AlertDialogHeader } from '@/app/ui/view/molecule/alert-dialog/alert-dialog'; | ||
import { DIALOG_KEY } from '@/app/utils/key/dialog-key.util'; | ||
import { redirect } from 'next/navigation'; | ||
|
||
export default function UpdateInstruction() { | ||
const { isOpen, close } = useDialog(DIALOG_KEY.UPDATE_INSTRUCTION); | ||
|
||
return ( | ||
<AlertDialog open={isOpen}> | ||
<AlertDialogContent> | ||
<div className="flex flex-col gap-4"> | ||
<div className="text-xl font-bold">업데이트 안내문</div> | ||
<p className="text-gray-800 leading-6"> | ||
<span className="text-primary font-bold">졸업을 부탁해</span>가 2.0.2 버전으로 업데이트됨에 따라, 2024년 9월 | ||
3일 이전에 성적표를 업로드하신 모든 사용자께서는 성적표를 재업로드해 주시기 바랍니다. | ||
<br /> | ||
감사합니다. | ||
</p> | ||
<Button | ||
label="확인" | ||
size="xs" | ||
variant="list" | ||
style={{ alignSelf: 'flex-end' }} | ||
onClick={() => { | ||
close(); | ||
redirect('/grade-upload'); | ||
}} | ||
/> | ||
</div> | ||
</AlertDialogContent> | ||
</AlertDialog> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,15 +1,29 @@ | ||||||||||||||||||||||||||||||||||||||||||
import { fetchTakenLectures } from '@/app/business/services/lecture/taken-lecture.query'; | ||||||||||||||||||||||||||||||||||||||||||
import { fetchTakenLectures, TakenLectureInfoResponse } from '@/app/business/services/lecture/taken-lecture.query'; | ||||||||||||||||||||||||||||||||||||||||||
import TakenLectureList from './taken-lecture-list'; | ||||||||||||||||||||||||||||||||||||||||||
import TakenLectureLabel from './taken-lecture-label'; | ||||||||||||||||||||||||||||||||||||||||||
import TakenLectureAtomHydrator from '@/app/store/stores/taken-lecture-atom-hydrator'; | ||||||||||||||||||||||||||||||||||||||||||
import UpdateTakenLecture from './update-taken-lecture'; | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
const processChapel = (takenLectures: TakenLectureInfoResponse[]) => { | ||||||||||||||||||||||||||||||||||||||||||
return takenLectures.map((lecture) => { | ||||||||||||||||||||||||||||||||||||||||||
return { | ||||||||||||||||||||||||||||||||||||||||||
id: lecture.id, | ||||||||||||||||||||||||||||||||||||||||||
year: lecture.year, | ||||||||||||||||||||||||||||||||||||||||||
semester: lecture.semester, | ||||||||||||||||||||||||||||||||||||||||||
lectureCode: lecture.lectureCode, | ||||||||||||||||||||||||||||||||||||||||||
lectureName: lecture.lectureName, | ||||||||||||||||||||||||||||||||||||||||||
credit: lecture.lectureName === '채플' ? 0.5 : lecture.credit, | ||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||||||
}; | ||||||||||||||||||||||||||||||||||||||||||
export default async function TakenLecture() { | ||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. credit 외 속성은 모두 그대로 사용하니, 구조 분해 할당을 사용하면 코드가 더 보기 편할 것 같아요.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 알려주셔서 감사합니다 |
||||||||||||||||||||||||||||||||||||||||||
const data = await fetchTakenLectures(); | ||||||||||||||||||||||||||||||||||||||||||
const takenLectures = processChapel(data.takenLectures); | ||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||
return ( | ||||||||||||||||||||||||||||||||||||||||||
<div className="flex flex-col gap-2"> | ||||||||||||||||||||||||||||||||||||||||||
<TakenLectureAtomHydrator initialValue={data.takenLectures}> | ||||||||||||||||||||||||||||||||||||||||||
<UpdateTakenLecture data={data.takenLectures}> | ||||||||||||||||||||||||||||||||||||||||||
<TakenLectureAtomHydrator initialValue={takenLectures}> | ||||||||||||||||||||||||||||||||||||||||||
<UpdateTakenLecture data={takenLectures}> | ||||||||||||||||||||||||||||||||||||||||||
<TakenLectureLabel /> | ||||||||||||||||||||||||||||||||||||||||||
<TakenLectureList /> | ||||||||||||||||||||||||||||||||||||||||||
</UpdateTakenLecture> | ||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,9 @@ export default function TakenLectureList() { | |
}); | ||
} | ||
deleteLecture(lectureId); | ||
toast({ | ||
title: '과목 삭제에 성공했습니다', | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 과목을 여러 개 삭제하면 어떤 과목이 삭제되었는지 확인하기 어려울 것 같아서 lectureName이나 코드 정보를 ID로 가져오는 것이 어렵지 않다면, 토스트 메시지에 추가하는 것도 좋아보여요. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. f0c4e62 |
||
}; | ||
|
||
return ( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 로그인시에 만료유저여부를 식별하는만큼 SignInPage에 위치시키는 것은 어떨까요? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
'use client'; | ||
import UpdateInstruction from '@/app/(sub-page)/sign-in/components/updateInstruction'; | ||
import Form from '../../view/molecule/form'; | ||
import { authenticate } from '@/app/business/services/user/user.command'; | ||
import useDialog from '@/app/hooks/useDialog'; | ||
import { DIALOG_KEY } from '@/app/utils/key/dialog-key.util'; | ||
|
||
export default function SignInForm() { | ||
const { open } = useDialog(DIALOG_KEY.UPDATE_INSTRUCTION); | ||
return ( | ||
<Form id="로그인" className="space-y-6" action={authenticate}> | ||
<Form.TextInput required={true} label="아이디" id="authId" placeholder="아이디를 입력하세요" /> | ||
<Form.PasswordInput required={true} label="비밀번호" id="password" placeholder="비밀번호를 입력하세요" /> | ||
<div className="pt-6"> | ||
<Form.SubmitButton label="로그인" position="center" variant="primary" /> | ||
</div> | ||
</Form> | ||
<> | ||
<Form | ||
id="로그인" | ||
className="space-y-6" | ||
action={authenticate} | ||
onSuccess={(formState) => { | ||
if (formState?.message === '재업로드') open(); | ||
}} | ||
> | ||
<Form.TextInput required={true} label="아이디" id="authId" placeholder="아이디를 입력하세요" /> | ||
<Form.PasswordInput required={true} label="비밀번호" id="password" placeholder="비밀번호를 입력하세요" /> | ||
<div className="pt-6"> | ||
<Form.SubmitButton label="로그인" position="center" variant="primary" /> | ||
</div> | ||
</Form> | ||
<UpdateInstruction /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
</> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
파일 이름을 케밥 케이스로 변경하는게 좋겠습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
수정했습니다!
f8b52be