|
1 | | -import { TOOL_NAME_REGEX } from "@/lib/constants"; |
2 | | -import { cn } from "@/lib/utils"; |
3 | | -import { Tool, isHttpTool } from "@/lib/toolTypes"; |
4 | | -import { ChevronDown, FileCode, Layers, SquareFunction } from "lucide-react"; |
5 | | -import { MethodBadge } from "./MethodBadge"; |
6 | | -import { useState, useEffect, useMemo } from "react"; |
7 | | -import { MoreActions } from "@/components/ui/more-actions"; |
8 | | -import { Input } from "@/components/ui/input"; |
9 | | -import { TextArea } from "@/components/ui/textarea"; |
10 | | -import { Dialog } from "@/components/ui/dialog"; |
11 | 1 | import { Button } from "@/components/ui/button"; |
12 | 2 | import { Checkbox } from "@/components/ui/checkbox"; |
| 3 | +import { Dialog } from "@/components/ui/dialog"; |
| 4 | +import { Input } from "@/components/ui/input"; |
| 5 | +import { MoreActions } from "@/components/ui/more-actions"; |
| 6 | +import { TextArea } from "@/components/ui/textarea"; |
13 | 7 | import { useCommandPalette } from "@/contexts/CommandPalette"; |
| 8 | +import { TOOL_NAME_REGEX } from "@/lib/constants"; |
| 9 | +import { Tool, isHttpTool } from "@/lib/toolTypes"; |
| 10 | +import { cn } from "@/lib/utils"; |
14 | 11 | import { useLatestDeployment } from "@gram/client/react-query/index.js"; |
| 12 | +import { Icon, Stack } from "@speakeasy-api/moonshine"; |
| 13 | +import { ChevronDown, FileCode, Layers, SquareFunction } from "lucide-react"; |
| 14 | +import { useEffect, useMemo, useState } from "react"; |
| 15 | +import { ToolVariationBadge } from "../tool-variation-badge"; |
| 16 | +import { Type } from "../ui/type"; |
| 17 | +import { MethodBadge } from "./MethodBadge"; |
15 | 18 |
|
16 | 19 | interface ToolListProps { |
17 | 20 | tools: Tool[]; |
@@ -307,9 +310,12 @@ function ToolRow({ |
307 | 310 | )} |
308 | 311 | /> |
309 | 312 | <div className="flex flex-col min-w-0 flex-1"> |
310 | | - <p className="text-sm leading-6 text-foreground truncate"> |
311 | | - {tool.name} |
312 | | - </p> |
| 313 | + <Stack direction="horizontal" gap={2} align="center"> |
| 314 | + <p className="text-sm leading-6 text-foreground truncate"> |
| 315 | + {tool.name} |
| 316 | + </p> |
| 317 | + <ToolVariationBadge tool={tool} /> |
| 318 | + </Stack> |
313 | 319 | <p className="text-sm leading-6 text-muted-foreground truncate"> |
314 | 320 | {tool.description || "No description"} |
315 | 321 | </p> |
@@ -337,23 +343,60 @@ function ToolRow({ |
337 | 343 | </Dialog.Header> |
338 | 344 | <div className="space-y-4 py-4"> |
339 | 345 | {editType === "name" ? ( |
340 | | - <Input |
341 | | - value={editValue} |
342 | | - onChange={setEditValue} |
343 | | - placeholder="Tool name" |
344 | | - /> |
| 346 | + <Stack gap={2}> |
| 347 | + <Input |
| 348 | + value={editValue} |
| 349 | + onChange={setEditValue} |
| 350 | + placeholder="Tool name" |
| 351 | + /> |
| 352 | + {tool.variation?.name && |
| 353 | + tool.variation?.name !== tool.canonical?.name && ( |
| 354 | + <Stack direction="horizontal" gap={2} align="center"> |
| 355 | + <Icon |
| 356 | + name="layers-2" |
| 357 | + size="small" |
| 358 | + className="text-muted-foreground/70" |
| 359 | + /> |
| 360 | + <Type small muted> |
| 361 | + Original name: |
| 362 | + </Type> |
| 363 | + <Type small muted> |
| 364 | + {tool.canonical?.name} |
| 365 | + </Type> |
| 366 | + </Stack> |
| 367 | + )} |
| 368 | + </Stack> |
345 | 369 | ) : ( |
346 | | - <TextArea |
347 | | - value={editValue} |
348 | | - onChange={setEditValue} |
349 | | - placeholder="Tool description" |
350 | | - rows={3} |
351 | | - /> |
| 370 | + <Stack gap={2}> |
| 371 | + <TextArea |
| 372 | + value={editValue} |
| 373 | + onChange={setEditValue} |
| 374 | + placeholder="Tool description" |
| 375 | + rows={3} |
| 376 | + /> |
| 377 | + {tool.variation?.description && |
| 378 | + tool.variation?.description !== |
| 379 | + tool.canonical?.description && ( |
| 380 | + <Stack className="p-2 border rounded-md border-border/70"> |
| 381 | + <Type small muted className="inline font-medium"> |
| 382 | + <Icon |
| 383 | + name="layers-2" |
| 384 | + size="small" |
| 385 | + className="text-muted-foreground/70 inline align-text-bottom" |
| 386 | + />{" "} |
| 387 | + Original Description |
| 388 | + </Type> |
| 389 | + <Type small muted> |
| 390 | + {tool.canonical?.description} |
| 391 | + </Type> |
| 392 | + </Stack> |
| 393 | + )} |
| 394 | + </Stack> |
352 | 395 | )} |
353 | 396 | {error && <p className="text-sm text-destructive">{error}</p>} |
354 | 397 | </div> |
355 | 398 | <Dialog.Footer> |
356 | | - <Button variant="outline" onClick={() => setEditDialogOpen(false)}> |
| 399 | + <Button variant="ghost" onClick={() => setEditDialogOpen(false)}> |
357 | 400 | Cancel |
358 | 401 | </Button> |
359 | 402 | <Button onClick={handleSave}>Save</Button> |
|
0 commit comments