This commit is contained in:
dahyeon committed 2026-04-27 19:48:42 -07:00
1 parent b38cc03a71
commit 1fd37f992b
6 files changed
+184 -17

No files matched your search

+44 -16
View File
@@ -6,6 +6,7 @@ import {
useDeleteMatch,
useLegacyMatches,
useMe,
useRebuildLegacyMatches,
} from '../../api/hooks';
import type { LegacyMatchListItem } from '../../api/types';
import { DEFAULT_COMMUNITY_ID } from '../../config';
@@ -41,6 +42,7 @@ export default function LegacyMatchesPage() {
const matchesQuery = useLegacyMatches(communityId, canManage);
const deleteMutation = useDeleteMatch(communityId);
const bulkDeleteMutation = useBulkDeleteLegacyMatches(communityId);
const rebuildMutation = useRebuildLegacyMatches(communityId);
const matches = matchesQuery.data?.pages.flatMap((page) => page.matches) ?? [];
const selectedIds = useMemo(
() => Object.entries(selected).filter(([, value]) => value).map(([id]) => id),
@@ -57,6 +59,9 @@ export default function LegacyMatchesPage() {
queryClient.invalidateQueries({
queryKey: ['community-internal-stats-leaderboard', communityId],
}),
queryClient.invalidateQueries({
queryKey: ['community-internal-stats-team-insights', communityId],
}),
]);
}
@@ -104,24 +109,47 @@ export default function LegacyMatchesPage() {
백필로 들어온 매치를 확인하고 외부 토너먼트 기록을 삭제할 수 있습니다.
</p>
</div>
<button
type="button"
className="btn btn-ghost btn-sm px-4 text-xs text-red-400"
disabled={selectedIds.length === 0 || bulkDeleteMutation.isPending}
onClick={() => {
if (!window.confirm(`${selectedIds.length}개 매치를 삭제할까요?`)) return;
bulkDeleteMutation.mutate(selectedIds, {
onSuccess: async () => {
setSelected({});
await invalidate();
},
});
}}
>
선택 삭제 ({selectedIds.length})
</button>
<div className="flex flex-wrap gap-2">
<button
type="button"
className="btn btn-primary btn-sm px-4 text-xs"
disabled={rebuildMutation.isPending}
onClick={() => {
if (!window.confirm('현재 가입자 기준으로 과거 매치를 재구성할까요?')) {
return;
}
rebuildMutation.mutate(undefined, { onSuccess: invalidate });
}}
>
{rebuildMutation.isPending ? '재구성 중...' : '과거 데이터 재구성'}
</button>
<button
type="button"
className="btn btn-ghost btn-sm px-4 text-xs text-red-400"
disabled={selectedIds.length === 0 || bulkDeleteMutation.isPending}
onClick={() => {
if (!window.confirm(`${selectedIds.length}개 매치를 삭제할까요?`)) return;
bulkDeleteMutation.mutate(selectedIds, {
onSuccess: async () => {
setSelected({});
await invalidate();
},
});
}}
>
선택 삭제 ({selectedIds.length})
</button>
</div>
</div>
{rebuildMutation.data && (
<div className="mb-4 border border-primary/20 bg-primary/5 px-3 py-2 text-xs text-base-content/55">
재구성 완료: {rebuildMutation.data.scanned}개 확인 ·{' '}
{rebuildMutation.data.rebuilt}개 갱신 · 제목 정리{' '}
{rebuildMutation.data.normalizedTitles}개
</div>
)}
<section className="border border-base-content/10 bg-base-100 overflow-hidden">
<div className="overflow-x-auto">
<table className="w-full min-w-[900px] text-left">