@@ -8,7 +8,7 @@ import { FileField } from '@sim/emcn/field/file-field'
88import { SecretField } from '@sim/emcn/field/value-fields'
99import { Modal } from '@sim/emcn/modal'
1010import { useScrollEdges } from '@sim/emcn/scroll-area/use-scroll-edges'
11- import { FailureNotice } from '@sim/emcn/status'
11+ import { InlineNotice } from '@sim/emcn/status'
1212import { getErrorMessage } from '@sim/utils/errors'
1313import Link from 'next/link'
1414import { toast } from '@/lib/toast/sink'
@@ -156,7 +156,6 @@ export function ImportModal({ organizationId, onClose, onOpenSync }: ImportModal
156156 confirmLabel = {
157157 done ? 'Done' : preview ? `Import ${ plural ( preview . updated , 'profile' ) } ` : 'Preview import'
158158 }
159- pending = { pending }
160159 confirmDisabled = { pending || ( ! preview && ! ready ) }
161160 onBack = { preview ? ( ) => setPreview ( null ) : undefined }
162161 onConfirm = {
@@ -248,46 +247,45 @@ export function ImportModal({ organizationId, onClose, onOpenSync }: ImportModal
248247 </ ExternalLink >
249248 </ >
250249 ) }
251- { source === 'directory' && connection . failed && (
252- < FailureNotice
253- message = 'Could not load your provisioning connection.'
254- retrying = { connection . fetching }
255- onRetry = { connection . refresh }
256- />
257- ) }
258- { source === 'directory' && ! connection . failed && ! connection . loading && (
250+ { source === 'directory' && (
259251 < >
260- < p className = { styles . secondary } data-type = 'T060' >
261- { ! connection . active
262- ? 'Enable SCIM provisioning and assign accounts in your provider to import their profiles.'
263- : connection . userCount === 0
264- ? 'Your connection is active. Assign accounts to Sim in your identity provider, then refresh here.'
265- : `Your connection has ${ plural ( connection . userCount , 'provisioned account' ) } . Preview the profile fields and reporting lines sent by your provider.` }
266- </ p >
267- < div className = { styles . links } >
268- { canOpenProvisioningSettings && (
252+ { ! connection . loading && (
253+ < p className = { styles . secondary } data-type = 'T060' >
254+ { connection . failed
255+ ? 'Could not load your provisioning connection.'
256+ : ! connection . active
257+ ? 'Enable SCIM provisioning and assign accounts in your provider to import their profiles.'
258+ : connection . userCount === 0
259+ ? 'Your connection is active. Assign accounts to Sim in your identity provider, then refresh here.'
260+ : `Your connection has ${ plural ( connection . userCount , 'provisioned account' ) } . Preview the profile fields and reporting lines sent by your provider.` }
261+ </ p >
262+ ) }
263+ { ! connection . loading && (
264+ < div className = { styles . links } >
265+ { canOpenProvisioningSettings && ! connection . failed && (
266+ < Button
267+ variant = 'quiet'
268+ size = 'compact'
269+ render = { < Link href = { provisioningSettingsHref } /> }
270+ >
271+ { connection . active ? 'Manage provisioning' : 'Set up provisioning' }
272+ </ Button >
273+ ) }
274+ { ! connection . active && (
275+ < ExternalLink href = 'https://docs.sim.ai/platform/enterprise/scim' >
276+ Provisioning guide
277+ </ ExternalLink >
278+ ) }
269279 < Button
270280 variant = 'quiet'
271281 size = 'compact'
272- render = { < Link href = { provisioningSettingsHref } /> }
282+ disabled = { connection . fetching }
283+ onClick = { connection . refresh }
273284 >
274- { connection . active ? 'Manage provisioning ' : 'Set up provisioning ' }
285+ { connection . failed ? 'Retry connection ' : 'Refresh ' }
275286 </ Button >
276- ) }
277- { ! connection . active && (
278- < ExternalLink href = 'https://docs.sim.ai/platform/enterprise/scim' >
279- Provisioning guide
280- </ ExternalLink >
281- ) }
282- < Button
283- variant = 'quiet'
284- size = 'compact'
285- disabled = { connection . fetching }
286- onClick = { connection . refresh }
287- >
288- Refresh
289- </ Button >
290- </ div >
287+ </ div >
288+ ) }
291289 </ >
292290 ) }
293291 { source === 'file' && (
@@ -303,6 +301,7 @@ export function ImportModal({ organizationId, onClose, onOpenSync }: ImportModal
303301 error = { fileError }
304302 hint = 'CSV or Excel with an email column, plus any of title, department, location, start date, and manager email.'
305303 />
304+ { reading && < InlineNotice message = 'Reading…' /> }
306305 < div >
307306 < Button variant = 'quiet' size = 'compact' onClick = { downloadImportTemplate } >
308307 Download template
0 commit comments