-
Notifications
You must be signed in to change notification settings - Fork 3
Refactor: 프로젝트의 전반적인 리팩토링 #83
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
Changes from all commits
888f9f8
56d106d
b69c9f1
a3090c8
07b832c
c2b2137
8b3cf78
acbc3f6
b756c85
f531849
f54894d
90c39f4
8a9cffb
bd4a859
ecb8552
ad8f75a
41d2b33
905ec6b
cb572d6
9fc2f27
9eeeaee
0245830
32f9eb4
faf2987
5c8dc5d
f1026bc
5ecd9f3
1282212
b63d310
b7a54e5
95a534c
a9350b5
e5abab1
7df470a
f0dbcab
db69fbf
084cc2c
a7e0d87
790d94e
ceaff3d
5555975
619271e
74f96cd
39ca442
300c235
c5b5b75
0e89fe2
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,18 @@ | ||
name: 'CI' | ||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: yarn install --frozen-lockfile | ||
|
||
- name: Check typescript | ||
run: yarn type:check | ||
|
||
- name: Check eslint | ||
run: yarn lint |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import axios from 'axios'; | ||
|
||
import { CustomInstance } from './type'; | ||
import { BASE_API_URL } from '@/constants/env'; | ||
import { BASE_API_URL } from '@/constants'; | ||
|
||
const publicApi: CustomInstance = axios.create({ | ||
baseURL: `${BASE_API_URL}/api`, | ||
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. 이 코드 패치에서 발견된 주요 변경 사항은 상대 경로
이러한 변경 사항과 개선 제안을 고려하여 코드 가독성을 높일 수 있습니다. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import AppDownloadBanner from '../../components/Header/AppDownloadBanner'; | ||
import { StrictPropsWithChildren } from '@/types'; | ||
import { isIOS } from '@/utils'; | ||
|
||
export function MainFooter({ children }: StrictPropsWithChildren) { | ||
return ( | ||
<> | ||
<div className="fixed inset-x-0 bottom-0 z-30"> | ||
<div className="mx-auto max-w-layout bg-white px-20 pb-24 pt-10"> | ||
<div className="flex gap-8 [&>*]:flex-1 [&>*]:grow">{children}</div> | ||
</div> | ||
{isIOS() && <AppDownloadBanner />} | ||
</div> | ||
<div className="h-88" /> | ||
</> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client'; | ||
|
||
import { QueryAsyncBoundary } from '@suspensive/react-query'; | ||
|
||
import FeedContent from './FeedContent'; | ||
import FilterSheet from './FilterSheet'; | ||
import { RejectedFallback } from '@/components/ErrorBoundary'; | ||
import { Loading } from '@/components/Loading'; | ||
import { PageAnimation } from '@/components/PageAnimation'; | ||
|
||
export default function FeedComponent() { | ||
return ( | ||
<QueryAsyncBoundary | ||
rejectedFallback={RejectedFallback} | ||
pendingFallback={<Loading className="h-[calc(100dvh-178px)]" />} | ||
> | ||
<PageAnimation> | ||
<FeedContent /> | ||
<FilterSheet /> | ||
</PageAnimation> | ||
</QueryAsyncBoundary> | ||
); | ||
} | ||
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. 이 코드는 상대적으로 깔끔해 보입니다. 개선을 위한 제안은 다음과 같습니다:
이상은 해당 코드에서 발견된 개선 사항 및 잠재적 위험 사항 중 규모가 있는 것들입니다. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ import { usePoseFeedQuery } from '@/apis'; | |
import { PrimaryButton } from '@/components/Button'; | ||
import EmptyCase from '@/components/Feed/EmptyCase'; | ||
import FeedSection from '@/components/Feed/FeedSection'; | ||
import { URL } from '@/constants/url'; | ||
import useFilterState from '@/hooks/useFilterState'; | ||
import { URL } from '@/constants'; | ||
import { useFilterState } from '@/hooks'; | ||
|
||
export default function FeedContent() { | ||
const { filterState } = useFilterState(); | ||
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. 코드 리뷰를 해볼게요:
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,8 @@ import { FilterTagsResponse, useFilterTagQuery } from '@/apis'; | |
import { BottomDiv, PrimaryButton } from '@/components/Button'; | ||
import BottomSheet from '@/components/Modal/BottomSheet'; | ||
import { SelectionBasic, SelectionTagList } from '@/components/Selection'; | ||
import { frameCountList, peopleCountList } from '@/constants/data'; | ||
import useBottomSheet from '@/hooks/useBottomSheet'; | ||
import useFilterState from '@/hooks/useFilterState'; | ||
import { FRAME_COUNT_LIST, PEOPLE_COUNT_LIST } from '@/constants'; | ||
import { useBottomSheet, useFilterState } from '@/hooks'; | ||
|
||
export default function FilterSheet() { | ||
const { data: tagListData } = useFilterTagQuery(); | ||
|
@@ -52,13 +51,13 @@ export default function FilterSheet() { | |
<div id="subtitle-2" className="mb-8 text-secondary"> | ||
인원 수 | ||
</div> | ||
<SelectionBasic data={peopleCountList} state={countState} setState={setCountState} /> | ||
<SelectionBasic data={PEOPLE_COUNT_LIST} state={countState} setState={setCountState} /> | ||
</section> | ||
<section> | ||
<div id="subtitle-2" className="mb-8 text-secondary"> | ||
프레임 수 | ||
</div> | ||
<SelectionBasic data={frameCountList} state={frameState} setState={setFrameState} /> | ||
<SelectionBasic data={FRAME_COUNT_LIST} state={frameState} setState={setFrameState} /> | ||
</section> | ||
<section> | ||
<div id="subtitle-2" className="mb-8 text-secondary"> | ||
|
@@ -74,8 +73,8 @@ export default function FilterSheet() { | |
</section> | ||
</div> | ||
<BottomDiv> | ||
<PrimaryButton type="outline" icon="restart" text="필터 초기화" onClick={resetFilter} /> | ||
<PrimaryButton type="fill" text="포즈보기" onClick={decideFilter} /> | ||
<PrimaryButton variant="outline" icon="restart" text="필터 초기화" onClick={resetFilter} /> | ||
<PrimaryButton variant="fill" text="포즈보기" onClick={decideFilter} /> | ||
</BottomDiv> | ||
</BottomSheet> | ||
); | ||
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. 코드 리뷰:
위 내용들을 고려하여 코드를 보완하고 관리하기 쉽도록 항상 주의 깊게 유지하는 것이 중요합니다. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,5 @@ | ||
'use client'; | ||
|
||
import { QueryAsyncBoundary } from '@suspensive/react-query'; | ||
|
||
import FeedContent from './FeedContent'; | ||
import FilterSheet from './FilterSheet'; | ||
import { RejectedFallback } from '@/components/ErrorBoundary'; | ||
import { Loading } from '@/components/Loading'; | ||
import { PageAnimation } from '@/components/PageAnimation'; | ||
import FeedComponent from './FeedComponent'; | ||
|
||
export default function Feed() { | ||
return ( | ||
<QueryAsyncBoundary | ||
rejectedFallback={RejectedFallback} | ||
pendingFallback={<Loading className="h-[calc(100dvh-178px)]" />} | ||
> | ||
<PageAnimation> | ||
<FeedContent /> | ||
<FilterSheet /> | ||
</PageAnimation> | ||
</QueryAsyncBoundary> | ||
); | ||
return <FeedComponent />; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client'; | ||
|
||
import { PrimaryButton } from '@/components/Button'; | ||
import EmptyCase from '@/components/Feed/EmptyCase'; | ||
import { PreparingPopup } from '@/components/Modal'; | ||
import { useOverlay } from '@/components/Overlay/useOverlay'; | ||
|
||
export default function MyPoseComponent() { | ||
const { open } = useOverlay(); | ||
|
||
return ( | ||
<EmptyCase | ||
title={'나만의 포즈를 추가해 보세요!'} | ||
text={'포즈피드에 네컷사진을 업로드할 수 있어요'} | ||
> | ||
<PrimaryButton | ||
onClick={() => open(({ exit }) => <PreparingPopup onClose={exit} />)} | ||
text="포즈 등록하기" | ||
variant="secondary" | ||
/> | ||
</EmptyCase> | ||
); | ||
} | ||
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. 주요 내용:
잠재적인 버그 리스크:
개선 제안:
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ export default function BookmarkEmpty() { | |
text={`북마크 버튼으로 포즈를 보관할 수 있어요.\n포즈피드에서 멋진 포즈를 찾아 보관해 보세요.`} | ||
> | ||
<Link href={'/feed'}> | ||
<PrimaryButton text="포즈피드 바로가기" type="secondary" /> | ||
<PrimaryButton text="포즈피드 바로가기" variant="secondary" /> | ||
</Link> | ||
</EmptyCase> | ||
); | ||
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.
코드 리뷰를 진행하겠습니다:
버그 위험:
BASE_API_URL
이 상수로 사용되는 데, 코드의 4번째 줄에서 재선언됨으로써 중복 정의 문제가 발생할 수 있음.개선 제안:
이외에도 API URL, 상수, 유틸리티 함수 등을 더 깊이 파악하기 위해 전체 코드베이스의 컨텍스트를 파악하는 것이 유용할 수 있습니다.
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.
95a534c