@@ -12,7 +12,7 @@ export function BlueprintCodegen() {
1212 const [ error , setError ] = useState < string | null > ( null )
1313 const [ optionStyle , setOptionStyle ] = useState < "NullOr" | "UndefinedOr" | "Union" > ( "UndefinedOr" )
1414 const [ moduleStrategy , setModuleStrategy ] = useState < "flat" | "namespaced" > ( "namespaced" )
15- const [ forceVariant , setForceVariant ] = useState ( true )
15+ const [ unionStyle , setUnionStyle ] = useState < "Variant" | "Struct" | "TaggedStruct" > ( "Variant" )
1616
1717 const generateTypes = async ( ) => {
1818 setError ( null )
@@ -33,8 +33,7 @@ export function BlueprintCodegen() {
3333 const config = createCodegenConfig ( {
3434 optionStyle,
3535 moduleStrategy,
36- forceVariant,
37- useSuspend : false ,
36+ unionStyle,
3837 useRelativeRefs : true ,
3938 emptyConstructorStyle : "Literal"
4039 } )
@@ -75,7 +74,8 @@ export function BlueprintCodegen() {
7574
7675 const loadSample = async ( ) => {
7776 try {
78- const response = await fetch ( "/evolution-sdk/sample-blueprint.json" )
77+ const basePath = process . env . NEXT_PUBLIC_BASE_PATH ?? ""
78+ const response = await fetch ( `${ basePath } /sample-blueprint.json` )
7979 if ( ! response . ok ) {
8080 throw new Error ( "Failed to load sample blueprint" )
8181 }
@@ -139,21 +139,19 @@ export function BlueprintCodegen() {
139139 </ div >
140140
141141 < div className = "space-y-2" >
142- < label htmlFor = "force-variant " className = "text-sm font-medium leading-none" >
143- Force Variant
142+ < label htmlFor = "union-style " className = "text-sm font-medium leading-none" >
143+ Union Style
144144 </ label >
145- < div className = "flex items-center h-10" >
146- < input
147- id = "force-variant"
148- type = "checkbox"
149- checked = { forceVariant }
150- onChange = { ( e ) => setForceVariant ( e . target . checked ) }
151- className = "h-4 w-4 rounded border-input"
152- />
153- < label htmlFor = "force-variant" className = "ml-2 text-sm text-muted-foreground" >
154- Use Variant for all unions
155- </ label >
156- </ div >
145+ < select
146+ id = "union-style"
147+ value = { unionStyle }
148+ onChange = { ( e ) => setUnionStyle ( e . target . value as any ) }
149+ className = "flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring"
150+ >
151+ < option value = "Variant" > Variant</ option >
152+ < option value = "Struct" > Struct (verbose)</ option >
153+ < option value = "TaggedStruct" > TaggedStruct</ option >
154+ </ select >
157155 </ div >
158156 </ div >
159157
0 commit comments