Files
bryanpedini 440f78ce9e
Test / test (push) Successful in 26m44s
Build and publish image / image (push) Successful in 27m27s
feat(ui): improve the records table, view state and record dialog
Sortable record columns, filters and sort kept in the URL on the zones,
zone and audit pages, a Show action that filters the records table to a
problem's owner, Save and add another, a highlight of the saved row, an
Audit history link on the zone page, and dialogs that keep typed input
on a backdrop click.
2026-11-22 17:36:46 +01:00

813 lines
12 KiB
CSS

/* SPDX-License-Identifier: GPL-2.0-or-later */
/* Copyright (C) 2026 Bryan Joshua Pedini */
:root {
color-scheme: light dark;
--bg: #f4f5f7;
--surface: #ffffff;
--text: #1c2128;
--muted: #5b6573;
--border: #d3d9e0;
--accent: #1f5fbf;
--accent-text: #ffffff;
--danger: #b3261e;
--danger-bg: #fdecea;
--warn: #8a5a00;
--warn-bg: #fff4d6;
--ok: #1e6b34;
--ok-bg: #e3f4e8;
--info-bg: #e5eefc;
--stripe: #f0f2f5;
--focus: #1f5fbf;
--radius: 6px;
--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
--sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #14181d;
--surface: #1d232b;
--text: #e6eaf0;
--muted: #9aa5b3;
--border: #36404c;
--accent: #6ea4f4;
--accent-text: #0c1624;
--danger: #ff8a80;
--danger-bg: #3a1f1d;
--warn: #f2c35c;
--warn-bg: #3a2f14;
--ok: #7bd493;
--ok-bg: #19301f;
--info-bg: #1b2a44;
--stripe: #222a33;
--focus: #8ab8ff;
}
}
*,
*::before,
*::after {
box-sizing: border-box;
}
[hidden] {
display: none !important;
}
html {
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
background: var(--bg);
color: var(--text);
font-family: var(--sans);
font-size: 1rem;
line-height: 1.5;
}
a {
color: var(--accent);
}
h1,
h2,
h3 {
line-height: 1.25;
margin: 0 0 0.5rem;
}
h1 {
font-size: 1.5rem;
overflow-wrap: anywhere;
}
h2 {
font-size: 1.125rem;
}
h3 {
font-size: 1rem;
}
p {
margin: 0 0 0.75rem;
}
code,
pre,
.mono {
font-family: var(--mono);
font-size: 0.9em;
}
pre.code {
background: var(--stripe);
border: 1px solid var(--border);
border-radius: var(--radius);
margin: 0.5rem 0 0;
overflow-x: auto;
padding: 0.5rem 0.75rem;
}
:focus-visible {
outline: 3px solid var(--focus);
outline-offset: 2px;
}
.visually-hidden {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
white-space: nowrap;
width: 1px;
}
.skip {
background: var(--accent);
color: var(--accent-text);
left: 0.5rem;
padding: 0.5rem 0.75rem;
position: absolute;
top: -4rem;
z-index: 100;
}
.skip:focus {
top: 0.5rem;
}
.topbar {
align-items: center;
background: var(--surface);
border-bottom: 1px solid var(--border);
display: flex;
flex-wrap: wrap;
gap: 0.5rem 1rem;
padding: 0.5rem 1rem;
}
.brand {
color: var(--text);
font-weight: 700;
text-decoration: none;
}
.nav {
display: flex;
flex: 1;
flex-wrap: wrap;
gap: 0.25rem 0.5rem;
}
.nav a {
border-radius: var(--radius);
color: var(--text);
padding: 0.25rem 0.625rem;
text-decoration: none;
}
.nav a:hover {
background: var(--stripe);
}
.nav a[aria-current="page"] {
background: var(--accent);
color: var(--accent-text);
}
.logout {
align-items: center;
display: flex;
gap: 0.5rem;
margin: 0;
}
.who {
overflow-wrap: anywhere;
}
.page {
margin: 0 auto;
max-width: 72rem;
padding: 1rem;
}
.page:focus {
outline: none;
}
.page-head,
.section-head {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: 0.5rem 1rem;
justify-content: space-between;
margin-bottom: 0.75rem;
}
.section-head h2 {
margin: 0;
}
.crumbs {
color: var(--muted);
margin-bottom: 0.25rem;
}
.card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
margin-bottom: 1rem;
padding: 1rem;
}
.narrow {
margin: 2rem auto;
max-width: 26rem;
}
.danger-zone {
border-color: var(--danger);
}
.danger-zone h2 {
color: var(--danger);
}
.muted {
color: var(--muted);
}
.actions {
align-items: center;
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.actions-cell {
white-space: nowrap;
}
.btn {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
color: var(--text);
cursor: pointer;
display: inline-flex;
align-items: center;
font: inherit;
gap: 0.25rem;
justify-content: center;
min-height: 2.25rem;
padding: 0.25rem 0.875rem;
text-decoration: none;
}
.btn:hover:not(:disabled) {
border-color: var(--accent);
}
.btn:disabled {
cursor: not-allowed;
opacity: 0.5;
}
.btn[aria-busy="true"] {
cursor: progress;
}
.btn-link {
border-color: transparent;
color: var(--accent);
text-decoration: underline;
}
.btn-primary {
background: var(--accent);
border-color: var(--accent);
color: var(--accent-text);
}
.btn-danger {
border-color: var(--danger);
color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
background: var(--danger-bg);
border-color: var(--danger);
}
.btn-small {
font-size: 0.875rem;
min-height: 2rem;
padding: 0.125rem 0.625rem;
}
.btn-icon {
border-color: transparent;
font-size: 1.25rem;
line-height: 1;
min-width: 2rem;
padding: 0.125rem 0.5rem;
}
.form,
.dialog-body {
display: block;
}
.field {
margin-bottom: 0.75rem;
min-width: 0;
}
.field label,
fieldset.field legend {
display: block;
font-weight: 600;
margin-bottom: 0.25rem;
}
fieldset.field {
border: 0;
margin-left: 0;
margin-right: 0;
padding: 0;
}
input[type="text"],
input[type="search"],
input[type="password"],
input[type="number"],
input:not([type]),
select,
textarea {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
color: var(--text);
font: inherit;
max-width: 100%;
min-height: 2.25rem;
padding: 0.25rem 0.5rem;
width: 100%;
}
textarea {
resize: vertical;
}
input[type="checkbox"],
input[type="radio"] {
height: 1.125rem;
width: 1.125rem;
}
[aria-invalid="true"] {
border-color: var(--danger);
}
.choice {
align-items: center;
display: flex;
font-weight: 400;
gap: 0.5rem;
margin-bottom: 0.25rem;
}
.hint {
color: var(--muted);
font-size: 0.875rem;
margin: 0.25rem 0 0;
}
.field-error {
color: var(--danger);
font-size: 0.875rem;
margin: 0.25rem 0 0;
}
.alert {
border-radius: var(--radius);
margin-bottom: 0.75rem;
padding: 0.5rem 0.75rem;
}
.alert > :last-child {
margin-bottom: 0;
}
.alert-error {
background: var(--danger-bg);
color: var(--danger);
}
.alert-warn {
background: var(--warn-bg);
color: var(--warn);
}
.alert-info {
background: var(--info-bg);
}
.grid-2 {
display: grid;
gap: 0 0.75rem;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.toolbar,
.filters,
.inline-form {
align-items: end;
display: flex;
flex-wrap: wrap;
gap: 0 0.75rem;
}
.toolbar .field,
.filters .field,
.inline-form .field {
flex: 1 1 12rem;
}
.toolbar .field.grow {
flex: 3 1 14rem;
}
.filters .actions,
.inline-form .btn {
margin-bottom: 0.75rem;
}
.table-wrap {
overflow-x: auto;
}
.table {
border-collapse: collapse;
width: 100%;
}
.table caption {
font-weight: 600;
padding: 0.5rem 0;
text-align: left;
}
.table th,
.table td {
border-bottom: 1px solid var(--border);
padding: 0.375rem 0.5rem;
text-align: left;
vertical-align: top;
}
.table thead th {
white-space: nowrap;
}
.table tbody th {
font-weight: 600;
overflow-wrap: anywhere;
}
.table tbody tr:nth-child(even) {
background: var(--stripe);
}
.table .num {
text-align: right;
white-space: nowrap;
}
.table .check {
width: 2rem;
}
.th-sort {
background: none;
border: 0;
color: inherit;
cursor: pointer;
font: inherit;
font-weight: 600;
padding: 0;
}
.th-sort::after {
color: var(--muted);
content: "\2195";
content: "\2195" / "";
display: inline-block;
margin-left: 0.25rem;
width: 1ch;
}
[aria-sort="ascending"] .th-sort::after {
color: var(--text);
content: "\2191";
content: "\2191" / "";
}
[aria-sort="descending"] .th-sort::after {
color: var(--text);
content: "\2193";
content: "\2193" / "";
}
.th-sort:hover {
color: var(--accent);
}
.table .value code {
overflow-wrap: anywhere;
}
.table .raw {
color: var(--danger);
}
.row-error {
box-shadow: inset 3px 0 0 var(--danger);
}
.row-warning {
box-shadow: inset 3px 0 0 var(--warn);
}
.row-muted {
color: var(--muted);
}
.table tbody tr.row-flash {
animation: row-flash 2s ease-out;
}
@keyframes row-flash {
from {
background: var(--info-bg);
}
}
.detail-row > td {
background: var(--stripe);
}
.diff {
min-width: 36rem;
table-layout: fixed;
}
.diff th:first-child {
width: 13rem;
}
.diff-content-row th {
white-space: nowrap;
}
.diff-content {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 0.25rem;
white-space: pre-wrap;
}
.diff-value {
display: inline-block;
max-width: 100%;
overflow-wrap: anywhere;
padding: 0 0.25rem;
}
.diff-before {
background: var(--danger-bg);
color: var(--danger);
}
.diff-after {
background: var(--ok-bg);
color: var(--ok);
}
.diff-same {
color: var(--muted);
}
.badge {
background: var(--stripe);
border: 1px solid var(--border);
border-radius: 999px;
display: inline-block;
font-size: 0.8125rem;
line-height: 1.4;
padding: 0 0.5rem;
}
.badge-ok {
background: var(--ok-bg);
color: var(--ok);
}
.badge-warning {
background: var(--warn-bg);
color: var(--warn);
}
.badge-error {
background: var(--danger-bg);
color: var(--danger);
}
.badge-muted {
color: var(--muted);
}
.dl {
display: grid;
gap: 0.25rem 1rem;
grid-template-columns: max-content minmax(0, 1fr);
margin: 0 0 0.5rem;
}
.dl dt {
color: var(--muted);
}
.dl dd {
margin: 0;
overflow-wrap: anywhere;
}
.list,
.problems {
list-style: none;
margin: 0 0 0.75rem;
padding: 0;
}
.list li {
border-bottom: 1px solid var(--border);
padding: 0.375rem 0;
}
.problems {
font-size: 0.875rem;
margin: 0.25rem 0 0;
}
.pager {
align-items: center;
display: flex;
gap: 0.75rem;
justify-content: center;
margin-top: 0.75rem;
}
.dialog {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
color: var(--text);
max-height: calc(100vh - 1rem);
max-width: 34rem;
overflow-y: auto;
padding: 0;
width: calc(100% - 1rem);
}
.dialog-small {
max-width: 24rem;
}
.dialog::backdrop {
background: rgb(0 0 0 / 55%);
}
.dialog-head {
align-items: center;
border-bottom: 1px solid var(--border);
display: flex;
justify-content: space-between;
padding: 0.5rem 0.75rem 0.5rem 1rem;
}
.dialog-head h2 {
margin: 0;
}
.dialog-body {
padding: 1rem;
}
.dialog-status {
align-self: center;
flex: 1 1 100%;
margin: 0;
}
.dialog-status:empty {
border: 0;
clip: rect(0 0 0 0);
height: 1px;
margin: -1px;
overflow: hidden;
padding: 0;
position: absolute;
white-space: nowrap;
width: 1px;
}
.dialog-actions {
border-top: 1px solid var(--border);
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
justify-content: flex-end;
padding: 0.75rem 1rem;
}
.toasts {
bottom: 0.5rem;
display: flex;
flex-direction: column;
gap: 0.5rem;
left: 0.5rem;
max-width: 28rem;
position: fixed;
right: 0.5rem;
z-index: 200;
}
.toast {
align-items: center;
background: var(--surface);
border: 1px solid var(--border);
border-left-width: 4px;
border-radius: var(--radius);
box-shadow: 0 2px 8px rgb(0 0 0 / 25%);
display: flex;
gap: 0.5rem;
padding: 0.5rem 0.5rem 0.5rem 0.75rem;
}
.toast-text {
flex: 1;
overflow-wrap: anywhere;
}
.toast-error {
border-left-color: var(--danger);
}
.toast-warning {
border-left-color: var(--warn);
}
.toast-info {
border-left-color: var(--accent);
}
@media (max-width: 30rem) {
.page {
padding: 0.75rem;
}
.grid-2 {
grid-template-columns: minmax(0, 1fr);
}
.dl {
grid-template-columns: minmax(0, 1fr);
}
.dl dd {
margin-bottom: 0.5rem;
}
.toasts {
max-width: none;
}
}
@media (prefers-reduced-motion: no-preference) {
.btn {
transition: border-color 0.1s, background-color 0.1s;
}
}