From 37082b217653b33da1ff5318293ceec28a253f9b Mon Sep 17 00:00:00 2001 From: Jay V Date: Tue, 27 May 2025 20:38:23 -0400 Subject: styling share --- app/packages/web/src/components/Share.tsx | 125 ++++++++++++++++++++++++++---- 1 file changed, 108 insertions(+), 17 deletions(-) (limited to 'app/packages/web/src/components/Share.tsx') diff --git a/app/packages/web/src/components/Share.tsx b/app/packages/web/src/components/Share.tsx index 22b9c5f8f..3f19b4c80 100644 --- a/app/packages/web/src/components/Share.tsx +++ b/app/packages/web/src/components/Share.tsx @@ -1,4 +1,15 @@ -import { createSignal, onCleanup, onMount, Show, For, createMemo } from "solid-js" +import { + For, + Show, + Match, + Switch, + onMount, + onCleanup, + createMemo, + createSignal, +} from "solid-js" +import { DateTime } from "luxon" +import { IconCpuChip, IconSparkles, IconUserCircle, IconWrenchScrewdriver } from "./icons" import styles from "./share.module.css" import { type UIMessage } from "ai" import { createStore, reconcile } from "solid-js/store" @@ -8,17 +19,17 @@ type Status = "disconnected" | "connecting" | "connected" | "error" | "reconnect type SessionMessage = UIMessage<{ time: { - created: number; - completed?: number; - }; - sessionID: string; + created: number + completed?: number + } + sessionID: string tool: Record; + properties: Record time: { - start: number; - end: number; - }; - }>; + start: number + end: number + } + }> }> type SessionInfo = { @@ -41,6 +52,14 @@ function getStatusText(status: [Status, string?]): string { } } +function TextPart(props: { text: string }) { + return ( +
+
{props.text}
+
+ ) +} + export default function Share(props: { api: string }) { let params = new URLSearchParams(document.location.search) const sessionId = params.get("id") @@ -151,6 +170,16 @@ export default function Share(props: { api: string }) { }) }) + function renderTime(time: number) { + return ( + + {DateTime.fromMillis(time).toLocaleString(DateTime.TIME_WITH_SECONDS)} + + ) + } + return (
@@ -158,13 +187,13 @@ export default function Share(props: { api: string }) {

{store.info?.title}

- {getStatusText(connectionStatus())} + {getStatusText(connectionStatus())}

-
    +
    • - Input Tokens + Input Tokens {store.info?.tokens?.input ? {store.info?.tokens?.input} : @@ -172,7 +201,7 @@ export default function Share(props: { api: string }) { }
    • - Output Tokens + Output Tokens {store.info?.tokens?.output ? {store.info?.tokens?.output} : @@ -180,7 +209,7 @@ export default function Share(props: { api: string }) { }
    • - Reasoning Tokens + Reasoning Tokens {store.info?.tokens?.reasoning ? {store.info?.tokens?.reasoning} : @@ -188,12 +217,74 @@ export default function Share(props: { api: string }) { }
    -
    - +
    + {messages().length > 0 && messages()[0].metadata?.time.created ? + + {DateTime.fromMillis( + messages()[0].metadata?.time.created || 0 + ).toLocaleString(DateTime.DATE_MED)} + + : + Started at — + }
+
+ 0} + fallback={

Waiting for messages...

} + > +
+ + {(msg) => ( + + {(part) => ( +
+
+
+ + }> + + + + + + + + + + +
+
+
+
+ + {renderTime( + msg.metadata?.time.completed + || msg.metadata?.time.created + || 0 + )} +
+
+ )} +
+ )} +
+
+
+
+