mirror of
https://github.com/rommapp/romm.git
synced 2026-11-29 01:58:41 +01:00
feat(v2): even out the top-bar pills and stream the scan progress
- The scan indicator, the now-playing pill and the user menu trigger share a new `--r-nav-pill-h` layout token, so the three pills line up at the same height. - The scan indicator drops its spinner; its bottom progress bar carries the activity instead, with a glow streaming along the unfilled track while the scan runs. The glow is a new `stream` mode on RProgressLinear. - On portrait phones the now-playing title is capped narrower and loops, so the pill no longer crowds the bar; landscape keeps the wider title. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01S76JZm1jjh32KhBbPCBvGW
This commit is contained in:
@@ -50,6 +50,7 @@ const NAME_OVERRIDES = {
|
||||
space: { rowPad: "--r-row-pad" },
|
||||
layout: {
|
||||
navHeight: "--r-nav-h",
|
||||
navPillHeight: "--r-nav-pill-h",
|
||||
bottomNavHeight: "--r-bottom-nav-h",
|
||||
bottomNavMaxWidth: "--r-bottom-nav-max-w",
|
||||
touchTarget: "--r-touch-target",
|
||||
|
||||
@@ -2,20 +2,18 @@
|
||||
// ScanningIndicator — live status pill that appears in the AppNav
|
||||
// right cluster whenever a library scan is in progress.
|
||||
//
|
||||
// Three signals stack inside the pill:
|
||||
// * a spinner on the leading edge for "something is happening",
|
||||
// Two signals stack inside the pill:
|
||||
// * a counter (scanned / total when known, scanned-only as soon
|
||||
// as the backend has reported a total ≥ scanned),
|
||||
// * a thin progress bar pinned to the bottom edge — determinate
|
||||
// when `total_roms` is known, indeterminate otherwise (the
|
||||
// scanner discovers files as it goes, so totals show up after
|
||||
// the first platform finishes).
|
||||
// with a glow streaming ahead of the fill when `total_roms` is
|
||||
// known, indeterminate otherwise (the scanner discovers files as
|
||||
// it goes, so totals show up after the first platform finishes).
|
||||
//
|
||||
// Click jumps to /scan so the user can inspect the live log.
|
||||
// Hidden on /scan itself. Honours `prefers-reduced-motion` by
|
||||
// dropping the shimmer + pulse animations; the spinner + progress
|
||||
// bar keep moving since they communicate live data, not affect.
|
||||
import { RIcon, RProgressLinear, RSpinner, RTooltip } from "@v2/lib";
|
||||
// Hidden on /scan itself. Under reduced motion the progress bar keeps
|
||||
// filling but drops its streaming glow.
|
||||
import { RIcon, RProgressLinear, RTooltip } from "@v2/lib";
|
||||
import { storeToRefs } from "pinia";
|
||||
import { computed } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
@@ -68,7 +66,6 @@ const counterLabel = computed(() => {
|
||||
:aria-label="t('scan.scanning-library')"
|
||||
>
|
||||
<span class="r-scan-indicator__row">
|
||||
<RSpinner size="14" color="primary" />
|
||||
<span class="r-scan-indicator__label">
|
||||
{{ t("scan.scanning") }}
|
||||
</span>
|
||||
@@ -93,6 +90,7 @@ const counterLabel = computed(() => {
|
||||
:height="2"
|
||||
color="primary"
|
||||
:rounded="false"
|
||||
stream
|
||||
/>
|
||||
</router-link>
|
||||
</template>
|
||||
@@ -111,7 +109,7 @@ const counterLabel = computed(() => {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 0;
|
||||
height: 32px;
|
||||
height: var(--r-nav-pill-h);
|
||||
padding: 0 12px;
|
||||
border-radius: var(--r-radius-pill);
|
||||
background: color-mix(in srgb, var(--r-color-brand-primary) 14%, transparent);
|
||||
@@ -138,8 +136,8 @@ const counterLabel = computed(() => {
|
||||
);
|
||||
}
|
||||
|
||||
/* Content row sits above the bottom-pinned progress bar — top-aligned
|
||||
inside the pill so the counter's baseline matches the spinner's. */
|
||||
/* Content row sits above the bottom-pinned progress bar, with the counter
|
||||
centred on the label or radar glyph. */
|
||||
.r-scan-indicator__row {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -333,7 +333,7 @@ async function onLogout() {
|
||||
border-radius: var(--r-radius-pill) !important;
|
||||
padding: 3px 12px 3px 3px !important;
|
||||
color: var(--r-color-fg) !important;
|
||||
height: auto !important;
|
||||
height: var(--r-nav-pill-h) !important;
|
||||
min-width: 0 !important;
|
||||
opacity: 1;
|
||||
transition: background var(--r-motion-fast) var(--r-motion-ease-out);
|
||||
|
||||
@@ -108,7 +108,8 @@ const progress = computed(() =>
|
||||
display: flex;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
padding: 1px 2px 1px 1px;
|
||||
height: var(--r-nav-pill-h);
|
||||
padding: 0 2px 0 0;
|
||||
background: var(--r-color-surface);
|
||||
border: 1px solid var(--r-color-border-strong);
|
||||
border-radius: var(--r-radius-pill);
|
||||
@@ -145,6 +146,12 @@ const progress = computed(() =>
|
||||
flex: 0 1 160px;
|
||||
font-size: var(--r-font-size-sm);
|
||||
}
|
||||
|
||||
/* Portrait phones cap the title and let it loop instead of widening the pill. */
|
||||
html[data-bp~="xs"] .r-v2-np-pill__title {
|
||||
flex-basis: 88px;
|
||||
width: 88px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -13,6 +13,7 @@ const meta: Meta<typeof RProgressLinear> = {
|
||||
indeterminate: { control: "boolean" },
|
||||
rounded: { control: "boolean" },
|
||||
striped: { control: "boolean" },
|
||||
stream: { control: "boolean" },
|
||||
},
|
||||
};
|
||||
|
||||
@@ -116,6 +117,22 @@ export const Striped: Story = {
|
||||
}),
|
||||
};
|
||||
|
||||
// ── Stream (work still running between updates) ────────────
|
||||
|
||||
export const Stream: Story = {
|
||||
name: "Stream (running between updates)",
|
||||
args: { modelValue: 30, stream: true, height: 4, color: "primary" },
|
||||
render: (args) => ({
|
||||
components: { RProgressLinear },
|
||||
setup: () => ({ args }),
|
||||
template: `
|
||||
<div style="width:360px;padding:24px">
|
||||
<RProgressLinear v-bind="args" />
|
||||
</div>
|
||||
`,
|
||||
}),
|
||||
};
|
||||
|
||||
// ── With external label (typical compose pattern) ──────────
|
||||
|
||||
export const WithLabel: Story = {
|
||||
|
||||
@@ -42,6 +42,9 @@ interface Props {
|
||||
/** Diagonal stripe overlay — keeps the bar feeling active even when
|
||||
* `modelValue` isn't changing. Ignored when `indeterminate`. */
|
||||
striped?: boolean;
|
||||
/** A glow sweeping the unfilled track, for work that is still running
|
||||
* between value updates. Ignored when `indeterminate`. */
|
||||
stream?: boolean;
|
||||
/** Accessible label. Defaults to "Progress". */
|
||||
ariaLabel?: string;
|
||||
}
|
||||
@@ -55,6 +58,7 @@ const props = withDefaults(defineProps<Props>(), {
|
||||
bgColor: undefined,
|
||||
rounded: true,
|
||||
striped: false,
|
||||
stream: false,
|
||||
ariaLabel: undefined,
|
||||
});
|
||||
|
||||
@@ -131,6 +135,11 @@ const wrapperStyle = computed(() => {
|
||||
class="r-progress-linear__buffer"
|
||||
:style="{ width: `${clampedBuffer}%` }"
|
||||
/>
|
||||
<div
|
||||
v-if="stream && !indeterminate"
|
||||
class="r-progress-linear__stream"
|
||||
:style="{ insetInlineStart: `${clampedValue}%` }"
|
||||
/>
|
||||
<div class="r-progress-linear__fill" :style="fillStyle" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -191,6 +200,38 @@ const wrapperStyle = computed(() => {
|
||||
}
|
||||
}
|
||||
|
||||
/* Stream — a soft glow travels the unfilled track from the fill's edge to
|
||||
the end, on a loop. */
|
||||
.r-progress-linear__stream {
|
||||
position: absolute;
|
||||
inset-block: 0;
|
||||
inset-inline-end: 0;
|
||||
overflow: hidden;
|
||||
transition: inset-inline-start var(--r-motion-med) var(--r-motion-ease-out);
|
||||
}
|
||||
.r-progress-linear__stream::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset-block: 0;
|
||||
inset-inline-start: 0;
|
||||
width: 40%;
|
||||
background: linear-gradient(
|
||||
to right,
|
||||
transparent,
|
||||
var(--r-prog-color),
|
||||
transparent
|
||||
);
|
||||
animation: r-progress-stream 1.6s ease-in-out infinite;
|
||||
}
|
||||
@keyframes r-progress-stream {
|
||||
from {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
to {
|
||||
transform: translateX(250%);
|
||||
}
|
||||
}
|
||||
|
||||
/* Indeterminate — single block slides across the track on a loop.
|
||||
`inset-inline-*` so RTL flips the direction automatically without
|
||||
a separate keyframe set. */
|
||||
@@ -218,9 +259,14 @@ const wrapperStyle = computed(() => {
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.r-progress-linear__fill,
|
||||
.r-progress-linear__buffer {
|
||||
.r-progress-linear__buffer,
|
||||
.r-progress-linear__stream {
|
||||
transition: none;
|
||||
}
|
||||
.r-progress-linear__stream::after {
|
||||
animation: none;
|
||||
opacity: 0;
|
||||
}
|
||||
.r-progress-linear--striped .r-progress-linear__fill,
|
||||
.r-progress-linear--indeterminate .r-progress-linear__fill {
|
||||
animation: none;
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
--r-focus-ring-width: 2px;
|
||||
--r-focus-ring-offset: 3px;
|
||||
--r-nav-h: 58px;
|
||||
--r-nav-pill-h: 38px;
|
||||
--r-bottom-nav-h: 58px;
|
||||
--r-bottom-nav-max-w: 480px;
|
||||
--r-touch-target: 44px;
|
||||
|
||||
@@ -387,10 +387,13 @@ export const zIndex = {
|
||||
// Layout constants from the mockup.
|
||||
export const layout = {
|
||||
navHeight: "58px",
|
||||
// Pills in the top bar's right cluster (scan indicator, mini player, user
|
||||
// menu) share one height so they line up.
|
||||
navPillHeight: "38px",
|
||||
// Fixed bottom tab bar shown on phones (xs). Mirrors navHeight so the
|
||||
// top and bottom chrome read as a matched pair. Consumed as
|
||||
// `--r-bottom-nav-h` to reserve space in AppLayout and offset the
|
||||
// gallery scroll height / MiniPlayer on mobile.
|
||||
// gallery scroll height on mobile.
|
||||
bottomNavHeight: "58px",
|
||||
// Cap for the bottom tab bar pill so it stays thumb-sized on large
|
||||
// tablets (the sm range reaches 959px) instead of stretching the four
|
||||
|
||||
Reference in New Issue
Block a user