Frontend overhaul: NetBox-style detail pages, selectable columns, data sources

- Cultivar/species detail pages rewritten with two-column card layout, attribute tables, em-dash placeholders
- Column toggle + per-page selector on all list pages (families, species, cultivars, suppliers)
- Species list: table/card view toggle with family, layer, N-fixer, uses columns
- Cultivar detail: supplier links with SKU/price/product URL, species info section
- Data sources page (/sources) with attribution for all 10 data sources
- Fixed Cultivar/Species structs with #[serde(default)] for API compatibility
- Added table_controls component (reusable column toggle + per-page selector)
- Removed max-width constraint on content area for full-width tables
- Fixed route conflicts: merged {slug}/{id} into single {ref} routes
- Removed PostgreSQL enum types (plant_layer, drought_tolerance, etc.) in favor of TEXT
- Fixed API per_page parameter support across all list endpoints
This commit is contained in:
2026-03-15 00:53:06 +01:00
parent 484979ad53
commit 42906efd90
17 changed files with 2130 additions and 276 deletions
+412 -1
View File
@@ -150,7 +150,6 @@ em {
.content {
flex: 1;
padding: 2rem 3rem;
max-width: 1200px;
}
.page {
@@ -498,6 +497,231 @@ tr:hover td {
font-size: 0.85rem;
}
/* Table toolbar (search + per-page on same row) */
.table-toolbar {
display: flex;
align-items: center;
gap: 1rem;
margin-bottom: 1rem;
flex-wrap: wrap;
}
.table-toolbar .search-bar {
flex: 1;
margin-bottom: 0;
min-width: 200px;
}
.toolbar-right {
display: flex;
align-items: center;
gap: 0.75rem;
}
/* Column toggle bar */
.column-toggle {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.4rem;
margin-bottom: 1rem;
padding: 0.5rem 0.75rem;
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
}
.column-toggle-label {
font-size: 0.75rem;
text-transform: uppercase;
letter-spacing: 0.5px;
color: var(--text-muted);
margin-right: 0.25rem;
font-weight: 600;
}
.col-btn {
padding: 0.2rem 0.5rem;
border: 1px solid var(--border);
border-radius: 3px;
background: var(--bg);
color: var(--text-muted);
font-size: 0.75rem;
cursor: pointer;
transition: all 0.15s;
white-space: nowrap;
}
.col-btn:hover {
border-color: var(--accent);
color: var(--accent);
}
.col-btn-active {
background: var(--accent-light);
border-color: var(--accent);
color: var(--accent);
font-weight: 500;
}
/* Per-page selector */
.per-page-selector {
display: flex;
align-items: center;
gap: 0.4rem;
font-size: 0.85rem;
color: var(--text-muted);
white-space: nowrap;
}
.per-page-selector select {
padding: 0.3rem 0.5rem;
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--bg-card);
font-size: 0.85rem;
cursor: pointer;
}
.per-page-selector select:focus {
outline: none;
border-color: var(--accent);
}
/* View toggle button */
.view-toggle-btn {
padding: 0.35rem 0.75rem;
border: 1px solid var(--border);
border-radius: var(--radius);
background: var(--bg-card);
font-size: 0.8rem;
cursor: pointer;
color: var(--text);
transition: all 0.15s;
white-space: nowrap;
}
.view-toggle-btn:hover {
border-color: var(--accent);
background: var(--accent-light);
}
/* Truncated cell */
.cell-truncated {
max-width: 250px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* External link styling in tables */
.external-link {
color: var(--accent);
font-size: 0.85rem;
}
.external-link:hover {
text-decoration: underline;
}
/* Species name in tables */
.species-name {
white-space: nowrap;
}
/* Sources page */
.sources-intro {
color: var(--text-muted);
margin-bottom: 2rem;
max-width: 700px;
line-height: 1.7;
}
.sources-grid {
display: flex;
flex-direction: column;
gap: 1rem;
}
.source-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 1.25rem 1.5rem;
box-shadow: var(--shadow);
}
.source-header {
display: flex;
align-items: baseline;
gap: 1rem;
margin-bottom: 0.5rem;
flex-wrap: wrap;
}
.source-name {
font-size: 1.1rem;
font-weight: 600;
margin: 0;
color: var(--text);
}
.source-url {
font-size: 0.85rem;
color: var(--accent);
}
.source-description {
color: var(--text-muted);
font-size: 0.9rem;
margin-bottom: 0.75rem;
}
.source-details {
display: flex;
flex-direction: column;
gap: 0.35rem;
}
.source-detail {
display: flex;
gap: 0.5rem;
font-size: 0.85rem;
align-items: baseline;
}
.source-detail-label {
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.5px;
color: var(--text-muted);
font-weight: 600;
flex-shrink: 0;
min-width: 70px;
}
.source-detail-value {
color: var(--text);
}
.source-license {
display: inline-block;
padding: 0.1rem 0.5rem;
background: var(--accent-light);
color: var(--accent);
border-radius: 3px;
font-size: 0.75rem;
font-weight: 500;
}
/* 404 */
.not-found {
@@ -525,6 +749,184 @@ tr:hover td {
border-radius: var(--radius);
}
/* Cultivar detail page */
.cultivar-detail .species-link {
font-size: 1.1rem;
color: var(--text-muted);
margin-bottom: 0.5rem;
}
.cultivar-detail .description {
margin: 1.5rem 0;
line-height: 1.7;
max-width: 800px;
}
.cultivar-detail .info-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 1rem;
margin: 1rem 0 1.5rem;
}
.cultivar-detail .info-item {
background: var(--accent-light);
padding: 0.75rem 1rem;
border-radius: var(--radius);
}
.cultivar-detail .info-label {
display: block;
font-size: 0.8rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.03em;
margin-bottom: 0.25rem;
}
.cultivar-detail .info-value {
font-weight: 600;
font-size: 1rem;
}
.supplier-links {
display: flex;
flex-wrap: wrap;
gap: 1rem;
margin-top: 1rem;
}
.supplier-link-card {
background: var(--bg-card);
border: 1px solid var(--border);
padding: 1rem 1.25rem;
border-radius: var(--radius);
display: flex;
align-items: center;
gap: 0.75rem;
flex-wrap: wrap;
}
.supplier-link-card .sku {
color: var(--text-muted);
font-size: 0.85rem;
}
.supplier-link-card .price {
font-weight: 600;
color: var(--accent);
}
.supplier-link-card .external-link {
background: var(--accent);
color: white;
padding: 0.3rem 0.8rem;
border-radius: var(--radius);
text-decoration: none;
font-size: 0.85rem;
}
.supplier-link-card .external-link:hover {
background: var(--accent-hover);
}
/* ========================================
Detail pages — two-column card layout
======================================== */
.detail-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 1.25rem;
margin-top: 1.25rem;
}
.detail-col {
display: flex;
flex-direction: column;
gap: 1.25rem;
}
.detail-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: var(--shadow);
overflow: hidden;
}
.detail-card-header {
background: var(--accent-light);
color: var(--accent);
font-weight: 600;
font-size: 0.9rem;
padding: 0.6rem 1rem;
border-bottom: 1px solid var(--border);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.detail-card-empty {
padding: 0.75rem 1rem;
font-size: 0.9rem;
}
/* Attribute table inside detail cards */
.attr-table {
width: 100%;
border-collapse: collapse;
box-shadow: none;
border-radius: 0;
}
.attr-table thead th {
text-align: left;
padding: 0.5rem 0.75rem;
font-size: 0.8rem;
font-weight: 600;
}
.attr-table tbody tr:nth-child(even) {
background: var(--bg);
}
.attr-table tbody tr:nth-child(odd) {
background: var(--bg-card);
}
.attr-table th {
width: 200px;
min-width: 140px;
text-align: right;
padding: 0.5rem 0.75rem;
color: var(--text-muted);
font-size: 0.85rem;
font-weight: 500;
vertical-align: top;
white-space: nowrap;
text-transform: none;
letter-spacing: 0;
background: transparent;
border-top: none;
}
.attr-table td {
padding: 0.5rem 0.75rem;
font-size: 0.9rem;
border-top: none;
word-break: break-word;
}
/* Placeholder (em dash) — muted style */
.placeholder,
td.placeholder {
color: var(--text-muted);
opacity: 0.5;
}
/* Responsive */
@media (max-width: 768px) {
@@ -554,4 +956,13 @@ tr:hover td {
.info-grid {
grid-template-columns: 1fr 1fr;
}
.detail-row {
grid-template-columns: 1fr;
}
.attr-table th {
width: auto;
min-width: 100px;
}
}