story-kit: merge 144_story_add_build_timestamp_and_persist_chat_history_across_rebuilds
This commit is contained in:
@@ -131,6 +131,11 @@ describe("ChatHeader", () => {
|
||||
expect(onToggleTools).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("displays the build timestamp in human-readable format", () => {
|
||||
render(<ChatHeader {...makeProps()} />);
|
||||
expect(screen.getByText("Built: 2026-01-01 00:00")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows disabled placeholder when claudeModels is empty and no API key", () => {
|
||||
render(
|
||||
<ChatHeader
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
function formatBuildTime(isoString: string): string {
|
||||
const d = new Date(isoString);
|
||||
const year = d.getUTCFullYear();
|
||||
const month = String(d.getUTCMonth() + 1).padStart(2, "0");
|
||||
const day = String(d.getUTCDate()).padStart(2, "0");
|
||||
const hours = String(d.getUTCHours()).padStart(2, "0");
|
||||
const minutes = String(d.getUTCMinutes()).padStart(2, "0");
|
||||
return `Built: ${year}-${month}-${day} ${hours}:${minutes}`;
|
||||
}
|
||||
|
||||
interface ContextUsage {
|
||||
used: number;
|
||||
total: number;
|
||||
@@ -109,6 +119,18 @@ export function ChatHeader({
|
||||
</div>
|
||||
|
||||
<div style={{ display: "flex", alignItems: "center", gap: "16px" }}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: "0.75em",
|
||||
color: "#555",
|
||||
whiteSpace: "nowrap",
|
||||
fontFamily: "monospace",
|
||||
}}
|
||||
title={__BUILD_TIME__}
|
||||
>
|
||||
{formatBuildTime(__BUILD_TIME__)}
|
||||
</div>
|
||||
|
||||
<div
|
||||
style={{
|
||||
fontSize: "0.9em",
|
||||
|
||||
4
frontend/src/vite-env.d.ts
vendored
4
frontend/src/vite-env.d.ts
vendored
@@ -1,5 +1,9 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare global {
|
||||
const __BUILD_TIME__: string;
|
||||
}
|
||||
|
||||
declare module "react" {
|
||||
interface InputHTMLAttributes<T> {
|
||||
webkitdirectory?: string;
|
||||
|
||||
@@ -8,6 +8,7 @@ export default defineConfig(() => {
|
||||
plugins: [react()],
|
||||
define: {
|
||||
__STORYKIT_PORT__: JSON.stringify(String(backendPort)),
|
||||
__BUILD_TIME__: JSON.stringify(new Date().toISOString()),
|
||||
},
|
||||
server: {
|
||||
port: backendPort + 2172,
|
||||
|
||||
@@ -3,6 +3,9 @@ import { defineConfig } from "vitest/config";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
define: {
|
||||
__BUILD_TIME__: JSON.stringify("2026-01-01T00:00:00.000Z"),
|
||||
},
|
||||
test: {
|
||||
environment: "jsdom",
|
||||
globals: true,
|
||||
|
||||
Reference in New Issue
Block a user