Skip to content

Commit b374246

Browse files
author
jyn
committed
Merge branch 'dev' of https://github.com/codeit-team6/nomadia into dev
2 parents c11c627 + fadea37 commit b374246

File tree

6 files changed

+48
-12
lines changed

6 files changed

+48
-12
lines changed

src/features/activityId/components/reservation-form.tsx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use client';
22
import axios from 'axios';
33
import { ArrowLeft, Minus, Plus, X } from 'lucide-react';
4+
import { useRouter } from 'next/navigation';
45
import { useEffect, useState } from 'react';
56
import { Controller, useForm } from 'react-hook-form';
67
import { toast } from 'sonner';
@@ -74,6 +75,7 @@ const ReservationForm = ({
7475
year: String(year),
7576
month: String(month + 1).padStart(2, '0'),
7677
});
78+
const router = useRouter();
7779

7880
// 리액트훅폼
7981
const {
@@ -398,7 +400,6 @@ const ReservationForm = ({
398400

399401
{/* 예약하기/확인 버튼 */}
400402
<button
401-
disabled={!isLoggedIn}
402403
type="submit"
403404
className={cn(
404405
'cursor-pointer text-white',
@@ -409,6 +410,10 @@ const ReservationForm = ({
409410
'z-100 lg:mt-0 lg:w-[13.5rem]',
410411
)}
411412
onClick={(e) => {
413+
if (!isLoggedIn) {
414+
openSecondModal(undefined, 'need-login');
415+
return;
416+
}
412417
if (!isDesktop) {
413418
if (!appear && !isValid) {
414419
appearModal();
@@ -450,6 +455,30 @@ const ReservationForm = ({
450455
</div>
451456
</SecondModal>
452457
)}
458+
{secondModalName === 'need-login' && (
459+
<SecondModal type="warning" extraClassName="md:pb-[1rem]">
460+
<Modal.Header>로그인이 필요합니다.</Modal.Header>
461+
<div className="mb-0 flex w-[23.4rem] gap-2 md:w-[28.2rem] md:gap-3">
462+
<Modal.Button
463+
color="white"
464+
ariaLabel="취소"
465+
onClick={closeSecondModal}
466+
>
467+
취소
468+
</Modal.Button>
469+
<Modal.Button
470+
color="blue"
471+
ariaLabel="로그인하기"
472+
onClick={() => {
473+
router.push('/login');
474+
closeSecondModal();
475+
}}
476+
>
477+
로그인 하기
478+
</Modal.Button>
479+
</div>
480+
</SecondModal>
481+
)}
453482
</>
454483
);
455484
};

src/features/activityId/components/reviews.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import StarImage from '@/shared/components/star';
1212
import { cn } from '@/shared/libs/cn';
1313
import { formatPrice } from '@/shared/libs/utils/formatPrice';
1414

15+
import { formatDateWithDots } from '../libs/utils/formatDateWithDots';
16+
1517
const Reviews = ({ activityId }: { activityId: number }) => {
1618
const [page, setPage] = useState(1);
1719
const { data } = useReviewsQuery(activityId, { page: page, size: 3 });
@@ -67,7 +69,7 @@ const Reviews = ({ activityId }: { activityId: number }) => {
6769
dateTime={review.createdAt}
6870
className="text-[1.2rem] font-semibold text-gray-400"
6971
>
70-
{review.createdAt}
72+
{formatDateWithDots(review.createdAt)}
7173
</time>
7274
</header>
7375
<section className="mt-[0.4rem] mb-[0.8rem] flex items-center">
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const formatDateWithDots = (date: string) => {
2+
const targetDate = new Date(date);
3+
return `${targetDate.getFullYear()}.${targetDate.getMonth() + 1}.${targetDate.getDate()}`;
4+
};

src/shared/components/calendar/components/calendar-for-form.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ const CalendarForForm = ({
5757
isForReservation?: boolean;
5858
changeFormValue?: () => void;
5959
}) => {
60-
const { setDate, setSelectedDate, year, month, date } = useCalendarStore();
60+
const { setDate, setSelectedDate, year, month, selectedDate } =
61+
useCalendarStore();
6162
const { thisMonthDays } = getMonthRange(year, month);
6263

6364
const handleClick = (day: number) => {
@@ -100,30 +101,30 @@ const CalendarForForm = ({
100101
{/* children */}
101102
{thisMonthDays.map((day) => {
102103
const dateStr = formatDateToYMD(new Date(year, month, day));
104+
const isSelected = dateStr === selectedDate;
103105
const hasSchedule = scheduleArray?.find(
104106
(schedule) => schedule.date === dateStr,
105107
);
106-
const isSelected = day === date; //--> bg-main 적용
107108

108109
return (
109110
<button
111+
disabled={!hasSchedule}
110112
type="button"
111113
key={day}
112114
onKeyDown={(e) => e.key === 'Enter' && handleClick(day)}
113115
onClick={() => handleClick(day)}
114116
className={cn(
115-
'flex-center hover:bg-sub cursor-pointer',
117+
'flex-center text-gray-300',
116118
defaultCellStyle,
117119
cellStyle,
118-
hasSchedule && 'text-main',
119-
isSelected && 'text-white',
120+
hasSchedule &&
121+
'hover:text-main cursor-pointer text-gray-800 transition hover:scale-110',
122+
isSelected && 'text-white hover:text-white',
120123
)}
121124
>
122125
{day}
126+
{hasSchedule && <div className={cn(selectedCircle, 'bg-sub')} />}
123127
{isSelected && <div className={cn(selectedCircle, 'bg-main')} />}
124-
{hasSchedule && (
125-
<div className={cn(selectedCircle, 'bg-sub -z-2')} />
126-
)}
127128
</button>
128129
);
129130
})}

src/shared/components/calendar/components/not-this-month.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const NotThisMonth = ({
1111
return daysArray.map((date) => (
1212
<div
1313
key={`lead-${date}`}
14-
className={cn(defaultCellStyle, cellStyle, 'text-gray-300 select-none')}
14+
className={cn(defaultCellStyle, cellStyle, 'text-gray-100 select-none')}
1515
>
1616
{date}
1717
</div>

src/shared/components/calendar/libs/constants/calendarStyles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export const selectedCircle =
22
'absolute inset-0 -z-1 m-auto size-[4.6rem] rounded-full';
33

44
export const defaultCellStyle =
5-
'relative z-0 h-[5.4rem] w-[4.67rem] text-[1.6rem] font-medium text-gray-800';
5+
'relative z-0 h-[5.4rem] w-[4.67rem] text-[1.6rem] font-medium';
66

77
export const defaultDayOfWeekStyle =
88
'flex-center size-[4.6rem] text-[1.6rem] font-semibold text-gray-800';

0 commit comments

Comments
 (0)