fix(web): use a time-only timestamp in the compact column entries (#1616)
At the 320px column minimum the full ISO timestamp ate most of line 1. Use an HH:MM:SS (UTC) form in the embedded HistoryEntry/NetworkEntry headers only; the full-size layouts keep the full ISO string. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3550b64032
commit
efddd94bea
4 changed files with 25 additions and 4 deletions
|
|
@ -212,7 +212,12 @@ describe("HistoryEntry", () => {
|
||||||
renderWithMantine(
|
renderWithMantine(
|
||||||
<HistoryEntry {...baseProps} entry={successEntry} embedded />,
|
<HistoryEntry {...baseProps} entry={successEntry} embedded />,
|
||||||
);
|
);
|
||||||
// Line 1 essentials plus the method are still shown.
|
// Line 1 essentials plus the method are still shown. The timestamp is the
|
||||||
|
// compact time-only form (not the full ISO) to fit the narrow line.
|
||||||
|
expect(screen.getByText("10:30:00")).toBeInTheDocument();
|
||||||
|
expect(
|
||||||
|
screen.queryByText("2026-03-17T10:30:00.000Z"),
|
||||||
|
).not.toBeInTheDocument();
|
||||||
expect(screen.getByText("client → server")).toBeInTheDocument();
|
expect(screen.getByText("client → server")).toBeInTheDocument();
|
||||||
expect(screen.getByText("142ms")).toBeInTheDocument();
|
expect(screen.getByText("142ms")).toBeInTheDocument();
|
||||||
expect(screen.getByText("OK")).toBeInTheDocument();
|
expect(screen.getByText("OK")).toBeInTheDocument();
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,12 @@ function formatTimestamp(date: Date): string {
|
||||||
return date.toISOString();
|
return date.toISOString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Time-only (HH:MM:SS, UTC) for the compact column header, where the full ISO
|
||||||
|
// string would eat most of the narrow line-1 width (#1616).
|
||||||
|
function formatTimestampCompact(date: Date): string {
|
||||||
|
return date.toISOString().slice(11, 19);
|
||||||
|
}
|
||||||
|
|
||||||
function extractTarget(entry: MessageEntry): string | undefined {
|
function extractTarget(entry: MessageEntry): string | undefined {
|
||||||
const msg = entry.message;
|
const msg = entry.message;
|
||||||
if (!("params" in msg) || !msg.params) return undefined;
|
if (!("params" in msg) || !msg.params) return undefined;
|
||||||
|
|
@ -161,7 +167,7 @@ export function HistoryEntry({
|
||||||
<HeaderRow>
|
<HeaderRow>
|
||||||
<HeaderCluster>
|
<HeaderCluster>
|
||||||
<TimestampText>
|
<TimestampText>
|
||||||
{formatTimestamp(entry.timestamp)}
|
{formatTimestampCompact(entry.timestamp)}
|
||||||
</TimestampText>
|
</TimestampText>
|
||||||
{directionBadge}
|
{directionBadge}
|
||||||
</HeaderCluster>
|
</HeaderCluster>
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,11 @@ describe("NetworkEntry", () => {
|
||||||
renderWithMantine(
|
renderWithMantine(
|
||||||
<NetworkEntry entry={baseEntry} isListExpanded={false} embedded />,
|
<NetworkEntry entry={baseEntry} isListExpanded={false} embedded />,
|
||||||
);
|
);
|
||||||
// Line 1: method, category, duration, status.
|
// Line 1: compact time-only timestamp, method, category, duration, status.
|
||||||
|
expect(screen.getByText("10:00:00")).toBeInTheDocument();
|
||||||
|
expect(
|
||||||
|
screen.queryByText("2026-03-17T10:00:00.000Z"),
|
||||||
|
).not.toBeInTheDocument();
|
||||||
expect(screen.getByText("POST")).toBeInTheDocument();
|
expect(screen.getByText("POST")).toBeInTheDocument();
|
||||||
expect(screen.getByText("transport")).toBeInTheDocument();
|
expect(screen.getByText("transport")).toBeInTheDocument();
|
||||||
expect(screen.getByText("45ms")).toBeInTheDocument();
|
expect(screen.getByText("45ms")).toBeInTheDocument();
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,12 @@ function formatTimestamp(date: Date): string {
|
||||||
return date.toISOString();
|
return date.toISOString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Time-only (HH:MM:SS, UTC) for the compact column header, where the full ISO
|
||||||
|
// string would eat most of the narrow line-1 width (#1616).
|
||||||
|
function formatTimestampCompact(date: Date): string {
|
||||||
|
return date.toISOString().slice(11, 19);
|
||||||
|
}
|
||||||
|
|
||||||
function statusColor(entry: FetchRequestEntry): string {
|
function statusColor(entry: FetchRequestEntry): string {
|
||||||
if (entry.error) return "red";
|
if (entry.error) return "red";
|
||||||
const status = entry.responseStatus;
|
const status = entry.responseStatus;
|
||||||
|
|
@ -266,7 +272,7 @@ export function NetworkEntry({
|
||||||
<HeaderRow>
|
<HeaderRow>
|
||||||
<HeaderCluster>
|
<HeaderCluster>
|
||||||
<TimestampText>
|
<TimestampText>
|
||||||
{formatTimestamp(entry.timestamp)}
|
{formatTimestampCompact(entry.timestamp)}
|
||||||
</TimestampText>
|
</TimestampText>
|
||||||
<Badge color="dark">{entry.method}</Badge>
|
<Badge color="dark">{entry.method}</Badge>
|
||||||
<Badge color={categoryColor(entry.category)} variant="light">
|
<Badge color={categoryColor(entry.category)} variant="light">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue