@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, 06:00 UTC

main
tsx 34 lines 1.09 KB
Raw
1 /** @jsxRuntime automatic */
2 /** @jsxImportSource @alchemy.run/sigil */
3 /**
4 * Shared rows for the Plan tree. Review and apply modes both render
5 * namespaces through this component so they look like the same tree.
6 */
7 import type { JSX } from "react";
8 import { theme } from "../../../Util/Theme.ts";
9 import { Row, Text, useGlyphs } from "../ui/index.ts";
10 import { actionStyle, type PlanAction } from "./statusStyle.ts";
11
12 export const namespaceStyle = (action: string): (typeof actionStyle)[PlanAction] =>
13 actionStyle[action as PlanAction] ?? {
14 color: theme.color.muted,
15 icon: "info",
16 };
17
18 /** A namespace node: rolled-up action icon + accent-colored id. */
19 type NamespaceRowProps = {
20 readonly id: string;
21 readonly depth: number;
22 readonly action: string;
23 };
24
25 export function NamespaceRow({ id, depth, action }: NamespaceRowProps): JSX.Element {
26 const style = namespaceStyle(action);
27 const glyphs = useGlyphs();
28 return (
29 <Row gap={1} paddingLeft={depth * 2}>
30 <Text color={style.color}>{glyphs[style.icon]}</Text>
31 <Text color={theme.color.accent}>{id}</Text>
32 </Row>
33 );
34 }