mirror of
https://github.com/AmanTahiliani/box-box.git
synced 2026-08-08 04:06:18 -04:00
feat(race-story): polish chapter strip, controls, graph, and map UX (#68)
Consolidate the Race Story section into a cohesive timeline surface: custom chapter-strip scrolling with active-card sync, unified segmented playback controls, chapter bands on the position graph with decimated axes and de-collided labels, map toggle gated by an on-mount replay/outline probe, and shared empty-state cards. Adds vitest coverage and visual snapshots. Note: replay/outline queries now probe on mount (not only when Map opens) so the toggle can be hidden before users hit a dead panel. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -520,6 +520,17 @@ a { color: inherit; text-decoration: none; }
|
||||
color: var(--text-3);
|
||||
}
|
||||
|
||||
.empty-state-icon {
|
||||
display: block;
|
||||
margin: 0 auto var(--s3);
|
||||
color: var(--text-3);
|
||||
}
|
||||
|
||||
.race-story-empty-card {
|
||||
padding: var(--s6) var(--s5);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.loading-state {
|
||||
padding: var(--s7) 0;
|
||||
text-align: center;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--s4);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.chapter-strip-title {
|
||||
@@ -44,6 +45,31 @@
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.chapter-strip-scroll-wrap {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.chapter-strip-scroll-wrap::before,
|
||||
.chapter-strip-scroll-wrap::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: var(--s2);
|
||||
width: 28px;
|
||||
pointer-events: none;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.chapter-strip-scroll-wrap::before {
|
||||
left: 0;
|
||||
background: linear-gradient(to right, var(--bg), transparent);
|
||||
}
|
||||
|
||||
.chapter-strip-scroll-wrap::after {
|
||||
right: 0;
|
||||
background: linear-gradient(to left, var(--bg), transparent);
|
||||
}
|
||||
|
||||
.chapter-strip-scroll {
|
||||
display: flex;
|
||||
gap: var(--s3);
|
||||
@@ -51,10 +77,26 @@
|
||||
padding-bottom: var(--s2);
|
||||
scroll-snap-type: x mandatory;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: var(--border-2) transparent;
|
||||
}
|
||||
|
||||
.chapter-strip-scroll::-webkit-scrollbar {
|
||||
height: 4px;
|
||||
}
|
||||
|
||||
.chapter-strip-scroll::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.chapter-strip-scroll::-webkit-scrollbar-thumb {
|
||||
background: var(--border-2);
|
||||
border-radius: 999px;
|
||||
}
|
||||
|
||||
.chapter-card {
|
||||
flex: 0 0 min(240px, 72vw);
|
||||
min-height: 88px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--s2);
|
||||
@@ -64,7 +106,7 @@
|
||||
background: var(--surface);
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
scroll-snap-align: start;
|
||||
scroll-snap-align: center;
|
||||
transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
|
||||
}
|
||||
|
||||
@@ -145,10 +187,21 @@
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.chapter-strip-empty {
|
||||
font-size: 12px;
|
||||
color: var(--text-3);
|
||||
padding: var(--s3) 0;
|
||||
.chapter-strip-empty-card {
|
||||
padding: var(--s6) var(--s5);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.chapter-strip-empty-card .empty-state-icon {
|
||||
margin: 0 auto var(--s3);
|
||||
color: var(--text-3);
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.chapter-strip-header {
|
||||
align-items: flex-start;
|
||||
}
|
||||
}
|
||||
|
||||
146
frontend/src/styles/race-story.css
Normal file
146
frontend/src/styles/race-story.css
Normal file
@@ -0,0 +1,146 @@
|
||||
.rs-replay-shell {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: var(--s5);
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.rs-replay-shell--split {
|
||||
grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
|
||||
}
|
||||
|
||||
.rs-replay-main {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.rs-chart-container {
|
||||
--rs-chart-max-width: 100%;
|
||||
}
|
||||
|
||||
.rs-chart-container--full {
|
||||
--rs-chart-max-width: 100%;
|
||||
}
|
||||
|
||||
.rs-segmented-control {
|
||||
display: inline-flex;
|
||||
align-items: stretch;
|
||||
flex-wrap: wrap;
|
||||
gap: 0;
|
||||
margin-top: var(--s3);
|
||||
border: 1px solid var(--border-2);
|
||||
border-radius: var(--s1);
|
||||
background: var(--surface);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.rs-segment {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: 30px;
|
||||
padding: 0 var(--s4);
|
||||
font-family: var(--f-mono);
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
color: var(--text-3);
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-right: 1px solid var(--border);
|
||||
cursor: pointer;
|
||||
transition: background 0.12s, color 0.12s;
|
||||
}
|
||||
|
||||
.rs-segment:last-child {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.rs-segment:hover:not(:disabled) {
|
||||
color: var(--text);
|
||||
background: var(--surface-h);
|
||||
}
|
||||
|
||||
.rs-segment:focus-visible {
|
||||
outline: 2px solid var(--red);
|
||||
outline-offset: -2px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.rs-segment.active {
|
||||
color: var(--text);
|
||||
background: rgba(230, 36, 41, 0.12);
|
||||
box-shadow: inset 0 -2px 0 var(--red);
|
||||
}
|
||||
|
||||
.rs-segment:disabled {
|
||||
opacity: 0.45;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.rs-segment-divider {
|
||||
width: 1px;
|
||||
align-self: stretch;
|
||||
background: var(--border);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.rs-replay-map-slot {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.rs-position-chart-svg {
|
||||
width: 100%;
|
||||
min-width: 280px;
|
||||
max-width: var(--rs-chart-max-width, 640px);
|
||||
display: block;
|
||||
}
|
||||
|
||||
.rs-chart-axis-label {
|
||||
fill: var(--text-3);
|
||||
font-family: var(--f-mono);
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.rs-chart-grid-line {
|
||||
stroke: var(--border);
|
||||
stroke-width: 0.5;
|
||||
}
|
||||
|
||||
.rs-chart-lap-tick {
|
||||
stroke: var(--border);
|
||||
stroke-width: 1;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.rs-replay-shell--split {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.rs-segmented-control {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.rs-segment {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.rs-segmented-control {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.rs-segment {
|
||||
border-right: none;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.rs-segment:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.rs-segment-divider {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -1,76 +1,9 @@
|
||||
.rs-replay-shell {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
|
||||
gap: var(--s5);
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.rs-replay-main {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.rs-replay-tools {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--s3);
|
||||
margin-top: var(--s3);
|
||||
}
|
||||
|
||||
.rs-tool-btn,
|
||||
.rs-speed-btn {
|
||||
height: 28px;
|
||||
padding: 0 var(--s4);
|
||||
font-family: var(--f-mono);
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
color: var(--text-2);
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border-2);
|
||||
border-radius: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.rs-tool-btn:hover,
|
||||
.rs-speed-btn:hover {
|
||||
color: var(--text);
|
||||
border-color: var(--text-3);
|
||||
}
|
||||
|
||||
.rs-tool-btn.active,
|
||||
.rs-speed-btn.active {
|
||||
color: var(--text);
|
||||
border-color: var(--red);
|
||||
background: rgba(230, 36, 41, 0.12);
|
||||
}
|
||||
|
||||
.rs-speed-group {
|
||||
display: inline-flex;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.rs-replay-map-slot {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.rs-replay-map-placeholder {
|
||||
min-height: 244px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
padding: var(--s5);
|
||||
color: var(--text-3);
|
||||
font-family: var(--f-mono);
|
||||
font-size: 11px;
|
||||
text-align: center;
|
||||
border: 1px dashed var(--border-2);
|
||||
background: var(--surface);
|
||||
}
|
||||
|
||||
.replay-map-panel {
|
||||
min-height: 244px;
|
||||
height: 100%;
|
||||
border: 1px solid var(--border);
|
||||
background: var(--surface);
|
||||
border-radius: var(--s2);
|
||||
}
|
||||
|
||||
.replay-map-stage {
|
||||
@@ -143,19 +76,15 @@
|
||||
stroke-width: 1.2;
|
||||
}
|
||||
|
||||
.replay-map-empty {
|
||||
.replay-map-empty-card {
|
||||
min-height: 244px;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
padding: var(--s5);
|
||||
color: var(--text-3);
|
||||
font-family: var(--f-mono);
|
||||
font-size: 11px;
|
||||
text-align: center;
|
||||
place-content: center;
|
||||
padding: var(--s6);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 860px) {
|
||||
.rs-replay-shell {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.replay-map-empty-card .empty-state-icon {
|
||||
margin: 0 auto var(--s3);
|
||||
color: var(--text-3);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user