-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into result-fetch/#92
- Loading branch information
Showing
29 changed files
with
572 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
app/(sub-page)/anonymous/components/anonymous-container.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use client'; | ||
import useFunnel from '@/app/hooks/useFunnel'; | ||
import SignUpTerm from '../../sign-up/components/sign-up-terms'; | ||
import { AnonymousResultType } from '@/app/utils/parser/anonymous'; | ||
import AnonymousUpload from './anonymous-upload'; | ||
import { FormState } from '@/app/ui/view/molecule/form/form-root'; | ||
import { useRouter } from 'next/navigation'; | ||
import { useAnonymousContext } from '../result/provider'; | ||
|
||
function isAnonymousResultType(formdata: any): formdata is AnonymousResultType { | ||
return formdata && 'graduationResult' in formdata && 'user' in formdata; | ||
} | ||
|
||
export default function AnonymousContainer() { | ||
const router = useRouter(); | ||
const { setResult } = useAnonymousContext(); | ||
const { Funnel, setStep } = useFunnel<'terms' | 'form'>('terms'); | ||
|
||
return ( | ||
<Funnel> | ||
<Funnel.Step name="terms"> | ||
<SignUpTerm | ||
onNext={() => { | ||
setStep('form'); | ||
}} | ||
/> | ||
</Funnel.Step> | ||
<Funnel.Step name="form"> | ||
<AnonymousUpload | ||
onNext={(formState?: FormState) => { | ||
if (isAnonymousResultType(formState?.value)) { | ||
setResult(formState.value); | ||
router.push('/anonymous/result'); | ||
} | ||
}} | ||
/> | ||
</Funnel.Step> | ||
</Funnel> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import UploadTakenLectureAnonymous from '@/app/ui/lecture/upload-taken-lecture/upload-taken-lectrue-anonymous'; | ||
import { FormState } from '@/app/ui/view/molecule/form/form-root'; | ||
|
||
interface AnonymousUploadProp { | ||
onNext?: (formState?: FormState) => void; | ||
} | ||
|
||
export default function AnonymousUpload({ onNext }: AnonymousUploadProp) { | ||
return <UploadTakenLectureAnonymous onSuccess={onNext} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import ContentContainer from '@/app/ui/view/atom/content-container/content-container'; | ||
import { AnonymousProvider } from './result/provider'; | ||
|
||
interface AnonymousLayoutProp { | ||
children: React.ReactNode; | ||
} | ||
|
||
export default function AnonymousLayout({ children }: AnonymousLayoutProp) { | ||
return <AnonymousProvider>{children}</AnonymousProvider>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Metadata } from 'next'; | ||
import AnonymousContainer from './components/anonymous-container'; | ||
import { Suspense } from 'react'; | ||
import ContentContainer from '@/app/ui/view/atom/content-container/content-container'; | ||
|
||
export const metadata: Metadata = { | ||
title: '비회원으로 검사하기', | ||
description: '로그인없이 졸업요건을 간편하게 검사해 보세요.', | ||
}; | ||
|
||
export default function AnonymousPage() { | ||
return ( | ||
<Suspense> | ||
<ContentContainer className="md:w-[768px] xl:w-[960px] p-4 py-6 md:p-8"> | ||
<AnonymousContainer /> | ||
</ContentContainer> | ||
</Suspense> | ||
); | ||
} |
42 changes: 42 additions & 0 deletions
42
app/(sub-page)/anonymous/result/component/anonymous-result.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
'use client'; | ||
import { ResultCategoryViewer } from '@/app/ui/result/result-category/result-category'; | ||
import UserInfoContentViewer from '@/app/ui/user/user-info-card/user-info-content/user-info-content-viewer'; | ||
import { AnonymousResultType, parseCredit, parseCreditDetailInfo, parseUserInfo } from '@/app/utils/parser/anonymous'; | ||
import { useAnonymousContext } from '../provider'; | ||
import { useRouter } from 'next/navigation'; | ||
import ResultCategoryDetailDialog from '@/app/ui/result/result-category-detail/result-category-detail-dialog'; | ||
import { ResultCategoryDetailInfoViewer } from '@/app/ui/result/result-category-detail/result-category-detail-info'; | ||
import { ResultCategoryKey } from '@/app/utils/key/result-category.key'; | ||
|
||
interface AnonymousResultProp { | ||
category: ResultCategoryKey; | ||
} | ||
|
||
const AnonymousResult = ({ category }: AnonymousResultProp) => { | ||
const { result } = useAnonymousContext(); | ||
const router = useRouter(); | ||
if (!result) { | ||
router.back(); | ||
return <></>; | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col items-center"> | ||
<div className="w-full"> | ||
<UserInfoContentViewer data={parseUserInfo(result)} categories={parseCredit(result)} /> | ||
</div> | ||
<ResultCategoryViewer categories={parseCredit(result)} className="top-[20rem] md:top-[27rem]" /> | ||
{category ? ( | ||
<ResultCategoryDetailDialog querystring={category}> | ||
<ResultCategoryDetailInfoViewer | ||
category={category} | ||
categories={parseCredit(result)} | ||
categoryInfo={parseCreditDetailInfo(result, category)} | ||
/> | ||
</ResultCategoryDetailDialog> | ||
) : null} | ||
</div> | ||
); | ||
}; | ||
|
||
export default AnonymousResult; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Metadata } from 'next/types'; | ||
import AnonymousResult from './component/anonymous-result'; | ||
import { ResultCategoryKey } from '@/app/utils/key/result-category.key'; | ||
import ContentContainer from '@/app/ui/view/atom/content-container/content-container'; | ||
|
||
export const metadata: Metadata = { | ||
title: '졸업 요건 검사 결과', | ||
description: '회원가입없이 졸업사정 결과와, 카테고리별 미이수 / 이수 과목정보 및 잔여학점을 확인해요', | ||
openGraph: { | ||
siteName: '졸업을 부탁해', | ||
url: 'https://mju-graduate.com/result', | ||
images: [ | ||
{ | ||
url: 'https://github.com/user-attachments/assets/2093a57f-af35-4280-8acb-d403341fc8ff', | ||
width: 1200, | ||
height: 630, | ||
alt: 'result-page iamge', | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
interface AnonymousResultPageProp { | ||
searchParams: { category: ResultCategoryKey }; | ||
} | ||
|
||
function AnonymousResultPage({ searchParams }: AnonymousResultPageProp) { | ||
const { category } = searchParams; | ||
|
||
return ( | ||
<ContentContainer className="max-md:max-w-[500px] md:w-[700px] p-4 py-6 md:p-8"> | ||
<AnonymousResult category={category} /> | ||
</ContentContainer> | ||
); | ||
} | ||
|
||
export default AnonymousResultPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
'use client'; | ||
import { createContext, useState, ReactNode, useContext } from 'react'; | ||
import { AnonymousResultType } from '@/app/utils/parser/anonymous'; | ||
|
||
interface AnonymousContextType { | ||
result?: AnonymousResultType; | ||
setResult: (data: AnonymousResultType) => void; | ||
} | ||
|
||
export const AnonymousContext = createContext<AnonymousContextType | null>(null); | ||
|
||
export const AnonymousProvider = ({ children }: { children: ReactNode }) => { | ||
const [result, setResult] = useState<AnonymousResultType>(); | ||
|
||
return <AnonymousContext.Provider value={{ result, setResult }}>{children}</AnonymousContext.Provider>; | ||
}; | ||
|
||
export function useAnonymousContext() { | ||
const context = useContext(AnonymousContext); | ||
if (!context) { | ||
throw new Error('useAnonymousContext must be used within an AnonymousProvider'); | ||
} | ||
return context; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
app/ui/lecture/upload-taken-lecture/upload-taken-lectrue-anonymous.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use client'; | ||
import Manual from '@/app/(sub-page)/grade-upload/components/manual'; | ||
import { registerAnonymousGrade } from '@/app/business/services/lecture/taken-lecture.command'; | ||
import Form from '@/app/ui/view/molecule/form'; | ||
import UploadPdf from '@/app/ui/view/molecule/upload-pdf/upload-pdf'; | ||
|
||
interface UploadTakenLectureAnonymousProp { | ||
onSuccess?: (data: any) => void; | ||
} | ||
|
||
function UploadTakenLectureAnonymous({ onSuccess }: UploadTakenLectureAnonymousProp) { | ||
const handleSuccess = (data: any) => { | ||
onSuccess?.(data); | ||
}; | ||
|
||
return ( | ||
<Form action={registerAnonymousGrade} id="성적업로드" onSuccess={handleSuccess}> | ||
<Manual /> | ||
<div className="mt-8 md:w-96 w-80 m-auto flex flex-col gap-4"> | ||
<Form.Select | ||
required={true} | ||
label="영어성적" | ||
id="engLv" | ||
placeholder="선택하세요" | ||
options={[ | ||
{ value: 'BASIC', placeholder: '기초영어' }, | ||
{ value: 'ENG12', placeholder: 'Level12' }, | ||
{ value: 'ENG34', placeholder: 'Level34' }, | ||
{ value: 'FREE', placeholder: '면제' }, | ||
]} | ||
/> | ||
<UploadPdf /> | ||
</div> | ||
<div className="py-6"> | ||
<Form.SubmitButton label="결과 보러가기" position="center" size="md" /> | ||
</div> | ||
</Form> | ||
); | ||
} | ||
|
||
export default UploadTakenLectureAnonymous; |
Oops, something went wrong.