From 83e3689f024e6f1be3cd258cd2464a108c763ea2 Mon Sep 17 00:00:00 2001 From: caadiq Date: Sat, 10 Jan 2026 10:28:21 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=AA=A8=EB=B0=94=EC=9D=BC=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=20=EB=92=A4=EB=A1=9C=EA=B0=80=EA=B8=B0=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - enterSearchMode()에서 history.pushState로 히스토리 상태 추가 - popstate 이벤트로 뒤로가기 시 검색 모드 종료 - 이전 페이지로 이동하지 않고 일정 화면으로 복귀 --- frontend/src/pages/mobile/public/Schedule.jsx | 32 +++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/mobile/public/Schedule.jsx b/frontend/src/pages/mobile/public/Schedule.jsx index 33016fd..7b3c820 100644 --- a/frontend/src/pages/mobile/public/Schedule.jsx +++ b/frontend/src/pages/mobile/public/Schedule.jsx @@ -27,6 +27,32 @@ function MobileSchedule() { const [calendarViewDate, setCalendarViewDate] = useState(() => new Date(selectedDate)); // 달력 뷰 날짜 const [calendarShowYearMonth, setCalendarShowYearMonth] = useState(false); // 달력 년월 선택 모드 const contentRef = useRef(null); // 스크롤 초기화용 + + // 검색 모드 진입 함수 (history 상태 추가) + const enterSearchMode = () => { + setIsSearchMode(true); + window.history.pushState({ searchMode: true }, ''); + }; + + // 검색 모드 종료 함수 + const exitSearchMode = () => { + setIsSearchMode(false); + setSearchInput(''); + setSearchTerm(''); + }; + + // 뒤로가기 버튼 처리 + useEffect(() => { + const handlePopState = (e) => { + if (isSearchMode) { + // 검색 모드에서 뒤로가기 시 검색 모드 종료 + exitSearchMode(); + } + }; + + window.addEventListener('popstate', handlePopState); + return () => window.removeEventListener('popstate', handlePopState); + }, [isSearchMode]); // 달력 월 변경 함수 const changeCalendarMonth = (delta) => { @@ -257,7 +283,7 @@ function MobileSchedule() { )} - @@ -340,7 +366,7 @@ function MobileSchedule() { -