-
-
Notifications
You must be signed in to change notification settings - Fork 372
Expand file tree
/
Copy pathApplicationStarter.tsx
More file actions
1121 lines (1073 loc) · 45.3 KB
/
Copy pathApplicationStarter.tsx
File metadata and controls
1121 lines (1073 loc) · 45.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import * as React from 'react'
import { ClientOnly } from '@tanstack/react-router'
import {
ChevronDown,
Copy,
Download,
Loader2,
Rocket,
Sparkles,
Wand2,
} from 'lucide-react'
import { twMerge } from 'tailwind-merge'
import anthropicDarkLogo from '~/images/anthropic-dark.svg'
import anthropicLightLogo from '~/images/anthropic-light.svg'
import openaiDarkLogo from '~/images/openai-dark.svg'
import openaiLightLogo from '~/images/openai-light.svg'
import type {
ApplicationStarterContext,
ApplicationStarterResult,
} from '~/utils/application-starter'
import {
Collapsible,
CollapsibleContent,
CollapsibleTrigger,
} from '~/components/Collapsible'
import {
GeneratedPromptPreviewBody,
GeneratedPromptPreviewHeader,
StarterChipButton,
StarterLibraryRows,
StarterPartnerRows,
StarterTooltipProvider,
} from '~/components/application-builder/parts'
import {
toneClasses,
type ApplicationStarterBuilderIntegration,
type StarterTone,
} from '~/components/application-builder/shared'
import { useApplicationBuilder } from '~/components/application-builder/useApplicationBuilder'
import { Button, GitHub } from '~/ui'
export interface ApplicationStarterProps {
alwaysShowPostAnalysisSection?: boolean
builderIntegration?: ApplicationStarterBuilderIntegration
className?: string
context: ApplicationStarterContext
footerContent?: React.ReactNode
enableHotkeys?: boolean
forceRouterOnly?: boolean
formId?: string
headerAction?: React.ReactNode
mode?: 'compact' | 'full'
onDirtyStateChange?: (dirty: boolean) => void
onResolvedResult?: (result: ApplicationStarterResult | null) => void
primaryActionLabel?: string
primaryButtonColor?: 'cyan' | 'emerald' | 'purple' | 'yellow'
secondaryActionLabel?: string
showCliExportActions?: boolean
showPromptPreview?: boolean
suggestionContext?: ApplicationStarterContext
submitButton?: React.ReactNode
title?: React.ReactNode
tone?: StarterTone
}
const LazyApplicationStarterHotkeys = React.lazy(() =>
import('~/components/ApplicationStarterHotkeys.client').then((m) => ({
default: m.ApplicationStarterHotkeys,
})),
)
const LazyDeployDialog = React.lazy(() =>
import('~/components/builder/DeployDialog').then((m) => ({
default: m.DeployDialog,
})),
)
const starterPackageManagers = ['pnpm', 'npm', 'yarn', 'bun'] as const
const starterToolchains = ['biome', 'eslint'] as const
export function ApplicationStarter({
alwaysShowPostAnalysisSection = false,
builderIntegration,
className,
context,
footerContent,
enableHotkeys = false,
forceRouterOnly = false,
formId,
headerAction,
mode = 'full',
onDirtyStateChange,
onResolvedResult,
primaryActionLabel = 'Generate Prompt',
primaryButtonColor,
secondaryActionLabel = 'Build with Netlify',
showCliExportActions = true,
showPromptPreview = true,
suggestionContext,
submitButton,
title = 'What would you like to build?',
tone = 'cyan',
}: ApplicationStarterProps) {
const {
analysis,
anonymousGenerationQuota,
copiedKind,
copyResultValue,
dismissPromptCopyNotice,
deployDialogProvider,
enableLuckyActions,
generatePrompt,
hasGeneratedPrompt,
hasFreshAnalysis,
hasInput,
hasMigrationRepositoryUrlError,
input,
isDeployDialogOpen,
isAnalysisStale,
isAnalyzing,
isGenerating,
isGeneratingNetlify,
isGeneratingPrompt,
isLocked,
isModHeld,
loadingPhrase,
lockMessage,
migrationRepositoryInputRef,
migrationRepositoryUrl,
navigateToResult,
openClaudeStart,
openCursorStart,
openCodexStart,
openDeployDialog,
openLogin,
openNetlifyStart,
partnerSuggestions,
promptCopyNotice,
result,
selectSuggestion,
selectedPackageManager,
selectedLibraries,
selectedPartners,
selectedToolchain,
setIsDeployDialogOpen,
setIsModHeld,
setSessionMode,
showMigrationRepositoryInput,
trackActivation,
showLuckyActions,
submitCurrentInput,
suggestions,
toggleLibrary,
togglePackageManager,
togglePartner,
toggleToolchain,
updateInput,
updateMigrationRepositoryUrl,
} = useApplicationBuilder({
builderIntegration,
context,
forceRouterOnly,
mode,
onDirtyStateChange,
onResolvedResult,
suggestionContext,
})
const palette = toneClasses[tone]
const compact = mode === 'compact'
const buttonColor = primaryButtonColor ?? palette.button
const [showMoreActions, setShowMoreActions] = React.useState(false)
const [hasFocusedPromptInput, setHasFocusedPromptInput] =
React.useState(false)
const [isPromptFocused, setIsPromptFocused] = React.useState(false)
const [isMacShortcutPlatform, setIsMacShortcutPlatform] =
React.useState(false)
const [showConfidentOptions, setShowConfidentOptions] = React.useState(false)
const [showPackageManagerOptions, setShowPackageManagerOptions] =
React.useState(false)
const [showToolchainOptions, setShowToolchainOptions] = React.useState(
alwaysShowPostAnalysisSection,
)
const canContinue =
hasInput && !hasMigrationRepositoryUrlError && !isGenerating
const canUseLuckyAction =
hasInput &&
!hasMigrationRepositoryUrlError &&
!isGenerating &&
(!showLuckyActions || isAnalysisStale)
const canUseConfidentAction =
alwaysShowPostAnalysisSection &&
hasInput &&
!hasMigrationRepositoryUrlError &&
!isGenerating &&
!hasFreshAnalysis &&
!hasGeneratedPrompt &&
!showConfidentOptions
const canUseFinalActions =
(hasFreshAnalysis || showLuckyActions || showConfidentOptions) &&
hasInput &&
!hasMigrationRepositoryUrlError &&
!isGenerating
const showPostAnalysisSection =
alwaysShowPostAnalysisSection || hasFreshAnalysis || hasGeneratedPrompt
const showActionSection =
alwaysShowPostAnalysisSection || hasFreshAnalysis || showLuckyActions
const postAnalysisSectionDisabled =
!hasFreshAnalysis && !hasGeneratedPrompt && !showConfidentOptions
const actionSectionDisabled =
alwaysShowPostAnalysisSection &&
!hasFreshAnalysis &&
!showLuckyActions &&
!showConfidentOptions
const analysisMessage = isAnalysisStale
? 'Prompt changed. Analyze again to refresh recommendations.'
: analysis
? 'Review or adjust the selected chips below, then generate the final prompt.'
: null
React.useEffect(() => {
if (typeof navigator === 'undefined') {
return
}
setIsMacShortcutPlatform(/Mac|iPhone|iPad|iPod/i.test(navigator.platform))
}, [])
return (
<div className={twMerge('relative', className)}>
{enableHotkeys && !compact && hasFocusedPromptInput ? (
<ClientOnly>
<React.Suspense fallback={null}>
<LazyApplicationStarterHotkeys
onAnalyze={() => {
void submitCurrentInput()
}}
onModKeyChange={setIsModHeld}
promptFocused={isPromptFocused}
/>
</React.Suspense>
</ClientOnly>
) : null}
{isDeployDialogOpen ? (
<React.Suspense fallback={null}>
<LazyDeployDialog
isOpen={isDeployDialogOpen}
onClose={() => setIsDeployDialogOpen(false)}
provider={deployDialogProvider}
starterRecipe={result?.recipe ?? null}
onTrackActivation={trackActivation}
/>
</React.Suspense>
) : null}
<div className="relative">
{compact ? (
<div className="space-y-2">
<h3
className={twMerge(
'font-semibold tracking-[-0.03em] text-gray-950 dark:text-white',
'text-base tracking-[-0.02em]',
)}
>
{title}
</h3>
</div>
) : null}
<form
id={formId}
className={twMerge('space-y-3', compact ? 'mt-3' : 'mt-0')}
onSubmit={async (event) => {
event.preventDefault()
await submitCurrentInput()
}}
>
{compact ? (
<>
<div className="overflow-hidden rounded-lg border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-950">
<div className="border-b border-gray-200 px-3 py-2 dark:border-gray-800">
<div className="text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500">
Ideas
</div>
<div className="mt-2 flex flex-wrap gap-2">
{suggestions.map((suggestion) => (
<StarterChipButton
key={suggestion.label}
compact
onClick={() => {
void selectSuggestion({ suggestion })
}}
palette={palette}
selected={input === suggestion.input}
>
{suggestion.label}
</StarterChipButton>
))}
</div>
</div>
{showMigrationRepositoryInput ? (
<div className="border-b border-gray-200 px-3 py-2 dark:border-gray-800">
<div className="text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500">
Existing Repository URL
</div>
<input
ref={migrationRepositoryInputRef}
type="text"
value={migrationRepositoryUrl}
onChange={(event) => {
updateMigrationRepositoryUrl(event.target.value)
}}
placeholder="https://github.com/acme/legacy-next-app"
className={twMerge(
'mt-2 h-9 w-full rounded-md border border-gray-200 bg-white px-3 text-xs text-gray-900 outline-none transition-colors placeholder:text-gray-400 dark:border-gray-800 dark:bg-gray-950 dark:text-white dark:placeholder:text-gray-500',
palette.ring,
hasMigrationRepositoryUrlError &&
'border-red-300 dark:border-red-800',
)}
/>
{hasMigrationRepositoryUrlError ? (
<div className="mt-2 text-[11px] text-red-600 dark:text-red-400">
Enter a valid Git or GitHub repository URL.
</div>
) : null}
</div>
) : null}
<div className="relative">
<div className="px-3 pt-2 text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500">
Prompt
</div>
<textarea
value={input}
onChange={(event) => {
updateInput(event.target.value)
}}
onFocus={() => {
setHasFocusedPromptInput(true)
setIsPromptFocused(true)
}}
onBlur={() => {
setIsPromptFocused(false)
}}
rows={3}
placeholder="Build a SaaS app with auth, Postgres, nested routes, and Sentry. Use pnpm and deploy to Cloudflare."
className={twMerge(
'w-full min-h-20 bg-transparent px-3 pb-2 pt-1 text-xs leading-5 text-gray-900 outline-none transition-colors dark:text-white',
palette.ring,
)}
/>
</div>
<div className="border-t border-gray-200 px-3 py-2 dark:border-gray-800">
<Button
color={buttonColor}
className="pr-1"
size="xs"
type="submit"
disabled={!canContinue}
>
{isAnalyzing ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<Wand2 className="h-4 w-4" />
)}
{isAnalyzing ? (
loadingPhrase
) : (
<>
Analyze
{enableHotkeys ? (
<AnalyzeShortcutHint isMac={isMacShortcutPlatform} />
) : null}
</>
)}
</Button>
{analysisMessage ? (
<div className="mt-2 text-[11px] leading-5 text-gray-500 dark:text-gray-400">
{analysisMessage}
</div>
) : null}
</div>
</div>
<Collapsible open={showPostAnalysisSection}>
<CollapsibleContent className="mt-3">
<StarterTooltipProvider>
<div
className={twMerge(
'space-y-2 rounded-lg border border-gray-200 bg-white px-3 py-3 dark:border-gray-800 dark:bg-gray-950',
postAnalysisSectionDisabled &&
'pointer-events-none opacity-55 saturate-50',
)}
>
<div className="mb-3">
<div className="text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500">
TanStack Libraries
</div>
<div className="mt-2 space-y-2">
<StarterLibraryRows
compact
selectedLibraries={selectedLibraries}
toggleLibrary={toggleLibrary}
/>
</div>
</div>
<div className="text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500">
Partner Integrations
</div>
<StarterPartnerRows
compact
palette={palette}
partnerSuggestions={partnerSuggestions}
selectedPartners={selectedPartners}
togglePartner={togglePartner}
/>
<StarterCustomizationSection
compact
onOpenChange={setShowToolchainOptions}
open={showToolchainOptions}
title="Toolchain"
>
<div className="mt-2 flex flex-wrap gap-2">
{starterToolchains.map((toolchain) => (
<StarterChipButton
key={toolchain}
compact
onClick={() => {
toggleToolchain(toolchain)
}}
palette={palette}
selected={selectedToolchain === toolchain}
>
{toolchain}
</StarterChipButton>
))}
</div>
</StarterCustomizationSection>
<StarterCustomizationSection
compact
onOpenChange={setShowPackageManagerOptions}
open={showPackageManagerOptions}
title="Package Manager"
>
<div className="mt-2 flex flex-wrap gap-2">
{starterPackageManagers.map((packageManager) => (
<StarterChipButton
key={packageManager}
compact
onClick={() => {
togglePackageManager(packageManager)
}}
palette={palette}
selected={
selectedPackageManager === packageManager
}
>
{packageManager}
</StarterChipButton>
))}
</div>
</StarterCustomizationSection>
<AnonymousGenerationLimitNotice
quota={anonymousGenerationQuota}
/>
</div>
</StarterTooltipProvider>
</CollapsibleContent>
</Collapsible>
</>
) : (
<div className="relative overflow-hidden rounded-[1rem] border border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-950">
{isLocked ? (
<div className="absolute inset-0 z-10 flex items-center justify-center bg-white/75 p-6 backdrop-blur-sm dark:bg-gray-950/75">
<div className="max-w-sm rounded-2xl border border-gray-200 bg-white p-5 text-center shadow-lg dark:border-gray-800 dark:bg-gray-900">
<div className="text-sm font-semibold text-gray-900 dark:text-white">
Sign in to unlock more generations
</div>
<div className="mt-2 text-sm leading-6 text-gray-500 dark:text-gray-400">
{lockMessage ||
'Anonymous generations are limited. Sign in to keep going.'}
</div>
<div className="mt-4 flex justify-center">
<Button
color={buttonColor}
size="sm"
type="button"
onClick={() => {
openLogin()
}}
>
<GitHub className="h-4 w-4" />
Sign in to continue
</Button>
</div>
</div>
</div>
) : null}
<div
className={twMerge(
isLocked && 'blur-sm pointer-events-none select-none',
)}
>
<div className="border-b border-gray-200 bg-gray-50/70 px-5 py-4 dark:border-gray-800 dark:bg-gray-900/50">
<div className="flex items-center justify-between gap-3">
<h3 className="font-semibold tracking-[-0.04em] text-[1.375rem] md:text-[1.5rem] text-gray-950 dark:text-white">
{title}
</h3>
{headerAction ? (
<div className="shrink-0">{headerAction}</div>
) : null}
</div>
<div className="mt-4 flex flex-wrap gap-2">
{suggestions.map((suggestion) => (
<StarterChipButton
key={suggestion.label}
onClick={() => {
void selectSuggestion({ suggestion })
}}
palette={palette}
selected={input === suggestion.input}
>
{suggestion.label}
</StarterChipButton>
))}
</div>
</div>
<div className="relative border-b border-gray-200 dark:border-gray-800">
{showMigrationRepositoryInput ? (
<div className="border-b border-gray-200 px-5 py-4 dark:border-gray-800">
<div className="text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500">
Existing Repository URL
</div>
<input
ref={migrationRepositoryInputRef}
type="text"
value={migrationRepositoryUrl}
onChange={(event) => {
updateMigrationRepositoryUrl(event.target.value)
}}
placeholder="https://github.com/acme/legacy-next-app"
className={twMerge(
'mt-3 h-10 w-full rounded-lg border border-gray-200 bg-white px-3 text-sm text-gray-900 outline-none transition-colors placeholder:text-gray-400 dark:border-gray-800 dark:bg-gray-950 dark:text-white dark:placeholder:text-gray-500',
palette.ring,
hasMigrationRepositoryUrlError &&
'border-red-300 dark:border-red-800',
)}
/>
{hasMigrationRepositoryUrlError ? (
<div className="mt-2 text-xs text-red-600 dark:text-red-400">
Enter a valid Git or GitHub repository URL.
</div>
) : null}
</div>
) : null}
<div className="px-5 pt-4 text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500">
Prompt
</div>
<textarea
value={input}
onChange={(event) => {
updateInput(event.target.value)
}}
onFocus={() => {
setHasFocusedPromptInput(true)
setIsPromptFocused(true)
}}
onBlur={() => {
setIsPromptFocused(false)
}}
onClick={(event) => {
if (enableHotkeys && isModHeld) {
event.preventDefault()
void generatePrompt()
}
}}
rows={4}
placeholder="Build a SaaS app with auth, Postgres, nested routes, and Sentry. Use pnpm and deploy to Cloudflare."
className={twMerge(
'w-full min-h-28 bg-transparent px-5 pb-4 pt-1 text-sm leading-6 text-gray-900 outline-none transition-colors dark:text-white',
palette.ring,
)}
/>
<div className="border-t border-gray-200 px-5 py-4 dark:border-gray-800">
<div className="flex flex-wrap items-center gap-3">
<Button
color={buttonColor}
className="pr-1.5"
variant={showActionSection ? 'secondary' : 'primary'}
size="sm"
type="submit"
disabled={!canContinue}
>
{isAnalyzing ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<Wand2 className="h-4 w-4" />
)}
{isAnalyzing ? (
loadingPhrase
) : (
<>
Analyze
{enableHotkeys ? (
<AnalyzeShortcutHint
isMac={isMacShortcutPlatform}
/>
) : null}
</>
)}
</Button>
{!showActionSection ? (
<Button
variant="secondary"
size="sm"
type="button"
onClick={() => {
setSessionMode('lucky')
enableLuckyActions()
}}
disabled={!canUseLuckyAction}
>
<Sparkles className="h-4 w-4" />
I'm feeling lucky
</Button>
) : null}
{canUseConfidentAction ? (
<Button
variant="secondary"
size="sm"
type="button"
onClick={() => {
setSessionMode('confident')
setShowConfidentOptions(true)
}}
>
<Sparkles className="h-4 w-4" />
I'm feeling confident
</Button>
) : null}
{analysisMessage ? (
<div className="text-xs leading-5 text-gray-500 dark:text-gray-400">
{analysisMessage}
</div>
) : null}
</div>
</div>
</div>
<Collapsible open={showPostAnalysisSection}>
<CollapsibleContent>
<div
className={twMerge(
'bg-gray-50/70 px-5 py-4 dark:bg-gray-900/50',
postAnalysisSectionDisabled && 'opacity-55 saturate-50',
)}
>
<StarterTooltipProvider>
<div
className={twMerge(
postAnalysisSectionDisabled &&
'pointer-events-none',
)}
>
<div className="mb-4">
<div className="text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500">
TanStack Libraries
</div>
<div className="mt-3 space-y-2.5">
<StarterLibraryRows
selectedLibraries={selectedLibraries}
toggleLibrary={toggleLibrary}
/>
</div>
</div>
<div className="text-[10px] font-medium uppercase tracking-[0.16em] text-gray-400 dark:text-gray-500">
Add Integrations
</div>
<div className="mt-3">
<StarterPartnerRows
palette={palette}
partnerSuggestions={partnerSuggestions}
selectedPartners={selectedPartners}
size="compact"
togglePartner={togglePartner}
/>
</div>
<StarterCustomizationSection
onOpenChange={setShowToolchainOptions}
open={showToolchainOptions}
title="Toolchain"
>
<div className="mt-3 flex flex-wrap gap-2">
{starterToolchains.map((toolchain) => (
<StarterChipButton
key={toolchain}
onClick={() => {
toggleToolchain(toolchain)
}}
palette={palette}
selected={selectedToolchain === toolchain}
size="compact"
>
{toolchain}
</StarterChipButton>
))}
</div>
</StarterCustomizationSection>
<StarterCustomizationSection
onOpenChange={setShowPackageManagerOptions}
open={showPackageManagerOptions}
title="Package Manager"
>
<div className="mt-3 flex flex-wrap gap-2">
{starterPackageManagers.map((packageManager) => (
<StarterChipButton
key={packageManager}
onClick={() => {
togglePackageManager(packageManager)
}}
palette={palette}
selected={
selectedPackageManager === packageManager
}
size="compact"
>
{packageManager}
</StarterChipButton>
))}
</div>
</StarterCustomizationSection>
</div>
</StarterTooltipProvider>
<AnonymousGenerationLimitNotice
quota={anonymousGenerationQuota}
/>
{footerContent ? (
<div className="mt-4">{footerContent}</div>
) : null}
</div>
</CollapsibleContent>
</Collapsible>
<Collapsible open={showActionSection}>
<CollapsibleContent>
<div
className={twMerge(
'bg-gray-50/70 px-5 py-4 dark:bg-gray-900/50',
actionSectionDisabled && 'opacity-55 saturate-50',
)}
>
<div
className={twMerge(
'flex flex-col gap-4',
actionSectionDisabled && 'pointer-events-none',
)}
>
<div className="flex flex-wrap items-center gap-3">
<Button
color={buttonColor}
variant={
hasGeneratedPrompt ? 'secondary' : 'primary'
}
size="sm"
type="button"
onClick={() => void generatePrompt()}
disabled={!canUseFinalActions}
>
{isGeneratingPrompt ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<Wand2 className="h-4 w-4" />
)}
{isGeneratingPrompt
? loadingPhrase
: primaryActionLabel}
</Button>
{showCliExportActions ? (
<>
<Button
size="sm"
type="button"
onClick={() => {
void openDeployDialog('cloudflare')
}}
disabled={!canUseFinalActions}
className="border-[#F48120] bg-[#F48120] text-white hover:bg-[#E67210]"
>
<Rocket className="h-4 w-4" />
Deploy to Cloudflare
</Button>
<Button
size="sm"
type="button"
onClick={() => void openNetlifyStart()}
disabled={!canUseFinalActions}
className="border-[#00AD9F] bg-[#00AD9F] text-white hover:bg-[#009a8e]"
>
{isGeneratingNetlify ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<Rocket className="h-4 w-4" />
)}
{secondaryActionLabel}
</Button>
<Button
size="sm"
type="button"
onClick={() => {
void openDeployDialog('railway')
}}
disabled={!canUseFinalActions}
className="border-[#7C66FF] bg-[#7C66FF] text-white hover:bg-[#6A54F0]"
>
<Rocket className="h-4 w-4" />
Deploy to Railway
</Button>
<Button
size="sm"
type="button"
onClick={() => {
void openDeployDialog('vercel')
}}
disabled={!canUseFinalActions}
className="border-black bg-black text-white hover:bg-gray-800 dark:border-white dark:bg-white dark:text-black dark:hover:bg-gray-100"
>
<Rocket className="h-4 w-4" />
Deploy to Vercel
</Button>
{!showMoreActions ? (
<Button
variant="secondary"
size="sm"
type="button"
onClick={() => setShowMoreActions(true)}
>
<ChevronDown className="h-4 w-4" />
Show More
</Button>
) : null}
</>
) : (
<>
<Button
size="sm"
type="button"
onClick={() => void openNetlifyStart()}
disabled={!canUseFinalActions}
className="border-[#00AD9F] bg-[#00AD9F] text-white hover:bg-[#009a8e]"
>
{isGeneratingNetlify ? (
<Loader2 className="h-4 w-4 animate-spin" />
) : (
<Rocket className="h-4 w-4" />
)}
{secondaryActionLabel}
</Button>
<Button
size="sm"
type="button"
onClick={() => void openCodexStart()}
disabled={!canUseFinalActions}
className="border-gray-900 bg-gray-900 text-white hover:bg-gray-800 dark:border-gray-100 dark:bg-gray-100 dark:text-gray-950 dark:hover:bg-gray-200"
>
<span className="relative h-4 w-4 shrink-0">
<img
src={openaiDarkLogo}
alt=""
aria-hidden="true"
className="h-4 w-4 dark:hidden"
/>
<img
src={openaiLightLogo}
alt=""
aria-hidden="true"
className="hidden h-4 w-4 dark:block"
/>
</span>
Open in Codex
</Button>
</>
)}
</div>
{showCliExportActions && showMoreActions ? (
<div className="flex flex-wrap items-center gap-2">
<Button
size="xs"
type="button"
onClick={() => void openCodexStart()}
disabled={!canUseFinalActions}
className="h-6 gap-1 px-2 text-[11px] border-gray-900 bg-gray-900 text-white hover:bg-gray-800 dark:border-gray-100 dark:bg-gray-100 dark:text-gray-950 dark:hover:bg-gray-200"
>
<span className="relative h-3 w-3 shrink-0">
<img
src={openaiDarkLogo}
alt=""
aria-hidden="true"
className="h-3 w-3 dark:hidden"
/>
<img
src={openaiLightLogo}
alt=""
aria-hidden="true"
className="hidden h-3 w-3 dark:block"
/>
</span>
Open in Codex
</Button>
<Button
size="xs"
type="button"
onClick={() => void openClaudeStart()}
disabled={!canUseFinalActions}
className="h-6 gap-1 px-2 text-[11px] border-[#D4A373] bg-[#D4A373] text-white hover:bg-[#C6905C] dark:border-[#E6C49A] dark:bg-[#E6C49A] dark:text-gray-950 dark:hover:bg-[#DBB684]"
>
<span className="relative h-3 w-3 shrink-0">
<img
src={anthropicDarkLogo}
alt=""
aria-hidden="true"
className="h-3 w-3 dark:hidden"
/>
<img
src={anthropicLightLogo}
alt=""
aria-hidden="true"
className="hidden h-3 w-3 dark:block"
/>
</span>
Open in Claude
</Button>
<Button
size="xs"
type="button"
onClick={() => void openCursorStart()}
disabled={!canUseFinalActions}
className="h-6 gap-1 px-2 text-[11px] border-black bg-black text-white hover:bg-gray-900 dark:border-white dark:bg-white dark:text-black dark:hover:bg-gray-100"
>
<CursorIcon className="h-3 w-3" />
Open in Cursor
</Button>
<Button
variant="secondary"
size="xs"
type="button"
onClick={() => {
void copyResultValue('command')
}}
disabled={!canUseFinalActions}
className="h-6 gap-1 px-2 text-[11px]"
>
<Copy className="h-3 w-3" />
Copy CLI Command
</Button>
<Button
variant="secondary"
size="xs"
type="button"
onClick={() => {
void openDeployDialog(null)
}}
disabled={!canUseFinalActions}
className="h-6 gap-1 px-2 text-[11px]"
>
<GitHub className="h-3 w-3" />
Clone to GitHub
</Button>
<Button
variant="secondary"
size="xs"
type="button"
onClick={() => {
void navigateToResult('download')
}}
disabled={!canUseFinalActions}