Skip to content

Commit ad93ae9

Browse files
authored
Merge pull request #362 from Passtival/develop
축제 진행 중 요구사항 반영 배포
2 parents 082674f + 66dfade commit ad93ae9

File tree

11 files changed

+79
-26
lines changed

11 files changed

+79
-26
lines changed

src/pages/blind-match/blind-match.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import Header from '@shared/components/header/header';
44
import Tab from '@shared/components/tab/tab';
55

66
import ApplyPage from './components/apply/apply';
7+
import { useCurrentDay } from './hooks/use-current-day';
78

89
const BlindMatch = () => {
910
const { day } = useParams<{ day: string }>();
10-
11-
const initialDay = day || '1';
11+
const initialDay = useCurrentDay(day);
1212

1313
return (
1414
<>

src/pages/blind-match/components/apply-after/closed.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import { APPLICATION_TIME_RANGE } from '@pages/blind-match/utils/time-format';
2+
13
import Button from '@shared/components/button/button';
24
import Title from '@shared/components/title/title';
35

46
import * as styles from './complete.css';
5-
import { APPLICATION_TIME_RANGE } from '../../constants/blind-match-time';
67

78
interface CompleteProps {
89
currentDay: string;

src/pages/blind-match/components/apply-after/complete.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { APPLICATION_TIME_RANGE } from '@pages/blind-match/utils/time-format';
2+
13
import Button from '@shared/components/button/button';
24
import Title from '@shared/components/title/title';
35
import { IcSvgCaution } from '@shared/icons';
46

57
import * as styles from './complete.css';
6-
import { APPLICATION_TIME_RANGE } from '../../constants/blind-match-time';
78

89
interface CompleteProps {
910
currentDay: string;

src/pages/blind-match/components/before-match/before-match.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import { APPLICATION_TIME_RANGE } from '@pages/blind-match/utils/time-format';
2+
13
import Button from '@shared/components/button/button';
24
import Title from '@shared/components/title/title';
35

46
import * as styles from './before-match.css';
5-
import { APPLICATION_TIME_RANGE } from '../../constants/blind-match-time';
67

78
interface BeforeMatchProps {
89
currentDay: string;

src/pages/blind-match/constants/blind-match-time.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,3 @@ export const DEADLINE_HOUR = 17;
2020
export const DEADLINE_MINUTE = 30;
2121
export const RESULTS_HOUR = 18;
2222
export const RESULTS_MINUTE = 0;
23-
24-
/**
25-
* 시간 포맷팅 유틸리티 함수
26-
*/
27-
export const formatTime = (hour: number, minute: number): string => {
28-
return `${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`;
29-
};
30-
31-
/**
32-
* 신청 가능 시간 문자열
33-
*/
34-
export const APPLICATION_TIME_RANGE = `[신청 가능 시간: ${formatTime(START_HOUR, START_MINUTE)} ~ ${formatTime(DEADLINE_HOUR, DEADLINE_MINUTE)}]`;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import {
2+
EVENT_YEAR,
3+
EVENT_MONTH,
4+
EVENT_DAYS,
5+
} from '../constants/blind-match-time';
6+
7+
/**
8+
* 현재 날짜에 따라 적절한 일차를 결정하는 훅
9+
* @param urlDay - URL 파라미터로 전달된 일차 값
10+
* @returns 현재 날짜에 맞는 일차 문자열 ('1', '2', '3')
11+
*/
12+
export const useCurrentDay = (urlDay?: string) => {
13+
const getCurrentDay = () => {
14+
const now = new Date();
15+
const currentDate = now.getDate();
16+
const currentMonth = now.getMonth();
17+
const currentYear = now.getFullYear();
18+
19+
// 이벤트 날짜와 비교
20+
if (currentYear === EVENT_YEAR && currentMonth === EVENT_MONTH) {
21+
if (currentDate === EVENT_DAYS.DAY_1) {
22+
return '1';
23+
} else if (currentDate === EVENT_DAYS.DAY_2) {
24+
return '2';
25+
} else if (currentDate === EVENT_DAYS.DAY_3) {
26+
return '3';
27+
}
28+
}
29+
30+
// URL 파라미터가 있으면 우선 사용, 없으면 기본값 1
31+
return urlDay || '1';
32+
};
33+
34+
return getCurrentDay();
35+
};

src/pages/blind-match/utils/.gitkeep

Whitespace-only changes.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import {
2+
START_HOUR,
3+
START_MINUTE,
4+
DEADLINE_HOUR,
5+
DEADLINE_MINUTE,
6+
} from '../constants/blind-match-time';
7+
8+
/**
9+
* 시간 포맷팅 유틸리티 함수
10+
* @param hour - 시간 (0-23)
11+
* @param minute - 분 (0-59)
12+
* @returns 포맷된 시간 문자열 (HH:MM)
13+
*/
14+
export const formatTime = (hour: number, minute: number): string => {
15+
return `${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}`;
16+
};
17+
18+
/**
19+
* 신청 가능 시간 문자열
20+
*/
21+
export const APPLICATION_TIME_RANGE = `[신청 가능 시간: ${formatTime(START_HOUR, START_MINUTE)} ~ ${formatTime(DEADLINE_HOUR, DEADLINE_MINUTE)}]`;

src/pages/ticket-complete/ticket-complete.css.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@ export const title = style({
66
padding: '1.3rem 2.4rem 1rem 2.4rem',
77
});
88

9+
export const carouselWrapper = style({
10+
padding: '0 2.4rem',
11+
});
12+
913
export const container = style({
1014
display: 'flex',
15+
paddingTop: '2.3rem',
1116
flexDirection: 'column',
1217
alignItems: 'center',
1318
justifyContent: 'center',
1419
gap: '3.3rem',
15-
position: 'absolute',
16-
top: 'calc(1rem)',
17-
bottom: '0',
18-
left: '0',
19-
right: '0',
2020
});
2121

2222
export const complete = style({

src/pages/ticket-complete/ticket-complete.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
import TicketCarousel from '@pages/ticket/components/carousel/carousel';
2+
import { useDateSelection } from '@pages/ticket/hooks/use-date-selection';
3+
14
import Header from '@shared/components/header/header';
25
import Title from '@shared/components/title/title';
36

47
import * as styles from './ticket-complete.css';
58

69
const Complete = () => {
10+
const { selectedDayNumber } = useDateSelection();
711
return (
812
<>
913
<Header
@@ -17,6 +21,9 @@ const Complete = () => {
1721
subTitle="상품 당첨의 기회를 잡아보세요!"
1822
/>
1923
</div>
24+
<div className={styles.carouselWrapper}>
25+
<TicketCarousel selectedDayNumber={selectedDayNumber} />
26+
</div>
2027
<div className={styles.container}>
2128
<p className={styles.complete}>Lv.3까지 모두 응모 완료하였습니다.</p>
2229
<div className={styles.data}>

0 commit comments

Comments
 (0)