diff --git a/src/App.tsx b/src/App.tsx index 9f219ab..414569c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -89,6 +89,7 @@ type VoiceAnnouncement = { opponentScore: number serverName: string serverCourt: 'left' | 'right' + matchPoint: boolean winnerTeamName: string | null } @@ -773,13 +774,18 @@ function App() { : getTeamDisplayName(rightTeam) : null - // 得分方接著發球,報分以發球方分數為先;左側隊伍的發球區需鏡像對應畫面。 + // 得分方接著發球,報分以發球方分數為先;發球區一律用實際球場左右,不做鏡像。 const servingScore = side === 'left' ? nextScoreState.scoreLeft : nextScoreState.scoreRight const opponentScore = side === 'left' ? nextScoreState.scoreRight : nextScoreState.scoreLeft - const serverCourt = - side === 'left' - ? getMirroredCourt(getServiceCourt(servingScore)) - : getServiceCourt(servingScore) + const serverCourt = getServiceCourt(servingScore) + // 只有發球方(剛得分那隊)再得 1 分就能贏,才算賽末點。 + const matchPoint = + !reachedTarget && + hasWonGame( + side === 'left' + ? { ...nextScoreState, scoreLeft: nextScoreState.scoreLeft + 1 } + : { ...nextScoreState, scoreRight: nextScoreState.scoreRight + 1 }, + ) setScoreHistory((current) => [...current, { pointLog, scoreState }]) setPointLog(nextPointLog) @@ -790,6 +796,7 @@ function App() { opponentScore, serverName: getNextServerName(nextScoreState, leftTeam, rightTeam, side), serverCourt, + matchPoint, winnerTeamName, }) diff --git a/src/pages/ScoreboardPage.tsx b/src/pages/ScoreboardPage.tsx index 54da9ba..3edf716 100644 --- a/src/pages/ScoreboardPage.tsx +++ b/src/pages/ScoreboardPage.tsx @@ -3,7 +3,6 @@ import { useEffect, useMemo, useRef, useState } from 'react' import { Link } from 'react-router-dom' import { getCourtAssignments, - getMirroredCourt, getReceivingPlayer, getServiceCourt, getServingPlayer, @@ -64,6 +63,7 @@ type ScoreboardPageProps = { opponentScore: number serverName: string serverCourt: 'left' | 'right' + matchPoint: boolean winnerTeamName: string | null } | null targetDate: string @@ -260,7 +260,11 @@ export function ScoreboardPage({ const parts: string[] = [] if (voiceSettings.announceScore) { - parts.push(`${voiceAnnouncement.servingScore}比${voiceAnnouncement.opponentScore}`) + parts.push( + `${voiceAnnouncement.servingScore}比${voiceAnnouncement.opponentScore}${ + voiceAnnouncement.matchPoint ? ' 賽末點' : '' + }`, + ) } if (voiceSettings.announceServer && voiceAnnouncement.serverName) { @@ -484,11 +488,7 @@ export function ScoreboardPage({ onSwapPlayers={() => onSwapTeamPlayers('left')} onSwapTeams={onSwapMatchup} score={scoreState.scoreLeft} - serviceCourt={ - scoreState.serving === 'left' && servingCourt - ? getMirroredCourt(servingCourt) - : null - } + serviceCourt={scoreState.serving === 'left' ? servingCourt : null} showServingPrompt={scoreState.serving === null} team={leftTeam} teamSlot="top"