more complete
This commit is contained in:
331
frontend.css
331
frontend.css
@@ -19,7 +19,7 @@ body {
|
||||
font-family: 'Inter', -apple-system, sans-serif;
|
||||
font-size: 15px;
|
||||
line-height: 1.5;
|
||||
min-height: 100vh;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
@@ -70,12 +70,12 @@ body {
|
||||
|
||||
.main {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 48px 64px;
|
||||
overflow: hidden;
|
||||
padding: 32px 64px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
/* ── Sidebar ──────────────────────────────────────────────────── */
|
||||
@@ -86,33 +86,53 @@ body {
|
||||
background: var(--surface);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow-y: auto;
|
||||
overflow: hidden;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.sidebar__section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.sidebar__section--history {
|
||||
flex: 1;
|
||||
border-top: 1px solid var(--border);
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.sidebar__header {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 1px;
|
||||
text-transform: uppercase;
|
||||
padding: 32px 32px 16px;
|
||||
padding: 24px 32px 16px;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.sidebar__list {
|
||||
flex: 1;
|
||||
padding: 0 16px 32px;
|
||||
padding: 0 16px 16px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.sidebar__history-list {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 0 16px 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.standing {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 16px;
|
||||
padding: 12px 16px;
|
||||
border-radius: 8px;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
@@ -162,7 +182,7 @@ body {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-top: 8px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.standing__bar {
|
||||
@@ -189,7 +209,7 @@ body {
|
||||
}
|
||||
|
||||
.sidebar__legend {
|
||||
padding: 24px 32px;
|
||||
padding: 16px 32px;
|
||||
border-top: 1px solid var(--border);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -199,23 +219,85 @@ body {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* ── Past Rounds Mini ─────────────────────────────────────────── */
|
||||
|
||||
.past-round-mini {
|
||||
background: var(--surface-2);
|
||||
border: 1px solid var(--border);
|
||||
padding: 12px;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.past-round-mini__top {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.past-round-mini__num {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: var(--text-muted);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.past-round-mini__prompt {
|
||||
font-family: 'Inter', sans-serif;
|
||||
font-size: 13px;
|
||||
color: var(--text);
|
||||
line-height: 1.4;
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.past-round-mini__winner {
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding-left: 28px;
|
||||
}
|
||||
|
||||
.small-model-name {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.small-model-name .model-logo {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
.past-round-mini__tie {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-weight: 700;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* ── Arena ─────────────────────────────────────────────────────── */
|
||||
|
||||
.arena {
|
||||
width: 100%;
|
||||
max-width: 1100px;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.arena__header-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: baseline;
|
||||
margin-bottom: 48px;
|
||||
padding-bottom: 24px;
|
||||
margin-bottom: 32px;
|
||||
padding-bottom: 16px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.arena__round-badge {
|
||||
@@ -241,14 +323,15 @@ body {
|
||||
/* ── Prompt Card ──────────────────────────────────────────────── */
|
||||
|
||||
.prompt-card {
|
||||
margin-bottom: 64px;
|
||||
margin-bottom: 48px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.prompt-card__by {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
margin-bottom: 24px;
|
||||
margin-bottom: 16px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
display: flex;
|
||||
@@ -258,7 +341,7 @@ body {
|
||||
|
||||
.prompt-card__text {
|
||||
font-family: 'DM Serif Display', serif;
|
||||
font-size: 56px;
|
||||
font-size: 48px;
|
||||
line-height: 1.1;
|
||||
color: var(--text);
|
||||
max-width: 95%;
|
||||
@@ -275,7 +358,9 @@ body {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 48px;
|
||||
margin-bottom: 64px;
|
||||
margin-bottom: 32px;
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.contestant {
|
||||
@@ -285,15 +370,17 @@ body {
|
||||
position: relative;
|
||||
border-top: 4px solid var(--border);
|
||||
padding-top: 24px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.contestant__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 32px;
|
||||
padding-bottom: 24px;
|
||||
margin-bottom: 24px;
|
||||
padding-bottom: 16px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.contestant__name {
|
||||
@@ -318,12 +405,13 @@ body {
|
||||
|
||||
.contestant__answer {
|
||||
flex: 1;
|
||||
min-height: 180px;
|
||||
overflow-y: auto;
|
||||
min-height: 120px;
|
||||
}
|
||||
|
||||
.contestant__text {
|
||||
font-family: 'DM Serif Display', serif;
|
||||
font-size: 36px;
|
||||
font-size: 28px;
|
||||
line-height: 1.3;
|
||||
color: var(--text-dim);
|
||||
letter-spacing: -0.5px;
|
||||
@@ -336,7 +424,7 @@ body {
|
||||
.contestant__thinking {
|
||||
color: var(--text-muted);
|
||||
font-family: 'DM Serif Display', serif;
|
||||
font-size: 36px;
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
.contestant__error {
|
||||
@@ -345,11 +433,15 @@ body {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.contestant__votes {
|
||||
margin-top: 48px;
|
||||
}
|
||||
/* ── Votes within Contestant ──────────────────────────────────── */
|
||||
|
||||
/* ── Vote Bar ─────────────────────────────────────────────────── */
|
||||
.contestant__votes-container {
|
||||
margin-top: 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.vote-bar {
|
||||
height: 2px;
|
||||
@@ -365,7 +457,7 @@ body {
|
||||
.vote-bar__label {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 16px;
|
||||
margin-top: 12px;
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 13px;
|
||||
color: var(--text-dim);
|
||||
@@ -377,73 +469,44 @@ body {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
/* ── Vote Ticker ──────────────────────────────────────────────── */
|
||||
|
||||
.vote-ticker {
|
||||
border-top: 1px solid var(--border);
|
||||
padding-top: 48px;
|
||||
margin-bottom: 64px;
|
||||
}
|
||||
|
||||
.vote-ticker__header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.vote-ticker__title {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 1px;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
.vote-ticker__status {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 13px;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.vote-ticker__list {
|
||||
.contestant__voters {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.vote-entry {
|
||||
display: flex;
|
||||
.voter-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
font-family: 'Inter', sans-serif;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
padding: 12px 16px;
|
||||
border-radius: 8px;
|
||||
gap: 6px;
|
||||
background: var(--surface-2);
|
||||
border: 1px solid var(--border);
|
||||
background: var(--surface);
|
||||
padding: 6px 10px;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
font-family: 'Inter', sans-serif;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.vote-entry--pending {
|
||||
.voter-badge--pending {
|
||||
opacity: 0.5;
|
||||
border-style: dashed;
|
||||
}
|
||||
|
||||
.vote-entry__arrow {
|
||||
.voter-badge--error {
|
||||
opacity: 0.5;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.vote-entry__pending {
|
||||
color: var(--text-muted);
|
||||
font-style: italic;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.vote-entry__error {
|
||||
color: var(--text-muted);
|
||||
font-style: italic;
|
||||
font-size: 13px;
|
||||
.pending-votes {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
margin-top: 16px;
|
||||
padding-top: 16px;
|
||||
border-top: 1px solid var(--border);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* ── Round Result (Tie) ───────────────────────────────────────── */
|
||||
@@ -454,10 +517,12 @@ body {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 2px;
|
||||
padding: 32px;
|
||||
padding: 24px;
|
||||
color: var(--text-dim);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
margin-top: 24px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* ── Waiting State ────────────────────────────────────────────── */
|
||||
@@ -473,102 +538,6 @@ body {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* ── History ──────────────────────────────────────────────────── */
|
||||
|
||||
.history {
|
||||
width: 100%;
|
||||
max-width: 1100px;
|
||||
margin: 80px auto 0;
|
||||
}
|
||||
|
||||
.history__title {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 1px;
|
||||
color: var(--text-dim);
|
||||
margin-bottom: 32px;
|
||||
padding-bottom: 24px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.past-round {
|
||||
padding: 32px 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.past-round__header {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.past-round__num {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-size: 14px;
|
||||
color: var(--text-muted);
|
||||
width: 32px;
|
||||
}
|
||||
|
||||
.past-round__prompt {
|
||||
font-family: 'Inter', sans-serif;
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: var(--text);
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.past-round__detail {
|
||||
padding-left: 56px;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 48px;
|
||||
}
|
||||
|
||||
.past-round__competitor {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.past-round__competitor-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.past-round__answer {
|
||||
font-family: 'DM Serif Display', serif;
|
||||
font-size: 20px;
|
||||
color: var(--text-dim);
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.past-round__competitor--winner .past-round__answer {
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.past-round__score {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-weight: 700;
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.past-round__winner-tag {
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
font-weight: 700;
|
||||
font-size: 10px;
|
||||
padding: 2px 6px;
|
||||
background: var(--text);
|
||||
color: var(--bg);
|
||||
border-radius: 4px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
/* ── Game Over ────────────────────────────────────────────────── */
|
||||
|
||||
.game-over {
|
||||
@@ -663,10 +632,6 @@ body {
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.model-logo.invert-dark {
|
||||
/* Some logos might need this if they are dark naturally, but SVG styling handles it or we'll assume they're visible. */
|
||||
}
|
||||
|
||||
.timer {
|
||||
color: var(--text-muted);
|
||||
font-family: 'JetBrains Mono', monospace;
|
||||
@@ -700,7 +665,7 @@ body {
|
||||
border-left: none;
|
||||
border-top: 1px solid var(--border);
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
.showdown { grid-template-columns: 1fr; gap: 48px; }
|
||||
.past-round__detail { grid-template-columns: 1fr; }
|
||||
.showdown { grid-template-columns: 1fr; gap: 32px; }
|
||||
}
|
||||
208
frontend.tsx
208
frontend.tsx
@@ -112,12 +112,14 @@ function ContestantPanel({
|
||||
totalVotes,
|
||||
isWinner,
|
||||
showVotes,
|
||||
voters,
|
||||
}: {
|
||||
task: TaskInfo;
|
||||
voteCount: number;
|
||||
totalVotes: number;
|
||||
isWinner: boolean;
|
||||
showVotes: boolean;
|
||||
voters: VoteInfo[];
|
||||
}) {
|
||||
const color = getColor(task.model.name);
|
||||
const pct = totalVotes > 0 ? Math.round((voteCount / totalVotes) * 100) : 0;
|
||||
@@ -144,13 +146,22 @@ function ContestantPanel({
|
||||
</div>
|
||||
|
||||
{showVotes && (
|
||||
<div className="contestant__votes">
|
||||
<div className="vote-bar">
|
||||
<div className="vote-bar__fill" style={{ width: `${pct}%`, background: color }} />
|
||||
<div className="contestant__votes-container">
|
||||
<div className="contestant__votes">
|
||||
<div className="vote-bar">
|
||||
<div className="vote-bar__fill" style={{ width: `${pct}%`, background: color }} />
|
||||
</div>
|
||||
<div className="vote-bar__label">
|
||||
<span className="vote-bar__count" style={{ color }}>{voteCount}</span>
|
||||
<span className="vote-bar__pct">{pct}%</span>
|
||||
</div>
|
||||
</div>
|
||||
<div className="vote-bar__label">
|
||||
<span className="vote-bar__count" style={{ color }}>{voteCount}</span>
|
||||
<span className="vote-bar__pct">{pct}%</span>
|
||||
<div className="contestant__voters">
|
||||
{voters.map((v, i) => (
|
||||
<div key={i} className="voter-badge">
|
||||
<ModelName model={v.voter} showLogo={true} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
@@ -158,37 +169,16 @@ function ContestantPanel({
|
||||
);
|
||||
}
|
||||
|
||||
function VoteTicker({ votes }: { votes: VoteInfo[] }) {
|
||||
const finishedVotes = votes.filter((v) => v.finishedAt);
|
||||
const pendingVotes = votes.filter((v) => !v.finishedAt);
|
||||
|
||||
function PendingVotes({ votes }: { votes: VoteInfo[] }) {
|
||||
if (votes.length === 0) return null;
|
||||
return (
|
||||
<div className="vote-ticker">
|
||||
<div className="vote-ticker__header">
|
||||
<span className="vote-ticker__title">JUDGES</span>
|
||||
<span className="vote-ticker__status">
|
||||
{finishedVotes.length} / {votes.length}
|
||||
</span>
|
||||
</div>
|
||||
<div className="vote-ticker__list">
|
||||
{finishedVotes.map((vote, i) => (
|
||||
<div key={`f-${i}`} className="vote-entry vote-entry--in">
|
||||
<ModelName model={vote.voter} showLogo={false} />
|
||||
<span className="vote-entry__arrow">→</span>
|
||||
{vote.error || !vote.votedFor ? (
|
||||
<span className="vote-entry__error">abstained</span>
|
||||
) : (
|
||||
<ModelName model={vote.votedFor} showLogo={false} />
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
{pendingVotes.map((vote, i) => (
|
||||
<div key={`p-${i}`} className="vote-entry vote-entry--pending">
|
||||
<ModelName model={vote.voter} showLogo={false} />
|
||||
<span className="vote-entry__pending">deliberating…</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="pending-votes">
|
||||
{votes.map((v, i) => (
|
||||
<div key={i} className={`voter-badge ${!v.finishedAt ? 'voter-badge--pending' : 'voter-badge--error'}`}>
|
||||
<ModelName model={v.voter} showLogo={true} />
|
||||
{!v.finishedAt ? " deliberating…" : " abstained"}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -206,6 +196,10 @@ function Arena({ round, total }: { round: RoundState; total: number }) {
|
||||
}
|
||||
const totalVotes = votesA + votesB;
|
||||
|
||||
const votersA = round.votes.filter(v => v.votedFor?.name === contA.name);
|
||||
const votersB = round.votes.filter(v => v.votedFor?.name === contB.name);
|
||||
const pendingOrAbstained = round.votes.filter(v => !v.finishedAt || v.error || !v.votedFor);
|
||||
|
||||
const phaseLabel =
|
||||
round.phase === "prompting"
|
||||
? "✍️ WRITING PROMPT"
|
||||
@@ -235,6 +229,7 @@ function Arena({ round, total }: { round: RoundState; total: number }) {
|
||||
totalVotes={totalVotes}
|
||||
isWinner={isDone && votesA > votesB}
|
||||
showVotes={showVotes}
|
||||
voters={votersA}
|
||||
/>
|
||||
<ContestantPanel
|
||||
task={round.answerTasks[1]}
|
||||
@@ -242,10 +237,11 @@ function Arena({ round, total }: { round: RoundState; total: number }) {
|
||||
totalVotes={totalVotes}
|
||||
isWinner={isDone && votesB > votesA}
|
||||
showVotes={showVotes}
|
||||
voters={votersB}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{showVotes && <VoteTicker votes={round.votes} />}
|
||||
{showVotes && <PendingVotes votes={pendingOrAbstained} />}
|
||||
|
||||
{isDone && votesA === votesB && (
|
||||
<div className="round-result">IT’S A TIE!</div>
|
||||
@@ -256,45 +252,23 @@ function Arena({ round, total }: { round: RoundState; total: number }) {
|
||||
);
|
||||
}
|
||||
|
||||
function PastRoundEntry({ round }: { round: RoundState }) {
|
||||
function PastRoundMini({ round }: { round: RoundState }) {
|
||||
const [contA, contB] = round.contestants;
|
||||
let votesA = 0,
|
||||
votesB = 0;
|
||||
let votesA = 0, votesB = 0;
|
||||
for (const v of round.votes) {
|
||||
if (v.votedFor?.name === contA.name) votesA++;
|
||||
else if (v.votedFor?.name === contB.name) votesB++;
|
||||
}
|
||||
|
||||
const isAWinner = votesA > votesB;
|
||||
const isBWinner = votesB > votesA;
|
||||
const winner = votesA > votesB ? contA : votesB > votesA ? contB : null;
|
||||
|
||||
return (
|
||||
<div className="past-round">
|
||||
<div className="past-round__header">
|
||||
<span className="past-round__num">R{round.num}</span>
|
||||
<span className="past-round__prompt">{round.prompt}</span>
|
||||
<div className="past-round-mini">
|
||||
<div className="past-round-mini__top">
|
||||
<span className="past-round-mini__num">R{round.num}</span>
|
||||
<span className="past-round-mini__prompt">"{round.prompt}"</span>
|
||||
</div>
|
||||
<div className="past-round__detail">
|
||||
<div className={`past-round__competitor ${isAWinner ? 'past-round__competitor--winner' : ''}`}>
|
||||
<div className="past-round__competitor-header">
|
||||
<ModelName model={contA} />
|
||||
<div style={{ display: 'flex', gap: '12px', alignItems: 'center' }}>
|
||||
<span className="past-round__score">{votesA}</span>
|
||||
{isAWinner && <span className="past-round__winner-tag">WINNER</span>}
|
||||
</div>
|
||||
</div>
|
||||
<span className="past-round__answer">“{round.answerTasks[0].result}”</span>
|
||||
</div>
|
||||
<div className={`past-round__competitor ${isBWinner ? 'past-round__competitor--winner' : ''}`}>
|
||||
<div className="past-round__competitor-header">
|
||||
<ModelName model={contB} />
|
||||
<div style={{ display: 'flex', gap: '12px', alignItems: 'center' }}>
|
||||
<span className="past-round__score">{votesB}</span>
|
||||
{isBWinner && <span className="past-round__winner-tag">WINNER</span>}
|
||||
</div>
|
||||
</div>
|
||||
<span className="past-round__answer">“{round.answerTasks[1].result}”</span>
|
||||
</div>
|
||||
<div className="past-round-mini__winner">
|
||||
{winner ? <><ModelName model={winner} showLogo={true} className="small-model-name" /> won</> : <span className="past-round-mini__tie">Tie</span>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -321,7 +295,7 @@ function GameOver({ scores }: { scores: Record<string, number> }) {
|
||||
);
|
||||
}
|
||||
|
||||
function Sidebar({ scores, activeRound }: { scores: Record<string, number>; activeRound: RoundState | null }) {
|
||||
function Sidebar({ scores, activeRound, completed }: { scores: Record<string, number>; activeRound: RoundState | null; completed: RoundState[] }) {
|
||||
const sorted = Object.entries(scores).sort((a, b) => b[1] - a[1]);
|
||||
const maxScore = sorted[0]?.[1] || 1;
|
||||
|
||||
@@ -333,44 +307,57 @@ function Sidebar({ scores, activeRound }: { scores: Record<string, number>; acti
|
||||
|
||||
return (
|
||||
<aside className="sidebar">
|
||||
<div className="sidebar__header">STANDINGS</div>
|
||||
<div className="sidebar__list">
|
||||
{sorted.map(([name, score], i) => {
|
||||
const pct = maxScore > 0 ? Math.round((score / maxScore) * 100) : 0;
|
||||
const color = getColor(name);
|
||||
const isActive = competing.has(name);
|
||||
const isJudging = judging.has(name);
|
||||
const isPrompting = name === prompting;
|
||||
<div className="sidebar__section">
|
||||
<div className="sidebar__header">STANDINGS</div>
|
||||
<div className="sidebar__list">
|
||||
{sorted.map(([name, score], i) => {
|
||||
const pct = maxScore > 0 ? Math.round((score / maxScore) * 100) : 0;
|
||||
const color = getColor(name);
|
||||
const isActive = competing.has(name);
|
||||
const isJudging = judging.has(name);
|
||||
const isPrompting = name === prompting;
|
||||
|
||||
let role = "";
|
||||
if (isActive) role = "⚔️";
|
||||
else if (isPrompting) role = "✍️";
|
||||
else if (isJudging) role = "🗳️";
|
||||
let role = "";
|
||||
if (isActive) role = "⚔️";
|
||||
else if (isPrompting) role = "✍️";
|
||||
else if (isJudging) role = "🗳️";
|
||||
|
||||
return (
|
||||
<div key={name} className={`standing ${isActive ? "standing--active" : ""}`}>
|
||||
<div className="standing__rank">{i === 0 && score > 0 ? "👑" : `${i + 1}.`}</div>
|
||||
<div className="standing__info">
|
||||
<div className="standing__name-row">
|
||||
<ModelName model={{id: name, name}} />
|
||||
{role && <span className="standing__role">{role}</span>}
|
||||
</div>
|
||||
<div className="standing__bar-row">
|
||||
<div className="standing__bar">
|
||||
<div className="standing__bar-fill" style={{ width: `${pct}%`, background: color }} />
|
||||
return (
|
||||
<div key={name} className={`standing ${isActive ? "standing--active" : ""}`}>
|
||||
<div className="standing__rank">{i === 0 && score > 0 ? "👑" : `${i + 1}.`}</div>
|
||||
<div className="standing__info">
|
||||
<div className="standing__name-row">
|
||||
<ModelName model={{id: name, name}} />
|
||||
{role && <span className="standing__role">{role}</span>}
|
||||
</div>
|
||||
<div className="standing__bar-row">
|
||||
<div className="standing__bar">
|
||||
<div className="standing__bar-fill" style={{ width: `${pct}%`, background: color }} />
|
||||
</div>
|
||||
<span className="standing__score">{score}</span>
|
||||
</div>
|
||||
<span className="standing__score">{score}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
{activeRound && (
|
||||
<div className="sidebar__legend">
|
||||
<span>⚔️ COMPETING</span>
|
||||
<span>✍️ PROMPTING</span>
|
||||
<span>🗳️ JUDGING</span>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{activeRound && (
|
||||
<div className="sidebar__legend">
|
||||
<span>⚔️ COMPETING</span>
|
||||
<span>✍️ PROMPTING</span>
|
||||
<span>🗳️ JUDGING</span>
|
||||
|
||||
{completed.length > 0 && (
|
||||
<div className="sidebar__section sidebar__section--history">
|
||||
<div className="sidebar__header">PAST ROUNDS</div>
|
||||
<div className="sidebar__history-list">
|
||||
{[...completed].reverse().map(round => (
|
||||
<PastRoundMini key={round.num} round={round} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</aside>
|
||||
@@ -422,14 +409,6 @@ function App() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (mainRef.current) {
|
||||
// Don't auto-scroll aggressively if they are just reading past rounds
|
||||
// but maybe scroll to top of arena when round changes?
|
||||
// Leaving this simple for now.
|
||||
}
|
||||
}, [state?.active?.num]);
|
||||
|
||||
if (!connected || !state) {
|
||||
return <ConnectingScreen />;
|
||||
}
|
||||
@@ -458,18 +437,9 @@ function App() {
|
||||
)}
|
||||
|
||||
{state.done && <GameOver scores={state.scores} />}
|
||||
|
||||
{state.completed.length > 0 && (
|
||||
<div className="history">
|
||||
<div className="history__title">PAST ROUNDS</div>
|
||||
{[...state.completed].reverse().map((round) => (
|
||||
<PastRoundEntry key={round.num} round={round} />
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</main>
|
||||
|
||||
<Sidebar scores={state.scores} activeRound={state.active} />
|
||||
<Sidebar scores={state.scores} activeRound={state.active} completed={state.completed} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user