@@ -444,6 +444,18 @@ export const AssistantDriveDataSources: FC<Props> = ({
444444 }
445445 }
446446
447+ // Get list of supported Microsoft services
448+ const getSupportedMicrosoftServices = ( ) : Array < 'microsoft_drive' | 'microsoft_sharepoint' > => {
449+ if ( ! supportedDriveIntegrations ) return [ ] ;
450+ return supportedDriveIntegrations . filter (
451+ integration => integration === 'microsoft_drive' || integration === 'microsoft_sharepoint'
452+ ) as Array < 'microsoft_drive' | 'microsoft_sharepoint' > ;
453+ } ;
454+
455+ const getServiceDisplayName = ( service : 'microsoft_drive' | 'microsoft_sharepoint' ) : string => {
456+ return service === 'microsoft_drive' ? 'OneDrive' : 'SharePoint' ;
457+ } ;
458+
447459 // Initialize drive rescan schedule from existing scheduled tasks
448460 useEffect ( ( ) => {
449461 const initializeDriveRescanSchedule = async ( ) => {
@@ -513,49 +525,58 @@ export const AssistantDriveDataSources: FC<Props> = ({
513525 ] }
514526 />
515527
516- { /* Microsoft Service Selector - shown when Microsoft tab is active */ }
517- { selectedIntegration && ( selectedIntegration . startsWith ( 'microsoft_' ) ) && (
518- < div className = "mb-4 px-4" >
519- < label className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2" >
520- < span className = "flex items-center gap-2" >
521- Select Service
522- </ span >
523- { /* Connection status indicator */ }
524- { connectedDriveIntegrations ?. includes ( selectedMicrosoftService ) ? (
525- < span className = "ml-auto text-xs text-green-600 dark:text-green-400 flex items-center gap-1" >
526- < span className = "w-2 h-2 bg-green-500 rounded-full" > </ span >
527- Connected
528- </ span >
529- ) : (
530- < span className = "ml-auto text-xs text-red-600 dark:text-red-400 flex items-center gap-1" >
531- < span className = "w-2 h-2 bg-red-500 rounded-full" > </ span >
532- Disconnected
528+ { /* Microsoft Service Selector - only shown when multiple services are supported */ }
529+ { selectedIntegration && ( selectedIntegration . startsWith ( 'microsoft_' ) ) && ( ( ) => {
530+ const supportedMicrosoftServices = getSupportedMicrosoftServices ( ) ;
531+
532+ // If only one service is supported, don't show selector at all
533+ if ( supportedMicrosoftServices . length <= 1 ) {
534+ return null ;
535+ }
536+
537+ // Multiple services supported - show dropdown
538+ return (
539+ < div className = "mb-4 px-4" >
540+ < label className = "block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2 flex items-center gap-2" >
541+ < span className = "flex items-center gap-2" >
542+ Select Service
533543 </ span >
534- ) }
535- </ label >
536- < div className = "relative" >
537- < select
538- value = { selectedMicrosoftService }
539- onChange = { ( e ) => {
540- const newService = e . target . value as 'microsoft_drive' | 'microsoft_sharepoint' ;
541- setSelectedMicrosoftService ( newService ) ;
542- setSelectedIntegration ( newService ) ;
543- } }
544- className = "w-full p-2 pl-10 border border-gray-300 dark:border-[#454652] rounded-md bg-white dark:bg-[#40414F] text-gray-900 dark:text-white text-sm cursor-pointer"
545- >
546- < option value = "microsoft_drive" >
547- OneDrive
548- </ option >
549- < option value = "microsoft_sharepoint" >
550- SharePoint
551- </ option >
552- </ select >
553- < div className = "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none" >
554- { translateIntegrationIcon ( selectedMicrosoftService ) }
544+ { /* Connection status indicator */ }
545+ { connectedDriveIntegrations ?. includes ( selectedMicrosoftService ) ? (
546+ < span className = "ml-auto text-xs text-green-600 dark:text-green-400 flex items-center gap-1" >
547+ < span className = "w-2 h-2 bg-green-500 rounded-full" > </ span >
548+ Connected
549+ </ span >
550+ ) : (
551+ < span className = "ml-auto text-xs text-red-600 dark:text-red-400 flex items-center gap-1" >
552+ < span className = "w-2 h-2 bg-red-500 rounded-full" > </ span >
553+ Disconnected
554+ </ span >
555+ ) }
556+ </ label >
557+ < div className = "relative" >
558+ < select
559+ value = { selectedMicrosoftService }
560+ onChange = { ( e ) => {
561+ const newService = e . target . value as 'microsoft_drive' | 'microsoft_sharepoint' ;
562+ setSelectedMicrosoftService ( newService ) ;
563+ setSelectedIntegration ( newService ) ;
564+ } }
565+ className = "w-full p-2 pl-10 border border-gray-300 dark:border-[#454652] rounded-md bg-white dark:bg-[#40414F] text-gray-900 dark:text-white text-sm cursor-pointer"
566+ >
567+ { supportedMicrosoftServices . map ( service => (
568+ < option key = { service } value = { service } >
569+ { getServiceDisplayName ( service ) }
570+ </ option >
571+ ) ) }
572+ </ select >
573+ < div className = "absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none" >
574+ { translateIntegrationIcon ( selectedMicrosoftService ) }
575+ </ div >
555576 </ div >
556577 </ div >
557- </ div >
558- ) }
578+ ) ;
579+ } ) ( ) }
559580
560581 { /* File Display */ }
561582 { selectedIntegration && (
0 commit comments