@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
tsx 65 lines 2.08 KB
Raw
1 import { useMessages } from "gt-react";
2 import { type ReactNode } from "react";
3 import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
4 import { cn } from "~/lib/utils";
5 import { type TimestampFormat } from "@t3tools/contracts/settings";
6 import { formatChatTimestampTooltip, formatDayAwareTimestamp } from "../../timestampFormat";
7
8 export const MESSAGE_HEADING_LEVEL = 3;
9
10 export function MessageAuthorHeading({ children }: { children: string }) {
11 return <h3 className="sr-only select-none">{children}</h3>;
12 }
13
14 export function TimelineRowTimestamp({
15 createdAt,
16 timestampFormat,
17 className,
18 alwaysVisible = false,
19 }: {
20 createdAt: string;
21 timestampFormat: TimestampFormat;
22 className?: string;
23 alwaysVisible?: boolean;
24 }) {
25 const m = useMessages();
26 return (
27 <Tooltip>
28 <TooltipTrigger
29 render={
30 <span
31 className={cn(
32 "pointer-events-none absolute me-1 shrink-0 whitespace-nowrap rounded-md text-muted-foreground text-xs tabular-nums opacity-0 group-hover/timeline-row:pointer-events-auto group-hover/timeline-row:static group-hover/timeline-row:opacity-100 group-focus-within/timeline-row:pointer-events-auto group-focus-within/timeline-row:static group-focus-within/timeline-row:opacity-100",
33 alwaysVisible && "pointer-events-auto static opacity-100",
34 className,
35 )}
36 />
37 }
38 >
39 {formatDayAwareTimestamp(createdAt, timestampFormat, undefined, undefined, m)}
40 </TooltipTrigger>
41 <TooltipPopup>{formatChatTimestampTooltip(createdAt, timestampFormat, m)}</TooltipPopup>
42 </Tooltip>
43 );
44 }
45
46 export function ActivityShimmerOverlay({
47 children,
48 className,
49 }: {
50 children: ReactNode;
51 className?: string;
52 }) {
53 return (
54 <span
55 aria-hidden
56 className="live-activity-focus pointer-events-none absolute inset-y-0 select-none"
57 >
58 <span className="live-activity-focus-counter block">
59 <span className={cn("live-activity-focus-aligned block text-foreground", className)}>
60 {children}
61 </span>
62 </span>
63 </span>
64 );
65 }