Партия: убрать дублирующий тост о чужом завершении
Тот, кто был в форме завершения, но не нажимал «Завершить», получал сразу два сообщения об одном событии: штатное уведомление сайта сверху (NotificationToaster по match_finished) и технический тост снизу. Нижний убран — сверху сказано то же самое, и там на него можно нажать, чтобы перейти к партии. Вместе с тостом ушли refs, которые обслуживали только его. #38 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BoiJK9ux8peeyjLb8TYjFf
This commit is contained in:
@@ -63,8 +63,6 @@ export function MatchDetailPage() {
|
|||||||
const draftPayload = useRef<MatchFinishDraftData | null>(null);
|
const draftPayload = useRef<MatchFinishDraftData | null>(null);
|
||||||
const lastLocalEdit = useRef(0);
|
const lastLocalEdit = useRef(0);
|
||||||
const appliedDraftAt = useRef<string | null>(null);
|
const appliedDraftAt = useRef<string | null>(null);
|
||||||
const iFinished = useRef(false);
|
|
||||||
const prevStatus = useRef<string | null>(null);
|
|
||||||
|
|
||||||
const sendDraft = () => {
|
const sendDraft = () => {
|
||||||
draftTimer.current = null;
|
draftTimer.current = null;
|
||||||
@@ -101,15 +99,6 @@ export function MatchDetailPage() {
|
|||||||
appliedDraftAt.current = incoming.updated_at;
|
appliedDraftAt.current = incoming.updated_at;
|
||||||
}, [incoming, match?.status, me?.id]);
|
}, [incoming, match?.status, me?.id]);
|
||||||
|
|
||||||
// Партию завершил кто-то другой — форма исчезает, и без этого молча.
|
|
||||||
useEffect(() => {
|
|
||||||
if (!match) return;
|
|
||||||
if (prevStatus.current === "in_progress" && match.status === "finished" && !iFinished.current) {
|
|
||||||
toast.show("Партию завершил другой участник — показаны его результаты");
|
|
||||||
}
|
|
||||||
prevStatus.current = match.status;
|
|
||||||
}, [match, toast]);
|
|
||||||
|
|
||||||
if (isLoading) return <Spinner />;
|
if (isLoading) return <Spinner />;
|
||||||
if (!match) return <div className="muted">Партия не найдена.</div>;
|
if (!match) return <div className="muted">Партия не найдена.</div>;
|
||||||
|
|
||||||
@@ -146,7 +135,6 @@ export function MatchDetailPage() {
|
|||||||
clearTimeout(draftTimer.current);
|
clearTimeout(draftTimer.current);
|
||||||
sendDraft();
|
sendDraft();
|
||||||
}
|
}
|
||||||
iFinished.current = true;
|
|
||||||
const commentOf = (uid: number) => (finishComments[uid] ?? "").trim() || null;
|
const commentOf = (uid: number) => (finishComments[uid] ?? "").trim() || null;
|
||||||
let place = 1;
|
let place = 1;
|
||||||
const survivors = finishBlocks.flatMap((ids) => {
|
const survivors = finishBlocks.flatMap((ids) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user