From 8f46c454f4839784bb502c92312a324f52ebf17b Mon Sep 17 00:00:00 2001 From: Suhyeon Jeon Date: Wed, 5 Mar 2025 22:58:02 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20store=20=EC=A0=95=EB=A0=AC=20=EC=A1=B0?= =?UTF-8?q?=EA=B1=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/home/_components/CategoryDrawer.tsx | 3 +-- src/app/home/list/_components/HomeList.tsx | 6 +++--- src/app/search/_components/SearchInput.tsx | 3 +++ .../result/_components/SearchResult.tsx | 8 ++++---- src/components/shared/FoodOrderFilter.tsx | 3 ++- .../shared/FoodOrderListInBottomSheet.tsx | 20 ++++++++++++------- src/constants/orderType.ts | 18 +++++++++++++++++ src/models/orderType.ts | 7 ------- src/store/homeSearchFilter.ts | 9 ++++----- 9 files changed, 48 insertions(+), 29 deletions(-) create mode 100644 src/constants/orderType.ts delete mode 100644 src/models/orderType.ts diff --git a/src/app/home/_components/CategoryDrawer.tsx b/src/app/home/_components/CategoryDrawer.tsx index c35de8a2..a75949ba 100644 --- a/src/app/home/_components/CategoryDrawer.tsx +++ b/src/app/home/_components/CategoryDrawer.tsx @@ -5,7 +5,6 @@ import CategoryItem from '@/components/shared/CategoryItem' import CATEGORY_LIST from '@/constants/category' import { cn } from '@/lib/utils' import { Category } from '@/models/category' -import { OrderType } from '@/models/orderType' import { useFoodSearchFilterStore } from '@/store/homeSearchFilter' import { ROUTE_PATHS } from '@/utils/routes' import { useRouter } from 'next/navigation' @@ -45,7 +44,7 @@ const CategoryDrawer = () => { useEffect(() => { setCategory('') - setOrder(OrderType.RANKING) + setOrder(0) }, []) return ( diff --git a/src/app/home/list/_components/HomeList.tsx b/src/app/home/list/_components/HomeList.tsx index 76a34fcf..cec117b7 100644 --- a/src/app/home/list/_components/HomeList.tsx +++ b/src/app/home/list/_components/HomeList.tsx @@ -2,8 +2,8 @@ import CartButton from '@/components/CartButton' import PullToRefresh from '@/components/PullToRefresh' +import { ORDER_TYPE } from '@/constants/orderType' import { useInfiniteScroll } from '@/hooks/useInfiniteScroll' -import { OrderType } from '@/models/orderType' import { Store } from '@/models/store' import { useGeoLocationStore } from '@/store/geoLocation' import { useFoodSearchFilterStore } from '@/store/homeSearchFilter' @@ -19,11 +19,11 @@ const HomeList = () => { const { member } = memberStore() const { data, isFetching, targetRef, refetch, hasNextPage } = useInfiniteScroll< Store, - { category: string; order: OrderType } + { category: string; orderType: string } >({ queryKey: 'stores', endpoint: 'stores/list-cursor', - filter: { category, order }, + filter: { category, orderType: ORDER_TYPE[order].value }, size: 10, ...(member ? { location: { lat: member.address.latitude, lng: member.address.longitude } } diff --git a/src/app/search/_components/SearchInput.tsx b/src/app/search/_components/SearchInput.tsx index efe26858..cba760d7 100644 --- a/src/app/search/_components/SearchInput.tsx +++ b/src/app/search/_components/SearchInput.tsx @@ -62,6 +62,7 @@ const SearchInput = () => { placeholder="무엇을 배달, 포장할까요?" inputSize="sm" value={word} + onClick={() => setIsFocus(true)} onFocus={() => setIsFocus(true)} onBlur={() => { setTimeout(() => { @@ -74,6 +75,8 @@ const SearchInput = () => { if (e.key === 'Enter') { setKeyword(word) setValue([word, ...(storedValue || [])]) + resetStoreSuggestion() + setIsFocus(false) router.push(ROUTE_PATHS.SEARCH_RESULT) } }} diff --git a/src/app/search/result/_components/SearchResult.tsx b/src/app/search/result/_components/SearchResult.tsx index fd79da9d..d7004aae 100644 --- a/src/app/search/result/_components/SearchResult.tsx +++ b/src/app/search/result/_components/SearchResult.tsx @@ -3,8 +3,8 @@ import usePostSearch from '@/api/usePostSearch' import PullToRefresh from '@/components/PullToRefresh' import FoodOrderFilter from '@/components/shared/FoodOrderFilter' +import { ORDER_TYPE } from '@/constants/orderType' import { useInfiniteScroll } from '@/hooks/useInfiniteScroll' -import { OrderType } from '@/models/orderType' import { Store } from '@/models/store' import { useGeoLocationStore } from '@/store/geoLocation' import { useFoodSearchFilterStore } from '@/store/homeSearchFilter' @@ -23,11 +23,11 @@ const SearchResult = () => { const { member } = memberStore() const { data, isFetching, targetRef, refetch } = useInfiniteScroll< Store, - { keyword: string | undefined; order: OrderType } + { keyword: string | undefined; orderType: string } >({ queryKey: 'stores', endpoint: 'stores/list-cursor', - filter: { keyword, order }, + filter: { keyword, orderType: ORDER_TYPE[order].value }, size: 10, ...(member ? { location: { lat: member.address.latitude, lng: member.address.longitude } } @@ -60,7 +60,7 @@ const SearchResult = () => {