Skip to content

Commit 5866088

Browse files
committed
[TOOL-2822]: Insight Playground: Move chain from subdomain to query param (#5922)
<!-- start pr-codex --> ## 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}` <!-- end pr-codex -->
1 parent ed0d215 commit 5866088

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

apps/dashboard/src/app/team/[team_slug]/[project_slug]/insight/[blueprint_slug]/blueprint-playground.client.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export function BlueprintPlayground(props: {
111111
abortController.abort();
112112
}
113113
}}
114-
domain={`https://{chainId}.insight.${thirdwebDomain}.com`}
114+
domain={`https://insight.${thirdwebDomain}.com`}
115115
path={props.path}
116116
isInsightEnabled={props.isInsightEnabled}
117117
projectSettingsLink={props.projectSettingsLink}
@@ -122,12 +122,12 @@ export function BlueprintPlayground(props: {
122122

123123
function modifyParametersForPlayground(_parameters: BlueprintParameter[]) {
124124
const parameters = [..._parameters];
125-
// if chainId parameter is not already present - add it, because we need it for the domain
126-
const chainIdParameter = parameters.find((p) => p.name === "chainId");
125+
// if chain parameter is not already mentioned - add it, its required
126+
const chainIdParameter = parameters.find((p) => p.name === "chain");
127127
if (!chainIdParameter) {
128128
parameters.unshift({
129-
name: "chainId",
130-
in: "path",
129+
name: "chain",
130+
in: "query",
131131
required: true,
132132
schema: {
133133
type: "integer",
@@ -561,14 +561,14 @@ function ParameterSection(props: {
561561
key={param.name}
562562
className={cn(
563563
"grid items-center",
564-
param.name === "chainId"
564+
param.name === "chain"
565565
? "grid-cols-1 lg:grid-cols-2"
566566
: "grid-cols-2",
567567
)}
568568
>
569569
<div className="flex h-full flex-row flex-wrap items-center justify-between gap-1 border-r px-3 py-2">
570570
<div className="font-medium font-mono text-sm">
571-
{param.name === "chainId" ? "chainId" : param.name}
571+
{param.name}
572572
</div>
573573
{param.required && (
574574
<Badge
@@ -580,7 +580,7 @@ function ParameterSection(props: {
580580
)}
581581
</div>
582582
<div className="relative">
583-
{param.name === "chainId" ? (
583+
{param.name === "chain" ? (
584584
<SingleNetworkSelector
585585
chainId={
586586
field.value ? Number(field.value) : undefined
@@ -886,6 +886,8 @@ function createParametersFormSchema(parameters: BlueprintParameter[]) {
886886
const paramSchema = openAPIV3ParamToZodFormSchema(param);
887887
if (paramSchema) {
888888
shape[param.name] = paramSchema;
889+
} else {
890+
shape[param.name] = z.string();
889891
}
890892
}
891893

0 commit comments

Comments
 (0)