88 spacing ,
99 palette ,
1010 MarketingModal ,
11+ Theme ,
12+ useDarkMode ,
1113} from '@mongodb-js/compass-components' ;
1214import { AiImageBanner } from './ai-image-banner' ;
1315import { closeOptInModal , optIn } from '../store/atlas-optin-reducer' ;
@@ -49,6 +51,49 @@ const bannerStyles = css({
4951 textAlign : 'left' ,
5052} ) ;
5153
54+ // TODO: The LG MarketingModal does not provide a way to disable the button
55+ // so this is a temporary workaround to make the button look disabled.
56+ const focusSelector = `&:focus-visible, &[data-focus="true"]` ;
57+ const hoverSelector = `&:hover, &[data-hover="true"]` ;
58+ const activeSelector = `&:active, &[data-active="true"]` ;
59+ const focusBoxShadow = ( color : string ) => `
60+ 0 0 0 2px ${ color } ,
61+ 0 0 0 4px ${ palette . blue . light1 } ;
62+ ` ;
63+ const disabledButtonStyles : Record < Theme , string > = {
64+ [ Theme . Light ] : css `
65+ & ,
66+ ${ hoverSelector } , ${ activeSelector } {
67+ background-color : ${ palette . gray . light2 } ;
68+ border-color : ${ palette . gray . light1 } ;
69+ color : ${ palette . gray . base } ;
70+ box-shadow : none;
71+ cursor : not-allowed;
72+ }
73+
74+ ${ focusSelector } {
75+ color : ${ palette . gray . base } ;
76+ box-shadow : ${ focusBoxShadow ( palette . white ) } ;
77+ }
78+ ` ,
79+
80+ [ Theme . Dark ] : css `
81+ & ,
82+ ${ hoverSelector } , ${ activeSelector } {
83+ background-color : ${ palette . gray . dark3 } ;
84+ border-color : ${ palette . gray . dark2 } ;
85+ color : ${ palette . gray . dark1 } ;
86+ box-shadow : none;
87+ cursor : not-allowed;
88+ }
89+
90+ ${ focusSelector } {
91+ color : ${ palette . gray . dark1 } ;
92+ box-shadow : ${ focusBoxShadow ( palette . black ) } ;
93+ }
94+ ` ,
95+ } ;
96+
5297export const AIOptInModal : React . FunctionComponent < OptInModalProps > = ( {
5398 isOptInModalVisible,
5499 isOptInInProgress,
@@ -61,6 +106,9 @@ export const AIOptInModal: React.FunctionComponent<OptInModalProps> = ({
61106 'enableGenAISampleDocumentPassingOnAtlasProject'
62107 ) ;
63108 const track = useTelemetry ( ) ;
109+ const darkMode = useDarkMode ( ) ;
110+ const currentDisabledButtonStyles =
111+ disabledButtonStyles [ darkMode ? Theme . Dark : Theme . Light ] ;
64112 const PROJECT_SETTINGS_LINK = projectId
65113 ? window . location . origin + '/v2/' + projectId + '#/settings/groupSettings'
66114 : null ;
@@ -90,6 +138,7 @@ export const AIOptInModal: React.FunctionComponent<OptInModalProps> = ({
90138 open = { isOptInModalVisible }
91139 onClose = { handleModalClose }
92140 // TODO Button Disabling
141+ className = { ! isProjectAIEnabled ? currentDisabledButtonStyles : undefined }
93142 buttonText = "Use AI Features"
94143 onButtonClick = { onConfirmClick }
95144 linkText = "Not now"
0 commit comments