added list (home) and details pages

This commit is contained in:
2026-03-26 22:12:54 +01:00
parent 26b12e9dca
commit 453f48804f
10 changed files with 599 additions and 2059 deletions

View File

@@ -2,59 +2,160 @@
box-sizing: border-box;
}
html {
font-size: 15px;
:root {
--primary-color: #d946ef;
--primary-soft: #fdf2f8;
--primary-border: #fce7f3;
--primary-text: #86198f;
--bg-main: #faf5ff;
--bg-card: #ffffff;
--bg-header: #f5f3ff;
--border-color: #f3e8ff;
--hover-color: #fdf2f8;
--text-dark: #2e1065;
--text-muted: #7e6c88;
--text-secondary: #4a3a54;
}
html, body {
margin: 0;
padding: 0;
background-color: var(--bg-main);
color: var(--text-dark);
font-family: "Inter", system-ui, -apple-system, sans-serif;
line-height: 1.5;
}
body {
font-family:
"Inter",
system-ui,
-apple-system,
Roboto,
"Segoe UI",
Arial,
sans-serif;
padding: 20px;
margin: 0;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color: #fff;
overflow-x: hidden;
height: 100vh;
}
h2 {
font-size: 1.8rem;
margin-bottom: 15px;
}
nav {
padding: 1rem;
}
nav a {
margin-right: 15px;
text-decoration: none;
}
main {
padding: 2rem;
flex: 1;
max-width: 800px;
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 1rem;
flex: 1;
}
h2 {
text-align: center;
margin: 2rem 0;
}
table {
width: 100%;
border-collapse: collapse;
background: var(--bg-card);
border-radius: 12px;
overflow: hidden;
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
th {
background: var(--bg-header);
padding: 12px 15px;
text-align: left;
font-size: 0.85rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: var(--text-muted);
border-bottom: 2px solid var(--border-color);
}
td {
padding: 12px 15px;
border-bottom: 1px solid var(--border-color);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
font-size: 0.9rem;
}
tr:last-child td {
border-bottom: none;
}
tr:hover {
background-color: var(--hover-color);
}
.score-cell {
color: var(--primary-color);
font-weight: 700;
}
.signature-cell {
color: var(--text-muted);
font-style: italic;
font-size: 0.8rem;
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
footer {
padding: 1rem;
padding: 2rem;
text-align: center;
color: var(--text-muted);
font-size: 0.9rem;
}
.card {
border: 1px solid #ddd;
padding: 10px;
border-radius: 8px;
margin-top: 10px;
@media (max-width: 768px) {
main {
padding: 0.5rem;
}
table thead {
display: none;
}
table, table tbody, table tr, table td {
display: block;
width: 100%;
}
table {
background: transparent;
box-shadow: none;
}
table tr {
background: var(--bg-card);
margin-bottom: 1rem;
border-radius: 12px;
padding: 1rem;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
border: 1px solid var(--border-color);
}
table td {
text-align: right;
padding: 8px 0;
border-bottom: 1px solid var(--bg-header);
position: relative;
}
table td:last-child {
border-bottom: none;
}
table td::before {
content: attr(data-label);
position: absolute;
left: 0;
font-weight: 600;
text-transform: uppercase;
font-size: 0.75rem;
color: var(--text-muted);
font-family: "Inter", sans-serif;
}
.signature-cell {
max-width: 100%;
}
}

View File

@@ -1,20 +1,17 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title>
<link rel="stylesheet" href="_base.css">
<style>
{% include "_base.css" %}
</style>
</head>
<body>
<nav>
<a href="/">Home</a>
<a href="/showcase">Showcase</a>
</nav>
<main>
{% block content %}{% endblock %}
</main>
<footer>Quick rust website template</footer>
<footer>{{ now() | date(format="%Y") }} - Slimes</footer>
</body>
</html>

258
templates/details.html Normal file
View File

@@ -0,0 +1,258 @@
{% extends "_layout.html" %}
{% block content %}
<div class="back-nav">
<a href="/">&larr; Back to Leaderboard</a>
</div>
<div class="report-card">
<div class="report-header">
<div class="header-main">
<h1 class="hostname-title">
{% if report.slimes["Hostname"] %}
{{ report.slimes["Hostname"].0 }}
{% else %}
Device {{ report.signature | truncate(length=10) }}
{% endif %}
</h1>
<p class="report-signature">{% if report.signature %}"{{ report.signature }}"{% endif %}</p>
<div class="meta-container">
<div class="meta-group system-context">
<div class="meta-item">
<span class="label">ID</span>
<span class="value">#{{ report.id }}</span>
</div>
<div class="meta-item">
<span class="label">VERSION</span>
<span class="value">v{{ report.client_version }}</span>
</div>
</div>
<div class="meta-group hardware-context">
<div class="meta-item">
<span class="label">MAC</span>
<span class="value">{{ report.mac_address }}</span>
</div>
<div class="meta-item">
<span class="label">REPORTED</span>
<span class="value">{{ time_ago }}</span>
</div>
</div>
</div>
</div>
<div class="score-container">
<div class="score-value">{{ report.benchmark.multi_thread.score }}</div>
<div class="score-label">Multi-Thread Score</div>
</div>
</div>
<div class="report-grid">
<div class="info-section">
<h3>Performance Breakdown</h3>
<div class="bench-stats">
<div class="stat-row">
<span>Single-Thread</span>
<strong>{{ report.benchmark.single_thread.score }}</strong>
</div>
<div class="stat-row">
<span>Multi-Thread</span>
<strong>{{ report.benchmark.multi_thread.score }}</strong>
</div>
<div class="stat-row">
<span>Threads</span>
<strong>{{ report.benchmark.logical_cores }}</strong>
</div>
</div>
</div>
{% for key, list in report.slimes %}
{% if key != "Hostname" %}
<div class="info-section">
<h3>{{ key }}</h3>
<ul class="info-list">
{% for item in list %}
<li>{{ item }}</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endfor %}
</div>
</div>
<style>
.back-nav { margin-bottom: 1.5rem; }
.back-nav a { color: var(--primary-color); text-decoration: none; font-weight: 500; }
.report-card {
background: var(--bg-card);
border-radius: 12px;
padding: 2.5rem;
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
border: 1px solid var(--border-color);
}
.report-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 2.5rem;
padding-bottom: 2rem;
border-bottom: 1px solid var(--border-color);
gap: 1.5rem;
}
.hostname-title {
margin: 0;
font-size: 2.2rem;
color: var(--text-dark);
letter-spacing: -0.02em;
line-height: 1.1;
}
.report-signature {
margin: 0.2rem 0 1.5rem 0;
font-style: italic;
color: var(--text-muted);
opacity: 0.7;
font-size: 1.1rem;
word-break: break-word;
}
.meta-container {
display: flex;
gap: 0.75rem;
flex-wrap: wrap;
}
.meta-group {
display: flex;
gap: 1.25rem;
padding: 0.6rem 1rem;
border-radius: 8px;
font-size: 0.85rem;
}
.system-context {
background: var(--primary-soft);
border: 1px solid var(--primary-border);
color: var(--primary-text);
}
.hardware-context {
background: var(--bg-main);
border: 1px solid var(--border-color);
color: var(--text-secondary);
}
.meta-item { display: flex; flex-direction: column; }
.meta-item .label {
font-size: 0.65rem;
font-weight: 700;
text-transform: uppercase;
opacity: 0.6;
letter-spacing: 0.05em;
}
.meta-item .value { font-family: ui-monospace, monospace; font-weight: 600; white-space: nowrap; }
.score-container { text-align: right; flex-shrink: 0; }
.score-value {
font-size: 2.5rem;
font-weight: 900;
color: var(--primary-color);
line-height: 1;
}
.score-label {
font-size: 0.7rem;
text-transform: uppercase;
color: var(--text-muted);
letter-spacing: 0.1em;
}
.report-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 1.5rem;
}
.info-section {
background: var(--bg-card);
padding: 1.25rem;
border-radius: 8px;
border: 1px solid var(--border-color);
}
.info-section h3 {
margin: 0 0 1rem 0;
font-size: 0.75rem;
text-transform: uppercase;
color: var(--text-muted);
border-bottom: 1px solid var(--border-color);
padding-bottom: 0.5rem;
}
.info-list { list-style: none; padding: 0; margin: 0; font-family: ui-monospace, monospace; font-size: 0.85rem; }
.info-list li {
margin-bottom: 0.5rem;
padding-left: 1rem;
position: relative;
word-break: break-word;
}
.info-list li::before { content: ""; position: absolute; left: 0; color: var(--primary-color); font-weight: bold; }
.bench-stats { display: flex; flex-direction: column; gap: 0.6rem; }
.stat-row { display: flex; justify-content: space-between; font-size: 0.9rem; }
@media (max-width: 640px) {
.report-card {
padding: 1.25rem;
border-radius: 0;
border-left: none;
border-right: none;
}
.report-header {
flex-direction: column;
align-items: flex-start;
margin-bottom: 1.5rem;
padding-bottom: 1.5rem;
gap: 1.5rem;
}
.hostname-title {
font-size: 1.75rem;
}
.score-container {
text-align: left;
width: 100%;
padding: 1rem;
background: var(--primary-soft);
border-radius: 8px;
box-sizing: border-box;
}
.score-value {
font-size: 2.0rem;
}
.meta-container {
flex-direction: column;
gap: 0.5rem;
}
.meta-group {
width: 100%;
box-sizing: border-box;
justify-content: flex-start;
}
.report-grid {
grid-template-columns: 1fr;
gap: 1rem;
}
}
</style>
{% endblock %}

View File

@@ -1,6 +1,49 @@
{% extends "_layout.html" %}
{% block content %}
<h1>Welcome to the Home Page</h1>
<p>This is a starter website built with Axum and Tera.</p>
<p>The time on the server is: <strong>{{ server_time }}</strong></p>
<h2>Benchmark Reports</h2>
<table>
<thead>
<tr>
<th>MT Score</th>
<th>Threads</th>
<th>RAM</th>
<th>OS</th>
<th>Hostname</th>
<th>Time</th>
<th>Note</th>
</tr>
</thead>
<tbody>
{% for report in reports %}
<tr class="clickable-row" onclick="window.location='/report/{{ report.id }}';">
<td data-label="MT Score" class="score-cell">
<a href="/report/{{ report.id }}">{{ report.score }}</a>
</td>
<td data-label="Threads">{{ report.cores }}</td>
<td data-label="RAM">{{ report.ram }}</td>
<td data-label="OS">{{ report.os | truncate(length=30) }}</td>
<td data-label="Hostname">{{ report.hostname }}</td>
<td data-label="Time">{{ report.time_ago }}</td>
<td data-label="Note" class="signature-cell">{{ report.signature }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<style>
.clickable-row {
cursor: pointer;
transition: background-color 0.2s;
}
.clickable-row:hover {
background-color: var(--hover-color);
}
.clickable-row a {
text-decoration: none;
color: inherit;
}
</style>
{% endblock %}

View File

@@ -1,12 +0,0 @@
{% extends "_layout.html" %}
{% block content %}
<h1>Project Showcase</h1>
<p>Here are some items passed from Rust to the template:</p>
{% for item in items %}
<div class="card">
<h3>{{ item.name }}</h3>
<p>{{ item.description }}</p>
</div>
{% endfor %}
{% endblock %}