Skip to content

Commit

Permalink
Merge pull request #184 from livable-final/dev
Browse files Browse the repository at this point in the history
release: 1.0.8 ver
  • Loading branch information
kledyu committed Oct 3, 2023
2 parents e7070ff + 7f3b27d commit 01ce6d8
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/assets/icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand All @@ -128,7 +128,6 @@ export {
Send,
Up,
Info,
ErrorIcon,
PlusBig,
PlusSmall,
ExitSmall,
Expand Down Expand Up @@ -220,4 +219,5 @@ export {
LunchActive,
MyActive,
PlateSmall,
ErrorIcon,
};
6 changes: 4 additions & 2 deletions src/components/lunch/calendar/LunchCalendarCafeteria.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 || '리뷰 등록 오류');
Expand Down
6 changes: 4 additions & 2 deletions src/components/lunch/calendar/LunchCalendarEatOut.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 || '리뷰 등록 오류');
Expand Down
22 changes: 8 additions & 14 deletions src/components/lunch/calendar/LunchCalendarForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions src/components/lunch/calendar/LunchCalendarLunchBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 || '리뷰 등록 오류');
Expand Down
24 changes: 18 additions & 6 deletions src/components/lunch/calendar/LunchCalendarMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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();
Expand Down
6 changes: 0 additions & 6 deletions src/pages/api/lunch/calendarRequests.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down

0 comments on commit 01ce6d8

Please sign in to comment.