Skip to content

Commit ad71edc

Browse files
samejrericallam
authored andcommitted
Copy raw properties footer behind isAdmin
1 parent 801e004 commit ad71edc

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

apps/webapp/app/components/runs/v3/ai/AISpanDetails.tsx

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import { CheckIcon, ClipboardDocumentIcon } from "@heroicons/react/20/solid";
12
import { useState } from "react";
2-
import { Clipboard, ClipboardCheck } from "lucide-react";
3+
import { Button } from "~/components/primitives/Buttons";
34
import { TabButton, TabContainer } from "~/components/primitives/Tabs";
4-
import type { AISpanData, DisplayItem } from "./types";
5-
import { AITagsRow, AIStatsSummary } from "./AIModelSummary";
5+
import { useHasAdminAccess } from "~/hooks/useUser";
66
import { AIChatMessages, AssistantResponse } from "./AIChatMessages";
7+
import { AIStatsSummary, AITagsRow } from "./AIModelSummary";
78
import { AIToolsInventory } from "./AIToolsInventory";
9+
import type { AISpanData, DisplayItem } from "./types";
810

911
type AITab = "overview" | "messages" | "tools";
1012

@@ -16,6 +18,7 @@ export function AISpanDetails({
1618
rawProperties?: string;
1719
}) {
1820
const [tab, setTab] = useState<AITab>("overview");
21+
const isAdmin = useHasAdminAccess();
1922
const toolCount = aiData.toolCount ?? aiData.toolDefinitions?.length ?? 0;
2023

2124
return (
@@ -51,14 +54,14 @@ export function AISpanDetails({
5154
</div>
5255

5356
{/* Tab content */}
54-
<div className="min-h-0 flex-1 overflow-y-auto scrollbar-gutter-stable scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
57+
<div className="scrollbar-gutter-stable min-h-0 flex-1 overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600">
5558
{tab === "overview" && <OverviewTab aiData={aiData} />}
5659
{tab === "messages" && <MessagesTab aiData={aiData} />}
5760
{tab === "tools" && <ToolsTab aiData={aiData} />}
5861
</div>
5962

60-
{/* Footer: Copy raw */}
61-
{rawProperties && <CopyRawFooter rawProperties={rawProperties} />}
63+
{/* Footer: Copy raw (admin only) */}
64+
{isAdmin && rawProperties && <CopyRawFooter rawProperties={rawProperties} />}
6265
</div>
6366
);
6467
}
@@ -126,23 +129,15 @@ function CopyRawFooter({ rawProperties }: { rawProperties: string }) {
126129
}
127130

128131
return (
129-
<div className="flex shrink-0 items-center justify-end border-t border-grid-dimmed px-3 py-2">
130-
<button
132+
<div className="flex h-[3.25rem] shrink-0 items-center justify-end border-t border-grid-dimmed px-2">
133+
<Button
134+
variant="minimal/medium"
131135
onClick={handleCopy}
132-
className="flex items-center gap-1.5 text-xs text-text-dimmed transition-colors hover:text-text-bright"
136+
LeadingIcon={copied ? CheckIcon : ClipboardDocumentIcon}
137+
leadingIconClassName={copied ? "text-green-500" : undefined}
133138
>
134-
{copied ? (
135-
<>
136-
<ClipboardCheck className="size-3.5" />
137-
Copied
138-
</>
139-
) : (
140-
<>
141-
<Clipboard className="size-3.5" />
142-
Copy raw properties
143-
</>
144-
)}
145-
</button>
139+
Copy raw properties
140+
</Button>
146141
</div>
147142
);
148143
}

0 commit comments

Comments
 (0)