Skip to content

Commit 773eb46

Browse files
committed
Apply the cleanup passes: step-back focus, one failure notice, fewer comments
1 parent f1498f5 commit 773eb46

12 files changed

Lines changed: 25 additions & 44 deletions

File tree

‎apps/sim/platform/app/(shell)/_components/sidebar/section-status.tsx‎

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ShellQueryStatus } from '@/platform/app/(shell)/_components/model'
22
import styles from '@/platform/app/(shell)/_components/sidebar/sidebar-collections.module.css'
3-
import { Button, InlineNotice } from '@/platform/design-system/components'
3+
import { FailureNotice } from '@/platform/design-system/components'
44

55
interface SectionStatusProps {
66
/** Absent means the rows are simply there, so nothing here applies. */
@@ -19,20 +19,7 @@ export function SectionStatus({
1919
failureLabel,
2020
onRetry,
2121
}: SectionStatusProps) {
22-
if (status === 'error')
23-
return (
24-
<InlineNotice
25-
intent='danger'
26-
message={failureLabel}
27-
action={
28-
onRetry && (
29-
<Button size='compact' variant='quiet' onClick={onRetry}>
30-
Retry
31-
</Button>
32-
)
33-
}
34-
/>
35-
)
22+
if (status === 'error') return <FailureNotice message={failureLabel} onRetry={onRetry} />
3623
if (status === 'success' && isEmpty)
3724
return (
3825
<p className={styles.message} data-type='T052'>

‎apps/sim/platform/app/(shell)/people/_components/directory-sync/directory-sync-modal.tsx‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import styles from '@/platform/app/(shell)/people/_components/directory-sync/dir
77
import { canUseProvisioning } from '@/platform/app/(shell)/people/_components/import/import-modal'
88
import {
99
Button,
10+
FailureNotice,
1011
InlineNotice,
1112
Modal,
1213
PropertyList,
@@ -368,14 +369,10 @@ export function DirectorySyncModal({ organization, onClose }: DirectorySyncModal
368369
Loading directory connection…
369370
</p>
370371
) : directory.loadError ? (
371-
<InlineNotice
372-
intent='danger'
372+
<FailureNotice
373373
message={directory.loadError.message}
374-
action={
375-
<Button size='compact' disabled={directory.fetching} onClick={directory.retry}>
376-
Retry connection
377-
</Button>
378-
}
374+
retrying={directory.fetching}
375+
onRetry={directory.retry}
379376
/>
380377
) : mode === 'disconnect' && sync ? (
381378
<>

‎apps/sim/platform/app/(shell)/settings/_components/section-parts/saved-settings.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ interface BooleanRowProps {
3030
description: string
3131
}
3232

33-
/** A saved on-or-off preference. */
3433
export function BooleanRow({ setting, label, description }: BooleanRowProps) {
3534
const { checked, disabled, set } = useBooleanSetting(setting)
3635
return (

‎apps/sim/platform/app/(shell)/settings/_components/section-parts/section-parts.module.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
display: block;
115115
block-size: var(--spacing-12);
116116
border-radius: var(--radius-4);
117-
background: var(--ui-hover);
117+
background: var(--control-muted-fill);
118118
}
119119

120120
.skeletonLabel {

‎apps/sim/platform/app/(shell)/settings/_components/section-parts/section-parts.tsx‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ interface SectionSkeletonProps {
142142
rows?: number
143143
}
144144

145-
/** A section's own heading over its loading rows. */
146145
export function SectionSkeleton({ title, rows }: SectionSkeletonProps) {
147146
return (
148147
<SettingsSection title={title}>

‎apps/sim/platform/app/(shell)/settings/_components/sections/data-drains/drain-create.tsx‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
import {
1414
Button,
1515
Checkbox,
16-
FailureNotice,
16+
InlineNotice,
1717
SecretField,
1818
SelectField,
1919
TextAreaField,
@@ -203,7 +203,9 @@ export function DrainCreate({ organizationId, onBack, onCreated }: DrainCreatePr
203203
}}
204204
/>
205205
))}
206-
{createDrain.error && <FailureNotice message={toError(createDrain.error).message} />}
206+
{createDrain.error && (
207+
<InlineNotice intent='danger' message={toError(createDrain.error).message} />
208+
)}
207209
</FieldStack>
208210
</SettingsSection>
209211
<ActionRow>

‎apps/sim/platform/app/(shell)/settings/_components/settings-screen/settings-screen.module.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,5 +75,5 @@
7575
block-size: var(--spacing-32);
7676
inline-size: var(--spacing-128);
7777
border-radius: var(--radius-4);
78-
background: var(--ui-hover);
78+
background: var(--control-muted-fill);
7979
}

‎apps/sim/platform/design-system/components/button/control-row.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function ControlRow({
5656
),
5757
},
5858
})
59-
if (!action) return control
59+
if (!action && !status) return control
6060
return (
6161
<div
6262
className={styles.chipRow}
@@ -65,7 +65,7 @@ export function ControlRow({
6565
>
6666
{control}
6767
{status && <span className={styles.chipStatus}>{status}</span>}
68-
<span className={styles.chipAction}>{action}</span>
68+
{action && <span className={styles.chipAction}>{action}</span>}
6969
</div>
7070
)
7171
}

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ function ModalSurface({
7272
const [index, setIndex] = useState(0)
7373
const [pending, setPending] = useState(false)
7474
const [error, setError] = useState<string | null>(null)
75+
/** A step back within one step still moves focus, so a repeated Enter cannot reach Cancel. */
76+
const [backs, setBacks] = useState(0)
7577
const open = controlled ?? internal
7678
const step = steps[index]
7779
const last = index === steps.length - 1
@@ -115,7 +117,7 @@ function ModalSurface({
115117
open={open}
116118
title={title}
117119
description={step.description}
118-
step={index}
120+
step={index + backs}
119121
presentation={presentation}
120122
busy={pending}
121123
onClose={dismiss}
@@ -144,8 +146,10 @@ function ModalSurface({
144146
onPrevious={() => {
145147
setError(null)
146148
if (index > 0) setIndex(index - 1)
147-
else if (onBack) onBack()
148-
else dismiss()
149+
else if (onBack) {
150+
onBack()
151+
setBacks(backs + 1)
152+
} else dismiss()
149153
}}
150154
cancelLabel={index > 0 || onBack ? 'Back' : cancelLabel}
151155
disabled={pending || (last && confirmDisabled)}

‎apps/sim/platform/lib/data/server-request.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ export async function serverRequestJson<C extends AnyApiRouteContract>(
3838
return readContractResponse(contract, response)
3939
}
4040

41-
/** A first-paint read, which gives up its seat quickly because the client can always fetch it. */
4241
export function prefetchRequestJson<C extends AnyApiRouteContract>(
4342
contract: C,
4443
input: ApiClientRequest<C>

0 commit comments

Comments
 (0)