commit 27aa171fc5b924f5a37fb665bda772a68ced66cd
Author: root <root@hub.scroll.pub> Date: 2024-12-27 19:06:40 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..8cb5147 --- /dev/null +++ b/body.html @@ -0,0 +1,33 @@ +<header class="site-header"> + <h1>Global Rankings</h1> + <button id="toggleTheme" aria-label="Toggle dark mode">🌓</button> +</header> + +<main> + <div class="controls"> + <input type="text" id="searchInput" placeholder="Search players..." aria-label="Search players"> + <select id="sortSelect" aria-label="Sort by"> + <option value="rank">Sort by Rank</option> + <option value="score">Sort by Score</option> + <option value="name">Sort by Name</option> + </select> + </div> + + <div class="leaderboard-wrapper"> + <div class="leaderboard" id="leaderboard"> + <div class="leaderboard-header"> + <span>Rank</span> + <span>Player</span> + <span>Score</span> + <span>Change</span> + </div> + <div class="leaderboard-body" id="leaderboardBody"> + <!-- Populated by JavaScript --> + </div> + </div> + </div> +</main> + +<footer> + <p>Built with passion by ranks.scroll.pub</p> +</footer> \ No newline at end of file diff --git a/index.scroll b/index.scroll new file mode 100644 index 0000000..61b0dda --- /dev/null +++ b/index.scroll @@ -0,0 +1,8 @@ +buildHtml +baseUrl https://ranks.scroll.pub +metaTags +editButton /edit.html +title Global Rankings - Live Leaderboard +style.css +body.html +script.js \ No newline at end of file diff --git a/prompt.json b/prompt.json new file mode 100644 index 0000000..432eb2b --- /dev/null +++ b/prompt.json @@ -0,0 +1,20 @@ +{ + "id": "msg_015wrnk84HAZnSnhQbdtFgxJ", + "type": "message", + "role": "assistant", + "model": "claude-3-5-sonnet-20241022", + "content": [ + { + "type": "text", + "text": "I'll create a leaderboard web app with a clean, modern design.\n\nSuggested domain: ranks.scroll.pub (short, memorable, describes the leaderboard purpose)\n\n---domain---\nranks.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://ranks.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Global Rankings - Live Leaderboard\nstyle.css\nbody.html\nscript.js\n---body.html---\n<header class=\"site-header\">\n <h1>Global Rankings</h1>\n <button id=\"toggleTheme\" aria-label=\"Toggle dark mode\">🌓</button>\n</header>\n\n<main>\n <div class=\"controls\">\n <input type=\"text\" id=\"searchInput\" placeholder=\"Search players...\" aria-label=\"Search players\">\n <select id=\"sortSelect\" aria-label=\"Sort by\">\n <option value=\"rank\">Sort by Rank</option>\n <option value=\"score\">Sort by Score</option>\n <option value=\"name\">Sort by Name</option>\n </select>\n </div>\n\n <div class=\"leaderboard-wrapper\">\n <div class=\"leaderboard\" id=\"leaderboard\">\n <div class=\"leaderboard-header\">\n <span>Rank</span>\n <span>Player</span>\n <span>Score</span>\n <span>Change</span>\n </div>\n <div class=\"leaderboard-body\" id=\"leaderboardBody\">\n <!-- Populated by JavaScript -->\n </div>\n </div>\n </div>\n</main>\n\n<footer>\n <p>Built with passion by ranks.scroll.pub</p>\n</footer>\n---style.css---\n:root {\n --primary: #2a6bed;\n --background: #ffffff;\n --text: #333333;\n --card: #f5f5f5;\n --border: #e0e0e0;\n --shadow: rgba(0,0,0,0.1);\n}\n\n[data-theme=\"dark\"] {\n --primary: #4d8eff;\n --background: #1a1a1a;\n --text: #ffffff;\n --card: #2d2d2d;\n --border: #404040;\n --shadow: rgba(0,0,0,0.3);\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;\n background: var(--background);\n color: var(--text);\n line-height: 1.6;\n transition: background-color 0.3s, color 0.3s;\n}\n\n.site-header {\n padding: 2rem;\n text-align: center;\n position: relative;\n}\n\nh1 {\n font-size: 2.5rem;\n color: var(--primary);\n margin-bottom: 1rem;\n}\n\n#toggleTheme {\n position: absolute;\n right: 2rem;\n top: 2rem;\n background: none;\n border: none;\n font-size: 1.5rem;\n cursor: pointer;\n padding: 0.5rem;\n border-radius: 50%;\n transition: transform 0.3s;\n}\n\n#toggleTheme:hover {\n transform: scale(1.1);\n}\n\n.controls {\n max-width: 800px;\n margin: 0 auto 2rem;\n padding: 0 1rem;\n display: flex;\n gap: 1rem;\n}\n\ninput, select {\n padding: 0.75rem;\n border: 2px solid var(--border);\n border-radius: 8px;\n background: var(--card);\n color: var(--text);\n font-size: 1rem;\n}\n\ninput {\n flex: 1;\n}\n\n.leaderboard-wrapper {\n max-width: 800px;\n margin: 0 auto;\n padding: 0 1rem;\n}\n\n.leaderboard {\n background: var(--card);\n border-radius: 12px;\n overflow: hidden;\n box-shadow: 0 4px 12px var(--shadow);\n}\n\n.leaderboard-header {\n display: grid;\n grid-template-columns: 80px 1fr 100px 100px;\n padding: 1rem;\n background: var(--primary);\n color: white;\n font-weight: bold;\n}\n\n.leaderboard-body {\n max-height: 600px;\n overflow-y: auto;\n}\n\n.player-row {\n display: grid;\n grid-template-columns: 80px 1fr 100px 100px;\n padding: 1rem;\n border-bottom: 1px solid var(--border);\n transition: background-color 0.2s;\n}\n\n.player-row:hover {\n background: var(--shadow);\n}\n\n.rank {\n font-weight: bold;\n}\n\n.change {\n font-weight: 500;\n}\n\n.change.positive {\n color: #2ecc71;\n}\n\n.change.negative {\n color: #e74c3c;\n}\n\nfooter {\n text-align: center;\n padding: 2rem;\n margin-top: 3rem;\n color: var(--text);\n}\n\n@media (max-width: 600px) {\n .controls {\n flex-direction: column;\n }\n \n .leaderboard-header,\n .player-row {\n grid-template-columns: 60px 1fr 70px 70px;\n font-size: 0.9rem;\n }\n}\n---script.js---\n// Sample data - in a real app, this would come from a backend\nlet players = [\n { id: 1, name: \"Alex Chen\", score: 2500, change: 12 },\n { id: 2, name: \"Maria Garcia\", score: 2450, change: -5 },\n { id: 3, name: \"James Wilson\", score: 2400, change: 8 },\n { id: 4, name: \"Sarah Kim\", score: 2350, change: 0 },\n { id: 5, name: \"David Lee\", score: 2300, change: 15 },\n // Add more players as needed\n];\n\n// DOM Elements\nconst leaderboardBody = document.getElementById('leaderboardBody');\nconst searchInput = document.getElementById('searchInput');\nconst sortSelect = document.getElementById('sortSelect');\nconst themeToggle = document.getElementById('toggleTheme');\n\n// Theme handling\nfunction toggleTheme() {\n document.body.dataset.theme = document.body.dataset.theme === 'dark' ? 'light' : 'dark';\n localStorage.setItem('theme', document.body.dataset.theme);\n}\n\n// Initialize theme\ndocument.body.dataset.theme = localStorage.getItem('theme') || 'light';\nthemeToggle.addEventListener('click', toggleTheme);\n\n// Render leaderboard\nfunction renderLeaderboard(players) {\n leaderboardBody.innerHTML = '';\n \n players.forEach((player, index) => {\n const row = document.createElement('div');\n row.className = 'player-row';\n \n const changeClass = player.change > 0 ? 'positive' : player.change < 0 ? 'negative' : '';\n const changeSymbol = player.change > 0 ? '↑' : player.change < 0 ? '↓' : '–';\n \n row.innerHTML = `\n <span class=\"rank\">#${index + 1}</span>\n <span class=\"name\">${player.name}</span>\n <span class=\"score\">${player.score}</span>\n <span class=\"change ${changeClass}\">${changeSymbol} ${Math.abs(player.change)}</span>\n `;\n \n leaderboardBody.appendChild(row);\n });\n}\n\n// Search functionality\nsearchInput.addEventListener('input', (e) => {\n const searchTerm = e.target.value.toLowerCase();\n const filtered = players.filter(player => \n player.name.toLowerCase().includes(searchTerm)\n );\n renderLeaderboard(filtered);\n});\n\n// Sort functionality\nsortSelect.addEventListener('change', (e) => {\n const sortBy = e.target.value;\n const sorted = [...players].sort((a, b) => {\n if (sortBy === 'rank') return b.score - a.score;\n if (sortBy === 'score') return b.score - a.score;\n if (sortBy === 'name') return a.name.localeCompare(b.name);\n return 0;\n });\n renderLeaderboard(sorted);\n});\n\n// Initial render\nrenderLeaderboard(players);\n---end---\n\nThis implementation features:\n- Dark/light theme toggle with local storage persistence\n- Responsive design that works on all devices\n- Search functionality to filter players\n- Sorting options (by rank, score, or name)\n- Smooth animations and transitions\n- Accessible controls with ARIA labels\n- Clean, semantic HTML structure\n- Modern CSS with CSS variables\n- Professional visual design with subtle shadows and animations\n- Clear visual hierarchy\n- Performance optimized with minimal JavaScript\n- No external dependencies\n\nThe design is both functional and aesthetically pleasing, with careful attention to spacing, typography, and color contrast." + } + ], + "stop_reason": "end_turn", + "stop_sequence": null, + "usage": { + "input_tokens": 281, + "cache_creation_input_tokens": 0, + "cache_read_input_tokens": 0, + "output_tokens": 2405 + } +} \ No newline at end of file diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..d70b78f --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# ranks.scroll.pub +Website generated by Claude from prompt: create a single web page application with a leaderboard. \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..35603d2 --- /dev/null +++ b/script.js @@ -0,0 +1,71 @@ +// Sample data - in a real app, this would come from a backend +let players = [ + { id: 1, name: "Alex Chen", score: 2500, change: 12 }, + { id: 2, name: "Maria Garcia", score: 2450, change: -5 }, + { id: 3, name: "James Wilson", score: 2400, change: 8 }, + { id: 4, name: "Sarah Kim", score: 2350, change: 0 }, + { id: 5, name: "David Lee", score: 2300, change: 15 }, + // Add more players as needed +]; + +// DOM Elements +const leaderboardBody = document.getElementById('leaderboardBody'); +const searchInput = document.getElementById('searchInput'); +const sortSelect = document.getElementById('sortSelect'); +const themeToggle = document.getElementById('toggleTheme'); + +// Theme handling +function toggleTheme() { + document.body.dataset.theme = document.body.dataset.theme === 'dark' ? 'light' : 'dark'; + localStorage.setItem('theme', document.body.dataset.theme); +} + +// Initialize theme +document.body.dataset.theme = localStorage.getItem('theme') || 'light'; +themeToggle.addEventListener('click', toggleTheme); + +// Render leaderboard +function renderLeaderboard(players) { + leaderboardBody.innerHTML = ''; + + players.forEach((player, index) => { + const row = document.createElement('div'); + row.className = 'player-row'; + + const changeClass = player.change > 0 ? 'positive' : player.change < 0 ? 'negative' : ''; + const changeSymbol = player.change > 0 ? '↑' : player.change < 0 ? '↓' : '–'; + + row.innerHTML = ` + <span class="rank">#${index + 1}</span> + <span class="name">${player.name}</span> + <span class="score">${player.score}</span> + <span class="change ${changeClass}">${changeSymbol} ${Math.abs(player.change)}</span> + `; + + leaderboardBody.appendChild(row); + }); +} + +// Search functionality +searchInput.addEventListener('input', (e) => { + const searchTerm = e.target.value.toLowerCase(); + const filtered = players.filter(player => + player.name.toLowerCase().includes(searchTerm) + ); + renderLeaderboard(filtered); +}); + +// Sort functionality +sortSelect.addEventListener('change', (e) => { + const sortBy = e.target.value; + const sorted = [...players].sort((a, b) => { + if (sortBy === 'rank') return b.score - a.score; + if (sortBy === 'score') return b.score - a.score; + if (sortBy === 'name') return a.name.localeCompare(b.name); + return 0; + }); + renderLeaderboard(sorted); +}); + +// Initial render +renderLeaderboard(players); \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..35c8efa --- /dev/null +++ b/style.css @@ -0,0 +1,155 @@ +:root { + --primary: #2a6bed; + --background: #ffffff; + --text: #333333; + --card: #f5f5f5; + --border: #e0e0e0; + --shadow: rgba(0,0,0,0.1); +} + +[data-theme="dark"] { + --primary: #4d8eff; + --background: #1a1a1a; + --text: #ffffff; + --card: #2d2d2d; + --border: #404040; + --shadow: rgba(0,0,0,0.3); +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif; + background: var(--background); + color: var(--text); + line-height: 1.6; + transition: background-color 0.3s, color 0.3s; +} + +.site-header { + padding: 2rem; + text-align: center; + position: relative; +} + +h1 { + font-size: 2.5rem; + color: var(--primary); + margin-bottom: 1rem; +} + +#toggleTheme { + position: absolute; + right: 2rem; + top: 2rem; + background: none; + border: none; + font-size: 1.5rem; + cursor: pointer; + padding: 0.5rem; + border-radius: 50%; + transition: transform 0.3s; +} + +#toggleTheme:hover { + transform: scale(1.1); +} + +.controls { + max-width: 800px; + margin: 0 auto 2rem; + padding: 0 1rem; + display: flex; + gap: 1rem; +} + +input, select { + padding: 0.75rem; + border: 2px solid var(--border); + border-radius: 8px; + background: var(--card); + color: var(--text); + font-size: 1rem; +} + +input { + flex: 1; +} + +.leaderboard-wrapper { + max-width: 800px; + margin: 0 auto; + padding: 0 1rem; +} + +.leaderboard { + background: var(--card); + border-radius: 12px; + overflow: hidden; + box-shadow: 0 4px 12px var(--shadow); +} + +.leaderboard-header { + display: grid; + grid-template-columns: 80px 1fr 100px 100px; + padding: 1rem; + background: var(--primary); + color: white; + font-weight: bold; +} + +.leaderboard-body { + max-height: 600px; + overflow-y: auto; +} + +.player-row { + display: grid; + grid-template-columns: 80px 1fr 100px 100px; + padding: 1rem; + border-bottom: 1px solid var(--border); + transition: background-color 0.2s; +} + +.player-row:hover { + background: var(--shadow); +} + +.rank { + font-weight: bold; +} + +.change { + font-weight: 500; +} + +.change.positive { + color: #2ecc71; +} + +.change.negative { + color: #e74c3c; +} + +footer { + text-align: center; + padding: 2rem; + margin-top: 3rem; + color: var(--text); +} + +@media (max-width: 600px) { + .controls { + flex-direction: column; + } + + .leaderboard-header, + .player-row { + grid-template-columns: 60px 1fr 70px 70px; + font-size: 0.9rem; + } +} \ No newline at end of file