Skip to content
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

User credit result/#91 #93

Merged
merged 8 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions app/(sub-page)/my/components/my-result-container.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import UserCreditResult from '@/app/ui/user/user-credit-result';
import Button from '@/app/ui/view/atom/button/button';
import Link from 'next/link';
import React from 'react';

export default function MyResultContainer() {
return (
<div className="flex flex-col justify-center gap-10">
<p className="font-bold sm:text-3xl text-2xl ml-1 sm:ml-0">๋งˆ์ดํŽ˜์ด์ง€</p>
<UserCreditResult />
<div className="flex justify-center">
<Link href="/result">
<Button label="์ˆ˜๊ฐ•ํ˜„ํ™ฉ ์ž์„ธํžˆ ๋ณด๊ธฐ" variant="primary" size="xs" />
</Link>
</div>
</div>
);
}
4 changes: 3 additions & 1 deletion app/(sub-page)/my/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ContentContainer from '@/app/ui/view/atom/content-container';
import Drawer from '@/app/ui/view/molecule/drawer/drawer';
import { DIALOG_KEY } from '@/app/utils/key/dialog-key.util';
import { Suspense } from 'react';
import MyResultContainer from './components/my-result-container';

export default function MyPage() {
return (
Expand All @@ -16,7 +17,8 @@ export default function MyPage() {
<UserInfoNavigator />
</Suspense>
</div>
<div className="w-full lg:w-[70%] lg:px-[20px]">
<div className="w-full lg:w-[70%] lg:px-[20px] pt-12 pb-2 flex flex-col gap-12">
<MyResultContainer />
<TakenLecture />
</div>
</ContentContainer>
Expand Down
12 changes: 10 additions & 2 deletions app/business/user/user.validation.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
import { z } from 'zod';

// api ๋ณ€๊ฒฝ ์˜ˆ์ •

export const UserInfoResponseSchema = z.object({
studentNumber: z.string(),
studentName: z.string(),
major: z.string(),
isSumbitted: z.boolean(),
completionDivision: z.array(
z.object({
majorType: z.string(),
major: z.string(),
}),
),
totalCredit: z.number(),
takenCredit: z.number(),
graduated: z.boolean(),
});

export const ValidateTokenResponseSchema = z.object({
Expand Down
2 changes: 1 addition & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function RootLayout({
/>
</head>
<body>
<div className="bg-white w-[100vw] h-[100vh]">
<div className="bg-white">
<Provider>
<MSWComponent>
<NavigationBar />
Expand Down
23 changes: 19 additions & 4 deletions app/mocks/db.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,30 @@ export const mockDatabase: MockDatabaseAction = {
return {
studentNumber: '',
studentName: '',
major: '',
isSumbitted: false,
completionDivision: [
{
majorType: '',
major: '',
},
],
totalCredit: 0,
takenCredit: 0,
graduated: false,
};
}
return {
studentNumber: user.studentNumber,
studentName: user.name,
major: user.major,
isSumbitted: user.isSumbitted,
completionDivision: [
{
majorType: 'primary',
major: '๋””์ง€ํ„ธ์ปจํ…์ธ ๋””์ž์ธํ•™๊ณผ',
},
],

totalCredit: 132,
takenCredit: 50,
graduated: false,
};
},
};
Expand Down
20 changes: 0 additions & 20 deletions app/ui/lecture/lecture-search/empty-data-container.tsx

This file was deleted.

19 changes: 17 additions & 2 deletions app/ui/lecture/lecture-search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,29 @@
import { useAtomValue } from 'jotai';
import LectureSearchBar from './lecture-search-bar';
import { searchWordAtom } from '@/app/store/search-word';
import EmptyDataContainer from './empty-data-container';
import { Suspense } from 'react';
import { LectureSearchResultSpinner } from './lecture-search-result/lecture-search-result-spinner';
import LectureSearchResult from './lecture-search-result';
import Image from 'next/image';
import searchResultIcon from '@/public/assets/searchResultIcon.svg';
import List from '../../view/molecule/list';

const emptyDataRender = () => {
return (
<div className="flex flex-col items-center justify-center gap-4">
<Image src={searchResultIcon} alt="search-result-icon" width={40} height={40} />
<div className="text-md font-medium text-gray-400 text-center whitespace-pre-wrap">
๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ๊ฐ€ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค
<br />ํ•œ ๊ธ€์ž ์ด์ƒ ๊ฒ€์ƒ‰ํ•ด์ฃผ์„ธ์š”
</div>
</div>
);
};
Comment on lines +12 to +22
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • ์ ์ ˆํ•ด ๋ณด์ด๋„ค์š”


export default function LectureSearch() {
const searchWord = useAtomValue(searchWordAtom);
const searchable = searchWord.keyword && searchWord.keyword.length > 1;

return (
<div className="bg-white w-full h-[500px] sm:h-[400px] z-[10] flex justify-center" data-testid="lecture-search">
<div className="w-[800px] mx-auto my-7 flex flex-col gap-10 sm:gap-6">
Expand All @@ -19,7 +34,7 @@ export default function LectureSearch() {
<LectureSearchResult />
</Suspense>
) : (
<EmptyDataContainer />
<List data={[]} isScrollList={true} emptyDataRender={emptyDataRender} />
)}
</div>
</div>
Expand Down
22 changes: 22 additions & 0 deletions app/ui/user/user-credit-result.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { getUserInfo } from '@/app/business/user/user.query';
import books from '@/public/assets/books.png';
import pencil from '@/public/assets/pencil.png';
import Image from 'next/image';

export default async function UserCreditResult() {
const userInfo = await getUserInfo();
return (
<div className="flex justify-between items-center bg-zinc-100 min-h-20 rounded-lg py-1 px-8 gap-3">
<div className="relative sm:h-20 sm:w-20 h-14 w-14">
<Image src={pencil} alt="pencil" layout="fill" />
</div>
<p className="zIndex-1 text-sm md:text-base lg:text-lg">
{userInfo.studentName}๋‹˜, ์ด ๊ธฐ์ค€ํ•™์  ์ค‘ <span className="text-point-blue">{userInfo.takenCredit}</span>ํ•™์ ์„
์ˆ˜๊ฐ•ํ•˜์…จ์Šต๋‹ˆ๋‹ค!
</p>
<div className="relative sm:h-20 sm:w-20 h-14 w-14">
<Image src={books} alt="books" layout="fill" />
</div>
</div>
);
}
2 changes: 1 addition & 1 deletion app/ui/user/user-info-navigator/user-info-navigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default async function UserInfoNavigator() {
<span className="font-semibold">{userInfo.studentName}</span>
<span>๋‹˜</span>
</div>
<div className="mb-3 text-sm">{userInfo.major}</div>
<div className="mb-3 text-sm">{userInfo.completionDivision[0].major}</div>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ฃผ์ „๊ณต ํ•˜๋‚˜๋งŒ ๋…ธ์ถœํ•˜์‹ค ๊ณ„ํš์ด์‹ ๊ฐ€์š”?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•— ์ด๊ฑฐ๋Š” mock ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ”๊พธ๋ฉด์„œ ์˜ค๋ฅ˜๊ฐ€ ๋‚˜์ง€ ์•Š๊ฒŒ๋” ๋ฐ”๊พผ ๊ฒƒ์ด๊ณ  ์–ด๋–ค ๊ฑฐ ๋…ธ์ถœํ•  ์ง€๋Š” user info navigator ๋‹ด๋‹นํ•˜์‹  ๋ถ„์ด ์ˆ˜์ •ํ•˜์ง€ ์•Š์„๊นŒ์‹ถ์Šต๋‹ˆ๋‹ค..!

<div className="text-sm text-gray-400">{userInfo.studentNumber}</div>

<div className="mt-9">
Expand Down
1 change: 1 addition & 0 deletions app/ui/view/molecule/drawer/drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const Drawer = ({ children, drawerKey, onClose, className }: DrawerProps) => {
className,
)}
>
<div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-slate-300" />
{children}
</DrawerPrimitive.Content>
</DrawerPrimitive.Portal>
Expand Down
Binary file added public/assets/books.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/pencil.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading