불러오는 중...
;
+ if (isError || !data) return 와인 데이터를 불러올 수 없습니다.
;
+
+
+ /* 전체 와인 리스트 조합 */
+ const wineList = data.pages.flatMap((page) => page.list);
+
return (
- {filteredWines.map((wine) => (
+ {wineList.map((wine) => (
))}
+ {/* 무한 스크롤 감지 */}
+
);
}
diff --git a/src/hooks/useWineListQuery.ts b/src/hooks/useWineListQuery.ts
index 529d42a..9809f8b 100644
--- a/src/hooks/useWineListQuery.ts
+++ b/src/hooks/useWineListQuery.ts
@@ -7,6 +7,7 @@ import useWineSearchKeywordStore from '@/stores/searchStore';
const PAGE_LIMIT = 8;
export function useWineListQuery() {
+ /* 각 필터 상태 */
const type = useFilterStore((state) => state.type);
const minPrice = useFilterStore((state) => state.minPrice);
const maxPrice = useFilterStore((state) => state.maxPrice);
diff --git a/src/lib/getWines.ts b/src/lib/getWines.ts
index 5dcc030..630fc35 100644
--- a/src/lib/getWines.ts
+++ b/src/lib/getWines.ts
@@ -1,4 +1,4 @@
-import useWinAddStore, { Wine } from '@/stores/wineAddStore';
+import useWineAddStore, { Wine } from '@/stores/wineAddStore';
interface GetWinesParams {
cursor: number;
@@ -18,6 +18,7 @@ interface GetWinesResponse {
totalCount: number;
}
+/* 평점 필터링 */
const ratingRangeMap: Record
= {
all: [0, 5],
'4.6': [4.5, 5],
@@ -26,9 +27,9 @@ const ratingRangeMap: Record = {
'3.1': [3.0, 3.5],
};
+/* 필터링 + 페이징 */
export function getWines({ cursor, limit, filters }: GetWinesParams): GetWinesResponse {
- // zustand에서 mock 데이터 직접 가져옴
- const allWines = useWinAddStore.getState().wines;
+ const allWines = useWineAddStore.getState().wines;
const { type, minPrice = 0, maxPrice = Infinity, rating = 'all', searchTerm = '' } = filters;
diff --git a/src/stores/wineAddStore.ts b/src/stores/wineAddStore.ts
index 5bcf621..108f832 100644
--- a/src/stores/wineAddStore.ts
+++ b/src/stores/wineAddStore.ts
@@ -16,7 +16,7 @@ interface WineStoreState {
addWine: (newWine: Wine) => void;
}
-const useWinAddStore = create((set) => ({
+const useWineAddStore = create((set) => ({
wines: [
{
id: 1,
@@ -36,7 +36,7 @@ const useWinAddStore = create((set) => ({
image: '/images/image3.svg',
price: 64900,
rating: 4.6,
- type: 'White',
+ type: 'Sparkling',
review:
'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
},
@@ -47,7 +47,7 @@ const useWinAddStore = create((set) => ({
image: '/images/image2.svg',
price: 59900,
rating: 3.6,
- type: 'Red',
+ type: 'White',
review:
'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
},
@@ -58,7 +58,183 @@ const useWinAddStore = create((set) => ({
image: '/images/image4.svg',
price: 74000,
rating: 2.1,
- type: 'Sparkling',
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 5,
+ name: 'Sentinel Carbernet Sauvignon 2016',
+ region: 'Western Cape, South Africa',
+ image: '/images/image1.svg',
+ price: 64900,
+ rating: 4.5,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 6,
+ name: 'Palazzo della Torre 2017',
+ region: 'Western Cape, South Africa',
+ image: '/images/image3.svg',
+ price: 64900,
+ rating: 4.6,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 7,
+ name: 'Sentinel Carbernet Sauvignon 2016',
+ region: 'Western Cape, South Africa',
+ image: '/images/image2.svg',
+ price: 59900,
+ rating: 3.6,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 8,
+ name: 'Palazzo della Torre 2017',
+ region: 'Western Cape, South Africa',
+ image: '/images/image4.svg',
+ price: 74000,
+ rating: 2.1,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 9,
+ name: 'Sentinel Carbernet Sauvignon 2016',
+ region: 'Western Cape, South Africa',
+ image: '/images/image1.svg',
+ price: 64900,
+ rating: 4.5,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 10,
+ name: 'Palazzo della Torre 2017',
+ region: 'Western Cape, South Africa',
+ image: '/images/image3.svg',
+ price: 64900,
+ rating: 4.6,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 11,
+ name: 'Sentinel Carbernet Sauvignon 2016',
+ region: 'Western Cape, South Africa',
+ image: '/images/image2.svg',
+ price: 59900,
+ rating: 3.6,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 12,
+ name: 'Palazzo della Torre 2017',
+ region: 'Western Cape, South Africa',
+ image: '/images/image4.svg',
+ price: 74000,
+ rating: 2.1,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 13,
+ name: 'Sentinel Carbernet Sauvignon 2016',
+ region: 'Western Cape, South Africa',
+ image: '/images/image1.svg',
+ price: 64900,
+ rating: 4.5,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 14,
+ name: 'Palazzo della Torre 2017',
+ region: 'Western Cape, South Africa',
+ image: '/images/image3.svg',
+ price: 64900,
+ rating: 4.6,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 15,
+ name: 'Sentinel Carbernet Sauvignon 2016',
+ region: 'Western Cape, South Africa',
+ image: '/images/image2.svg',
+ price: 59900,
+ rating: 3.6,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 16,
+ name: 'Palazzo della Torre 2017',
+ region: 'Western Cape, South Africa',
+ image: '/images/image4.svg',
+ price: 74000,
+ rating: 2.1,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 17,
+ name: 'Sentinel Carbernet Sauvignon 2016',
+ region: 'Western Cape, South Africa',
+ image: '/images/image1.svg',
+ price: 64900,
+ rating: 4.5,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 18,
+ name: 'Palazzo della Torre 2017',
+ region: 'Western Cape, South Africa',
+ image: '/images/image3.svg',
+ price: 64900,
+ rating: 4.6,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 19,
+ name: 'Sentinel Carbernet Sauvignon 2016',
+ region: 'Western Cape, South Africa',
+ image: '/images/image2.svg',
+ price: 59900,
+ rating: 3.6,
+ type: 'Red',
+ review:
+ 'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
+ },
+ {
+ id: 20,
+ name: 'Palazzo della Torre 2017',
+ region: 'Western Cape, South Africa',
+ image: '/images/image4.svg',
+ price: 74000,
+ rating: 2.1,
+ type: 'Red',
review:
'Cherry, cocoa, vanilla and clove - beautiful red fruit driven Amarone. Low acidity and medium tannins. Nice long velvety finish.',
},
@@ -70,4 +246,4 @@ const useWinAddStore = create((set) => ({
})),
}));
-export default useWinAddStore;
+export default useWineAddStore;