From cf67b781d46861e0bc0381b7906cda238e8da080 Mon Sep 17 00:00:00 2001 From: Sejin Cha Date: Wed, 22 Nov 2023 20:12:25 +0900 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20roomType=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EB=B0=8F=20params=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/RoomSearch/components/Selection.tsx | 8 ++++---- src/core/api/functions/roomAPI.ts | 1 - src/core/api/queries/useSearchRooms.ts | 5 ++++- src/core/types/TotalRooms.ts | 2 +- src/pages/SearchPage.tsx | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/RoomSearch/components/Selection.tsx b/src/RoomSearch/components/Selection.tsx index 90d999bc..161c0c07 100644 --- a/src/RoomSearch/components/Selection.tsx +++ b/src/RoomSearch/components/Selection.tsx @@ -7,11 +7,11 @@ interface SelectionProps { setRoomType: React.Dispatch>; } -const TYPES = ['all', 'morning', 'night'] as const; +const TYPES = ['ALL', 'MORNING', 'NIGHT'] as const; const typeMap = { - all: '전체', - morning: '아침', - night: '밤' + ALL: '전체', + MORNING: '아침', + NIGHT: '밤' }; const Selection = ({ currentRoomType, setRoomType }: SelectionProps) => { diff --git a/src/core/api/functions/roomAPI.ts b/src/core/api/functions/roomAPI.ts index b03a8b8a..9874148f 100644 --- a/src/core/api/functions/roomAPI.ts +++ b/src/core/api/functions/roomAPI.ts @@ -57,7 +57,6 @@ const roomAPI = { }, getRoomsAll: async (params?: RoomsRequestParams) => { - console.log(params); return await baseInstance.get('/rooms', { params }); } }; diff --git a/src/core/api/queries/useSearchRooms.ts b/src/core/api/queries/useSearchRooms.ts index c25353db..4a201193 100644 --- a/src/core/api/queries/useSearchRooms.ts +++ b/src/core/api/queries/useSearchRooms.ts @@ -13,7 +13,10 @@ const useSearchRooms = ({ queryKey: ['rooms', roomType, keyword], queryFn: ({ pageParam }) => { - const params: RoomsRequestParams = { roomType }; + const params: RoomsRequestParams = {}; + if (roomType !== 'ALL') { + params.roomType = roomType; + } if (pageParam > 0) { params.roomId = pageParam; } diff --git a/src/core/types/TotalRooms.ts b/src/core/types/TotalRooms.ts index 4b5ff2b3..6cd0c10c 100644 --- a/src/core/types/TotalRooms.ts +++ b/src/core/types/TotalRooms.ts @@ -1,6 +1,6 @@ import { DayType } from '.'; -export type RoomSelectType = 'morning' | 'night' | 'all'; +export type RoomSelectType = 'ALL' | 'MORNING' | 'NIGHT'; export interface Room { id: number; diff --git a/src/pages/SearchPage.tsx b/src/pages/SearchPage.tsx index a04df9e5..493f2871 100644 --- a/src/pages/SearchPage.tsx +++ b/src/pages/SearchPage.tsx @@ -8,7 +8,7 @@ import ResultListFallback from '@/RoomSearch/components/ResultListFallback'; import { NetworkFallback } from '@/shared/ErrorBoundary'; const SearchPage = () => { - const [roomType, setRoomType] = useState('all'); + const [roomType, setRoomType] = useState('ALL'); const [keyword, setKeyword] = useState(''); return ( From d89aacaff171a20c4a4362cc6d893aabcd380383 Mon Sep 17 00:00:00 2001 From: Sejin Cha Date: Wed, 22 Nov 2023 20:22:59 +0900 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20rooms=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/RoomList/components/RoomAccordion.tsx | 6 +- src/RoomList/mocks/totalRooms.ts | 108 ---------------------- src/RoomList/mocks/types/myJoinRoom.d.ts | 15 --- src/RoomList/mocks/types/rooms.ts | 14 --- src/core/types/TotalRooms.ts | 2 +- 5 files changed, 4 insertions(+), 141 deletions(-) delete mode 100644 src/RoomList/mocks/totalRooms.ts delete mode 100644 src/RoomList/mocks/types/myJoinRoom.d.ts delete mode 100644 src/RoomList/mocks/types/rooms.ts diff --git a/src/RoomList/components/RoomAccordion.tsx b/src/RoomList/components/RoomAccordion.tsx index d14d9988..962a68c6 100644 --- a/src/RoomList/components/RoomAccordion.tsx +++ b/src/RoomList/components/RoomAccordion.tsx @@ -1,7 +1,7 @@ import { clsx } from 'clsx'; import { useMoveRoute } from '@/core/hooks'; import useHover from '@/core/hooks/useHover'; -import { Room } from '@/RoomList/mocks/types/rooms'; +import { Room } from '@/core/types'; import roomListStyle from '@/RoomList/styles/roomListStyle'; import { Accordion, AccordionHeader, AccordionBody } from '@/shared/Accordion'; import { RoomSummary } from '@/RoomSummary'; @@ -14,7 +14,7 @@ interface RoomAccordionProps { } const RoomAccordion = ({ room }: RoomAccordionProps) => { - const { routine, id } = room; + const { routines, id } = room; const moveTo = useMoveRoute(); const [hoverRef, hovered] = useHover(); const keyword = useKeyword(); @@ -48,7 +48,7 @@ const RoomAccordion = ({ room }: RoomAccordionProps) => { >
- {routine.map(({ routineId, content }) => ( + {routines.map(({ routineId, content }) => ( Date: Wed, 22 Nov 2023 20:29:12 +0900 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=EB=B9=8C=EB=93=9C=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=83=80=EC=9E=85=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/mocks/datas/searchRooms.ts | 60 ++++++++++++++--------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/core/mocks/datas/searchRooms.ts b/src/core/mocks/datas/searchRooms.ts index 944888d4..c475c1e6 100644 --- a/src/core/mocks/datas/searchRooms.ts +++ b/src/core/mocks/datas/searchRooms.ts @@ -12,7 +12,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -34,7 +34,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -56,7 +56,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물먹기' @@ -78,7 +78,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -100,7 +100,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -122,7 +122,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물먹기' @@ -144,7 +144,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -166,7 +166,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -188,7 +188,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물먹기' @@ -210,7 +210,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물먹기' @@ -232,7 +232,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -254,7 +254,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -276,7 +276,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물먹기' @@ -298,7 +298,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -320,7 +320,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -342,7 +342,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물먹기' @@ -364,7 +364,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -386,7 +386,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -408,7 +408,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물먹기' @@ -430,7 +430,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물먹기' @@ -452,7 +452,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -474,7 +474,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -496,7 +496,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물먹기' @@ -518,7 +518,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -540,7 +540,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -562,7 +562,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물먹기' @@ -584,7 +584,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -606,7 +606,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -628,7 +628,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물먹기' @@ -650,7 +650,7 @@ export const SEARCH_ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물먹기' From d8c20cf239a48249ceea29ae2e8c6c497cae0a70 Mon Sep 17 00:00:00 2001 From: Sejin Cha Date: Wed, 22 Nov 2023 20:31:10 +0900 Subject: [PATCH 4/5] =?UTF-8?q?feat:=20mockData=20=ED=83=80=EC=9E=85=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/mocks/datas/totalRooms.ts | 76 +++++++++++++++--------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/src/core/mocks/datas/totalRooms.ts b/src/core/mocks/datas/totalRooms.ts index a8fe62fc..6b240367 100644 --- a/src/core/mocks/datas/totalRooms.ts +++ b/src/core/mocks/datas/totalRooms.ts @@ -12,7 +12,7 @@ export const ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -34,7 +34,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -56,7 +56,7 @@ export const ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -78,7 +78,7 @@ export const ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -100,7 +100,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' @@ -122,7 +122,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' @@ -144,7 +144,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -166,7 +166,7 @@ export const ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -188,7 +188,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' @@ -210,7 +210,7 @@ export const ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -232,7 +232,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -254,7 +254,7 @@ export const ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -276,7 +276,7 @@ export const ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -298,7 +298,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' @@ -320,7 +320,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' @@ -342,7 +342,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -364,7 +364,7 @@ export const ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -386,7 +386,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' @@ -408,7 +408,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' @@ -430,7 +430,7 @@ export const ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -452,7 +452,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -474,7 +474,7 @@ export const ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: false, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -496,7 +496,7 @@ export const ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -518,7 +518,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' @@ -540,7 +540,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' @@ -562,7 +562,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -584,7 +584,7 @@ export const ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -606,7 +606,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' @@ -628,7 +628,7 @@ export const ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -650,7 +650,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -672,7 +672,7 @@ export const ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -694,7 +694,7 @@ export const ROOMS: Room[] = [ maxUserCount: 9, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -716,7 +716,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' @@ -738,7 +738,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' @@ -760,7 +760,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -782,7 +782,7 @@ export const ROOMS: Room[] = [ maxUserCount: 7, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: '물 마시기' @@ -804,7 +804,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' @@ -826,7 +826,7 @@ export const ROOMS: Room[] = [ maxUserCount: 10, image: '', isPassword: true, - routine: [ + routines: [ { routineId: 5, content: 'PR 올리기' From 2de5d22257be8e0188f7e55ac75df33021f6bc7d Mon Sep 17 00:00:00 2001 From: Sejin Cha Date: Wed, 22 Nov 2023 20:32:52 +0900 Subject: [PATCH 5/5] =?UTF-8?q?refactor:=20=EB=AA=A8=EB=93=88=20import=20?= =?UTF-8?q?=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/mocks/handlers/rooms.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/mocks/handlers/rooms.ts b/src/core/mocks/handlers/rooms.ts index a72956c3..edbd09dd 100644 --- a/src/core/mocks/handlers/rooms.ts +++ b/src/core/mocks/handlers/rooms.ts @@ -1,5 +1,5 @@ import { http, HttpResponse, delay } from 'msw'; -import { Room } from '@/RoomList/mocks/types/rooms'; +import { Room } from '@/core/types'; import { baseURL } from '../baseURL'; import { RoomInfo, RoomInfoBeforeEditing } from '../datas/room'; import { MY_JOIN_ROOMS } from '../datas/myJoinRoom';