-
-
-
- {marks.rest > 0 &&
+{marks.rest}
}
+
+
+
= scoreB ? 'lead' : ''}`}>
+
{teamA}
+
+ {scoreA}
+
+
+
= scoreA ? 'lead' : ''}`}>
+
{teamB}
+
+ {scoreB}
+
+
+
+
)
}
-function SnakeRow({ label, count }: { label: string; count: number }) {
- if (count === 0) return null
+function SvgMarkRow({
+ count,
+ y,
+ side,
+ kind,
+}: {
+ count: number
+ y: number
+ side: 'left' | 'right'
+ kind: 'bar' | 'fifty'
+}) {
+ if (count <= 0) return null
+
+ const gap = kind === 'fifty' ? 14 : 9
+ const first = side === 'left' ? 151 : 169
+
return (
-
- {label}
- {'丨'.repeat(count)}
-
+
+ {Array.from({ length: count }, (_, i) => {
+ const x = side === 'left' ? first - i * gap : first + i * gap
+ if (x < 58 || x > 262) return null
+
+ const seed = i * 17 + (side === 'left' ? 3 : 11)
+ const rot = ((seed % 5) - 2) * 1.15
+
+ if (kind === 'fifty') {
+ return (
+
+
+
+
+ )
+ }
+
+ if ((i + 1) % 5 === 0) {
+ const span = gap * 3.3
+ return (
+
+ )
+ }
+
+ return (
+
+ )
+ })}
+
)
}
@@ -274,20 +406,20 @@ function RoundScreen({
const [team, setTeam] = useState
('a')
const [cardPoints, setCardPoints] = useState('')
const [matsch, setMatsch] = useState(false)
- const [weisA, setWeisA] = useState('')
- const [weisB, setWeisB] = useState('')
+ const [weisA, setWeisA] = useState(0)
+ const [weisB, setWeisB] = useState(0)
const parsedCards = cardPoints === '' ? 0 : Number(cardPoints)
- const parsedWeisA = weisA === '' ? 0 : Number(weisA)
- const parsedWeisB = weisB === '' ? 0 : Number(weisB)
+ const effectiveWeisA = matsch && team !== 'a' ? 0 : weisA
+ const effectiveWeisB = matsch && team !== 'b' ? 0 : weisB
const preview = computeRound({
id: 'preview',
team,
cardPoints: parsedCards,
matsch,
- weisA: parsedWeisA,
- weisB: parsedWeisB,
+ weisA: effectiveWeisA,
+ weisB: effectiveWeisB,
})
const cardsValid =
@@ -298,7 +430,13 @@ function RoundScreen({
Number.isInteger(parsedCards))
const teamName = team === 'a' ? game.teamA : game.teamB
- const loserWeisDisabled = (side: TeamId) => matsch && team !== side
+ const weisBlocked = (side: TeamId) => matsch && team !== side
+
+ const addWeis = (side: TeamId, points: number) => {
+ if (weisBlocked(side)) return
+ if (side === 'a') setWeisA((v) => v + points)
+ else setWeisB((v) => v + points)
+ }
return (
@@ -319,23 +457,15 @@ function RoundScreen({
team,
cardPoints: matsch ? 0 : parsedCards,
matsch,
- weisA: loserWeisDisabled('a')
- ? 0
- : Number.isFinite(parsedWeisA)
- ? Math.max(0, Math.round(parsedWeisA))
- : 0,
- weisB: loserWeisDisabled('b')
- ? 0
- : Number.isFinite(parsedWeisB)
- ? Math.max(0, Math.round(parsedWeisB))
- : 0,
+ weisA: effectiveWeisA,
+ weisB: effectiveWeisB,
})
}}
>
Neue Runde