Skip to content

Commit e77b994

Browse files
committed
[chore]머지 후 변경사항 커밋
1 parent ee9bfb1 commit e77b994

File tree

8 files changed

+39
-54
lines changed

8 files changed

+39
-54
lines changed

src/domains/recipe/api/RecipeFetch.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { getApi } from '@/app/api/config/appConfig';
44
import { Cocktail } from '../types/types';
55
import { Dispatch, SetStateAction, useCallback } from 'react';
66

7-
87
interface Props {
98
setData: React.Dispatch<React.SetStateAction<Cocktail[]>>;
109
lastId: number | null;
@@ -13,7 +12,7 @@ interface Props {
1312
setHasNextPage: Dispatch<SetStateAction<boolean>>;
1413
SIZE?: number;
1514
}
16-
// api/cocktais fetch용
15+
// api/cocktais fetch용
1716
export const RecipeFetch = ({
1817
setData,
1918
lastId,
@@ -22,19 +21,16 @@ export const RecipeFetch = ({
2221
setHasNextPage,
2322
SIZE = 20,
2423
}: Props) => {
25-
26-
2724
const fetchData = useCallback(async () => {
28-
2925
// 쿼리파라미터에 값 넣기
3026
if (!hasNextPage) return;
3127
const url = new URL(`${getApi}/cocktails`);
3228
url.searchParams.set('size', String(SIZE));
3329
if (typeof lastId === 'number') {
3430
url.searchParams.set('lastId', String(lastId));
3531
}
36-
37-
const res = await fetch(url.toString(),{method:'GET'});
32+
33+
const res = await fetch(url.toString(), { method: 'GET' });
3834
if (!res.ok) throw new Error('레시피 데이터 요청실패');
3935

4036
const json = await res.json();
@@ -44,7 +40,6 @@ export const RecipeFetch = ({
4440
setData((prev) =>
4541
Array.from(new Map([...prev, ...list].map((i) => [i.cocktailId, i])).values())
4642
);
47-
4843

4944
if (list.length > 0) {
5045
setLastId(list[list.length - 1].cocktailId);

src/domains/recipe/components/details/BackBtn.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,17 @@ import { useRouter } from 'next/navigation';
44
import Back from '@/shared/assets/icons/back_36.svg';
55

66
function BackButton() {
7-
const router = useRouter()
8-
7+
const router = useRouter();
98

109
const handleClick = () => {
11-
const url = sessionStorage.getItem('saveUrl')
12-
if(!url) return
13-
router.push(url)
14-
}
15-
10+
const url = sessionStorage.getItem('saveUrl');
11+
if (!url) return;
12+
router.push(url);
13+
};
1614

1715
return (
18-
<button type="button" className="z-1" aria-label="뒤로가기" onClick={ handleClick}>
19-
<Back />
16+
<button type="button" className="z-1" aria-label="뒤로가기" onClick={handleClick}>
17+
<Back />
2018
</button>
2119
);
2220
}

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const SELECT_OPTIONS = [
6565
];
6666

6767
function Accordion({ setAlcoholBaseTypes, setCocktailTypes, setAlcoholStrengths }: Props) {
68-
const router = useRouter()
68+
const router = useRouter();
6969
const pathname = usePathname();
7070
const searchParams = useSearchParams();
7171

@@ -92,7 +92,6 @@ function Accordion({ setAlcoholBaseTypes, setCocktailTypes, setAlcoholStrengths
9292
return entry ? entry[0] : '전체';
9393
};
9494

95-
9695
// URL 파라미터에서 현재 선택된 값 가져오기 아코디언 UI에 적용
9796
const currentValues = useMemo(() => {
9897
return {
@@ -135,8 +134,7 @@ function Accordion({ setAlcoholBaseTypes, setCocktailTypes, setAlcoholStrengths
135134
const queryString = params.toString();
136135
const newUrl = `${pathname}?${queryString}`;
137136

138-
139-
router.push(newUrl)
137+
router.push(newUrl);
140138
// shallow routing으로 URL만 변경
141139
// window.history.pushState({ ...window.history.state, as: newUrl, url: newUrl }, '', newUrl);
142140
};

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ interface Props {
1515
}
1616

1717
function CocktailList({ cocktails, RecipeFetch, hasNextPage, lastId, onItemClick }: Props) {
18-
1918
const cocktailRef = useRef(null);
2019
const onIntersect: IntersectionObserverCallback = ([entry]) => {
2120
if (!RecipeFetch) return;
@@ -29,8 +28,8 @@ function CocktailList({ cocktails, RecipeFetch, hasNextPage, lastId, onItemClick
2928

3029
const handleClick = () => {
3130
sessionStorage.setItem('listScrollY', String(window.scrollY));
32-
sessionStorage.setItem('saveUrl', String(location.href))
33-
}
31+
sessionStorage.setItem('saveUrl', String(location.href));
32+
};
3433

3534
return (
3635
<ul
@@ -45,10 +44,7 @@ function CocktailList({ cocktails, RecipeFetch, hasNextPage, lastId, onItemClick
4544
{cocktails.map(
4645
({ cocktailImgUrl, cocktailId, cocktailName, cocktailNameKo, alcoholStrength }) => (
4746
<li key={cocktailId} onClick={onItemClick} className="w-full">
48-
<Link
49-
href={`/recipe/${cocktailId}`}
50-
onClick={handleClick}
51-
>
47+
<Link href={`/recipe/${cocktailId}`} onClick={handleClick}>
5248
<CocktailCard
5349
id={cocktailId}
5450
src={cocktailImgUrl}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import CocktailSearchBar from './CocktailSearchBar';
1111
import useSearchControl from '../../hook/useSearchControl';
1212
import CocktailSearch from '../../api/CocktailSearch';
1313

14-
1514
function Cocktails() {
1615
const {
1716
data,

src/domains/recipe/hook/ozToMl.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
// 분수 매핑
1+
// 분수 매핑
22
const FRAC_MAP: Record<string, number> = {
3-
'¼': 8,
4-
'½': 15,
5-
'¾': 23,
6-
'⅓': 10,
7-
'⅔': 20,
8-
'⅕': 6,
9-
'⅖': 12,
10-
'⅗': 18,
11-
'⅘': 24,
12-
'⅙': 5,
13-
'⅚': 25,
3+
'¼': 8,
4+
'½': 15,
5+
'¾': 23,
6+
'⅓': 10,
7+
'⅔': 20,
8+
'⅕': 6,
9+
'⅖': 12,
10+
'⅗': 18,
11+
'⅘': 24,
12+
'⅙': 5,
13+
'⅚': 25,
1414
'⅛': 4,
15-
'⅜': 11,
16-
'⅝': 19,
17-
'⅞': 26,
15+
'⅜': 11,
16+
'⅝': 19,
17+
'⅞': 26,
1818
};
1919

2020
// 정규식 분리 용 class

src/domains/shared/components/keep/Keep.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import KeepIcon from '@/shared/assets/icons/keep_36.svg';
44
import KeepIconActive from '@/shared/assets/icons/keep_active_36.svg';
55
import { useEffect, useState } from 'react';
6-
import { deleteKeep, postKeep } from '../../api/keep/keep';
6+
import { deleteKeep, postKeep } from '../../api/keep/keep';
77
import { getApi } from '@/app/api/config/appConfig';
88

99
interface Props {
@@ -19,13 +19,13 @@ function Keep({ className, cocktailId }: Props) {
1919
useEffect(() => {
2020
const getKeep = async () => {
2121
const res = await fetch(`${getApi}/me/bar`, {
22-
credentials:'include'
23-
})
24-
const json = await res.json()
25-
json.data.items.keptAt ? setIsClick(true) : setIsClick(false)
26-
}
27-
getKeep()
28-
},[])
22+
credentials: 'include',
23+
});
24+
const json = await res.json();
25+
json.data.items.keptAt ? setIsClick(true) : setIsClick(false);
26+
};
27+
getKeep();
28+
}, []);
2929

3030
const handleClick = async (e: React.MouseEvent<HTMLButtonElement>) => {
3131
e.preventDefault();

src/domains/shared/hook/useMemoScroll.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@ export function useMemoScroll<T>({
1919
storageKey,
2020
eventName = 'resetScroll',
2121
}: UseScrollRestorationProps) {
22-
2322
// 뒤로가기를 통해 목록 복원을 저장해주는 플래그
2423
const NAVIGATION_FLAG_KEY = `${storageKey}_nav_flag`;
25-
24+
2625
// 실제 렌더링 되는 데이터
2726
const [data, setData] = useState<T[]>([]);
2827
const [lastId, setLastId] = useState<number | null>(null);

0 commit comments

Comments
 (0)