Skip to content

Commit 5a01d0f

Browse files
committed
fix(org): line up every Add source row and give Generic Secrets its integration mark
A source that opens nothing used a settings row, whose wider leading slot put its mark 4px off the others; it is now the same row, without the chevron a row that opens nothing has no business showing. Generic Secrets drops the organization's monogram for the mark the Integrations list gives it.
1 parent 146e4bf commit 5a01d0f

5 files changed

Lines changed: 31 additions & 45 deletions

File tree

‎apps/sim/platform/design-system/components/activity-row/activity-row.module.css‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@
3939
align-items: center;
4040
gap: var(--ui-popup-padding);
4141
}
42-
.row:hover {
42+
.row:hover:not([data-read-only]) {
4343
background: var(--ui-hover);
4444
}
45+
.row[data-read-only] {
46+
cursor: default;
47+
}
4548
.body {
4649
display: flex;
4750
align-items: start;

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

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ interface ActivityRowProps {
2424
}
2525

2626
type ActivityTarget =
27-
| { href: string; onOpen?: never; render?: never }
28-
| { href?: never; onOpen: () => void; render?: never }
27+
| { href: string; onOpen?: never; render?: never; readOnly?: never }
28+
| { href?: never; onOpen: () => void; render?: never; readOnly?: never }
2929
/** The row's own link, for a destination whose navigation carries a guard. */
30-
| { href?: never; onOpen?: never; render: ReactElement }
30+
| { href?: never; onOpen?: never; render: ReactElement; readOnly?: never }
31+
/** A row in the same list that opens nothing, such as a source this deployment does not offer. */
32+
| { href?: never; onOpen?: never; render?: never; readOnly: true }
3133

3234
interface RenderedRowProps {
3335
render: ReactElement
@@ -55,6 +57,7 @@ export function ActivityRow({
5557
onOpen,
5658
href,
5759
render,
60+
readOnly,
5861
}: ActivityRowProps & ActivityTarget) {
5962
const content = (
6063
<>
@@ -75,22 +78,26 @@ export function ActivityRow({
7578
</span>
7679
)}
7780
</ActivityBody>
78-
{(metadata || showChevron) && (
81+
{(metadata || (showChevron && !readOnly)) && (
7982
<span className={styles.meta} data-type='T052'>
8083
{metadata && (
8184
<span className={styles.metaLabel}>
8285
{metadataLeading}
8386
{metadata}
8487
</span>
8588
)}
86-
{showChevron && <Icon name='I032' />}
89+
{showChevron && !readOnly && <Icon name='I032' />}
8790
</span>
8891
)}
8992
</>
9093
)
9194
return (
9295
<li className={styles.entry}>
93-
{render ? (
96+
{readOnly ? (
97+
<div className={styles.row} data-density={density} data-read-only>
98+
{content}
99+
</div>
100+
) : render ? (
94101
<RenderedRow render={render} rowDensity={density}>
95102
{content}
96103
</RenderedRow>

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

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
11
'use client'
22

33
import type { ComponentType, ReactNode } from 'react'
4-
import {
5-
ActivityRow,
6-
Avatar,
7-
EmptyState,
8-
Modal,
9-
RowList,
10-
} from '@/platform/design-system/components'
11-
import { SettingsRow } from '@/platform/design-system/components/settings-section/settings-section'
4+
import { ActivityRow, EmptyState, Modal, RowList } from '@/platform/design-system/components'
125
import { IntegrationMark } from '@/platform/embedded/app/(shell)/_components/integration-mark/integration-mark'
136
import { GENERIC_SECRETS_SOURCE_TYPE } from '@/platform/embedded/app/(shell)/settings/_components/sections/integrations/generic-secrets'
147

15-
interface SourceMarkProps {
16-
organization: AddSourceModalProps['organization']
17-
type: string
18-
icon?: ComponentType<{ className?: string }>
19-
}
20-
218
interface AddSourceModalProps {
22-
organization: { name: string; logo?: string | null }
239
sources: {
2410
type: string
2511
name: string
@@ -35,16 +21,10 @@ interface AddSourceModalProps {
3521
descriptions: Readonly<Record<string, string>>
3622
}
3723

38-
function SourceMark({ organization, type, icon }: SourceMarkProps) {
39-
return type === GENERIC_SECRETS_SOURCE_TYPE ? (
40-
<Avatar name={organization.name} src={organization.logo ?? undefined} organization />
41-
) : (
42-
<IntegrationMark providerId={type} icon={icon} />
43-
)
44-
}
24+
/** Generic Secrets has no provider, so it takes the same mark the Integrations list gives it. */
25+
const markId = (type: string) => (type === GENERIC_SECRETS_SOURCE_TYPE ? undefined : type)
4526

4627
export function AddSourceModal({
47-
organization,
4828
sources,
4929
pending,
5030
ready,
@@ -77,18 +57,19 @@ export function AddSourceModal({
7757
? 'Unavailable in this deployment'
7858
: descriptions[type]
7959
return pending || !sourceReady || !available ? (
80-
<li key={type}>
81-
<SettingsRow
82-
label={name}
83-
description={description}
84-
leading={<SourceMark organization={organization} type={type} icon={icon} />}
85-
/>
86-
</li>
60+
<ActivityRow
61+
readOnly
62+
density='comfortable'
63+
key={type}
64+
leading={<IntegrationMark providerId={markId(type)} icon={icon} />}
65+
title={name}
66+
detail={description}
67+
/>
8768
) : (
8869
<ActivityRow
8970
density='comfortable'
9071
key={type}
91-
leading={<SourceMark organization={organization} type={type} icon={icon} />}
72+
leading={<IntegrationMark providerId={markId(type)} icon={icon} />}
9273
title={name}
9374
detail={description}
9475
onOpen={() => onSelect(type, access.admin ? 'admin' : 'members')}

‎apps/sim/platform/embedded/app/(shell)/settings/_components/sections/integrations/generic-secrets.tsx‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@ import { useRouter } from 'next/navigation'
77
import type { GenericSecretSource } from '@/lib/api/contracts/organization-secrets'
88
import { organizationRoutes } from '@/lib/navigation/paths'
99
import type { SecretSourceMode } from '@/lib/organization-secrets/validation'
10-
import { useOrganization } from '@/lib/organizations/provider'
1110
import {
1211
useConfigureOrganizationSecretSource,
1312
useRemoveOrganizationSecretSource,
1413
} from '@/hooks/queries/organization-secrets'
1514
import {
1615
ActionMenu,
17-
Avatar,
1816
Button,
1917
ConfirmDialog,
2018
FieldFrame,
2119
Modal,
2220
SegmentedControl,
2321
} from '@/platform/design-system/components'
2422
import { SettingsRow } from '@/platform/design-system/components/settings-section/settings-section'
23+
import { IntegrationMark } from '@/platform/embedded/app/(shell)/_components/integration-mark/integration-mark'
2524
import {
2625
ActionRow,
2726
Muted,
@@ -81,7 +80,6 @@ interface GenericSecretSourceRowProps {
8180
}
8281

8382
export function GenericSecretSourceRow({ organizationId, source }: GenericSecretSourceRowProps) {
84-
const { organization } = useOrganization()
8583
const [editing, setEditing] = useState(false)
8684
const [removing, setRemoving] = useState(false)
8785
const remove = useRemoveOrganizationSecretSource(organizationId)
@@ -91,9 +89,7 @@ export function GenericSecretSourceRow({ organizationId, source }: GenericSecret
9189
<SettingsRow
9290
label={GENERIC_SECRETS_NAME}
9391
description={source.mode === 'organization' ? 'Organization' : 'Member'}
94-
leading={
95-
<Avatar name={organization.name} src={organization.logo ?? undefined} organization />
96-
}
92+
leading={<IntegrationMark />}
9793
>
9894
<ActionRow>
9995
{source.mode === 'organization' && (

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ export default function IntegrationsSection({ organization: context }: SettingsS
348348
)}
349349
{adding && (
350350
<AddSourceModal
351-
organization={organization}
352351
sources={availableToAdd}
353352
descriptions={Object.fromEntries(
354353
availableToAdd.map(({ type, access }) => [

0 commit comments

Comments
 (0)