185 lines
7.4 KiB
HTML
185 lines
7.4 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>KittyRec — RecNet</title>
|
|
<link rel="icon" type="image/x-icon" href="/static/favicon.ico">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="/static/kittyrec_icon.png">
|
|
<link rel="apple-touch-icon" href="/static/kittyrec_icon.png">
|
|
<style>
|
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
:root {
|
|
--bg: #06050f; --bg2: #0c0a1e; --bg3: #13102e; --bg4: #1a1640;
|
|
--purple: #8b5cf6; --purple-l: #a78bfa; --purple-d: #6d3bef;
|
|
--teal: #2dd4bf; --green: #34d399;
|
|
--text: #ede9fe; --text2: #a39dc8; --text3: #5c5488;
|
|
--card-r: 20px; --gap: 20px;
|
|
--ease: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
|
|
}
|
|
html { scroll-behavior: smooth; }
|
|
body {
|
|
background: var(--bg); color: var(--text);
|
|
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
|
font-size: 14px; line-height: 1.6;
|
|
-webkit-font-smoothing: antialiased;
|
|
overflow-x: hidden; padding-bottom: 80px;
|
|
}
|
|
a { color: var(--purple-l); text-decoration: none; transition: var(--ease); }
|
|
a:hover { color: var(--text); }
|
|
|
|
.nav-wrapper {
|
|
position: fixed; top: 24px; left: 0; right: 0; z-index: 100;
|
|
display: flex; justify-content: center; pointer-events: none;
|
|
}
|
|
.nav {
|
|
pointer-events: auto; display: flex; align-items: center; justify-content: space-between;
|
|
background: rgba(12,10,30,0.65); backdrop-filter: blur(24px) saturate(1.2);
|
|
border: 1px solid rgba(255,255,255,0.05); padding: 0 24px; height: 56px;
|
|
border-radius: 100px; width: calc(100% - 48px); max-width: 1200px;
|
|
box-shadow: 0 12px 40px rgba(0,0,0,0.2);
|
|
}
|
|
.nav-brand { display: flex; align-items: center; }
|
|
.nav-links { display: flex; gap: 28px; align-items: center; }
|
|
.nav-links a { font-size: 13px; font-weight: 500; color: var(--text2); }
|
|
.nav-links a:hover { color: #fff; }
|
|
.nav-links a.active { color: #fff; }
|
|
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
|
|
.nav-status { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--text); padding-left: 12px; border-left: 1px solid rgba(255,255,255,0.1); }
|
|
|
|
.page-wrap { max-width: 1200px; margin: 104px auto 0; padding: 0 24px; }
|
|
.page-head { margin-bottom: 32px; }
|
|
.page-title { font-size: clamp(28px, 4vw, 40px); font-weight: 700; color: #fff; letter-spacing: -0.03em; }
|
|
.page-sub { color: var(--text2); font-size: 15px; margin-top: 8px; }
|
|
.photo-count { color: var(--text3); font-size: 13px; font-weight: 600; margin-top: 4px; }
|
|
|
|
.photo-grid {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
|
gap: var(--gap);
|
|
}
|
|
.photo-card {
|
|
background: var(--bg2); border: 1px solid rgba(255,255,255,0.03);
|
|
border-radius: 16px; overflow: hidden; cursor: pointer; transition: var(--ease);
|
|
}
|
|
.photo-card:hover {
|
|
transform: translateY(-4px); border-color: rgba(255,255,255,0.1);
|
|
box-shadow: 0 20px 40px rgba(0,0,0,0.4);
|
|
}
|
|
.photo-card img {
|
|
width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--bg3);
|
|
}
|
|
.photo-meta { padding: 16px; }
|
|
.photo-uploader { font-weight: 600; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
.photo-room { font-size: 12px; color: var(--text3); margin-top: 4px; }
|
|
.photo-date { font-size: 11px; color: var(--text3); margin-top: 4px; }
|
|
|
|
.empty { color: var(--text3); font-size: 13px; padding: 48px 0; text-align: center; }
|
|
.hidden { display: none !important; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="nav-wrapper">
|
|
<nav class="nav">
|
|
<a href="/" class="nav-brand"><img src="/static/kittyrec_icon.png" alt="KittyRec" style="height:38px;width:38px;"></a>
|
|
<div class="nav-links">
|
|
<a href="/">Home</a>
|
|
<a href="/leaderboard">Leaderboard</a>
|
|
<a href="/recnet" class="active">RecNet</a>
|
|
<a href="/account">Account</a>
|
|
<a href="/api-docs">API</a>
|
|
<div class="nav-status"><span class="dot"></span> Online</div>
|
|
</div>
|
|
</nav>
|
|
</div>
|
|
|
|
<div class="page-wrap">
|
|
<div class="page-head">
|
|
<h1 class="page-title">RecNet</h1>
|
|
<p class="page-sub">photos from in game</p>
|
|
<div class="photo-count" id="photo-count"></div>
|
|
</div>
|
|
<div id="photos-grid" class="photo-grid">
|
|
<div class="empty">loading photos...</div>
|
|
</div>
|
|
<div id="sentinel" style="height:1px; margin-top:40px;"></div>
|
|
<div id="load-indicator" class="hidden" style="text-align:center; padding:32px 0; color:var(--text3); font-size:13px; font-weight:600; letter-spacing:0.05em;">loading...</div>
|
|
</div>
|
|
|
|
<script>
|
|
function esc(s) {
|
|
return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
|
}
|
|
|
|
const LIMIT = 24;
|
|
let offset = 0;
|
|
let total = null;
|
|
let fetching = false;
|
|
let initialLoad = true;
|
|
|
|
function photoCard(p) {
|
|
return `<div class="photo-card" onclick="openPhoto('${esc(p.url)}')">
|
|
<img src="${esc(p.url)}" alt="Photo by ${esc(p.uploader)}" loading="lazy">
|
|
<div class="photo-meta">
|
|
<div class="photo-uploader">${esc(p.uploader)}</div>
|
|
${p.room ? `<div class="photo-room">${esc(p.room)}</div>` : ''}
|
|
${p.created_at ? `<div class="photo-date">${esc(p.created_at)}</div>` : ''}
|
|
</div>
|
|
</div>`;
|
|
}
|
|
|
|
async function loadNextPage() {
|
|
if (fetching) return;
|
|
if (total !== null && offset >= total) return;
|
|
fetching = true;
|
|
const indicator = document.getElementById('load-indicator');
|
|
const grid = document.getElementById('photos-grid');
|
|
indicator.classList.remove('hidden');
|
|
try {
|
|
const data = await fetch(`/api/public/v1/photos?limit=${LIMIT}&offset=${offset}`).then(r => r.json());
|
|
total = data.total;
|
|
const photos = data.photos || [];
|
|
if (initialLoad) {
|
|
if (!photos.length) {
|
|
grid.innerHTML = '<div class="empty">no photos yet</div>';
|
|
indicator.classList.add('hidden');
|
|
fetching = false;
|
|
return;
|
|
}
|
|
grid.innerHTML = '';
|
|
initialLoad = false;
|
|
}
|
|
document.getElementById('photo-count').textContent = total.toLocaleString() + ' captures';
|
|
grid.insertAdjacentHTML('beforeend', photos.map(photoCard).join(''));
|
|
offset += photos.length;
|
|
} catch(_) {
|
|
if (initialLoad) grid.innerHTML = '<div class="empty">could not load photos</div>';
|
|
}
|
|
indicator.classList.add('hidden');
|
|
fetching = false;
|
|
}
|
|
|
|
function openPhoto(url) {
|
|
const lb = document.createElement('div');
|
|
lb.style.cssText = 'position:fixed; inset:0; background:rgba(6,5,15,0.95); backdrop-filter:blur(16px); z-index:9999; display:flex; align-items:center; justify-content:center; cursor:pointer; opacity:0; transition:opacity 0.3s;';
|
|
lb.innerHTML = `<img src="${url}" style="max-width:90vw; max-height:90vh; border-radius:16px; box-shadow:0 24px 64px rgba(0,0,0,0.6); transform:scale(0.95); transition:transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);">`;
|
|
document.body.appendChild(lb);
|
|
requestAnimationFrame(() => { lb.style.opacity = '1'; lb.querySelector('img').style.transform = 'scale(1)'; });
|
|
const close = () => { lb.style.opacity = '0'; lb.querySelector('img').style.transform = 'scale(0.95)'; setTimeout(() => lb.remove(), 300); };
|
|
lb.onclick = close;
|
|
document.addEventListener('keydown', function handler(e) {
|
|
if (e.key === 'Escape') { close(); document.removeEventListener('keydown', handler); }
|
|
});
|
|
}
|
|
|
|
const observer = new IntersectionObserver(entries => {
|
|
if (entries[0].isIntersecting) loadNextPage();
|
|
}, { rootMargin: '200px' });
|
|
observer.observe(document.getElementById('sentinel'));
|
|
|
|
loadNextPage();
|
|
</script>
|
|
</body>
|
|
</html>
|