Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(search-tools): wire real ExportCodeModal from F7 into SearchToolsTopBar

diegosouzapw5e6e513c02a5
diff --git a/src/app/(dashboard)/dashboard/search-tools/SearchToolsClient.tsx b/src/app/(dashboard)/dashboard/search-tools/SearchToolsClient.tsx
index 96e5ff4b46..db6b234cbe 100644
--- a/src/app/(dashboard)/dashboard/search-tools/SearchToolsClient.tsx
+++ b/src/app/(dashboard)/dashboard/search-tools/SearchToolsClient.tsx
@@ -2,6 +2,7 @@
import { useState, useEffect } from "react";
import type { SearchProviderCatalogItem } from "@/shared/schemas/searchTools";
+import type { PlaygroundState } from "@/lib/playground/codeExport";
import SearchToolsTopBar, { type ActiveTab } from "./components/SearchToolsTopBar";
import SearchToolsConfigPane, { type ConfigState } from "./components/SearchToolsConfigPane";
@@ -64,12 +65,12 @@ export default function SearchToolsClient() {
};
// Build export state from current config (passed to TopBar for ExportCodeModal)
- const exportState: Record<string, unknown> = {
+ const exportState: PlaygroundState = {
endpoint: activeTab === "scrape" ? "web.fetch" : "search",
- provider: configState.provider,
+ baseUrl: typeof window !== "undefined" ? window.location.origin : "http://localhost:20128",
+ searchProvider: configState.provider,
searchType: configState.searchType,
- fetchFormat: configState.fetchFormat,
- fullPage: configState.fullPage,
+ fetchFormat: configState.fetchFormat as PlaygroundState["fetchFormat"],
};
return (
diff --git a/src/app/(dashboard)/dashboard/search-tools/components/SearchToolsTopBar.tsx b/src/app/(dashboard)/dashboard/search-tools/components/SearchToolsTopBar.tsx
index 70cf408e86..760b33dbb5 100644
--- a/src/app/(dashboard)/dashboard/search-tools/components/SearchToolsTopBar.tsx
+++ b/src/app/(dashboard)/dashboard/search-tools/components/SearchToolsTopBar.tsx
@@ -1,47 +1,8 @@
"use client";
import { useState } from "react";
-
-// TODO(F7-merge): replace MockExportCodeModal with playground/components/ExportCodeModal
-// once the F7 branch (feat/playground-ui-advanced-F7) is merged.
-interface MockExportCodeModalProps {
- isOpen: boolean;
- onClose: () => void;
- state?: Record<string, unknown>;
-}
-
-function MockExportCodeModal({ isOpen, onClose }: MockExportCodeModalProps) {
- if (!isOpen) return null;
- return (
- <div
- className="fixed inset-0 z-50 flex items-center justify-center bg-black/60"
- data-testid="export-code-modal"
- >
- <div className="bg-surface border border-border rounded-xl shadow-2xl w-[500px] max-w-[95vw] p-6">
- <div className="flex justify-between items-center mb-4">
- <span className="text-sm font-semibold text-text-main">Export Code</span>
- <button
- className="text-text-muted hover:text-text-main"
- onClick={onClose}
- aria-label="Close export modal"
- >
- ✕
- </button>
- </div>
- <div className="text-xs text-text-muted p-4 bg-bg-alt rounded-lg">
- Export code modal — disponível após merge com F7 (
- <code>feat/playground-ui-advanced-F7</code>).
- </div>
- <button
- className="mt-4 text-xs px-3 py-1.5 rounded-md bg-primary/15 text-primary hover:bg-primary/25 transition-colors"
- onClick={onClose}
- >
- Fechar
- </button>
- </div>
- </div>
- );
-}
+import ExportCodeModal from "@/app/(dashboard)/dashboard/playground/components/ExportCodeModal";
+import type { PlaygroundState } from "@/lib/playground/codeExport";
export type ActiveTab = "search" | "scrape" | "compare";
@@ -50,7 +11,7 @@ interface SearchToolsTopBarProps {
onTabChange: (tab: ActiveTab) => void;
latencyMs?: number | null;
costUsd?: number | null;
- exportState?: Record<string, unknown>;
+ exportState?: PlaygroundState;
}
const TABS: { id: ActiveTab; icon: string; label: string }[] = [
@@ -122,11 +83,13 @@ export default function SearchToolsTopBar({
</div>
</div>
- <MockExportCodeModal
- isOpen={exportOpen}
- onClose={() => setExportOpen(false)}
- state={exportState}
- />
+ {exportState && (
+ <ExportCodeModal
+ isOpen={exportOpen}
+ onClose={() => setExportOpen(false)}
+ state={exportState}
+ />
+ )}
</>
);
}