diff --git a/src/components/layout/empty/EmptyCard/EmptyCard.module.scss b/src/components/layout/empty/EmptyCard/EmptyCard.module.scss
index 6f057011..58125192 100644
--- a/src/components/layout/empty/EmptyCard/EmptyCard.module.scss
+++ b/src/components/layout/empty/EmptyCard/EmptyCard.module.scss
@@ -9,4 +9,8 @@
background-color: $black70;
border: 0.1rem dashed $gray50;
border-radius: 0.8rem;
+
+ &.small {
+ height: 11.2rem;
+ }
}
diff --git a/src/components/layout/empty/EmptyCard/index.tsx b/src/components/layout/empty/EmptyCard/index.tsx
index 47d426c9..375656ae 100644
--- a/src/components/layout/empty/EmptyCard/index.tsx
+++ b/src/components/layout/empty/EmptyCard/index.tsx
@@ -10,13 +10,14 @@ const cx = classNames.bind(styles);
type EmptyCardProps = {
text: string;
+ isSmall?: boolean;
};
const { url, alt } = SVGS.empty;
-const EmptyCard = ({ text }: EmptyCardProps) => {
+const EmptyCard = ({ text, isSmall }: EmptyCardProps) => {
return (
-
+
diff --git a/src/constants/mockData/reservationDetailMockData.json b/src/constants/mockData/reservationDetailMockDataConfirmed.json
similarity index 74%
rename from src/constants/mockData/reservationDetailMockData.json
rename to src/constants/mockData/reservationDetailMockDataConfirmed.json
index a7a34d58..d2799b2d 100644
--- a/src/constants/mockData/reservationDetailMockData.json
+++ b/src/constants/mockData/reservationDetailMockDataConfirmed.json
@@ -1,18 +1,18 @@
{
"cursorId": 0,
- "totalCount": 3,
+ "totalCount": 1,
"reservations": [
{
"id": 1,
- "nickname": "tester",
+ "nickname": "testerc",
"userId": 0,
- "teamId": "test",
+ "teamId": "testerc",
"activityId": 0,
"scheduleId": 0,
- "status": "pending",
+ "status": "confirmed",
"reviewSubmitted": false,
"totalPrice": 0,
- "headCount": 2,
+ "headCount": 1,
"date": "2024-03-27",
"startTime": "09:00",
"endTime": "12:00",
diff --git a/src/constants/mockData/reservationDetailMockDataDeclined.json b/src/constants/mockData/reservationDetailMockDataDeclined.json
new file mode 100644
index 00000000..c8035b4b
--- /dev/null
+++ b/src/constants/mockData/reservationDetailMockDataDeclined.json
@@ -0,0 +1,40 @@
+{
+ "cursorId": 0,
+ "totalCount": 2,
+ "reservations": [
+ {
+ "id": 1,
+ "nickname": "testerd",
+ "userId": 0,
+ "teamId": "testd",
+ "activityId": 0,
+ "scheduleId": 0,
+ "status": "declined",
+ "reviewSubmitted": false,
+ "totalPrice": 0,
+ "headCount": 10,
+ "date": "2024-03-27",
+ "startTime": "09:00",
+ "endTime": "12:00",
+ "createdAt": "2024-03-27T02:35:20.905Z",
+ "updatedAt": "2024-03-27T02:35:20.905Z"
+ },
+ {
+ "id": 2,
+ "nickname": "testerd2",
+ "userId": 0,
+ "teamId": "testd2",
+ "activityId": 0,
+ "scheduleId": 0,
+ "status": "declined",
+ "reviewSubmitted": false,
+ "totalPrice": 0,
+ "headCount": 11,
+ "date": "2024-03-27",
+ "startTime": "09:00",
+ "endTime": "12:00",
+ "createdAt": "2024-03-27T02:35:20.905Z",
+ "updatedAt": "2024-03-27T02:35:20.905Z"
+ }
+ ]
+}
diff --git a/src/constants/mockData/reservationDetailMockDataPending.json b/src/constants/mockData/reservationDetailMockDataPending.json
new file mode 100644
index 00000000..d5d4efe3
--- /dev/null
+++ b/src/constants/mockData/reservationDetailMockDataPending.json
@@ -0,0 +1,57 @@
+{
+ "cursorId": 0,
+ "totalCount": 3,
+ "reservations": [
+ {
+ "id": 1,
+ "nickname": "testerp",
+ "userId": 0,
+ "teamId": "testp",
+ "activityId": 0,
+ "scheduleId": 0,
+ "status": "pending",
+ "reviewSubmitted": false,
+ "totalPrice": 0,
+ "headCount": 2,
+ "date": "2024-03-27",
+ "startTime": "09:00",
+ "endTime": "12:00",
+ "createdAt": "2024-03-27T02:35:20.905Z",
+ "updatedAt": "2024-03-27T02:35:20.905Z"
+ },
+ {
+ "id": 2,
+ "nickname": "testerp2",
+ "userId": 0,
+ "teamId": "testp2",
+ "activityId": 0,
+ "scheduleId": 0,
+ "status": "pending",
+ "reviewSubmitted": false,
+ "totalPrice": 0,
+ "headCount": 3,
+ "date": "2024-03-27",
+ "startTime": "09:00",
+ "endTime": "12:00",
+ "createdAt": "2024-03-27T02:35:20.905Z",
+ "updatedAt": "2024-03-27T02:35:20.905Z"
+ },
+ {
+ "id": 3,
+ "nickname": "testerp3",
+ "userId": 0,
+ "teamId": "testp3",
+ "activityId": 0,
+ "scheduleId": 0,
+ "status": "pending",
+ "reviewSubmitted": false,
+ "totalPrice": 0,
+ "headCount": 4,
+ "date": "2024-03-27",
+ "startTime": "09:00",
+ "endTime": "12:00",
+ "createdAt": "2024-03-27T02:35:20.905Z",
+ "updatedAt": "2024-03-27T02:35:20.905Z"
+ }
+ ]
+}
diff --git a/src/constants/mockData/reservationDetailMockDataPendingNoData.json b/src/constants/mockData/reservationDetailMockDataPendingNoData.json
new file mode 100644
index 00000000..ee594a7a
--- /dev/null
+++ b/src/constants/mockData/reservationDetailMockDataPendingNoData.json
@@ -0,0 +1,5 @@
+{
+ "cursorId": 0,
+ "totalCount": 0,
+ "reservations": []
+}
diff --git a/src/types/schedule.ts b/src/types/schedule.ts
index b0fb91f9..48dbaa6b 100644
--- a/src/types/schedule.ts
+++ b/src/types/schedule.ts
@@ -1,4 +1,4 @@
-import { ReservationResponse } from '@/types';
+import { MyReservationsStatus, MyReservationsStatusKR, ReservationResponse } from '@/types';
export type AvailableSchedule = {
date: string;
@@ -18,22 +18,32 @@ export type DailyReservationCount = {
pending: number;
};
-export type MonthlySchedule = {
+export type MonthlyReservationResponse = {
date: string;
reservations: MonthlyReservationCount;
};
-export type DailySchedule = {
+export type DailyReservationResponse = {
scheduleId: number;
startTime: string;
endTime: string;
count: DailyReservationCount;
};
-export type DetailSchedule = {
+export type DetailReservationResponse = {
cursorId: 0;
totalCount: 0;
- reservations: Omit
[];
+ reservations: ReservationDetail[];
+};
+
+export type ReservationDetail = Omit & {
+ nickname: string;
};
export type ReservationsByDate = Record;
+
+export type StatusTabOptions = {
+ id: MyReservationsStatus;
+ text: MyReservationsStatusKR;
+ count: number;
+};
diff --git a/src/utils/dataMap.ts b/src/utils/dataMap.ts
index c12ae395..e9921535 100644
--- a/src/utils/dataMap.ts
+++ b/src/utils/dataMap.ts
@@ -1,6 +1,11 @@
import { PRICE_TO_POST_TYPES } from '@/constants';
-import { MonthlySchedule, ReservationsByDate } from '@/types';
+import {
+ DailyReservationCount,
+ DailyReservationResponse,
+ MonthlyReservationResponse,
+ ReservationsByDate,
+} from '@/types';
import { formatCategoryToGameNameKR } from './gameFormatter';
@@ -29,10 +34,35 @@ export const splitDescByDelimiter = (inputString: string) => {
};
};
-export const scheduleListToObjectByDate = (scheduleData: MonthlySchedule[] | undefined) => {
+export const getScheduleByDate = (scheduleData: MonthlyReservationResponse[] | undefined) => {
const result: ReservationsByDate = {};
- scheduleData?.forEach((schedule) => (result[schedule.date] = schedule.reservations));
+ scheduleData?.forEach((schedule) => {
+ result[schedule.date] = schedule.reservations;
+ });
+
+ return result;
+};
+
+export const getStatusCountByScheduleId = (scheduleData: DailyReservationResponse[] | undefined) => {
+ const result: { [id: number]: DailyReservationCount } = {};
+
+ scheduleData?.forEach((schedule) => {
+ result[schedule.scheduleId] = schedule.count;
+ });
+
+ return result;
+};
+
+export const getScheduleDropdownOption = (scheduleData: DailyReservationResponse[] | undefined) => {
+ const result: { title: string; value: number | string }[] = [];
+
+ scheduleData?.forEach((schedule) => {
+ result.push({
+ title: `${schedule.startTime} - ${schedule.endTime}`,
+ value: schedule.scheduleId,
+ });
+ });
return result;
};
diff --git a/src/utils/getDate.ts b/src/utils/getDate.ts
index c3a0e41c..c4cdc5fa 100644
--- a/src/utils/getDate.ts
+++ b/src/utils/getDate.ts
@@ -126,3 +126,5 @@ export const getMonthString = (month: number) =>
dayjs()
.month(month - 1)
.format('MMMM');
+
+export const getDateStringKR = (date: string) => dayjs(date).format('YYYY년 M월 D일');