Skip to content

Commit 7d77df6

Browse files
committed
Fix
1 parent a9efc70 commit 7d77df6

3 files changed

Lines changed: 26 additions & 223 deletions

File tree

apps/codebattle/assets/js/widgets/pages/game/ThreejsGamePage.jsx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,16 @@ function Pane({
486486
);
487487
}
488488

489-
function EditorBody({ player, fontSize, onMount, isWinner, theme = "vs-dark", showCup = true }) {
489+
function EditorBody({
490+
player,
491+
fontSize,
492+
onMount,
493+
isWinner,
494+
theme = "vs-dark",
495+
showCup = true,
496+
cupX = null,
497+
cupY = null,
498+
}) {
490499
const language = languages[getPlayerLang(player)] || "javascript";
491500
const text = getPlayerText(player) || "";
492501
return (
@@ -507,8 +516,8 @@ function EditorBody({ player, fontSize, onMount, isWinner, theme = "vs-dark", sh
507516
title="Winner"
508517
style={{
509518
position: "absolute",
510-
bottom: "20px",
511-
left: "24px",
519+
...(cupY != null ? { top: `${cupY}px`, bottom: "auto" } : { bottom: "20px" }),
520+
left: cupX != null ? `${cupX}px` : "24px",
512521
height: "160px",
513522
width: "auto",
514523
filter: `drop-shadow(0 0 28px ${brand.gold}) drop-shadow(0 0 48px rgba(224,191,122,0.55))`,
@@ -523,7 +532,7 @@ function EditorBody({ player, fontSize, onMount, isWinner, theme = "vs-dark", sh
523532
);
524533
}
525534

526-
function TestsBody({ tests, isWinner, kiosk = false, showCup = true }) {
535+
function TestsBody({ tests, isWinner, kiosk = false, showCup = true, fontSize = null }) {
527536
const status = tests?.status || "initial";
528537
// Before a check runs the default payload is 0/1; show a 0/100 placeholder instead.
529538
const hasRun = status !== "initial";
@@ -608,7 +617,7 @@ function TestsBody({ tests, isWinner, kiosk = false, showCup = true }) {
608617
fontFamily: "'Inter', 'Helvetica Neue', Arial, sans-serif",
609618
fontStyle: "italic",
610619
fontWeight: 900,
611-
fontSize: kiosk ? "min(14vw, 70vh)" : "28px",
620+
fontSize: kiosk ? (fontSize ? `${fontSize}px` : "min(14vw, 70vh)") : "28px",
612621
lineHeight: 1,
613622
letterSpacing: "-0.02em",
614623
paddingRight: kiosk ? "min(3vw, 4vh)" : "16px",
@@ -618,7 +627,7 @@ function TestsBody({ tests, isWinner, kiosk = false, showCup = true }) {
618627
{`${displayPercent}/100`}
619628
</div>
620629
</div>
621-
{(isError || isFailure) && (errorText || failedAssert) && (
630+
{!kiosk && (isError || isFailure) && (errorText || failedAssert) && (
622631
<pre
623632
style={{
624633
margin: 0,
@@ -638,7 +647,7 @@ function TestsBody({ tests, isWinner, kiosk = false, showCup = true }) {
638647
{isError
639648
? errorText || "Unknown error"
640649
: failedAssert
641-
? `Expected: ${JSON.stringify(failedAssert.expected)}\nGot: ${JSON.stringify(failedAssert.result ?? failedAssert.actual)}\nArgs: ${JSON.stringify(failedAssert.arguments)}${failedAssert.output ? `\n\n${failedAssert.output}` : ""}`
650+
? failedAssert.output || ""
642651
: errorText}
643652
</pre>
644653
)}
@@ -1521,6 +1530,8 @@ function ThreejsGamePage({ gameId: gameIdProp, initialGame: initialGameProp, str
15211530
isWinner={leftPlayer?.result === "won"}
15221531
theme={monacoTheme}
15231532
showCup={!hideCup}
1533+
cupX={streamParams?.cupX}
1534+
cupY={streamParams?.cupY}
15241535
/>
15251536
);
15261537
} else if (kioskWidget === "rightEditor" && rightPlayer) {
@@ -1532,6 +1543,8 @@ function ThreejsGamePage({ gameId: gameIdProp, initialGame: initialGameProp, str
15321543
isWinner={rightPlayer?.result === "won"}
15331544
theme={monacoTheme}
15341545
showCup={!hideCup}
1546+
cupX={streamParams?.cupX}
1547+
cupY={streamParams?.cupY}
15351548
/>
15361549
);
15371550
} else if (kioskWidget === "leftTests" && leftPlayer) {
@@ -1540,6 +1553,7 @@ function ThreejsGamePage({ gameId: gameIdProp, initialGame: initialGameProp, str
15401553
tests={battleState.tests[getPlayerId(leftPlayer)]}
15411554
isWinner={leftPlayer?.result === "won"}
15421555
kiosk
1556+
fontSize={streamParams?.fontSize || null}
15431557
showCup={!hideCup}
15441558
/>
15451559
);
@@ -1549,6 +1563,7 @@ function ThreejsGamePage({ gameId: gameIdProp, initialGame: initialGameProp, str
15491563
tests={battleState.tests[getPlayerId(rightPlayer)]}
15501564
isWinner={rightPlayer?.result === "won"}
15511565
kiosk
1566+
fontSize={streamParams?.fontSize || null}
15521567
showCup={!hideCup}
15531568
/>
15541569
);

apps/codebattle/assets/js/widgets/pages/game/TournamentThreejsStreamPage.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ function parseStreamParams(search) {
2525
const widgetRaw = (p.get("widget") || "").trim();
2626
const themeRaw = (p.get("editor_theme") || p.get("theme") || "").trim();
2727
const fontRaw = parseInt(p.get("font_size") || p.get("fontSize") || "", 10);
28+
const cupXRaw = parseInt(p.get("cup_x") || p.get("cupX") || "", 10);
29+
const cupYRaw = parseInt(p.get("cup_y") || p.get("cupY") || "", 10);
2830

2931
return {
3032
fullscreen: TRUTHY.has((p.get("fullscreen") || "").toLowerCase()),
@@ -33,6 +35,8 @@ function parseStreamParams(search) {
3335
fontSize: Number.isFinite(fontRaw) && fontRaw >= 8 && fontRaw <= 200 ? fontRaw : null,
3436
editorTheme: ALLOWED_THEMES.has(themeRaw) ? themeRaw : null,
3537
hideCup: TRUTHY.has((p.get("hide_cup") || "").toLowerCase()),
38+
cupX: Number.isFinite(cupXRaw) ? cupXRaw : null,
39+
cupY: Number.isFinite(cupYRaw) ? cupYRaw : null,
3640
};
3741
}
3842

apps/codebattle/lib/codebattle/tournament/simulator/names.ex

Lines changed: 0 additions & 216 deletions
This file was deleted.

0 commit comments

Comments
 (0)