feat(backend,frontend): lot utilisateur #310 #311 #312 #313 — horodatage conversation, stop agent robuste, préférence terminal par défaut, paramètres projet (QA verte)
- #310: horodatage de tous les messages et événements de conversation visibles — composant partagé EntryTimestamp, timestamps propagés dans le transcript chat, les annonces inter-agent et le viewer de conversation, normalisation côté domain/adapters (conversation_log, paginate). - #311: stop d'agent robuste pour PTY non monté, sessions headless et CLI custom — lifecycle/orchestrator durcis, ponts chat app-tauri/web-server alignés, arrêt fiable sans session orpheline. - #312: préférence globale d'interface terminal par défaut — nouveau store settings (domain/application/infrastructure + tests), DTO et commandes backend, adapter frontend userSettings, panneau TerminalSettings dans les paramètres globaux. - #313: Paramètres du projet — contexte de projet éditable et couleur de thème par projet (ProjectSettingsPanel + projectTheme), teinte des onglets projet, persistance via DTO projet. QA verte (GO QA sur feature/batch-310-311-312-313-chat-stop-prefs-theme) — vérifications Git: git diff --cached --check OK; staging borné à crates/ et frontend/ (74 fichiers, +2105/-531), commit unique de lot conforme à la convention des lots (précédents batch-151/158/159, batch-210/211/212) car les fichiers partagés (dto.rs, commands.rs, CustomAgentChatView) entrelacent les 4 tickets. fichiers .ideai/* (agents/test.md, chat-drafts.json, system-permissions.json, tickets/counter.json, tickets/index.json, tickets/308-313/), attachments/ et scripts/ hors périmètre et préservés en worktree ; aucun push. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -32,6 +32,13 @@ export type { ToolbarProps } from "./ui/Toolbar";
|
||||
export { Spinner } from "./ui/Spinner";
|
||||
export type { SpinnerProps } from "./ui/Spinner";
|
||||
|
||||
export {
|
||||
EntryTimestamp,
|
||||
formatFullLocalTime,
|
||||
formatShortLocalTime,
|
||||
normalizeTimestamp,
|
||||
} from "./ui/EntryTimestamp";
|
||||
|
||||
export { zIndex } from "./ui/zIndex";
|
||||
export type { ZIndexLevel } from "./ui/zIndex";
|
||||
|
||||
|
||||
19
frontend/src/shared/ui/EntryTimestamp.test.tsx
Normal file
19
frontend/src/shared/ui/EntryTimestamp.test.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { EntryTimestamp, formatShortLocalTime } from "./EntryTimestamp";
|
||||
|
||||
describe("EntryTimestamp", () => {
|
||||
it("shows a stable local HH:mm and exposes the full zoned date", () => {
|
||||
const atMs = Date.UTC(2026, 8, 10, 12, 37);
|
||||
render(<EntryTimestamp atMs={atMs} />);
|
||||
const timestamp = screen.getByText(formatShortLocalTime(atMs)!);
|
||||
expect(timestamp.getAttribute("title")).toBeTruthy();
|
||||
expect(timestamp.getAttribute("tabindex")).toBe("0");
|
||||
});
|
||||
|
||||
it("does not invent a timestamp for legacy entries", () => {
|
||||
render(<EntryTimestamp atMs={null} />);
|
||||
expect(screen.getByLabelText("Heure indisponible").textContent).toBe("—");
|
||||
});
|
||||
});
|
||||
52
frontend/src/shared/ui/EntryTimestamp.tsx
Normal file
52
frontend/src/shared/ui/EntryTimestamp.tsx
Normal file
@ -0,0 +1,52 @@
|
||||
import { cn } from "../lib/cn";
|
||||
|
||||
export function normalizeTimestamp(atMs: number | null | undefined): number | null {
|
||||
return typeof atMs === "number" && Number.isFinite(atMs) && atMs > 0 && !Number.isNaN(new Date(atMs).getTime())
|
||||
? atMs
|
||||
: null;
|
||||
}
|
||||
|
||||
export function formatShortLocalTime(atMs: number | null | undefined): string | null {
|
||||
const value = normalizeTimestamp(atMs);
|
||||
if (value === null) return null;
|
||||
const parts = new Intl.DateTimeFormat(undefined, {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
hourCycle: "h23",
|
||||
}).formatToParts(new Date(value));
|
||||
const hour = parts.find((part) => part.type === "hour")?.value;
|
||||
const minute = parts.find((part) => part.type === "minute")?.value;
|
||||
return hour && minute ? `${hour}:${minute}` : null;
|
||||
}
|
||||
|
||||
export function formatFullLocalTime(atMs: number | null | undefined): string {
|
||||
const value = normalizeTimestamp(atMs);
|
||||
if (value === null) return "Heure indisponible";
|
||||
return new Intl.DateTimeFormat(undefined, {
|
||||
dateStyle: "full",
|
||||
timeStyle: "long",
|
||||
}).format(new Date(value));
|
||||
}
|
||||
|
||||
export function EntryTimestamp({
|
||||
atMs,
|
||||
className,
|
||||
}: {
|
||||
atMs: number | null | undefined;
|
||||
className?: string;
|
||||
}) {
|
||||
const value = normalizeTimestamp(atMs);
|
||||
const short = formatShortLocalTime(value);
|
||||
const full = formatFullLocalTime(value);
|
||||
return (
|
||||
<time
|
||||
dateTime={value === null ? undefined : new Date(value).toISOString()}
|
||||
title={full}
|
||||
aria-label={full}
|
||||
tabIndex={0}
|
||||
className={cn("shrink-0 text-faint", className)}
|
||||
>
|
||||
{short ?? "—"}
|
||||
</time>
|
||||
);
|
||||
}
|
||||
@ -21,6 +21,7 @@ export interface MenuBarItem {
|
||||
label: string;
|
||||
onSelect: () => void;
|
||||
disabled?: boolean;
|
||||
title?: string;
|
||||
/** Renders a selected/active marker (e.g. the currently-open panel). */
|
||||
active?: boolean;
|
||||
/**
|
||||
@ -124,6 +125,7 @@ export function MenuBar({ menus, className }: MenuBarProps) {
|
||||
<button
|
||||
type="button"
|
||||
disabled={item.disabled}
|
||||
title={item.title}
|
||||
aria-haspopup={hasSub ? "menu" : undefined}
|
||||
aria-expanded={hasSub ? subOpen : undefined}
|
||||
onClick={() => {
|
||||
|
||||
@ -16,6 +16,9 @@ export interface TabItem {
|
||||
label: string;
|
||||
/** Optional leading visual, such as a status indicator. */
|
||||
leading?: ReactNode;
|
||||
/** Optional project colour used only for this tab's subtle neutral tint. */
|
||||
themeColor?: string | null;
|
||||
themeAccent?: string | null;
|
||||
}
|
||||
|
||||
export interface TabsProps {
|
||||
@ -42,6 +45,14 @@ export function Tabs({ items, value, onSelect, onClose, className }: TabsProps)
|
||||
return (
|
||||
<div
|
||||
key={tab.id}
|
||||
style={
|
||||
tab.themeColor
|
||||
? {
|
||||
backgroundColor: `color-mix(in srgb, var(--color-raised) ${active ? 90 : 96}%, ${tab.themeColor})`,
|
||||
...(active ? { borderColor: tab.themeAccent ?? tab.themeColor } : {}),
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
className={cn(
|
||||
"group flex items-center gap-1 rounded-md border px-1 transition-colors",
|
||||
active
|
||||
|
||||
Reference in New Issue
Block a user