Skip to content

Commit 1c05d16

Browse files
committed
consistent dialogs
1 parent 6d75105 commit 1c05d16

File tree

5 files changed

+68
-28
lines changed

5 files changed

+68
-28
lines changed

components/settings/api-keys-dialog.tsx

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -253,25 +253,38 @@ export function ApiKeysDialog({ open, onOpenChange }: ApiKeysDialogProps) {
253253
Create a new API key for webhook authentication
254254
</DialogDescription>
255255
</DialogHeader>
256-
<div className="space-y-4 py-4">
257-
<div className="space-y-2">
258-
<Label htmlFor="key-name">Label (optional)</Label>
259-
<Input
260-
id="key-name"
261-
onChange={(e) => setNewKeyName(e.target.value)}
262-
placeholder="e.g., Production, Testing"
263-
value={newKeyName}
264-
/>
256+
<form
257+
id="create-api-key-form"
258+
onSubmit={(e) => {
259+
e.preventDefault();
260+
handleCreate();
261+
}}
262+
>
263+
<div className="space-y-4 py-4">
264+
<div className="space-y-2">
265+
<Label htmlFor="key-name">Label (optional)</Label>
266+
<Input
267+
id="key-name"
268+
onChange={(e) => setNewKeyName(e.target.value)}
269+
placeholder="e.g., Production, Testing"
270+
value={newKeyName}
271+
/>
272+
</div>
265273
</div>
266-
</div>
274+
</form>
267275
<DialogFooter>
268276
<Button
269277
onClick={() => setShowCreateDialog(false)}
278+
type="button"
270279
variant="outline"
271280
>
272281
Cancel
273282
</Button>
274-
<Button disabled={creating} onClick={handleCreate}>
283+
<Button
284+
disabled={creating}
285+
form="create-api-key-form"
286+
type="submit"
287+
>
275288
{creating ? <Spinner className="mr-2 size-4" /> : null}
276289
Create
277290
</Button>

components/settings/index.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,36 @@ export function SettingsDialog({ open, onOpenChange }: SettingsDialogProps) {
8383
<Spinner />
8484
</div>
8585
) : (
86-
<div className="mt-4">
86+
<form
87+
className="mt-4"
88+
id="settings-form"
89+
onSubmit={(e) => {
90+
e.preventDefault();
91+
saveAccount();
92+
}}
93+
>
8794
<AccountSettings
8895
accountEmail={accountEmail}
8996
accountName={accountName}
9097
onEmailChange={setAccountEmail}
9198
onNameChange={setAccountName}
9299
/>
93-
</div>
100+
</form>
94101
)}
95102

96103
<DialogFooter>
97-
<Button onClick={() => onOpenChange(false)} variant="outline">
104+
<Button
105+
onClick={() => onOpenChange(false)}
106+
type="button"
107+
variant="outline"
108+
>
98109
Cancel
99110
</Button>
100-
<Button disabled={loading || saving} onClick={saveAccount}>
111+
<Button
112+
disabled={loading || saving}
113+
form="settings-form"
114+
type="submit"
115+
>
101116
{saving ? <Spinner className="mr-2 size-4" /> : null}
102117
Save
103118
</Button>

components/settings/integration-form-dialog.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,14 @@ export function IntegrationFormDialog({
498498
searchQuery={searchQuery}
499499
/>
500500
) : (
501-
<div className="space-y-4">
501+
<form
502+
className="space-y-4"
503+
id="integration-form"
504+
onSubmit={(e) => {
505+
e.preventDefault();
506+
handleSave();
507+
}}
508+
>
502509
<ConfigFields
503510
formData={formData}
504511
isEditMode={mode === "edit"}
@@ -516,7 +523,7 @@ export function IntegrationFormDialog({
516523
value={formData.name}
517524
/>
518525
</div>
519-
</div>
526+
</form>
520527
)}
521528

522529
<DialogFooter
@@ -547,11 +554,16 @@ export function IntegrationFormDialog({
547554
<Button
548555
disabled={saving || deleting}
549556
onClick={() => onClose()}
557+
type="button"
550558
variant="outline"
551559
>
552560
Cancel
553561
</Button>
554-
<Button disabled={saving || deleting} onClick={handleSave}>
562+
<Button
563+
disabled={saving || deleting}
564+
form="integration-form"
565+
type="submit"
566+
>
555567
{saving ? <Spinner className="mr-2 size-4" /> : null}
556568
{mode === "edit" ? "Update" : "Create"}
557569
</Button>

components/settings/integrations-dialog.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,12 @@ export function IntegrationsDialog({
9292
</div>
9393
)}
9494

95-
<DialogFooter className="flex justify-between sm:justify-between">
96-
<Button onClick={() => handleClose(false)} variant="outline">
97-
Done
98-
</Button>
99-
<Button onClick={() => setShowCreateDialog(true)}>
95+
<DialogFooter className="sm:justify-between">
96+
<Button onClick={() => setShowCreateDialog(true)} variant="outline">
10097
<Plus className="mr-2 size-4" />
10198
Add Connection
10299
</Button>
100+
<Button onClick={() => handleClose(false)}>Done</Button>
103101
</DialogFooter>
104102
</DialogContent>
105103
</Dialog>

components/workflow/workflow-toolbar.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,11 +1744,11 @@ function WorkflowIssuesDialog({
17441744
)}
17451745
</div>
17461746

1747-
<AlertDialogFooter className="flex-col gap-2 sm:flex-row">
1748-
<AlertDialogCancel>Cancel</AlertDialogCancel>
1747+
<AlertDialogFooter className="sm:justify-between">
17491748
<Button onClick={actions.handleExecuteAnyway} variant="outline">
17501749
Run Anyway
17511750
</Button>
1751+
<AlertDialogCancel>Cancel</AlertDialogCancel>
17521752
</AlertDialogFooter>
17531753
</AlertDialogContent>
17541754
</AlertDialog>
@@ -1920,12 +1920,14 @@ function WorkflowDialogsComponent({
19201920
the workflow?
19211921
</AlertDialogDescription>
19221922
</AlertDialogHeader>
1923-
<AlertDialogFooter>
1924-
<AlertDialogCancel>Cancel</AlertDialogCancel>
1923+
<AlertDialogFooter className="sm:justify-between">
19251924
<Button onClick={actions.handleRunWithoutSaving} variant="outline">
19261925
Run Without Saving
19271926
</Button>
1928-
<Button onClick={actions.handleSaveAndRun}>Save and Run</Button>
1927+
<div className="flex gap-2">
1928+
<AlertDialogCancel>Cancel</AlertDialogCancel>
1929+
<Button onClick={actions.handleSaveAndRun}>Save and Run</Button>
1930+
</div>
19291931
</AlertDialogFooter>
19301932
</AlertDialogContent>
19311933
</AlertDialog>

0 commit comments

Comments
 (0)