-
Notifications
You must be signed in to change notification settings - Fork 5
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
[FE] issue134: 내 스터디 페이지 생성 #166
Merged
+1,528
−146
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b9f27b5
feat: 내 스터디 카드 컴포넌트 생성
airman5573 02fd271
feat: 내 스터디 조회 페이지 생성
airman5573 32f43c4
refactor: 파일 이름 변경
airman5573 c4bf631
feat: 내 스터디 페이지로 가는 링크 생성
airman5573 ba2adb8
fix: storybook 수정
airman5573 fec2682
refactor: 사용하지 않는 파일 삭제
airman5573 696b68e
refactor: Divider 색깔 수정
airman5573 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
feat: 내 스터디 조회 페이지 생성
Co-authored-by: TaeYoon <[email protected]>
commit 02fd271f29860df51ea105d3c6c116971266fba9
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
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,6 @@ | ||
import axiosInstance from '@api/axiosInstance'; | ||
|
||
export const getMyStudyList = async () => { | ||
const response = await axiosInstance.get(`/api/my/studies`); | ||
return response.data; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import { rest } from 'msw'; | ||
|
||
import detailStudyHandlers from './detail-study-handlers'; | ||
import studyJSON from './studies.json'; | ||
import { tagHandlers } from './tagHandlers'; | ||
import { tokenHandlers } from './tokenHandlers'; | ||
import detailStudyHandlers from '@mocks/detailStudyHandlers'; | ||
import { myHandlers } from '@mocks/myHandlers'; | ||
import { reviewHandlers } from '@mocks/reviewHandler'; | ||
import studyJSON from '@mocks/studies.json'; | ||
import { tagHandlers } from '@mocks/tagHandlers'; | ||
import { tokenHandlers } from '@mocks/tokenHandlers'; | ||
|
||
export const handlers = [ | ||
rest.get('/api/studies', (req, res, ctx) => { | ||
|
@@ -89,4 +91,6 @@ export const handlers = [ | |
...detailStudyHandlers, | ||
...tagHandlers, | ||
...tokenHandlers, | ||
...myHandlers, | ||
...reviewHandlers, | ||
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. 얘도! |
||
]; |
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
export const PageTitle = styled.h1` | ||
font-size: 32px; | ||
text-align: center; | ||
`; | ||
|
||
export const SectionContainer = styled.div` | ||
margin-bottom: 20px; | ||
`; |
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,59 @@ | ||
import { useQuery } from 'react-query'; | ||
|
||
import { css } from '@emotion/react'; | ||
|
||
import type { MyStudyQueryData } from '@custom-types/index'; | ||
import { MyStudyData } from '@custom-types/index'; | ||
|
||
import { getMyStudyList } from '@api/getMyStudyList'; | ||
|
||
import MyStudyCardListSection from '@pages/my-study-page/components/my-study-card-list-section/MyStudyCardListSection'; | ||
|
||
import Divider from '@components/divider/Divider'; | ||
import Wrapper from '@components/wrapper/Wrapper'; | ||
|
||
import * as S from '@my-study-page/MyStudyPage.style'; | ||
|
||
const studies: Record<string, Array<MyStudyData>> = { | ||
prepare: [], | ||
inProgress: [], | ||
done: [], | ||
}; | ||
|
||
const MyStudyPage: React.FC = () => { | ||
const { data, isFetching, isError } = useQuery<MyStudyQueryData, Error>('my-studies', getMyStudyList); | ||
|
||
const myStudies = | ||
data?.studies.reduce((acc, study) => { | ||
if (study.studyStatus === 'IN_PROGRESS') { | ||
acc.inProgress.push(study); | ||
} | ||
if (study.studyStatus === 'PREPARE') { | ||
acc.prepare.push(study); | ||
} | ||
if (study.studyStatus === 'DONE') { | ||
acc.done.push(study); | ||
} | ||
return acc; | ||
}, studies) || studies; | ||
|
||
const mb20 = css` | ||
margin-bottom: 20px; | ||
`; | ||
|
||
return ( | ||
<div> | ||
<Wrapper> | ||
<S.PageTitle>가입한 스터디 목록</S.PageTitle> | ||
<Divider /> | ||
{isFetching && <div>로딩 중...</div>} | ||
{isError && <div>내 스터디 불러오기를 실패했습니다</div>} | ||
<MyStudyCardListSection css={mb20} sectionTitle="활동 중!" myStudies={myStudies.inProgress} /> | ||
<MyStudyCardListSection css={mb20} sectionTitle="곧 시작해요!" myStudies={myStudies.prepare} /> | ||
<MyStudyCardListSection css={mb20} sectionTitle="종료했어요" myStudies={myStudies.done} disabled={true} /> | ||
</Wrapper> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MyStudyPage; |
414 changes: 414 additions & 0 deletions
414
...es/my-study-page/components/my-study-card-list-section/MyStudyCardListSection.stories.tsx
Large diffs are not rendered by default.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
이거 지워야겠네요!