From 5866088894533977e4f661abb029eb7f6b948287 Mon Sep 17 00:00:00 2001 From: MananTank Date: Thu, 9 Jan 2025 21:59:16 +0000 Subject: [PATCH] [TOOL-2822]: Insight Playground: Move chain from subdomain to query param (#5922) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## PR-Codex overview This PR focuses on modifying the handling of a parameter in the `BlueprintPlayground` component, changing its name from `chainId` to `chain`, and updating its usage throughout the codebase. ### Detailed summary - Changed the `domain` URL format to remove `chainId`. - Updated the parameter name from `chainId` to `chain` in `modifyParametersForPlayground`. - Adjusted the parameter handling in `ParameterSection` to reflect the new name. - Updated the schema creation to default to `z.string()` for parameters without a schema. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .../blueprint-playground.client.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/insight/[blueprint_slug]/blueprint-playground.client.tsx b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/insight/[blueprint_slug]/blueprint-playground.client.tsx index 095e0bc1a38..d4cce813e2a 100644 --- a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/insight/[blueprint_slug]/blueprint-playground.client.tsx +++ b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/insight/[blueprint_slug]/blueprint-playground.client.tsx @@ -111,7 +111,7 @@ export function BlueprintPlayground(props: { abortController.abort(); } }} - domain={`https://{chainId}.insight.${thirdwebDomain}.com`} + domain={`https://insight.${thirdwebDomain}.com`} path={props.path} isInsightEnabled={props.isInsightEnabled} projectSettingsLink={props.projectSettingsLink} @@ -122,12 +122,12 @@ export function BlueprintPlayground(props: { function modifyParametersForPlayground(_parameters: BlueprintParameter[]) { const parameters = [..._parameters]; - // if chainId parameter is not already present - add it, because we need it for the domain - const chainIdParameter = parameters.find((p) => p.name === "chainId"); + // if chain parameter is not already mentioned - add it, its required + const chainIdParameter = parameters.find((p) => p.name === "chain"); if (!chainIdParameter) { parameters.unshift({ - name: "chainId", - in: "path", + name: "chain", + in: "query", required: true, schema: { type: "integer", @@ -561,14 +561,14 @@ function ParameterSection(props: { key={param.name} className={cn( "grid items-center", - param.name === "chainId" + param.name === "chain" ? "grid-cols-1 lg:grid-cols-2" : "grid-cols-2", )} >
- {param.name === "chainId" ? "chainId" : param.name} + {param.name}
{param.required && (
- {param.name === "chainId" ? ( + {param.name === "chain" ? (