Skip to content

Commit 604d0b9

Browse files
committed
Remove workaround for MarketingModal button disabling
1 parent e9e8887 commit 604d0b9

File tree

1 file changed

+1
-53
lines changed

1 file changed

+1
-53
lines changed

packages/compass-generative-ai/src/components/ai-optin-modal.tsx

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -72,53 +72,6 @@ const bannerStyles = css({
7272
textAlign: 'left',
7373
});
7474

75-
// TODO: The LG MarketingModal does not provide a way to disable the button
76-
// so this is a temporary workaround to make the button look disabled.
77-
const leafyGreenButtonSelector =
78-
'button[data-lgid="lg-button"]:not([aria-label="Close modal"])';
79-
const focusSelector = `&:focus-visible, &[data-focus="true"]`;
80-
const hoverSelector = `&:hover, &[data-hover="true"]`;
81-
const activeSelector = `&:active, &[data-active="true"]`;
82-
const focusBoxShadow = (color: string) => `
83-
0 0 0 2px ${color},
84-
0 0 0 4px ${palette.blue.light1};
85-
`;
86-
const disabledButtonStyles: Record<Theme, string> = {
87-
[Theme.Light]: css({
88-
[leafyGreenButtonSelector]: {
89-
[`&, ${hoverSelector}, ${activeSelector}`]: {
90-
backgroundColor: palette.gray.light2,
91-
borderColor: palette.gray.light1,
92-
color: palette.gray.base,
93-
boxShadow: 'none',
94-
cursor: 'not-allowed',
95-
},
96-
97-
[focusSelector]: {
98-
color: palette.gray.base,
99-
boxShadow: focusBoxShadow(palette.white),
100-
},
101-
},
102-
}),
103-
104-
[Theme.Dark]: css({
105-
[leafyGreenButtonSelector]: {
106-
[`&, ${hoverSelector}, ${activeSelector}`]: {
107-
backgroundColor: palette.gray.dark3,
108-
borderColor: palette.gray.dark2,
109-
color: palette.gray.dark1,
110-
boxShadow: 'none',
111-
cursor: 'not-allowed',
112-
},
113-
114-
[focusSelector]: {
115-
color: palette.gray.dark1,
116-
boxShadow: focusBoxShadow(palette.black),
117-
},
118-
},
119-
}),
120-
};
121-
12275
const CloudAIOptInBannerContent: React.FunctionComponent<{
12376
isProjectAIEnabled: boolean;
12477
isSampleDocumentPassingEnabled: boolean;
@@ -178,8 +131,6 @@ export const AIOptInModal: React.FunctionComponent<OptInModalProps> = ({
178131
);
179132
const track = useTelemetry();
180133
const darkMode = useDarkMode();
181-
const currentDisabledButtonStyles =
182-
disabledButtonStyles[darkMode ? Theme.Dark : Theme.Light];
183134

184135
useEffect(() => {
185136
if (isOptInModalVisible) {
@@ -206,13 +157,10 @@ export const AIOptInModal: React.FunctionComponent<OptInModalProps> = ({
206157
title={`Use AI Features in ${isCloudOptIn ? 'Data Explorer' : 'Compass'}`}
207158
open={isOptInModalVisible}
208159
onClose={handleModalClose}
209-
// TODO Button Disabling
210-
backdropClassName={
211-
!isProjectAIEnabled ? currentDisabledButtonStyles : undefined
212-
}
213160
buttonProps={{
214161
children: 'Use AI Features',
215162
onClick: onConfirmClick,
163+
disabled: !isProjectAIEnabled,
216164
}}
217165
linkText="Not now"
218166
onLinkClick={onOptInModalClose}

0 commit comments

Comments
 (0)