Skip to content

Commit d28df51

Browse files
committed
RI-6910: disable cloud ads based on flag
1 parent 14a33d3 commit d28df51

File tree

5 files changed

+21
-16
lines changed

5 files changed

+21
-16
lines changed

src/webviews/src/actions/oauthCallback.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { INFINITE_MESSAGES } from 'uiSrc/components'
2-
import { CloudAuthStatus, CloudJobName, CloudJobStep, OAuthSocialAction, StorageItem } from 'uiSrc/constants'
2+
import { CLOUD_ADS, CloudAuthStatus, CloudJobName, CloudJobStep, OAuthSocialAction, StorageItem } from 'uiSrc/constants'
33
import { CustomError } from 'uiSrc/interfaces'
44
import { CloudAuthResponse } from 'uiSrc/modules/oauth/interfaces'
55
import { localStorageService } from 'uiSrc/services'
@@ -9,6 +9,10 @@ import { getApiErrorMessage, parseCustomError, removeInfinityToast, showErrorInf
99
let isFlowInProgress = false
1010

1111
export const processOauthCallback = ({ status, message = '', error }: CloudAuthResponse) => {
12+
if (!CLOUD_ADS) {
13+
return
14+
}
15+
1216
const {
1317
ssoFlow,
1418
isRecommendedSettings,

src/webviews/src/modules/oauth/oauth-create-free-db/OAuthCreateFreeDb.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { VscChevronRight, VscCloud } from 'react-icons/vsc'
55

66
import { RiButton } from 'uiSrc/ui'
77
import { useOAuthStore } from 'uiSrc/store'
8-
import { CLOUD_ADS, OAuthSocialAction, OAuthSocialSource, VscodeMessageAction } from 'uiSrc/constants'
8+
import { OAuthSocialAction, OAuthSocialSource, VscodeMessageAction } from 'uiSrc/constants'
99
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/utils'
1010
import { vscodeApi } from 'uiSrc/services'
1111
import styles from './styles.module.scss'
@@ -47,10 +47,6 @@ const OAuthCreateFreeDb = ({ source, compressed }: Props) => {
4747
? l10n.t('Includes native support for JSON, Query and Search and more.')
4848
: l10n.t('Get free trial Redis Cloud database')
4949

50-
if (!CLOUD_ADS) {
51-
return null
52-
}
53-
5450
return (
5551
<>
5652
{!compressed && <h2 className="pt-8 text-[16px]">{l10n.t('Create free trial Redis Cloud database')}</h2>}

src/webviews/src/pages/AddDatabasePage/AddDatabasePage.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { VSCodeDivider } from '@vscode/webview-ui-toolkit/react'
22
import React, { FC, useEffect } from 'react'
33
import * as l10n from '@vscode/l10n'
44

5-
import { OAuthSocialSource } from 'uiSrc/constants'
5+
import { CLOUD_ADS, OAuthSocialSource } from 'uiSrc/constants'
66
import { CommonAppSubscription, DatabasePanel } from 'uiSrc/modules'
77
import { OAuthCreateFreeDb, OAuthSsoDialog, OAuthJobs, OAuthSelectPlan } from 'uiSrc/modules/oauth'
88
import { fetchCerts } from 'uiSrc/store'
@@ -22,13 +22,17 @@ export const AddDatabasePage: FC<any> = () => {
2222
{l10n.t('Add Redis database')}
2323
</h1>
2424
<VSCodeDivider className="divider" />
25-
<OAuthJobs />
26-
<CommonAppSubscription />
27-
<OAuthSsoDialog />
28-
<OAuthCreateFreeDb source={OAuthSocialSource.AddDbForm} />
29-
<VSCodeDivider className="divider" />
25+
{CLOUD_ADS && (
26+
<>
27+
<OAuthJobs />
28+
<CommonAppSubscription />
29+
<OAuthSsoDialog />
30+
<OAuthCreateFreeDb source={OAuthSocialSource.AddDbForm} />
31+
<OAuthSelectPlan />
32+
<VSCodeDivider className="divider" />
33+
</>
34+
)}
3035
<DatabasePanel />
31-
<OAuthSelectPlan />
3236
</div>
3337
)
3438
}

src/webviews/src/pages/AddKeyPage/AddKeyPage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { FC } from 'react'
2+
import { CLOUD_ADS } from 'uiSrc/constants'
23
import { AddKey } from 'uiSrc/modules'
34
import { KeysStoreProvider } from 'uiSrc/modules/keys-tree/hooks/useKeys'
45
import { OAuthSsoDialog } from 'uiSrc/modules/oauth'
@@ -9,7 +10,7 @@ export const AddKeyPage: FC<any> = () => (
910
<ContextStoreProvider>
1011
<KeysStoreProvider>
1112
<AddKey />
12-
<OAuthSsoDialog />
13+
{CLOUD_ADS && <OAuthSsoDialog />}
1314
</KeysStoreProvider>
1415
</ContextStoreProvider>
1516
</div>

src/webviews/src/pages/SidebarPage/SidebarPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { DatabaseWrapper } from 'uiSrc/modules'
55
import { useDatabasesStore } from 'uiSrc/store'
66
import { useAppInfoStore } from 'uiSrc/store/hooks/use-app-info-store/useAppInfoStore'
77
import { OAuthCreateFreeDb } from 'uiSrc/modules/oauth'
8-
import { OAuthSocialSource } from 'uiSrc/constants'
8+
import { CLOUD_ADS, OAuthSocialSource } from 'uiSrc/constants'
99

1010
export const SidebarPage: FC<any> = () => {
1111
const databases = useDatabasesStore((state) => state.data)
@@ -20,7 +20,7 @@ export const SidebarPage: FC<any> = () => {
2020

2121
return (
2222
<div className="flex w-full flex-wrap flex-col min-h-full text-vscode-icon-foreground" data-testid="tree-view-page">
23-
<OAuthCreateFreeDb compressed source={OAuthSocialSource.DatabasesList} />
23+
{CLOUD_ADS && <OAuthCreateFreeDb compressed source={OAuthSocialSource.DatabasesList} />}
2424
{databases.map((database) => (
2525
<DatabaseWrapper database={database} key={database.id} />
2626
))}

0 commit comments

Comments
 (0)