Skip to content

Commit d5aea16

Browse files
committed
fix(org): give pick-a-row dialogs one way to close
A row acts on its own in Add source and Add provider, so Done did the same thing as Close. The confirm action becomes optional in the shared modal, which every other caller still passes.
1 parent f185154 commit d5aea16

4 files changed

Lines changed: 11 additions & 7 deletions

File tree

‎apps/sim/platform/design-system/components/modal/modal-parts.tsx‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ export function ModalBody({ children, label, inactive, onInput }: ModalBodyProps
5656
}
5757

5858
interface ModalFooterProps {
59-
confirmLabel: string
59+
/** Absent for a dialog whose rows act on their own, which only closes. */
60+
confirmLabel?: string
6061
onPrevious?: () => void
6162
cancelLabel?: string
6263
destructive?: boolean
@@ -84,9 +85,11 @@ export function ModalFooter({
8485
<Button variant='quiet' disabled={cancelDisabled} onClick={onPrevious}>
8586
{cancelLabel}
8687
</Button>
87-
<Button variant={destructive ? 'destructive' : 'primary'} submit disabled={disabled}>
88-
{confirmLabel}
89-
</Button>
88+
{confirmLabel && (
89+
<Button variant={destructive ? 'destructive' : 'primary'} submit disabled={disabled}>
90+
{confirmLabel}
91+
</Button>
92+
)}
9093
</footer>
9194
)
9295
}

‎apps/sim/platform/design-system/components/modal/modal.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ type ConfirmHandler<Args extends unknown[]> = (...args: Args) => unknown
2626

2727
interface ModalActions {
2828
title: string
29-
confirmLabel: string
29+
/** Absent for a dialog whose rows act on their own, which only closes. */
30+
confirmLabel?: string
3031
confirmDisabled?: boolean
3132
onConfirm?: ConfirmHandler<[values: FormData]>
3233
/** Names the dialog more specifically than its visible title. */

‎apps/sim/platform/embedded/app/(shell)/settings/_components/sections/connected-accounts/provider-catalog-modal.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function ProviderCatalogModal({
5353
}}
5454
title='Add provider'
5555
cancelLabel='Close'
56-
confirmLabel='Done'
56+
submitOnEnter={false}
5757
>
5858
<SectionSearch subject='providers' value={search} onValueChange={setSearch} />
5959
{providers.map(({ name, icon, choice }) => {

‎apps/sim/platform/embedded/app/(shell)/settings/_components/sections/integrations/add-source-modal.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function AddSourceModal({
4141
}}
4242
title='Add source'
4343
cancelLabel='Close'
44-
confirmLabel='Done'
44+
submitOnEnter={false}
4545
>
4646
{feedback}
4747
<RowList>

0 commit comments

Comments
 (0)