Skip to content

Commit e1ad005

Browse files
committed
feat(site): add random quotes extracted from reasoning traces
1 parent 4e2256b commit e1ad005

2 files changed

Lines changed: 95 additions & 7 deletions

File tree

site/index.html

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,8 @@
7575
<!-- Live Stream Section -->
7676
<div class="container mx-auto px-4 mt-8">
7777
<div class="max-w-4xl mx-auto">
78-
<div class="relative w-full overflow-hidden rounded-lg shadow-lg dark:shadow-2xl dark:ring-1 dark:ring-white/5"
79-
style="padding-bottom: 56.25%">
80-
<iframe src="https://player.twitch.tv/?channel=S1M0N38&parent=balatrobench.com&parent=localhost"
81-
title="S1M0N38 Twitch Stream" class="absolute top-0 left-0 w-full h-full" allow="fullscreen" allowfullscreen>
82-
</iframe>
83-
</div>
8478
<!-- GitHub Repositories -->
85-
<div class="flex items-center justify-center gap-6 mt-6">
79+
<div class="flex items-center justify-center gap-6 mb-6">
8680
<a href="https://github.com/coder/balatrobench" target="_blank" rel="noopener"
8781
class="flex items-center gap-2 text-zinc-500 hover:text-zinc-700 dark:text-zinc-400 dark:hover:text-white transition-colors">
8882
<svg fill="currentColor" class="w-5 h-5">
@@ -105,6 +99,19 @@
10599
<span class="text-sm font-medium">coder/balatrobot</span>
106100
</a>
107101
</div>
102+
<div class="relative w-full overflow-hidden rounded-lg shadow-lg dark:shadow-2xl dark:ring-1 dark:ring-white/5"
103+
style="padding-bottom: 56.25%">
104+
<iframe src="https://player.twitch.tv/?channel=S1M0N38&parent=balatrobench.com&parent=localhost"
105+
title="S1M0N38 Twitch Stream" class="absolute top-0 left-0 w-full h-full" allow="fullscreen" allowfullscreen>
106+
</iframe>
107+
</div>
108+
<!-- Quotes Section -->
109+
<div id="quote-container" class="mt-8 text-center transition-opacity duration-1000 ease-in-out min-h-12">
110+
<p class="text-base leading-normal text-zinc-600 dark:text-zinc-400 max-w-2xl mx-auto">
111+
<span id="quote-text" class="italic cursor-pointer"></span>
112+
<span id="quote-author" class="text-zinc-500 dark:text-zinc-500 whitespace-nowrap"></span>
113+
</p>
114+
</div>
108115
</div>
109116
</div>
110117

site/script.js

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,8 +1233,89 @@ document.addEventListener('DOMContentLoaded', () => {
12331233

12341234
// Initialize version selector for both pages
12351235
initBenchmarkVersionSelector();
1236+
1237+
// Initialize quotes rotation (if on a page with quotes)
1238+
initQuotesRotation();
12361239
});
12371240

1241+
// ============================================================================
1242+
// Quotes Rotation
1243+
// ============================================================================
1244+
1245+
const QUOTE_ROTATION_INTERVAL_MS = 10000; // 10 seconds between quotes
1246+
1247+
async function initQuotesRotation() {
1248+
const container = document.getElementById('quote-container');
1249+
const textEl = document.getElementById('quote-text');
1250+
const authorEl = document.getElementById('quote-author');
1251+
1252+
if (!container || !textEl || !authorEl) return; // Not on a page with quotes
1253+
1254+
try {
1255+
const response = await fetch('assets/quotes.json');
1256+
if (!response.ok) return;
1257+
const data = await response.json();
1258+
const quotes = data.quotes;
1259+
1260+
if (!quotes || quotes.length === 0) return;
1261+
1262+
let currentIndex = Math.floor(Math.random() * quotes.length);
1263+
let isTransitioning = false;
1264+
let autoRotateTimer = null;
1265+
1266+
function displayQuote(index) {
1267+
const quote = quotes[index];
1268+
textEl.textContent = `"${quote.text}"`;
1269+
authorEl.textContent = ` — ${quote.vendor} / ${quote.model}`;
1270+
}
1271+
1272+
function getRandomIndex() {
1273+
// Pick a random index different from current
1274+
if (quotes.length <= 1) return 0;
1275+
let newIndex;
1276+
do {
1277+
newIndex = Math.floor(Math.random() * quotes.length);
1278+
} while (newIndex === currentIndex);
1279+
return newIndex;
1280+
}
1281+
1282+
function transitionToNext() {
1283+
if (isTransitioning) return;
1284+
isTransitioning = true;
1285+
1286+
currentIndex = getRandomIndex();
1287+
// Fade out container
1288+
container.style.opacity = '0';
1289+
// After fade out (1s), update and fade in
1290+
setTimeout(() => {
1291+
displayQuote(currentIndex);
1292+
container.style.opacity = '1';
1293+
isTransitioning = false;
1294+
}, 1000);
1295+
}
1296+
1297+
function resetAutoRotate() {
1298+
if (autoRotateTimer) clearInterval(autoRotateTimer);
1299+
autoRotateTimer = setInterval(transitionToNext, QUOTE_ROTATION_INTERVAL_MS);
1300+
}
1301+
1302+
// Display first quote immediately
1303+
displayQuote(currentIndex);
1304+
1305+
// Click on quote text to cycle to next quote
1306+
textEl.addEventListener('click', () => {
1307+
transitionToNext();
1308+
resetAutoRotate(); // Reset timer on manual click
1309+
});
1310+
1311+
// Start auto-rotation
1312+
resetAutoRotate();
1313+
1314+
} catch (e) {
1315+
console.error('Failed to load quotes:', e);
1316+
}
1317+
}
1318+
12381319
// ===== Run Viewer (modal) =====
12391320
function formatRequestId(n) {
12401321
return String(n).padStart(5, '0');

0 commit comments

Comments
 (0)