style(v2): widen state cards and show one timestamp everywhere

State cards in the flow grid were narrow enough that labels, chips and the
timestamp stacked them taller than wide. Cells now start at 300px (shrinking
on a phone rather than overflowing), which also gives the screenshot room.

The relative and exact time now render through AssetTimestamp everywhere:
side by side on state cards, the launch view preview and phone save rows,
where the exact moment is no longer hidden. The preview drops its own
clock icon and dot separator.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
zurdi
2026-09-23 16:44:01 +02:00
parent b5e50a14cc
commit 3965463590
5 changed files with 50 additions and 52 deletions

View File

@@ -6,9 +6,10 @@ import { RIcon, RTag, RTooltip } from "@v2/lib";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import type { SaveSchema, StateSchema } from "@/__generated__";
import { formatBytes, formatRelativeDate, formatTimestamp } from "@/utils";
import { formatBytes, formatTimestamp } from "@/utils";
import AssetFavoriteMark from "@/v2/components/shared/AssetFavoriteMark.vue";
import AssetLabels from "@/v2/components/shared/AssetLabels.vue";
import AssetTimestamp from "@/v2/components/shared/AssetTimestamp.vue";
import { dateOf, type AssetDateField } from "@/v2/utils/assets";
import { toCssUrl } from "@/v2/utils/css";
@@ -197,13 +198,11 @@ const emptyText = computed(() =>
{{ formatBytes(asset.file_size_bytes) }}
</span>
</div>
<p class="r-asset-preview__when">
<RIcon icon="mdi-clock-outline" size="11" />
{{ formatRelativeDate(dateOf(asset, timestamp)) }}
<span class="r-asset-preview__when-exact">
{{ formatTimestamp(dateOf(asset, timestamp), locale) }}
</span>
</p>
<AssetTimestamp
class="r-asset-preview__when"
:date="dateOf(asset, timestamp)"
inline
/>
</div>
<!-- For states this stays as an empty block: the stage already carries
@@ -517,25 +516,6 @@ const emptyText = computed(() =>
color: var(--r-color-fg-secondary);
}
.r-asset-preview__when {
margin: 0;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 4px;
font-size: 11px;
color: var(--r-color-fg-secondary);
font-variant-numeric: tabular-nums;
}
.r-asset-preview__when-exact {
color: var(--r-color-fg-muted);
}
/* Separates the exact stamp from the relative one it trails. */
.r-asset-preview__when-exact::before {
content: "·";
margin-right: 4px;
}
.r-asset-preview__empty-hint {
margin: 0;
font-size: 12px;

View File

@@ -310,6 +310,7 @@ const fadeIndex = computed(() =>
class="r-asset-list__time"
:date="dateOf(asset, timestamp)"
:align="xs ? 'start' : 'end'"
:inline="xs"
/>
<span v-if="!selectable" class="r-asset-list__actions">
@@ -574,24 +575,26 @@ const fadeIndex = computed(() =>
/* Phones give each part its own band, which `display: contents` allows by
lifting the text block's children into the row grid: the name rides the
thumbnail, then labels, then facts beside the timestamp, then the actions. */
thumbnail, then labels, facts, the timestamp and the actions. */
html[data-bp~="xs"] .r-asset-list__row {
padding: var(--r-space-2) var(--r-space-3);
grid-template-columns: auto minmax(0, 1fr) auto;
grid-template-columns: auto minmax(0, 1fr);
grid-template-areas:
"icon name name"
"labels labels labels"
"facts facts time"
"actions actions actions";
"icon name"
"labels labels"
"facts facts"
"time time"
"actions actions";
gap: var(--r-space-1) var(--r-space-3);
}
html[data-bp~="xs"] .r-asset-list__row--checkable {
grid-template-columns: auto auto minmax(0, 1fr) auto;
grid-template-columns: auto auto minmax(0, 1fr);
grid-template-areas:
"check icon name name"
"check labels labels labels"
"check facts facts time"
"check actions actions actions";
"check icon name"
"check labels labels"
"check facts facts"
"check time time"
"check actions actions";
}
html[data-bp~="xs"] .r-asset-list__check {
grid-area: check;

View File

@@ -252,6 +252,7 @@ const fadeIndex = computed(() =>
/>
<AssetTimestamp
:date="asset.updated_at"
:inline="layout === 'flow'"
class="r-asset-strip__time"
/>
<AssetOwnerChip
@@ -361,12 +362,11 @@ const fadeIndex = computed(() =>
border-radius: 6px;
}
/* Flow layout (Save data subtab): a responsive grid instead of a single
horizontal scroll row. Tiles fill their grid cell, so the per-tile
flex-basis below is overridden. */
/* Flow layout: a responsive grid with cells wide enough that labels and chips
don't stack a tile too tall. min() lets a lone column shrink on a phone. */
.r-asset-strip--flow .r-asset-strip__track {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
overflow: visible;
scroll-snap-type: none;
padding: 4px 0;

View File

@@ -15,5 +15,14 @@ describe("AssetTimestamp", () => {
expect(wrapper.get(".r-asset-timestamp__relative").text()).not.toBe("");
expect(wrapper.get(".r-asset-timestamp__exact").text()).toMatch(/2026/);
expect(wrapper.classes()).toContain("r-asset-timestamp--end");
expect(wrapper.classes()).not.toContain("r-asset-timestamp--inline");
});
it("sets the two side by side when inline", () => {
const wrapper = mount(AssetTimestamp, {
props: { date: "2026-09-16T12:00:00Z", inline: true },
});
expect(wrapper.classes()).toContain("r-asset-timestamp--inline");
});
});

View File

@@ -1,13 +1,15 @@
<script setup lang="ts">
// When an asset was last written: relative first, the exact moment under it.
// When an asset was last written: relative first, the exact moment under it
// (or beside it when `inline`).
import { useI18n } from "vue-i18n";
import { formatRelativeDate, formatTimestamp } from "@/utils";
defineOptions({ inheritAttrs: false });
withDefaults(defineProps<{ date: string; align?: "start" | "end" }>(), {
align: "start",
});
withDefaults(
defineProps<{ date: string; align?: "start" | "end"; inline?: boolean }>(),
{ align: "start", inline: false },
);
const { locale } = useI18n();
</script>
@@ -15,7 +17,10 @@ const { locale } = useI18n();
<template>
<span
class="r-asset-timestamp"
:class="`r-asset-timestamp--${align}`"
:class="[
`r-asset-timestamp--${align}`,
{ 'r-asset-timestamp--inline': inline },
]"
v-bind="$attrs"
>
<span class="r-asset-timestamp__relative">
@@ -38,6 +43,12 @@ const { locale } = useI18n();
.r-asset-timestamp--end {
align-items: flex-end;
}
.r-asset-timestamp--inline {
flex-direction: row;
flex-wrap: wrap;
align-items: baseline;
column-gap: 6px;
}
.r-asset-timestamp__relative {
font-size: 11px;
font-weight: var(--r-font-weight-medium);
@@ -48,9 +59,4 @@ const { locale } = useI18n();
color: var(--r-color-fg-muted);
font-variant-numeric: tabular-nums;
}
/* On a phone the exact moment is the first thing to go; tooltips keep it. */
html[data-bp~="xs"] .r-asset-timestamp__exact {
display: none;
}
</style>