The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import type { EnvironmentId } from "@t3tools/contracts"; |
| 2 | import { formatAttachmentSize } from "@t3tools/client-runtime/state/attachments"; |
| 3 | import { useMessages } from "gt-react"; |
| 4 | |
| 5 | import { useFileMetadata } from "../../hooks/useFileMetadata"; |
| 6 | import { PierreEntryIcon } from "./PierreEntryIcon"; |
| 7 | |
| 8 | export function WorkspaceEntryIcon(props: { |
| 9 | path: string; |
| 10 | environmentId?: EnvironmentId | null | undefined; |
| 11 | cwd?: string | undefined; |
| 12 | theme: "light" | "dark"; |
| 13 | }) { |
| 14 | const metadata = useFileMetadata(props.environmentId, props.path, props.cwd); |
| 15 | return ( |
| 16 | <PierreEntryIcon |
| 17 | pathValue={props.path} |
| 18 | kind={metadata?.kind === "directory" ? "directory" : "file"} |
| 19 | mimeType={metadata?.mimeType} |
| 20 | theme={props.theme} |
| 21 | /> |
| 22 | ); |
| 23 | } |
| 24 | |
| 25 | export function WorkspaceEntryTooltip(props: { |
| 26 | path: string; |
| 27 | label?: string; |
| 28 | environmentId?: EnvironmentId | null | undefined; |
| 29 | cwd?: string | undefined; |
| 30 | }) { |
| 31 | const metadata = useFileMetadata(props.environmentId, props.path, props.cwd); |
| 32 | const messages = useMessages(); |
| 33 | return ( |
| 34 | <> |
| 35 | {props.label ?? props.path} |
| 36 | {metadata?.byteLength === undefined |
| 37 | ? null |
| 38 | : ` · ${formatAttachmentSize(metadata.byteLength, messages)}`} |
| 39 | </> |
| 40 | ); |
| 41 | } |