Grok 4.1 Fast· xai
Frontier Reasoning Traces
Build a research visualization showcase: submissions and judging.
- User
Build a research visualization showcase: submissions and judging.
- Assistant
Build a research visualization showcase: submissions and judging.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Research Viz Showcase: Submissions & Judging</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; color: #333; }
nav { background: rgba(255,255,255,0.95); backdrop-filter: blur(10px); padding: 1rem 2rem; position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 20px rgba(0,0,0,0.1); }
nav ul { list-style: none; display: flex; gap: 2rem; justify-content: center; }
nav a { text-decoration: none; color: #333; font-weight: 600; padding: 0.5rem 1rem; border-radius: 25px; transition: all 0.3s; }
nav a:hover, nav a.active { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.container { max-width: 1200px; margin: 2rem auto; padding: 0 2rem; }
.hero { text-align: center; color: white; margin-bottom: 3rem; }
.hero h1 { font-size: 3rem; margin-bottom: 1rem; text-shadow: 0 2px 10px rgba(0,0,0,0.3); }
.hero p { font-size: 1.2rem; opacity: 0.9; }
.section { display: none; background: white; border-radius: 20px; padding: 2rem; box-shadow: 0 10px 40px rgba(0,0,0,0.1); margin-bottom: 2rem; }
.section.active { display: block; animation: fadeIn 0.5s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 2rem; }
.card { border-radius: 15px; overflow: hidden; box-shadow: 0 5px 20px rgba(0,0,0,0.1); transition: transform 0.3s, box-shadow 0.3s; }
.card:hover { transform: translateY(-10px); box-shadow: 0 15px 40px rgba(0,0,0,0.2); }
.card-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 1.5rem; }
.card-header h3 { margin-bottom: 0.5rem; }
.card-header .author { opacity: 0.9; font-size: 0.9rem; }
.card-viz { height: 250px; background: #f8f9fa; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: #666; position: relative; }
.card-viz canvas { max-height: 100%; max-width: 100%; }
.card-body { padding: 1.5rem; }
.card-stats { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font-size: 0.9rem; color: #666; }
.score { font-weight: bold; color: #667eea; font-size: 1.1rem; }
.tags { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
.tag { background: #e9ecef; padding: 0.3rem 0.8rem; border-radius: 20px; font-size: 0.8rem; }
.form-group { margin-bottom: 1.5rem; }
label { display: block; margin-bottom: 0.5rem; font-weight: 600; color: #555; }
input, textarea, select { width: 100%; padding: 0.8rem; border: 2px solid #e9ecef; border-radius: 10px; font-size: 1rem; transition: border-color 0.3s; }
input:focus, textarea:focus, select:focus { outline: none; border-color: #667eea; }
button { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 1rem 2rem; border: none; border-radius: 10px; font-size: 1.1rem; cursor: pointer; transition: transform 0.3s; width: 100%; }
button:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(102,126,234,0.4); }
.judge-controls { background: #f8f9fa; padding: 1rem; border-radius: 10px; margin-top: 1rem; display: flex; gap: 1rem; align-items: center; }
.stars { display: flex; gap: 0.2rem; font-size: 1.5rem; }
.star { cursor: pointer; color: #ddd; transition: color 0.3s; }
.star.filled { color: #ffd700; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; margin-top: 2rem; }
.stat-card { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 2rem; border-radius: 15px; text-align: center; }
.stat-number { font-size: 3rem; font-weight: bold; margin-bottom: 0.5rem; }
#login-form { max-width: 400px; margin: 0 auto; }
.hidden { display: none; }
.alert { padding: 1rem; border-radius: 10px; margin: 1rem 0; }
.alert.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
</style>
</head>
<body>
<nav>
<ul>
<li><a href="#" onclick="showSection('showcase')" class="active">Showcase</a></li>
<li><a href="#" onclick="showSection('submit')">Submit</a></li>
<li><a href="#" onclick="showSection('judge')">Judge</a></li>
<li><a href="#" onclick="showSection('stats')">Stats</a></li>
</ul>
</nav>
<div class="container">
<div class="hero">
<h1>🔬 Research Viz Showcase</h1>
<p>Submit, showcase, and judge cutting-edge research visualizations. Data-driven discoveries, visualized!</p>
</div>
<!-- Showcase Section -->
<div id="showcase" class="section active">
<h2 style="margin-bottom: 2rem; text-align: center;">Featured Submissions</h2>
<div id="submissions-grid" class="grid"></div>
</div>
<!-- Submit Section -->
<div id="submit" class="section">
<h2 style="margin-bottom: 2rem;">Submit Your Visualization</h2>
<form id="submit-form">
<div class="form-group">
<label for="title">Title</label>
<input type="text" id="title" required>
</div>
<div class="form-group">
<label for="author">Author(s)</label>
<input type="text" id="author" required>
</div>
<div class="form-group">
<label for="description">Description (research context, methods, insights)</label>
<textarea id="description" rows="4" required></textarea>
</div>
<div class="form-group">
<label for="tags">Tags (comma-separated)</label>
<input type="text" id="tags" placeholder="e.g., machine learning, climate data, network graph">
</div>
<div class="form-group">
<label for="viz-type">Visualization Type</label>
<select id="viz-type">
<option value="chart">Interactive Chart (Chart.js)</option>
<option value="image">Static Image</option>
<option value="embed">Embed (e.g., Observable, Tableau)</option>
</select>
</div>
<div class="form-group" id="viz-input">
<label for="viz-data">Viz Data/URL</label>
<input type="text" id="viz-data" placeholder="JSON for chart, image URL, or embed code">
</div>
<button type="submit">Submit Visualization</button>
</form>
<div id="submit-alert"></div>
</div>
<!-- Judge Section -->
<div id="judge" class="section">
<h2 style="margin-bottom: 2rem;">Judging Panel</h2>
<div id="login-form">
<div class="form-group">
<label for="judge-name">Judge Name (for tracking)</label>
<input type="text" id="judge-name" placeholder="Enter your name">
</div>
<button onclick="loginJudge()">Enter Judging Mode</button>
</div>
<div id="judging-interface" class="hidden">
<p>Welcome, <span id="current-judge"></span>! Rate visualizations on Innovation (1-5), Clarity (1-5), Impact (1-5).</p>
<div id="judge-grid" class="grid"></div>
</div>
</div>
<!-- Stats Section -->
<div id="stats" class="section">
<h2 style="margin-bottom: 2rem;">Live Statistics</h2>
<div class="stats-grid">
<div class="stat-card">
<div class="stat-number" id="total-subs">0</div>
<div>Total Submissions</div>
</div>
<div class="stat-card">
<div class="stat-number" id="avg-score">0</div>
<div>Avg Score</div>
</div>
<div class="stat-card">
<div class="stat-number" id="top-tags"></div>
<div>Top Tags</div>
</div>
<div class="stat-card">
<canvas id="score-dist" width="200" height="200"></canvas>
<div>Score Distribution</div>
</div>
</div>
</div>
</div>
<script>
let submissions = JSON.parse(localStorage.getItem('submissions')) || [];
let judges = JSON.parse(localStorage.getItem('judges')) || {};
let currentJudge = null;
// Mock initial data
if (submissions.length === 0) {
submissions = [
{ id: 1, title: 'Climate Change Trends', author: 'Dr. Jane Doe', description: 'Global temp rise using ARIMA forecasting.', tags: ['climate', 'time-series'], scores: [], vizType: 'chart', vizData: JSON.stringify({ type: 'line', labels: ['2010','2020','2030'], data: [14.5, 15.2, 16.1] }) },
{ id: 2, title: 'Neural Network Layers', author: 'Prof. John Smith', description: 't-SNE viz of embeddings.', tags: ['ml', 'dim-reduction'], scores: [4,5], vizType: 'image', vizData: 'https://via.placeholder.com/400x250/667eea/ffffff?text=Neural+Net+Viz' },
{ id: 3, title: 'Genomic Networks', author: 'Team BioViz', description: 'Force-directed graph of gene interactions.', tags: ['biology', 'network'], scores: [5,4,3], vizType: 'chart', vizData: JSON.stringify({ type: 'scatter', data: Array.from({length:20}, () => [Math.random()*10, Math.random()*10]) }) }
];
localStorage.setItem('submissions', JSON.stringify(submissions));
}
function showSection(id) {
document.querySelectorAll('.section').forEach(s => s.classList.remove('active'));
document.getElementById(id).classList.add('active');
document.querySelectorAll('nav a').forEach(a => a.classList.remove('active'));
event.target.classList.add('active');
if (id === 'showcase') renderShowcase();
if (id === 'judge') renderJudgeGrid();
if (id === 'stats') renderStats();
}
function renderShowcase() {
const grid = document.getElementById('submissions-grid');
grid.innerHTML = submissions.map(sub => {
const avgScore = sub.scores.length ? (sub.scores.reduce((a,b)=>a+b,0)/sub.scores.length).toFixed(1) : 'N/A';
let vizHtml = '';
if (sub.vizType === 'image') {
vizHtml = `<img src="${sub.vizData}" alt="Viz" style="width:100%;height:100%;object-fit:cover;">`;
} else if (sub.vizType === 'chart') {
vizHtml = `<canvas id="chart-${sub.id}"></canvas><script>renderChart(${sub.id}, ${sub.vizData});<\/script>`;
} else {
vizHtml = `<iframe src="${sub.vizData}" style="width:100%;height:100%;border:none;"></iframe>`;
}
return `
<div class="card">
<div class="card-header">
<h3>${sub.title}</h3>
<div class="author">by ${sub.author}</div>
</div>
<div class="card-viz">${vizHtml}</div>
<div class="card-body">
<p>${sub.description}</p>
<div class="card-stats">
<span>Avg Score: <span class="score">${avgScore}</span></span>
<span>Votes: ${sub.scores.length}</span>
</div>
<div class="tags">${sub.tags.map(t => `<span class="tag">#${t}</span>`).join('')}</div>
</div>
</div>
`;
}).join('');
// Re-render charts after DOM update
submissions.forEach(sub => {
if (sub.vizType === 'chart') renderChart(sub.id, JSON.parse(sub.vizData));
});
}
function renderChart(id, config) {
const ctx = document.getElementById(`chart-${id}`)?.getContext('2d');
if (ctx) {
new Chart(ctx, {
type: config.type || 'line',
data: { labels: config.labels || [], datasets: [{ label: 'Data', data: config.data || [], borderColor: '#667eea', backgroundColor: 'rgba(102,126,234,0.2)', fill: true }] },
options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: true } } }
});
}
}
document.getElementById('submit-form').addEventListener('submit', (e) => {
e.preventDefault();
const newSub = {
id: Date.now(),
title: document.getElementById('title').value,
author: document.getElementById('author').value,
description: document.getElementById('description').value,
tags: document.getElementById('tags').value.split(',').map(t => t.trim()).filter(t => t),
vizType: document.getElementById('viz-type').value,
vizData: document.getElementById('viz-data').value,
scores: []
};
submissions.unshift(newSub);
localStorage.setItem('submissions', JSON.stringify(submissions));
document.getElementById('submit-alert').innerHTML = '<div class="alert success">Submission added! Refresh showcase to see it.</div>';
e.target.reset();
});
function loginJudge() {
const name = document.getElementById('judge-name').value.trim();
if (!name) return alert('Enter your name');
currentJudge = name;
document.getElementById('current-judge').textContent = name;
document.getElementById('login-form').classList.add('hidden');
document.getElementById('judging-interface').classList.remove('hidden');
renderJudgeGrid();
}
function renderJudgeGrid() {
if (!currentJudge) return;
const grid = document.getElementById('judge-grid');
grid.innerHTML = submissions.map(sub => {
const userScores = judges[currentJudge]?.[sub.id] || [0,0,0];
return `
<div class="card">
<div class="card-header"><h3>${sub.title}</h3><div>by ${sub.author}</div></div>
<div class="card-viz" style="height:200px;background:#f0f0f0;font-size:1rem;">Viz Preview</div>
<div class="card-body">
<p>${sub.description.slice(0,100)}...</p>
<div class="judge-controls">
<div>Innovation: <div class="stars">${[1,2,3,4,5].map(i => `<span class="star ${userScores[0] >= i ? 'filled' : ''}" onclick="rate(${sub.id},0,${i})">★</span>`).join('')}</div></div>
<div>Clarity: <div class="stars">${[1,2,3,4,5].map(i => `<span class="star ${userScores[1] >= i ? 'filled' : ''}" onclick="rate(${sub.id},1,${i})">★</span>`).join('')}</div></div>
<div>Impact: <div class="stars">${[1,2,3,4,5].map(i => `<span class="star ${userScores[2] >= i ? 'filled' : ''}" onclick="rate(${sub.id},2,${i})">★</span>`).join('')}</div></div>
</div>
</div>
</div>
`;
}).join('');
}
function rate(subId, category, score) {
if (!judges[currentJudge]) judges[currentJudge] = {};
if (!judges[currentJudge][subId]) judges[currentJudge][subId] = [0,0,0];
judges[currentJudge][subId][category] = score;
localStorage.setItem('judges', JSON.stringify(judges));
// Aggregate scores
const sub = submissions.find(s => s.id === subId);
if (sub) {
const allScores = Object.values(judges).flatMap(j => j[subId] || []).filter(s => s > 0);
sub.scores = allScores;
localStorage.setItem('submissions', JSON.stringify(submissions));
}
renderJudgeGrid();
}
function renderStats() {
document.getElementById('total-subs').textContent = submissions.length;
const avg = submissions.reduce((sum, s) => sum + (s.scores.reduce((a,b)=>a+b,0)/s.scores.length || 0), 0) / submissions.length || 0;
document.getElementById('avg-score').textContent = avg.toFixed(1);
const allTags = submissions.flatMap(s => s.tags);
const topTags = allTags.reduce((acc, tag) => { acc[tag] = (acc[tag]||0)+1; return acc; }, {});
document.getElementById('top-tags').textContent = Object.entries(topTags).sort((a,b)=>b[1]-a[1])[0]?.[0] || 'N/A';
// Score distribution chart
const ctx = document.getElementById('score-dist').getContext('2d');
const scores = submissions.flatMap(s => s.scores);
new Chart(ctx, {
type: 'doughnut',
data: {
labels: ['1-2', '3', '4', '5'],
datasets: [{ data: [scores.filter(s=>s<=2).length, scores.filter(s=>s===3).length, scores.filter(s=>s===4).length, scores.filter(s=>s===5).length], backgroundColor: ['#ff6384','#36a2eb','#ffcd56','#4bc0c0'] }]
},
options: { responsive: true, maintainAspectRatio: false }
});
}
// Init
renderShowcase();
renderStats();
</script>
</body>
</html>
research-viz-showcase.html and open in any browser.localStorage—data survives refreshes (clear browser storage to reset).{"type":"line","labels":["A","B"],"data":[1,2]}.This is a fully functional, interactive prototype—deployable instantly! 🚀