feat: players page redesign — deltas, KPI tiles, sparklines, expanded row #9
@@ -12,37 +12,6 @@
|
||||
background: #059669;
|
||||
}
|
||||
|
||||
/* ── Progress ─────────────────────────────────── */
|
||||
|
||||
.progress-container {
|
||||
width: 100%;
|
||||
background: var(--surface-3);
|
||||
border-radius: var(--radius-xl);
|
||||
padding: 3px;
|
||||
margin: 20px 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
width: 0%;
|
||||
height: 26px;
|
||||
background: linear-gradient(135deg, var(--accent), var(--accent-hover));
|
||||
border-radius: var(--radius-xl);
|
||||
text-align: center;
|
||||
line-height: 26px;
|
||||
color: white;
|
||||
font-weight: 600;
|
||||
font-size: 12px;
|
||||
transition: width 0.4s ease;
|
||||
}
|
||||
|
||||
.progress-text {
|
||||
text-align: center;
|
||||
margin: 8px 0;
|
||||
font-size: 13px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* ── Mobile helpers ───────────────────────────── */
|
||||
|
||||
.mobile-only {
|
||||
|
||||
@@ -306,15 +306,6 @@ body {
|
||||
margin: 0 0 24px 0;
|
||||
}
|
||||
|
||||
/* ── Loading ──────────────────────────────────── */
|
||||
|
||||
.loading {
|
||||
text-align: center;
|
||||
padding: 40px 20px;
|
||||
font-size: 15px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
/* ── Tables ───────────────────────────────────── */
|
||||
|
||||
table {
|
||||
|
||||
@@ -106,75 +106,6 @@ router.get('/api/ratings/progress', (req, res) => {
|
||||
});
|
||||
});
|
||||
|
||||
router.post('/api/populate-database', (req, res) => {
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'text/event-stream',
|
||||
'Cache-Control': 'no-cache',
|
||||
'Connection': 'keep-alive',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
});
|
||||
|
||||
const progressCallback = (progress) => {
|
||||
res.write(`data: ${JSON.stringify(progress)}\n\n`);
|
||||
};
|
||||
|
||||
logger.info('=== Starting database population from database players ===');
|
||||
|
||||
refreshAllPlayersInDB(progressCallback).then(ratings => {
|
||||
logger.info(`=== Database population complete: ${ratings.length} players refreshed ===`);
|
||||
res.write(`data: ${JSON.stringify({ status: 'complete', ratings, message: `Successfully refreshed ${ratings.length} players` })}\n\n`);
|
||||
res.end();
|
||||
}).catch(error => {
|
||||
logger.error('Error populating database:', error);
|
||||
res.write(`data: ${JSON.stringify({ status: 'error', message: error.message })}\n\n`);
|
||||
res.end();
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/api/database-status', async (req, res) => {
|
||||
try {
|
||||
const playerCount = await new Promise((resolve, reject) => {
|
||||
db.get('SELECT COUNT(*) as count FROM players', [], (err, row) => {
|
||||
if (err) reject(err);
|
||||
else resolve(row.count);
|
||||
});
|
||||
});
|
||||
|
||||
res.json({
|
||||
playersInDB: playerCount,
|
||||
needsPopulation: playerCount === 0
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to check database status' });
|
||||
}
|
||||
});
|
||||
|
||||
router.get('/api/load-all-players', (req, res) => {
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'text/event-stream',
|
||||
'Cache-Control': 'no-cache',
|
||||
'Connection': 'keep-alive',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Headers': 'Cache-Control'
|
||||
});
|
||||
|
||||
const progressCallback = (progress) => {
|
||||
res.write(`data: ${JSON.stringify(progress)}\n\n`);
|
||||
};
|
||||
|
||||
refreshAllPlayersInDB(progressCallback).then(ratings => {
|
||||
res.write(`data: ${JSON.stringify({ status: 'complete', ratings })}\n\n`);
|
||||
res.end();
|
||||
}).catch(error => {
|
||||
res.write(`data: ${JSON.stringify({ status: 'error', error: error.message })}\n\n`);
|
||||
res.end();
|
||||
});
|
||||
|
||||
req.on('close', () => {
|
||||
res.end();
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/api/rating-history/:pdgaNumber', async (req, res) => {
|
||||
try {
|
||||
const { pdgaNumber } = req.params;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="loading" class="loading" style="display: none;">Loading courses...</div>
|
||||
<div id="courses-table" hx-get="/partials/course-table" hx-trigger="load"></div>
|
||||
`; %>
|
||||
|
||||
|
||||
@@ -19,13 +19,6 @@
|
||||
<div style="display: flex; justify-content: flex-end; gap: 12px; margin-bottom: 16px;">
|
||||
<a href="#" onclick="clearCache(); return false;" style="color: var(--text-muted); font-size: 12px; text-decoration: none; opacity: 0.4;" title="Clear cache"><i class="fas fa-cog"></i></a>
|
||||
</div>
|
||||
<div id="loading" class="loading" style="display: none;">Loading ratings...</div>
|
||||
<div id="progress-section" style="display: none;">
|
||||
<div class="progress-container">
|
||||
<div id="progress-bar" class="progress-bar">0%</div>
|
||||
</div>
|
||||
<div id="progress-text" class="progress-text">Preparing to load ratings...</div>
|
||||
</div>
|
||||
<div id="ratings-table" hx-get="/partials/ratings-table" hx-trigger="load"></div>
|
||||
`; %>
|
||||
|
||||
@@ -57,7 +50,7 @@
|
||||
title: 'PDGA Ratings',
|
||||
activePage: 'players',
|
||||
cssFiles: ['players.css'],
|
||||
jsFiles: ['tooltips.js', 'chart.js', 'progress.js', 'players.js'],
|
||||
jsFiles: ['tooltips.js', 'chart.js', 'players.js'],
|
||||
initScript: 'setupTooltipsAfterSwap();',
|
||||
body: body,
|
||||
modals: modals
|
||||
|
||||
Reference in New Issue
Block a user