diff --git a/src/assets/icons/index.ts b/src/assets/icons/index.ts index 2ce1ecd4..32e9558a 100644 --- a/src/assets/icons/index.ts +++ b/src/assets/icons/index.ts @@ -16,7 +16,6 @@ import Right from '@/assets/icons/Right.svg'; import Seminar from '@/assets/icons/seminar.svg'; import Up from '@/assets/icons/Up.svg'; import Info from '@/assets/icons/Info.svg'; -import ErrorIcon from '@/assets/icons/Erroricon.svg'; import PlusBig from '@/assets/icons/Plus=big.svg'; import PlusSmall from '@/assets/icons/Plus=small.svg'; import ExitSmall from '@/assets/icons/Exit=small.svg'; @@ -108,6 +107,7 @@ import HomeActive from '@/assets/icons/HomeActive.svg'; import LunchActive from '@/assets/icons/LunchActive.svg'; import MyActive from '@/assets/icons/MyActive.svg'; import PlateSmall from '@/assets/icons/plateSmall.svg'; +import ErrorIcon from '@/assets/icons/Erroricon.svg'; export { As, @@ -128,7 +128,6 @@ export { Send, Up, Info, - ErrorIcon, PlusBig, PlusSmall, ExitSmall, @@ -220,4 +219,5 @@ export { LunchActive, MyActive, PlateSmall, + ErrorIcon, }; diff --git a/src/components/lunch/calendar/LunchCalendarCafeteria.tsx b/src/components/lunch/calendar/LunchCalendarCafeteria.tsx index 3c76ce4c..8b550347 100644 --- a/src/components/lunch/calendar/LunchCalendarCafeteria.tsx +++ b/src/components/lunch/calendar/LunchCalendarCafeteria.tsx @@ -24,7 +24,7 @@ import Alert from '@/components/common/Alert'; function LunchCalendarCafeteria() { const [searchText, setSearchText] = useState(''); - const { setNextComponent } = usePagesStore(); + const { setNextComponent, reset } = usePagesStore(); const { bottomSheetState, openBottomSheet, closeBottomSheet } = useBottomSheetStore(); const { isSave } = useSaveStore(); @@ -56,8 +56,10 @@ function LunchCalendarCafeteria() { if (imageFiles.length === 0) { router.replace('/lunch/calendar'); + reset(); + } else { + setNextComponent(calendar.Inform); } - setNextComponent(calendar.Inform); } catch (err) { const error = err as ErrorProps; openAlert('๐Ÿ“ข', error.message || '๋ฆฌ๋ทฐ ๋“ฑ๋ก ์˜ค๋ฅ˜'); diff --git a/src/components/lunch/calendar/LunchCalendarEatOut.tsx b/src/components/lunch/calendar/LunchCalendarEatOut.tsx index 3dbef89f..11889453 100644 --- a/src/components/lunch/calendar/LunchCalendarEatOut.tsx +++ b/src/components/lunch/calendar/LunchCalendarEatOut.tsx @@ -24,7 +24,7 @@ import Alert from '@/components/common/Alert'; function LunchCalenderEatOut() { const [searchText, setSearchText] = useState(''); - const { setNextComponent, goBack } = usePagesStore(); + const { setNextComponent, goBack, reset } = usePagesStore(); const { bottomSheetState, openBottomSheet, closeBottomSheet } = useBottomSheetStore(); const { @@ -80,8 +80,10 @@ function LunchCalenderEatOut() { if (imageFiles.length === 0) { router.replace('/lunch/calendar'); + reset(); + } else { + setNextComponent(calendar.Inform); } - setNextComponent(calendar.Inform); } catch (err) { const error = err as ErrorProps; openAlert('๐Ÿ“ข', error.message || '๋ฆฌ๋ทฐ ๋“ฑ๋ก ์˜ค๋ฅ˜'); diff --git a/src/components/lunch/calendar/LunchCalendarForm.tsx b/src/components/lunch/calendar/LunchCalendarForm.tsx index f2565870..741b5460 100644 --- a/src/components/lunch/calendar/LunchCalendarForm.tsx +++ b/src/components/lunch/calendar/LunchCalendarForm.tsx @@ -76,9 +76,6 @@ const CalendarStyles = css` width: 350px; max-width: 100%; background: white; - border: 1px solid #a0a096; - font-family: Arial, Helvetica, sans-serif; - line-height: 1.125em; } .react-calendar--doubleView { @@ -126,13 +123,12 @@ const CalendarStyles = css` } .react-calendar__navigation button:disabled { - // background-color: #f0f0f0; - // pointer-events: none; + } .react-calendar__navigation button:enabled:hover, .react-calendar__navigation button:enabled:focus { - // background-color: #e6e6e6; + } // ์š”์ผ section @@ -200,21 +196,19 @@ const CalendarStyles = css` .react-calendar__tile:disabled { color: ${theme.palette.greyscale.grey40}; - // pointer-events: none; } .react-calendar__tile:enabled:hover, .react-calendar__tile:enabled:focus { - // background-color: #e6e6e6; + } // ์˜ค๋Š˜ ๋‚ ์งœ .react-calendar__tile--now { - color: ${theme.palette.bluescale.blue50}; } .react-calendar__tile--now:enabled:hover, .react-calendar__tile--now:enabled:focus { - // background: #ffffa9; + } .react-calendar__tile--hasActive { @@ -223,23 +217,23 @@ const CalendarStyles = css` .react-calendar__tile--hasActive:enabled:hover, .react-calendar__tile--hasActive:enabled:focus { - // background: #a9d4ff; + } // ์„ ํƒํ•œ ๋‚ ์งœ .react-calendar__tile--active { .react-calendar__tile--active:enabled:hover, .react-calendar__tile--active:enabled:focus { - // background: #1087ff; + } .react-calendar--selectRange .react-calendar__tile--hover { - // background-color: #e6e6e6; + } // ๋„ค๋น„๊ฒŒ์ด์…˜ ๋ ˆ์ด๋ธ” - button ํƒœ๊ทธ .react-calendar__navigation__label { - // pointer-events: none; + } // ๋„ค๋น„๊ฒŒ์ด์…˜ ๋ ˆ์ด๋ธ” - span ํƒœ๊ทธ .react-calendar__navigation__label__labelText.react-calendar__navigation__label__labelText--from { diff --git a/src/components/lunch/calendar/LunchCalendarLunchBox.tsx b/src/components/lunch/calendar/LunchCalendarLunchBox.tsx index fdf51852..1db8c7e1 100644 --- a/src/components/lunch/calendar/LunchCalendarLunchBox.tsx +++ b/src/components/lunch/calendar/LunchCalendarLunchBox.tsx @@ -21,7 +21,7 @@ import Alert from '@/components/common/Alert'; function LunchCalendarLunchBox() { const [searchText, setSearchText] = useState(''); - const { setNextComponent } = usePagesStore(); + const { setNextComponent, reset } = usePagesStore(); const { bottomSheetState, openBottomSheet, closeBottomSheet } = useBottomSheetStore(); const { isSave } = useSaveStore(); @@ -51,8 +51,10 @@ function LunchCalendarLunchBox() { if (imageFiles.length === 0) { router.replace('/lunch/calendar'); + reset(); + } else { + setNextComponent(calendar.Inform); } - setNextComponent(calendar.Inform); } catch (err) { const error = err as ErrorProps; openAlert('๐Ÿ“ข', error.message || '๋ฆฌ๋ทฐ ๋“ฑ๋ก ์˜ค๋ฅ˜'); diff --git a/src/components/lunch/calendar/LunchCalendarMain.tsx b/src/components/lunch/calendar/LunchCalendarMain.tsx index 1d963ad8..f8c0a0df 100644 --- a/src/components/lunch/calendar/LunchCalendarMain.tsx +++ b/src/components/lunch/calendar/LunchCalendarMain.tsx @@ -3,6 +3,7 @@ import { useRouter } from 'next/router'; import { css } from '@emotion/react'; import { CALENDAR_CONTENT } from '@/constants/lunch'; import { Rice } from '@/assets/icons'; +import { getReviewDetailsData } from '@/pages/api/lunch/calendarRequests'; import Header from '@/components/common/Header'; import Alert from '@/components/common/Alert'; import LunchCalendarWriteBtn from '@/components/lunch/calendar/LunchCalendarWriteBtn'; @@ -11,23 +12,34 @@ import LunchCalendarForm from '@/components/lunch/calendar/LunchCalendarForm'; import LunchCalendarDetailsSlide from '@/components/lunch/calendar/LunchCalendarDetailsSlide'; import useWriteStore from '@/stores/useWriteStore'; import useAlertStore from '@/stores/useAlertStore'; -import useCalendarStore from '@/stores/useCalendarStore'; +import { ErrorProps } from '@/types/common/response'; import checkTodayReview from '@/utils/checkTodayReview'; function LunchCalendarMain() { const [isCompleted, setIsCompleted] = useState(false); const isChecked = useWriteStore((state) => state.isChecked); - const reviewDetails = useCalendarStore((state) => state.reviewDetails); - const { alertState } = useAlertStore(); + const { alertState, openAlert } = useAlertStore(); const { title, subTitle } = CALENDAR_CONTENT; const router = useRouter(); useEffect(() => { - const res = checkTodayReview(reviewDetails); - setIsCompleted(res); - }, [reviewDetails]); + checkReviews(); + }, []); + + const checkReviews = async () => { + try { + const year = new Date().getFullYear(); + const month = new Date().getMonth() + 1; + const { data } = await getReviewDetailsData(year, month); + const res = checkTodayReview(data); + setIsCompleted(res); + } catch (err) { + const error = err as ErrorProps; + openAlert('๐Ÿ“ข', error.message || '๋ฆฌ๋ทฐ ์ฒดํฌ ์˜ค๋ฅ˜'); + } + }; const onClickHeaderHandler = () => { router.back(); diff --git a/src/pages/api/lunch/calendarRequests.ts b/src/pages/api/lunch/calendarRequests.ts index 45e79b40..3a5ca3eb 100644 --- a/src/pages/api/lunch/calendarRequests.ts +++ b/src/pages/api/lunch/calendarRequests.ts @@ -1,12 +1,6 @@ import { apiInstance } from '@/pages/api/axios'; // ๋‹ฌ๋ ฅ -export const getReviewData = async (year: number, month: number) => { - const res = await apiInstance.get( - `/reviews/members?year=${year}&month=${month}`, - ); - return res.data; -}; export const getReviewDetailsData = async (year: number, month: number) => { const res = await apiInstance.get(