@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 41 lines 1.2 KB
Raw
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 }