Jonas c5fd4de09b Implement labeling frontend and the backend support it needs
Add a framework-free HTML/CSS/JS labeling UI: set/session/status
filters, a frame browser, drag-to-draw/move/resize bounding boxes with
a per-set class picker, per-frame status control, and Left/Right frame
navigation. No login - a locally cached username is sent for
attribution only, matching the backend's get-or-create user model.

Backend additions the frontend needed: serve frame images from a
configurable FRAMES_ROOT via a /images static mount, permissive CORS
(internal tool, not publicly exposed), and a GET /sets/{id}/frames
endpoint returning frames joined with their per-set label status
(defaulting missing rows to unlabeled) for the frame browser.

Verified the full call chain end-to-end against a running backend +
static frontend server (set/class creation, frame ingest, image
serving, label CRUD, status updates, CORS preflight) - every field
name the JS reads matches the API responses. 18/18 backend tests
pass. Not yet verified: actual interactive browser use (no browser
tooling available here) - try drag-to-draw/resize locally.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-16 11:34:26 +02:00

165 lines
2.5 KiB
CSS

:root {
color-scheme: light dark;
--border: #888;
--bg: canvas;
--fg: canvastext;
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: system-ui, sans-serif;
background: var(--bg);
color: var(--fg);
}
.topbar {
display: flex;
align-items: center;
gap: 1rem;
padding: 0.5rem 1rem;
border-bottom: 1px solid var(--border);
flex-wrap: wrap;
}
.topbar h1 {
font-size: 1.1rem;
margin: 0;
}
.topbar label {
display: flex;
align-items: center;
gap: 0.35rem;
font-size: 0.9rem;
}
.frame-position {
margin-left: auto;
font-variant-numeric: tabular-nums;
opacity: 0.8;
}
.workspace {
display: flex;
gap: 1rem;
padding: 1rem;
align-items: flex-start;
}
.canvas-area {
flex: 1;
min-width: 0;
}
#image-container {
position: relative;
display: inline-block;
max-width: 100%;
border: 1px solid var(--border);
line-height: 0;
}
#frame-image {
display: block;
max-width: 100%;
height: auto;
user-select: none;
}
#bbox-layer {
position: absolute;
inset: 0;
cursor: crosshair;
}
.bbox {
position: absolute;
border: 2px solid var(--bbox-color, #ff4136);
background: color-mix(in srgb, var(--bbox-color, #ff4136) 15%, transparent);
cursor: move;
}
.bbox.selected {
outline: 2px dashed white;
outline-offset: 2px;
}
.bbox .bbox-tag {
position: absolute;
top: -1.3em;
left: -2px;
background: var(--bbox-color, #ff4136);
color: #fff;
font-size: 0.75rem;
padding: 0 0.3em;
white-space: nowrap;
}
.bbox .bbox-handle {
position: absolute;
right: -5px;
bottom: -5px;
width: 10px;
height: 10px;
background: var(--bbox-color, #ff4136);
cursor: nwse-resize;
}
.nav-controls {
display: flex;
align-items: center;
gap: 1rem;
margin-top: 0.75rem;
}
.sidebar {
width: 220px;
flex-shrink: 0;
}
.sidebar h2 {
font-size: 1rem;
margin: 0 0 0.5rem;
}
#class-list {
display: flex;
flex-direction: column;
gap: 0.25rem;
margin-bottom: 1rem;
}
.main-class-label {
font-size: 0.8rem;
opacity: 0.7;
margin-top: 0.5rem;
}
.class-chip {
display: block;
width: 100%;
text-align: left;
padding: 0.3rem 0.5rem;
border: 1px solid var(--border);
border-left: 6px solid var(--chip-color, #888);
background: none;
color: inherit;
cursor: pointer;
font-size: 0.9rem;
}
.class-chip.active {
background: color-mix(in srgb, var(--chip-color, #888) 25%, transparent);
font-weight: 600;
}
.hint {
font-size: 0.8rem;
opacity: 0.75;
line-height: 1.4;
}