MCPcopy Create free account
hub / github.com/freecodexyz/free-code / MessageTimestamp

Function MessageTimestamp

src/components/MessageTimestamp.tsx:10–59  ·  view source on GitHub ↗
(t0)

Source from the content-addressed store, hash-verified

8 isTranscriptMode: boolean;
9};
10export function MessageTimestamp(t0) {
11 const $ = _c(10);
12 const {
13 message,
14 isTranscriptMode
15 } = t0;
16 const shouldShowTimestamp = isTranscriptMode && message.timestamp && message.type === "assistant" && message.message.content.some(_temp);
17 if (!shouldShowTimestamp) {
18 return null;
19 }
20 let T0;
21 let formattedTimestamp;
22 let t1;
23 if ($[0] !== message.timestamp) {
24 formattedTimestamp = new Date(message.timestamp).toLocaleTimeString("en-US", {
25 hour: "2-digit",
26 minute: "2-digit",
27 hour12: true
28 });
29 T0 = Box;
30 t1 = stringWidth(formattedTimestamp);
31 $[0] = message.timestamp;
32 $[1] = T0;
33 $[2] = formattedTimestamp;
34 $[3] = t1;
35 } else {
36 T0 = $[1];
37 formattedTimestamp = $[2];
38 t1 = $[3];
39 }
40 let t2;
41 if ($[4] !== formattedTimestamp) {
42 t2 = <Text dimColor={true}>{formattedTimestamp}</Text>;
43 $[4] = formattedTimestamp;
44 $[5] = t2;
45 } else {
46 t2 = $[5];
47 }
48 let t3;
49 if ($[6] !== T0 || $[7] !== t1 || $[8] !== t2) {
50 t3 = <T0 minWidth={t1}>{t2}</T0>;
51 $[6] = T0;
52 $[7] = t1;
53 $[8] = t2;
54 $[9] = t3;
55 } else {
56 t3 = $[9];
57 }
58 return t3;
59}
60function _temp(c) {
61 return c.type === "text";
62}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected