mirror of
https://github.com/skidoodle/ncore-stats.git
synced 2026-04-28 07:47:36 +02:00
lgtm
This commit is contained in:
+1
-1
@@ -63,7 +63,7 @@
|
|||||||
</article>
|
</article>
|
||||||
{{else}}
|
{{else}}
|
||||||
<div
|
<div
|
||||||
style="grid-column: 1 / -1; padding: 4rem; text-align: center; color: var(--muted); border: 1px dashed var(--border-dim);">
|
style="grid-column: 1 / -1; padding: 4rem; text-align: center; color: var(--muted); border: 1px dashed var(--border);">
|
||||||
No profiles found. Use the CLI to add users.
|
No profiles found. Use the CLI to add users.
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|||||||
+12
-14
@@ -11,15 +11,13 @@ async function renderChart(owner) {
|
|||||||
if (!root) return;
|
if (!root) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${config.api.history}${encodeURIComponent(owner)}`);
|
const response = await fetch(`${config.api.history}${encodeURIComponent(owner)}`); if (!response.ok) throw new Error('Network error');
|
||||||
if (!response.ok) throw new Error('Network error');
|
|
||||||
const historyData = await response.json();
|
const historyData = await response.json();
|
||||||
|
|
||||||
if (!historyData || historyData.length === 0) {
|
if (!historyData || historyData.length === 0) {
|
||||||
root.innerHTML = '<div class="spinner-container"><p class="stat-label">No history available.</p></div>';
|
root.innerHTML = '<p class="stat-label" style="text-align: center; padding: 2rem; color: var(--muted);">No history available.</p>';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const parseUploadValue = (value) => {
|
const parseUploadValue = (value) => {
|
||||||
if (typeof value !== 'string') return 0;
|
if (typeof value !== 'string') return 0;
|
||||||
const num = parseFloat(value.replace(/,/g, '').replace(/TiB|GiB|MiB/i, '').trim());
|
const num = parseFloat(value.replace(/,/g, '').replace(/TiB|GiB|MiB/i, '').trim());
|
||||||
@@ -33,7 +31,7 @@ async function renderChart(owner) {
|
|||||||
|
|
||||||
const series = [
|
const series = [
|
||||||
{
|
{
|
||||||
name: 'Upload',
|
name: 'Upload (TiB)',
|
||||||
data: historyData.map(r => ({ x: new Date(r.timestamp).getTime(), y: parseUploadValue(r.upload) }))
|
data: historyData.map(r => ({ x: new Date(r.timestamp).getTime(), y: parseUploadValue(r.upload) }))
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -59,21 +57,21 @@ async function renderChart(owner) {
|
|||||||
height: '100%',
|
height: '100%',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
background: 'transparent',
|
background: 'transparent',
|
||||||
foreColor: '#888',
|
foreColor: '#71717a',
|
||||||
fontFamily: 'Inter, system-ui, sans-serif',
|
fontFamily: 'Inter, system-ui, sans-serif',
|
||||||
toolbar: { show: false },
|
toolbar: { show: false },
|
||||||
animations: { enabled: true, easing: 'easeinout', speed: 800 }
|
animations: { enabled: true, easing: 'easeinout', speed: 800 }
|
||||||
},
|
},
|
||||||
theme: { mode: 'dark' },
|
theme: { mode: 'dark' },
|
||||||
colors: ['#FFFFFF', '#00FF00', '#0066FF', '#FF00FF'],
|
colors: ['#FFFFFF', '#10b981', '#3b82f6', '#f43f5e'],
|
||||||
stroke: {
|
stroke: {
|
||||||
curve: 'smooth',
|
curve: 'smooth',
|
||||||
width: [3, 2, 2, 2],
|
width: [3, 2, 2, 2],
|
||||||
dashArray: 0
|
dashArray: 0
|
||||||
},
|
},
|
||||||
grid: {
|
grid: {
|
||||||
borderColor: '#1a1a1a',
|
borderColor: '#27272a',
|
||||||
strokeDashArray: 0,
|
strokeDashArray: 4,
|
||||||
padding: { top: 20, bottom: 0, left: 20, right: 20 },
|
padding: { top: 20, bottom: 0, left: 20, right: 20 },
|
||||||
xaxis: { lines: { show: true } },
|
xaxis: { lines: { show: true } },
|
||||||
yaxis: { lines: { show: true } }
|
yaxis: { lines: { show: true } }
|
||||||
@@ -89,9 +87,9 @@ async function renderChart(owner) {
|
|||||||
},
|
},
|
||||||
yaxis: [
|
yaxis: [
|
||||||
{
|
{
|
||||||
seriesName: 'Upload',
|
seriesName: 'Upload (TiB)',
|
||||||
labels: {
|
labels: {
|
||||||
style: { colors: '#FFF', fontSize: '10px', fontWeight: 700 },
|
style: { colors: '#FFF', fontSize: '11px', fontWeight: 600 },
|
||||||
formatter: (v) => v != null ? v.toFixed(2) : ''
|
formatter: (v) => v != null ? v.toFixed(2) : ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -100,7 +98,7 @@ async function renderChart(owner) {
|
|||||||
opposite: true,
|
opposite: true,
|
||||||
reversed: true,
|
reversed: true,
|
||||||
labels: {
|
labels: {
|
||||||
style: { colors: '#00FF00', fontSize: '10px', fontWeight: 700 },
|
style: { colors: '#10b981', fontSize: '11px', fontWeight: 600 },
|
||||||
formatter: (v) => v != null ? '#' + Math.round(v) : ''
|
formatter: (v) => v != null ? '#' + Math.round(v) : ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -115,9 +113,9 @@ async function renderChart(owner) {
|
|||||||
],
|
],
|
||||||
legend: {
|
legend: {
|
||||||
position: 'bottom',
|
position: 'bottom',
|
||||||
fontSize: '14px',
|
fontSize: '12px',
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
markers: { width: 10, height: 10, radius: 2 },
|
markers: { width: 8, height: 8, radius: 10 },
|
||||||
itemMargin: { horizontal: 15, vertical: 10 }
|
itemMargin: { horizontal: 15, vertical: 10 }
|
||||||
},
|
},
|
||||||
tooltip: {
|
tooltip: {
|
||||||
|
|||||||
+110
-88
@@ -1,10 +1,13 @@
|
|||||||
:root {
|
:root {
|
||||||
--bg: #000000;
|
--bg: #0a0a0b;
|
||||||
--fg: #ffffff;
|
--card-bg: #111113;
|
||||||
--border: #ffffff;
|
--fg: #f4f4f5;
|
||||||
--border-dim: #1a1a1a;
|
--muted: #71717a;
|
||||||
--muted: #666666;
|
--border: #27272a;
|
||||||
--accent: #ffffff;
|
--accent: #10b981;
|
||||||
|
--accent-dim: rgba(16, 185, 129, 0.1);
|
||||||
|
--rank-bg: #18181b;
|
||||||
|
--blue: #3b82f6;
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
@@ -21,14 +24,14 @@ html,
|
|||||||
body {
|
body {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-color: var(--bg);
|
background-color: var(--bg);
|
||||||
|
color: var(--fg);
|
||||||
|
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
||||||
|
line-height: 1.5;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
color: var(--fg);
|
|
||||||
font-family: 'Inter', system-ui, -apple-system, sans-serif;
|
|
||||||
line-height: 1.4;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
@@ -36,7 +39,7 @@ body {
|
|||||||
.container {
|
.container {
|
||||||
max-width: 1200px;
|
max-width: 1200px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 2.5rem;
|
padding: 2rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
height: 100vh;
|
height: 100vh;
|
||||||
@@ -45,105 +48,125 @@ body {
|
|||||||
header {
|
header {
|
||||||
margin-bottom: 2.5rem;
|
margin-bottom: 2.5rem;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border-bottom: 1px solid var(--border-dim);
|
|
||||||
padding-bottom: 1.5rem;
|
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
font-size: 1.5rem;
|
font-size: 1.75rem;
|
||||||
font-weight: 800;
|
font-weight: 800;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.2em;
|
letter-spacing: 0.15em;
|
||||||
|
background: linear-gradient(to right, #fff, #71717a);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtitle {
|
||||||
|
color: var(--muted);
|
||||||
|
font-size: 0.75rem;
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.25em;
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
padding: 0.5rem 0;
|
padding: 1rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid {
|
.grid {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(3, 1fr);
|
grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
|
||||||
gap: 1.25rem;
|
gap: 1.5rem;
|
||||||
margin: 0 auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
background-color: var(--bg);
|
background-color: var(--card-bg);
|
||||||
border: 1px solid var(--border-dim);
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 12px;
|
||||||
padding: 1.75rem;
|
padding: 1.75rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||||
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
|
||||||
}
|
}
|
||||||
|
|
||||||
.card:hover {
|
.card:hover {
|
||||||
border-color: var(--muted);
|
border-color: var(--accent);
|
||||||
background-color: #050505;
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-header {
|
.card-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: flex-start;
|
align-items: center;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 1.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card h3 {
|
.card h3 {
|
||||||
font-size: 1.1rem;
|
font-size: 1.1rem;
|
||||||
font-weight: 800;
|
font-weight: 700;
|
||||||
text-transform: uppercase;
|
color: #fff;
|
||||||
letter-spacing: -0.01em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.rank-badge {
|
.rank-badge {
|
||||||
font-family: monospace;
|
font-family: 'JetBrains Mono', monospace;
|
||||||
font-size: 0.7rem;
|
font-size: 0.7rem;
|
||||||
color: var(--muted);
|
color: var(--accent);
|
||||||
background: #111;
|
background: var(--accent-dim);
|
||||||
padding: 3px 6px;
|
padding: 4px 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-weight: 700;
|
||||||
letter-spacing: 0.05em;
|
letter-spacing: 0.05em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stats-group {
|
.stats-group {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
gap: 0.75rem;
|
gap: 1rem;
|
||||||
margin-bottom: 2rem;
|
margin-bottom: 1.75rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat {
|
.stat {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border-bottom: 1px solid #111;
|
padding-bottom: 0.5rem;
|
||||||
padding-bottom: 0.4rem;
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat:last-child {
|
||||||
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-label {
|
.stat-label {
|
||||||
font-size: 0.6rem;
|
font-size: 0.7rem;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
letter-spacing: 0.1em;
|
letter-spacing: 0.05em;
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stat-value {
|
.stat-value {
|
||||||
font-size: 0.9rem;
|
font-size: 0.95rem;
|
||||||
font-weight: 700;
|
font-weight: 600;
|
||||||
font-family: monospace;
|
color: #efefef;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-view {
|
.btn-view {
|
||||||
margin-top: auto;
|
margin-top: auto;
|
||||||
background: transparent;
|
background: var(--bg);
|
||||||
border: 1px solid var(--border-dim);
|
border: 1px solid var(--border);
|
||||||
color: var(--fg);
|
color: var(--fg);
|
||||||
padding: 0.75rem;
|
padding: 0.85rem;
|
||||||
font-size: 0.7rem;
|
font-size: 0.75rem;
|
||||||
font-weight: 800;
|
font-weight: 700;
|
||||||
|
border-radius: 8px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s ease;
|
transition: all 0.2s ease;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
@@ -151,35 +174,38 @@ main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.btn-view:hover {
|
.btn-view:hover {
|
||||||
background: var(--fg);
|
background: var(--accent);
|
||||||
color: var(--bg);
|
color: #000;
|
||||||
border-color: var(--fg);
|
border-color: var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-overlay {
|
.modal-overlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
background-color: rgba(0, 0, 0, 0.9);
|
background-color: rgba(0, 0, 0, 0.8);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
backdrop-filter: blur(8px);
|
backdrop-filter: blur(12px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-panel {
|
.modal-panel {
|
||||||
background-color: var(--bg);
|
background-color: var(--card-bg);
|
||||||
border: 1px solid var(--border-dim);
|
border: 1px solid var(--border);
|
||||||
width: 90vw;
|
width: 90vw;
|
||||||
max-width: 1200px;
|
max-width: 1100px;
|
||||||
height: 80vh;
|
height: 75vh;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
border-radius: 16px;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-header {
|
.modal-header {
|
||||||
padding: 1.25rem 2rem;
|
padding: 1.5rem 2rem;
|
||||||
border-bottom: 1px solid var(--border-dim);
|
background: #18181b;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -187,13 +213,14 @@ main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.modal-header h2 {
|
.modal-header h2 {
|
||||||
font-size: 0.8rem;
|
font-size: 0.85rem;
|
||||||
font-weight: 900;
|
font-weight: 800;
|
||||||
letter-spacing: 0.2em;
|
letter-spacing: 0.15em;
|
||||||
|
color: var(--muted);
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-body {
|
.modal-body {
|
||||||
padding: 1.5rem 2rem;
|
padding: 2rem;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -203,15 +230,20 @@ main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.close-btn {
|
.close-btn {
|
||||||
background: none;
|
background: rgba(255, 255, 255, 0.05);
|
||||||
border: none;
|
border: none;
|
||||||
color: var(--muted);
|
color: var(--muted);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 0.5rem;
|
padding: 0.5rem;
|
||||||
|
border-radius: 6px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.close-btn:hover {
|
.close-btn:hover {
|
||||||
color: var(--fg);
|
color: #fff;
|
||||||
|
background: rgba(255, 255, 255, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
main::-webkit-scrollbar {
|
main::-webkit-scrollbar {
|
||||||
@@ -223,46 +255,36 @@ main::-webkit-scrollbar-track {
|
|||||||
}
|
}
|
||||||
|
|
||||||
main::-webkit-scrollbar-thumb {
|
main::-webkit-scrollbar-thumb {
|
||||||
background: var(--border-dim);
|
background: var(--border);
|
||||||
|
border-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.apexcharts-canvas,
|
.apexcharts-canvas,
|
||||||
.apexcharts-canvas *,
|
.apexcharts-canvas *,
|
||||||
.apexcharts-canvas *:focus {
|
.apexcharts-canvas *:focus {
|
||||||
outline: none !important;
|
outline: none !important;
|
||||||
-webkit-tap-highlight-color: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apexcharts-yaxis-label {
|
|
||||||
font-weight: 700 !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.apexcharts-tooltip {
|
.apexcharts-tooltip {
|
||||||
background: #000 !important;
|
background: #18181b !important;
|
||||||
border: 1px solid #333 !important;
|
border: 1px solid var(--border) !important;
|
||||||
color: #fff !important;
|
border-radius: 8px !important;
|
||||||
border-radius: 0 !important;
|
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5) !important;
|
||||||
box-shadow: none !important;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes spin {
|
@media (max-width: 700px) {}
|
||||||
to {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 1100px) {
|
|
||||||
.grid {
|
|
||||||
grid-template-columns: repeat(2, 1fr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 700px) {
|
@media (max-width: 700px) {
|
||||||
|
.container {
|
||||||
|
padding: 1.5rem;
|
||||||
|
}
|
||||||
|
|
||||||
.grid {
|
.grid {
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.modal-panel {
|
||||||
padding: 1.5rem;
|
width: 95vw;
|
||||||
|
height: 90vh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user