Skip to content

Commit 00c30b0

Browse files
committed
chore/포매팅
1 parent d9e4130 commit 00c30b0

File tree

17 files changed

+88
-96
lines changed

17 files changed

+88
-96
lines changed

src/app/(with-layout)/mypage/layout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import MyNav from '@/domains/mypage/components/main/MyNav';
32
import MyProfile from '@/domains/mypage/components/main/MyProfile';
43
import SkeletonLayout from '@/domains/mypage/skeleton/main/SkeletonLayout';

src/app/(with-layout)/mypage/my-setting/page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import MySetting from '@/domains/mypage/components/main/MySetting';
32
import { Metadata } from 'next';
43
export const metadata: Metadata = {

src/app/(with-layout)/recipe/page.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,20 @@ import { Suspense } from 'react';
55
import SkeletonRecipe from '@/domains/recipe/skeleton/SkeletonRecipe';
66
import Cocktails from '@/domains/recipe/components/main/Cocktails';
77

8-
98
export const metadata: Metadata = {
109
title: '칵테일레시피',
1110
description: '칵테일 레시피가 궁금하신 분들을 위한 레시피 페이지',
1211
};
1312

14-
1513
function Page() {
16-
1714
return (
1815
<div className="w-full">
1916
<section>
2017
<PageHeader title="Cocktail Recipes" description="다양하고 재밌는 칵테일 레시피" />
2118
</section>
2219
<div className="page-layout max-w-1224 mt-6">
2320
<Suspense fallback={<SkeletonRecipe />}>
24-
<Cocktails />
21+
<Cocktails />
2522
</Suspense>
2623
</div>
2724
</div>

src/domains/community/hook/useItemVirtualizer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { CommentType, Post } from '../types/post';
33
import { Cocktail } from '@/domains/recipe/types/types';
44

55
export function useItemVirtualizer(
6-
items: CommentType[] | Post[] | Cocktail[] |null,
6+
items: CommentType[] | Post[] | Cocktail[] | null,
77
parentRef: React.RefObject<HTMLElement | null>
88
) {
99
return useVirtualizer({

src/domains/mypage/components/main/MyAbv.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import Help from '@/shared/assets/icons/help_24.svg';
33
import ToolTip from '@/shared/components/tool-tip/ToolTip';
44
import useMedia from '../../hook/useMedia';
55

6-
76
function MyAbv({ abv }: { abv: number }) {
87
const isMd = useMedia('(min-width:768px)');
98
const position = isMd ? 'leftTop' : 'top';

src/domains/mypage/components/pages/my-active/MyComment.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@ function MyComment() {
2222
credentials: 'include',
2323
});
2424
const json = await res.json();
25-
25+
2626
setMyComment(json.data.items);
2727
};
2828

29-
3029
useEffect(() => {
3130
fetchComment();
3231
}, []);

src/domains/recipe/api/fetchRecipe.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ interface PageParam {
2828
lastValue: number | string;
2929
}
3030

31-
3231
// 로그인 한 유저의 킵 칵테일을 Get으로 불러옴
3332
const fetchKeep = async (): Promise<Set<number>> => {
3433
const res = await fetch(`${getApi}/me/bar`, {
@@ -104,7 +103,6 @@ const hasActiveFilters = (filters: SearchFilters): boolean => {
104103
);
105104
};
106105

107-
108106
export const useKeepQuery = () => {
109107
const user = useAuthStore((state) => state.user);
110108

@@ -114,15 +112,15 @@ export const useKeepQuery = () => {
114112
enabled: !!user,
115113
staleTime: 5 * 60 * 1000,
116114
gcTime: 10 * 60 * 1000,
117-
})
115+
});
118116
};
119117

120118
// 무한스크롤 fetch
121119
export const useCocktailsInfiniteQuery = (size: number = 20, sortBy?: Sort) => {
122120
const user = useAuthStore((state) => state.user);
123121
const queryClient = useQueryClient();
124122
const prevSortBy = useRef(sortBy);
125-
const { data:keepIds } = useKeepQuery()
123+
const { data: keepIds } = useKeepQuery();
126124

127125
useEffect(() => {
128126
if (prevSortBy.current !== undefined && prevSortBy.current !== sortBy) {
@@ -141,8 +139,8 @@ export const useCocktailsInfiniteQuery = (size: number = 20, sortBy?: Sort) => {
141139
if (user && keepIds) {
142140
return cocktails.map((item) => ({
143141
...item,
144-
isKeep : keepIds.has(item.cocktailId)
145-
}))
142+
isKeep: keepIds.has(item.cocktailId),
143+
}));
146144
}
147145

148146
return cocktails;
@@ -178,22 +176,21 @@ export const useCocktailsInfiniteQuery = (size: number = 20, sortBy?: Sort) => {
178176
initialPageParam: null as PageParam | null,
179177
refetchOnMount: false,
180178
refetchOnWindowFocus: false,
181-
staleTime: 2 * 60 * 1000
179+
staleTime: 2 * 60 * 1000,
182180
});
183181
};
184182

185183
// 검색용 fetch
186184
export const useCocktailsSearchQuery = (filters: SearchFilters) => {
187185
const user = useAuthStore((state) => state.user);
188186
const isActive = hasActiveFilters(filters);
189-
const {data: keepIds} = useKeepQuery()
187+
const { data: keepIds } = useKeepQuery();
190188

191189
return useQuery({
192190
queryKey: ['cocktails', 'search', filters, user?.id],
193191
queryFn: async () => {
194192
const cocktails = await searchCocktails(filters);
195193
if (user && cocktails.length > 0 && keepIds) {
196-
197194
return cocktails.map((item) => ({
198195
...item,
199196
isKeep: keepIds.has(item.cocktailId),
@@ -204,7 +201,7 @@ export const useCocktailsSearchQuery = (filters: SearchFilters) => {
204201
enabled: isActive,
205202
refetchOnMount: false,
206203
refetchOnWindowFocus: false,
207-
staleTime: 5 * 60 * 1000
204+
staleTime: 5 * 60 * 1000,
208205
});
209206
};
210207

src/domains/recipe/components/main/CocktailFilter.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import SelectBox from '@/shared/components/select-box/SelectBox';
22
import { useRouter, useSearchParams } from 'next/navigation';
33

4-
5-
64
interface Props {
75
cocktailsEA: number;
86
}
@@ -14,29 +12,34 @@ function CocktailFilter({ cocktailsEA }: Props) {
1412
댓글순: 'comments',
1513
};
1614

17-
const searchParams = useSearchParams()
15+
const searchParams = useSearchParams();
1816
const router = useRouter();
1917

2018
const getCurrentSort = () => {
21-
const sortBy = searchParams.get('sortBy') || 'recent'
19+
const sortBy = searchParams.get('sortBy') || 'recent';
2220

23-
const entry = Object.entries(sortMap).find(([_, value]) => value === sortBy)
24-
return entry ? entry[0] : '최신순'
25-
}
21+
const entry = Object.entries(sortMap).find(([_, value]) => value === sortBy);
22+
return entry ? entry[0] : '최신순';
23+
};
2624

2725
const handleChange = (selectTitle: string) => {
2826
const sortValue = sortMap[selectTitle as keyof typeof sortMap];
2927

30-
const params = new URLSearchParams(searchParams.toString())
31-
params.set('sortBy', sortValue)
28+
const params = new URLSearchParams(searchParams.toString());
29+
params.set('sortBy', sortValue);
3230

3331
router.push(`?sortBy=${sortValue}`);
3432
};
3533

3634
return (
3735
<div className="h-10 flex justify-between items-center mt-3 border-b-1 border-gray-light">
3836
<p>{cocktailsEA}개+</p>
39-
<SelectBox option={['최신순', '댓글순', '인기순']} title="최신순" onChange={handleChange} value={ getCurrentSort()} />
37+
<SelectBox
38+
option={['최신순', '댓글순', '인기순']}
39+
title="최신순"
40+
onChange={handleChange}
41+
value={getCurrentSort()}
42+
/>
4043
</div>
4144
);
4245
}

src/domains/recipe/components/main/CocktailFilterRadios.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,11 @@ const SELECT_OPTIONS = [
6464
},
6565
];
6666

67-
function CocktailFilterRadios({ setAlcoholBaseTypes, setAlcoholStrengths, setCocktailTypes } : Props) {
67+
function CocktailFilterRadios({
68+
setAlcoholBaseTypes,
69+
setAlcoholStrengths,
70+
setCocktailTypes,
71+
}: Props) {
6872
const router = useRouter();
6973
const pathname = usePathname();
7074
const searchParams = useSearchParams();
@@ -149,4 +153,4 @@ function CocktailFilterRadios({ setAlcoholBaseTypes, setAlcoholStrengths, setCoc
149153
);
150154
}
151155

152-
export default CocktailFilterRadios;
156+
export default CocktailFilterRadios;

src/domains/recipe/components/main/CocktailList.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,10 @@ import { Cocktail } from '../../types/types';
55
import CocktailCard from '@/domains/shared/components/cocktail-card/CocktailCard';
66
import { useSaveScroll } from '../../hook/useSaveScroll';
77

8-
9-
10-
118
interface Props {
129
cocktails: Cocktail[];
1310
}
1411

15-
1612
// Grid반응형 구조에서 virtual의 높이가 측정하기 힘든문제로 인해 virtual사용 포기
1713

1814
function CocktailList({ cocktails }: Props) {
@@ -26,11 +22,8 @@ function CocktailList({ cocktails }: Props) {
2622
saveAndNavigate(`/recipe/${cocktailId}`);
2723
};
2824

29-
30-
3125
return (
32-
<div
33-
>
26+
<div>
3427
<ul
3528
className="
3629
grid gap-8 lg:justify-between justify-center

0 commit comments

Comments
 (0)