From 53d3b304d339af011ad475bd15d2c674e7c68efd Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 8 Jul 2026 10:17:01 +0530 Subject: [PATCH] refactor(playground): improve API reference and playground runner UI - Adjusted text formatting in the API reference for better readability. - Simplified import statements in PlaygroundRunner for cleaner code. - Enhanced button styling and layout in PlaygroundRunner for improved user experience. - Streamlined output display logic in PlaygroundRunner for better clarity. --- .../playground/components/api-reference.tsx | 5 ++-- .../components/playground-runner.tsx | 24 +++++-------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/surfsense_web/app/dashboard/[workspace_id]/playground/components/api-reference.tsx b/surfsense_web/app/dashboard/[workspace_id]/playground/components/api-reference.tsx index beed5d525..05434b953 100644 --- a/surfsense_web/app/dashboard/[workspace_id]/playground/components/api-reference.tsx +++ b/surfsense_web/app/dashboard/[workspace_id]/playground/components/api-reference.tsx @@ -91,12 +91,13 @@ export function ApiReference({

API reference

- Create an API key, enable API access for this workspace, then use the examples below to call this endpoint. + Create an API key, enable API access for this workspace, then use the examples below to + call this endpoint.

- + {snippets.map((snippet) => ( {snippet.label} diff --git a/surfsense_web/app/dashboard/[workspace_id]/playground/components/playground-runner.tsx b/surfsense_web/app/dashboard/[workspace_id]/playground/components/playground-runner.tsx index f62ffc312..6b426b196 100644 --- a/surfsense_web/app/dashboard/[workspace_id]/playground/components/playground-runner.tsx +++ b/surfsense_web/app/dashboard/[workspace_id]/playground/components/playground-runner.tsx @@ -1,13 +1,6 @@ "use client"; -import { - Check, - Copy, - Hash, - Info, - Coins, - Timer, -} from "lucide-react"; +import { Check, Coins, Copy, Hash, Info, Timer } from "lucide-react"; import Link from "next/link"; import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { toast } from "sonner"; @@ -99,9 +92,9 @@ function EndpointCopyButton({ endpoint }: { endpoint: string }) { variant="ghost" size="sm" onClick={handleCopy} - className="h-auto justify-start gap-2 rounded bg-muted/40 px-2 py-1 font-mono text-xs text-muted-foreground hover:bg-muted hover:text-foreground" + className="h-auto max-w-full items-start justify-start gap-2 whitespace-normal rounded bg-muted/40 px-2 py-1 font-mono text-xs text-muted-foreground hover:bg-muted hover:text-foreground sm:whitespace-nowrap" > - {endpoint} + {endpoint} {copied ? : } {copied ? "Copied endpoint" : "Copy endpoint"} @@ -243,8 +236,8 @@ export function PlaygroundRunner({ workspaceId, platform, verb }: PlaygroundRunn className="font-medium text-foreground underline-offset-4 hover:underline" > Read docs - - {" "}for more info. + {" "} + for more info. ) : null}

@@ -280,17 +273,12 @@ export function PlaygroundRunner({ workspaceId, platform, verb }: PlaygroundRunn )} -

Output

{isRunning ? ( - + ) : run.status === "cancelled" ? (
Run cancelled.