From 959fe39b1d2061ecf9e64911fc770c4549c01b7f Mon Sep 17 00:00:00 2001 From: S2D2 Date: Mon, 9 Nov 2026 09:42:45 +0000 Subject: [PATCH 1/4] feat(ENG-3987): move the connector profile picker into the hub form The header no longer carries the profile dropdown: it keeps back, logo, connector name, guide and close. The picker is now the first field of the form, a two-line dropdown with the profile name and a Default pill on line one and its auth method on line two. It is hidden when the connector has a single profile. Co-Authored-By: Claude Opus 5.5 Co-authored-by: Bryce Tozer <188892020+brycetoz@users.noreply.github.com> --- .../integration-picker/IntegrationPicker.tsx | 5 +- .../components/IntegrationFields.tsx | 16 ++++- .../components/IntegrationPickerContent.tsx | 13 ++++ .../components/IntegrationPickerTitle.tsx | 12 +--- .../components/ProfilePicker.tsx | 35 ++++++++++ .../components/cardTitle.tsx | 68 +++---------------- .../components/views/IntegrationFormView.tsx | 3 + .../utils/profileOptions.test.tsx | 18 +++-- .../utils/profileOptions.tsx | 8 ++- 9 files changed, 96 insertions(+), 82 deletions(-) create mode 100644 src/modules/integration-picker/components/ProfilePicker.tsx diff --git a/src/modules/integration-picker/IntegrationPicker.tsx b/src/modules/integration-picker/IntegrationPicker.tsx index 9348582..9d5396b 100644 --- a/src/modules/integration-picker/IntegrationPicker.tsx +++ b/src/modules/integration-picker/IntegrationPicker.tsx @@ -146,9 +146,6 @@ export const IntegrationPicker: React.FC = ({ hasOnlyOneIntegration } connectorData={connectorData?.config ?? null} - profiles={profiles} - selectedProfileId={selectedIntegration?.integration_id} - onProfileChange={selectProfile} /> ) } @@ -173,6 +170,7 @@ export const IntegrationPicker: React.FC = ({ connectorData={connectorData?.config ?? null} hubData={hubData ?? null} fields={fields} + profiles={profiles} notices={notices} loadError={loadError} onRetryLoad={retryLoad} @@ -180,6 +178,7 @@ export const IntegrationPicker: React.FC = ({ onChange={setFormData} onValidationChange={handleValidationChange} onCancelOAuth={handleCancelOAuth} + onProfileChange={selectProfile} selectedCategory={selectedCategory} search={search} editingSecrets={editingSecrets} diff --git a/src/modules/integration-picker/components/IntegrationFields.tsx b/src/modules/integration-picker/components/IntegrationFields.tsx index 9bd9dcb..8eecf8a 100644 --- a/src/modules/integration-picker/components/IntegrationFields.tsx +++ b/src/modules/integration-picker/components/IntegrationFields.tsx @@ -226,6 +226,7 @@ const ErrorBlock = ({ error }: { error?: { message: string; provider_response: s }; interface IntegrationFieldsProps { fields: Array; + profilePicker?: React.ReactNode; notices?: Array; error?: { message: string; @@ -241,9 +242,10 @@ interface IntegrationFieldsProps { const NoFieldsView: React.FC<{ integrationName: string; + profilePicker?: React.ReactNode; error?: { message: string; provider_response: string }; notices?: AuthenticationNotice[]; -}> = ({ integrationName, error, notices = [] }) => { +}> = ({ integrationName, profilePicker, error, notices = [] }) => { // No fields for a notice to sit above or below, so position is irrelevant here — // render every notice together rather than orphaning bottom ones under the card. return ( @@ -257,6 +259,7 @@ const NoFieldsView: React.FC<{ )} + {profilePicker} {notices.map((n) => ( ))} @@ -284,6 +287,7 @@ const NoFieldsView: React.FC<{ export const IntegrationForm: React.FC = ({ fields, + profilePicker, notices = [], onChange, error, @@ -354,7 +358,14 @@ export const IntegrationForm: React.FC = ({ }; if (displayedFields.length === 0) { - return ; + return ( + + ); } return ( @@ -366,6 +377,7 @@ export const IntegrationForm: React.FC = ({ )}
+ {profilePicker} {displayedFields.map((field) => { const key = typeof field.key === 'object' diff --git a/src/modules/integration-picker/components/IntegrationPickerContent.tsx b/src/modules/integration-picker/components/IntegrationPickerContent.tsx index bca587a..e73444d 100644 --- a/src/modules/integration-picker/components/IntegrationPickerContent.tsx +++ b/src/modules/integration-picker/components/IntegrationPickerContent.tsx @@ -3,10 +3,12 @@ import { AuthenticationNotice, ConnectorConfig, ConnectorConfigField, + ConnectorProfile, HubData, Integration, } from '../types'; import { describeLoadError } from '../utils/requestErrors'; +import { ProfilePicker } from './ProfilePicker'; import { ErrorView } from './views/ErrorView'; import { IntegrationFormView } from './views/IntegrationFormView'; import { IntegrationListView } from './views/IntegrationListView'; @@ -31,6 +33,7 @@ interface IntegrationPickerContentProps { connectorData: ConnectorConfig | null; hubData: HubData | null; fields: ConnectorConfigField[]; + profiles?: ConnectorProfile[]; notices?: AuthenticationNotice[]; selectedCategory: string | null; search: string; @@ -44,6 +47,7 @@ interface IntegrationPickerContentProps { onChange: (data: Record) => void; onValidationChange?: (isValid: boolean) => void; onCancelOAuth?: () => void; + onProfileChange: (integrationId: string) => void; editingSecrets?: Set; setEditingSecrets?: (updater: (prev: Set) => Set) => void; } @@ -56,6 +60,7 @@ export const IntegrationPickerContent: React.FC = connectorData, hubData, fields, + profiles, notices, selectedCategory, search, @@ -65,6 +70,7 @@ export const IntegrationPickerContent: React.FC = onChange, onValidationChange, onCancelOAuth, + onProfileChange, editingSecrets, setEditingSecrets, }) => { @@ -126,6 +132,13 @@ export const IntegrationPickerContent: React.FC = + } notices={notices} error={connectionState.error} onChange={onChange} diff --git a/src/modules/integration-picker/components/IntegrationPickerTitle.tsx b/src/modules/integration-picker/components/IntegrationPickerTitle.tsx index 8b00ca7..8169d44 100644 --- a/src/modules/integration-picker/components/IntegrationPickerTitle.tsx +++ b/src/modules/integration-picker/components/IntegrationPickerTitle.tsx @@ -1,6 +1,5 @@ import { Flex, FlexAlign, FlexDirection, FlexJustify } from '@stackone/malachite'; -import { ConnectorConfig, ConnectorProfile, HubData } from '../types'; -import { profileOptions } from '../utils/profileOptions'; +import { ConnectorConfig, HubData } from '../types'; import CardTitle from './cardTitle'; import { HeaderCloseButton } from './headerCloseButton'; import { IntegrationListHeader } from './views/IntegrationListView'; @@ -18,9 +17,6 @@ interface IntegrationPickerTitleProps { onCategoryChange: (category: string | null) => void; onSearchChange: (search: string) => void; hideBackButton?: boolean; - profiles?: ConnectorProfile[]; - selectedProfileId?: string; - onProfileChange?: (integrationId: string) => void; } export const IntegrationPickerTitle: React.FC = ({ @@ -36,9 +32,6 @@ export const IntegrationPickerTitle: React.FC = ({ onCategoryChange, onSearchChange, hideBackButton, - profiles, - selectedProfileId, - onProfileChange, }) => { const loneClose = onClose ? ( = ({ onBack={accountData || hideBackButton ? undefined : onBack} onClose={onClose} guide={guide} - profileOptions={profileOptions(profiles)} - selectedProfileId={selectedProfileId} - onProfileChange={onProfileChange} /> ); } diff --git a/src/modules/integration-picker/components/ProfilePicker.tsx b/src/modules/integration-picker/components/ProfilePicker.tsx new file mode 100644 index 0000000..02cad69 --- /dev/null +++ b/src/modules/integration-picker/components/ProfilePicker.tsx @@ -0,0 +1,35 @@ +import { Dropdown } from '@stackone/malachite'; +import { ConnectorProfile } from '../types'; +import { profileOptions } from '../utils/profileOptions'; + +interface ProfilePickerProps { + profiles?: ConnectorProfile[]; + selectedProfileId?: string; + onProfileChange: (integrationId: string) => void; +} + +export const ProfilePicker: React.FC = ({ + profiles, + selectedProfileId, + onProfileChange, +}) => { + const items = profileOptions(profiles); + if (items.length === 0) { + return null; + } + + return ( + id && onProfileChange(id)} + /> + ); +}; diff --git a/src/modules/integration-picker/components/cardTitle.tsx b/src/modules/integration-picker/components/cardTitle.tsx index d2446d1..22055ee 100644 --- a/src/modules/integration-picker/components/cardTitle.tsx +++ b/src/modules/integration-picker/components/cardTitle.tsx @@ -1,8 +1,6 @@ import { Avatar, Button, - Dropdown, - DropdownItem, Flex, FlexAlign, FlexDirection, @@ -14,47 +12,21 @@ import { import { ConnectorConfig } from '../types'; import { HeaderCloseButton } from './headerCloseButton'; -const TITLE_CONTAINER_CLASS = 'stackone-hub-card-title'; -const CONNECTOR_NAME_CLASS = 'stackone-hub-card-title-name'; -const NAME_HIDDEN_BELOW_PX = 420; - -// The hub renders inside malachite's shadow root, which page-level stylesheets cannot reach. -const TITLE_STYLES = ` -.${TITLE_CONTAINER_CLASS} { container-type: inline-size; } -.${CONNECTOR_NAME_CLASS} { display: contents; } -@container (max-width: ${NAME_HIDDEN_BELOW_PX}px) { - .${CONNECTOR_NAME_CLASS} { display: none; } -} -`; - interface CardTitleProps { connectorData: ConnectorConfig; onBack?: () => void; onClose?: () => void; guide?: { supportLink?: string | null; description?: string | null }; - profileOptions?: DropdownItem[]; - selectedProfileId?: string; - onProfileChange?: (integrationId: string) => void; } -const CardTitle: React.FC = ({ - connectorData, - onBack, - onClose, - guide, - profileOptions, - selectedProfileId, - onProfileChange, -}) => { +const CardTitle: React.FC = ({ connectorData, onBack, onClose, guide }) => { return ( - = ({ size={16} fallback="placeholder" /> -
- - {connectorData.name} - -
+ + {connectorData.name} +
- {profileOptions && profileOptions.length > 0 && ( - <> - Profile -
- id && onProfileChange?.(id)} - /> -
- - )} {guide?.supportLink ? (