fix: close competition cutover integrity gaps

This commit is contained in:
dahyeon committed 2026-07-12 21:22:22 +00:00
1 parent 7ea2002975
commit 683d602d63
57 files changed
+4805 -1582

No files matched your search

+20 -12
View File
@@ -1,5 +1,10 @@
import { useMemo, useState } from 'react';
import { useQueryClient } from '@tanstack/react-query';
import type {
MatchDetailResponse,
MatchGameMode,
MatchScheduleItemView,
} from '@lolympus/contracts';
import { Link, useParams } from 'react-router';
import {
useCreateMatch,
@@ -8,12 +13,7 @@ import {
useMe,
useUpdateMatch,
} from '../../api/hooks';
import type {
ApiMatch,
ApiMatchScheduleItem,
MatchGameMode,
MatchMutationRequest,
} from '../../api/types';
import type { MatchMutationRequest } from '../../api/types';
import { DEFAULT_COMMUNITY_ID } from '../../config';
const DEFAULT_FORM: MatchMutationRequest = {
@@ -92,7 +92,7 @@ function parseLines(value: string) {
.filter(Boolean);
}
function parseSchedule(value: string): ApiMatchScheduleItem[] {
function parseSchedule(value: string): MatchScheduleItemView[] {
return parseLines(value).map((line) => {
const [time, ...labelParts] = line.split('|').map((part) => part.trim());
return {
@@ -102,11 +102,11 @@ function parseSchedule(value: string): ApiMatchScheduleItem[] {
});
}
function scheduleToText(schedule: ApiMatchScheduleItem[] = []) {
function scheduleToText(schedule: MatchScheduleItemView[] = []) {
return schedule.map((item) => `${item.time}|${item.label}`).join('\n');
}
function makeForm(match?: ApiMatch): MatchMutationRequest & {
function makeForm(match?: MatchDetailResponse): MatchMutationRequest & {
prizesText: string;
noticesText: string;
scheduleText: string;
@@ -149,7 +149,7 @@ export default function MatchAdminPage() {
const createMutation = useCreateMatch(communityId);
const updateMutation = useUpdateMatch(communityId);
const deleteMutation = useDeleteMatch(communityId);
const [editing, setEditing] = useState<ApiMatch | null>(null);
const [editing, setEditing] = useState<MatchDetailResponse | null>(null);
const [showForm, setShowForm] = useState(false);
const [form, setForm] = useState(makeForm());
const [message, setMessage] = useState<string | null>(null);
@@ -181,7 +181,7 @@ export default function MatchAdminPage() {
setMessage(null);
}
function openEdit(match: ApiMatch) {
function openEdit(match: MatchDetailResponse) {
setEditing(match);
setForm(makeForm(match));
setShowForm(true);
@@ -550,7 +550,15 @@ export default function MatchAdminPage() {
<button
type="button"
className="text-xs px-2 py-1 border border-red-500/20 text-red-400 hover:bg-red-500/10"
disabled={deleteMutation.isPending}
disabled={
deleteMutation.isPending ||
match.status !== 'recruiting'
}
title={
match.status === 'recruiting'
? '내전 삭제'
: '팀 구성이 확정된 내전 기록은 삭제할 수 없습니다.'
}
onClick={() => {
if (!window.confirm('이 내전을 삭제할까요?')) return;
deleteMutation.mutate(match._id, {