feat: refresh the home page and separate match event types
Add an inhouse hero, Hall of Fame, rankings, and event-specific schedules. Carry the event type through the API and admin tools, and improve results and player history displays.
This commit is contained in:
1 parent
7e0cd7cb19
commit
664af15255
58 files changed
+2316
-593
No files matched your search
@@ -17,6 +17,11 @@ export const HOME_MATCH_STATUS = {
|
||||
finished: '종료',
|
||||
} as const;
|
||||
|
||||
type HomeMatchEnrollment = Pick<
|
||||
MatchDetailResponse,
|
||||
'status' | 'joined' | 'participants' | 'maxParticipants'
|
||||
>;
|
||||
|
||||
export function getHomeMatchSchedule(scheduledAt: string) {
|
||||
const value = new Date(scheduledAt);
|
||||
if (Number.isNaN(value.getTime())) return;
|
||||
@@ -61,12 +66,7 @@ export function getHistoryMatchTitle(
|
||||
: title;
|
||||
}
|
||||
|
||||
export function getHomeMatchEnrollment(
|
||||
match: Pick<
|
||||
MatchDetailResponse,
|
||||
'status' | 'joined' | 'participants' | 'maxParticipants'
|
||||
>,
|
||||
) {
|
||||
export function getHomeMatchEnrollment(match: HomeMatchEnrollment) {
|
||||
const current = match.participants.length;
|
||||
const remaining = match.maxParticipants - current;
|
||||
const isRecruiting = match.status === 'recruiting';
|
||||
@@ -84,3 +84,20 @@ export function getHomeMatchEnrollment(
|
||||
|
||||
return { canApply, capacity, label };
|
||||
}
|
||||
|
||||
export function getNextMatchBanner(
|
||||
match: HomeMatchEnrollment & Pick<MatchDetailResponse, 'title'>,
|
||||
) {
|
||||
const { canApply, capacity } = getHomeMatchEnrollment(match);
|
||||
const regularTitle = /^(?:[월화수목금토일]요일\s*(?:정기\s*)?|정기\s*)내전$/u;
|
||||
const title = regularTitle.test(match.title.trim()) ? '정기 내전' : match.title;
|
||||
|
||||
let status: string = HOME_MATCH_STATUS[match.status];
|
||||
if (match.status === 'team-built') status = '팀 편성';
|
||||
if (match.status === 'recruiting') {
|
||||
if (match.joined) status = '신청 완료';
|
||||
else if (!canApply) status = match.maxParticipants > 0 ? '정원 마감' : '모집 마감';
|
||||
}
|
||||
|
||||
return { title, status, capacity, canApply };
|
||||
}
|
||||
Reference in new issue
Block a user