Skip to content

Commit 4aa0031

Browse files
authored
Merge pull request #83 from team-ppointer/feat/service/home/problem
[Feat/Service/#80] ProblemViewer 적용
2 parents 329d608 + 16b991c commit 4aa0031

17 files changed

Lines changed: 167 additions & 67 deletions

File tree

apps/service/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"dependencies": {
1313
"@next/third-parties": "^15.2.4",
1414
"@repo/pointer-design-system": "workspace:*",
15+
"@repo/pointer-editor": "workspace:*",
1516
"@tanstack/react-query": "^5.66.0",
1617
"@tanstack/react-query-devtools": "^5.66.0",
1718
"dayjs": "^1.11.13",
Lines changed: 3 additions & 0 deletions
Loading

apps/service/src/apis/authMiddleware.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use client';
22
import { Middleware } from 'openapi-fetch';
33

4-
import { getAccessToken, setAccessToken, setName, setRefreshToken } from '@utils';
4+
import { getAccessToken, setAccessToken, setGrade, setName, setRefreshToken } from '@utils';
55
import { postRefreshToken } from '@/apis/controller/auth';
66

77
const UNPROTECTED_ROUTES = ['/api/student/auth/social/login', '/api/common/auth/refresh'];
@@ -32,6 +32,7 @@ const reissueToken = async () => {
3232
}
3333
if (result.data?.name) {
3434
setName(result.data.name);
35+
setGrade(result.data.grade);
3536
}
3637
return accessToken;
3738
};

apps/service/src/apis/controller/home/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,12 @@ import useGetWeeklyProgress from './useGetWeeklyProgress';
22
import useGetNoticeUnreadCount from './useGetNoticeUnreadCount';
33
import useGetNotice from './useGetNotice';
44
import putRead from './putRead';
5+
import useGetWeeklyPublish from './useGetWeeklyPublish';
56

6-
export { useGetWeeklyProgress, useGetNoticeUnreadCount, useGetNotice, putRead };
7+
export {
8+
useGetWeeklyPublish,
9+
useGetWeeklyProgress,
10+
useGetNoticeUnreadCount,
11+
useGetNotice,
12+
putRead,
13+
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { TanstackQueryClient } from '@apis';
2+
3+
const useGetWeeklyPublish = () => {
4+
return TanstackQueryClient.useQuery('get', '/api/student/study/publish/weekly');
5+
};
6+
7+
export default useGetWeeklyPublish;

apps/service/src/app/(home)/page.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
import { useRouter } from 'next/navigation';
33

44
import { Button } from '@components';
5-
import { IcCalendar } from '@svg';
5+
import { IcCalendar, IcQuestionWhite } from '@svg';
66
import { trackEvent } from '@utils';
77
import { HomeHeader, NoticeButton, ProblemSwiper, WeekProgress } from '@/components/home';
8+
import { useGetWeeklyPublish } from '@/apis/controller/home';
89
const Page = () => {
910
const router = useRouter();
11+
const { data, isLoading } = useGetWeeklyPublish();
12+
const problemSets = data?.data ?? [];
1013

1114
const handleClickAllProblem = () => {
1215
trackEvent('home_all_problem_button_click');
@@ -31,21 +34,22 @@ const Page = () => {
3134
</div>
3235
</main>
3336
<div className='mt-[2.4rem]'>
34-
{/* {isLoading ? (
37+
{isLoading ? (
3538
<div className='h-[456px] w-full' />
3639
) : problemSets ? (
3740
<ProblemSwiper problemSets={problemSets} />
3841
) : (
3942
<></>
40-
)} */}
43+
)}
4144
</div>
42-
<footer className='bg-background mt-[2.4rem] flex flex-col gap-[1rem] px-[2rem] pb-[3.3rem]'>
45+
46+
<footer className='bg-background flex flex-col gap-[1rem] px-[2rem] pb-[3.3rem]'>
4347
<Button variant='light' onClick={handleClickAllProblem}>
4448
<IcCalendar width={24} height={24} />
4549
날짜별로 보기
4650
</Button>
4751
<Button variant='blue' onClick={handleClickQnA}>
48-
<IcCalendar width={24} height={24} />
52+
<IcQuestionWhite width={24} height={24} />
4953
QnA 바로가기
5054
</Button>
5155
</footer>

apps/service/src/app/onboarding/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useEffect, useState } from 'react';
66

77
import { Button, Header } from '@components';
88
import { postUserInfo } from '@/apis/controller/auth';
9-
import { setName } from '@utils';
9+
import { setName, setGrade } from '@utils';
1010
import UserInfoForm from '@/components/onboarding/UserInfoForm';
1111

1212
const Page = () => {
@@ -26,6 +26,7 @@ const Page = () => {
2626
if (result.isSuccess) {
2727
if (result.data) {
2828
setName(result.data.name);
29+
setGrade(result.data.grade);
2930
}
3031
router.push('/');
3132
} else {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import type { SVGProps } from 'react';
2+
import { memo } from 'react';
3+
interface SVGRProps {
4+
title?: string;
5+
titleId?: string;
6+
}
7+
const SvgIcQuestionWhite = ({ title, titleId, ...props }: SVGProps<SVGSVGElement> & SVGRProps) => (
8+
<svg fill='none' xmlns='http://www.w3.org/2000/svg' aria-labelledby={titleId} {...props}>
9+
{title ? <title id={titleId}>{title}</title> : null}
10+
<path
11+
d='M12 1C18.0751 1 23 5.92487 23 12C23 18.0751 18.0751 23 12 23C5.92487 23 1 18.0751 1 12C1 5.92487 5.92487 1 12 1Z'
12+
stroke='white'
13+
strokeWidth={2}
14+
strokeLinecap='round'
15+
strokeLinejoin='round'
16+
/>
17+
</svg>
18+
);
19+
const Memo = memo(SvgIcQuestionWhite);
20+
export default Memo;

apps/service/src/assets/svg/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export { default as IcPrescription20 } from './IcPrescription20';
2222
export { default as IcPrevBlack } from './IcPrevBlack';
2323
export { default as IcPrev } from './IcPrev';
2424
export { default as IcQuestion18 } from './IcQuestion18';
25+
export { default as IcQuestionWhite } from './IcQuestionWhite';
2526
export { default as IcRight } from './IcRight';
2627
export { default as IcSearch } from './IcSearch';
2728
export { default as IcSecret } from './IcSecret';

apps/service/src/components/home/HomeHeader.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
import Link from 'next/link';
22
import { IcSetting } from '@svg';
33
import { LogoHeader } from '@/assets/svg/logo';
4+
import { getName, getGrade } from '@/utils/common/auth';
45

56
const HomeHeader = () => {
7+
const name = getName();
8+
const grade = getGrade();
69
return (
710
<header className='bg-background fixed inset-0 z-40 mx-auto flex h-[6rem] max-w-[768px] items-center justify-between px-[2rem]'>
811
<Link href='/'>
912
<LogoHeader width={106} height={24} title='로고' titleId='logo-icon' />
1013
</Link>
1114
<div className='flex items-center gap-[0.8rem]'>
12-
{/* TODO: 학년 받아오기 */}
1315
<div className='font-medium-12 text-main bg-sub2 flex h-[2.2rem] items-center justify-center rounded-[0.4rem] px-[0.8rem]'>
14-
2학년
16+
{grade}학년
1517
</div>
1618
<div className='font-medium-14 text-black'>
17-
{/* TODO: 이름 받아오기 */}
1819
<>
19-
<span className='text-main mr-[0.4rem]'>홍길동</span>
20+
<span className='text-main mr-[0.4rem]'>{name}</span>
2021
</>
2122
</div>
2223
<Link href='/my-page'>

0 commit comments

Comments
 (0)