Skip to content

Commit 14a33d3

Browse files
committed
RI-6910: hide cloud ads based on env variable
1 parent 452bf51 commit 14a33d3

File tree

6 files changed

+25
-15
lines changed

6 files changed

+25
-15
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ RI_ANALYTICS_START_EVENTS=true
1919
RI_AGREEMENTS_PATH='../../webviews/resources/agreements-spec.json'
2020
RI_ENCRYPTION_KEYTAR_SERVICE="redis-for-vscode"
2121
RI_SOCKETS_CORS=true
22+
RI_FEATURES_CLOUD_ADS_DEFAULT_FLAG=true
2223
# RI_SEGMENT_WRITE_KEY='SEGMENT_WRITE_KEY'
2324

src/webviews/src/components/no-databases/NoDatabases.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as l10n from '@vscode/l10n'
44

55
import { PromoLink } from 'uiSrc/ui'
66
import { vscodeApi } from 'uiSrc/services'
7-
import { OAuthSocialSource, VscodeMessageAction } from 'uiSrc/constants'
7+
import { CLOUD_ADS, OAuthSocialSource, VscodeMessageAction } from 'uiSrc/constants'
88
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/utils'
99
import { useAppInfoStore } from 'uiSrc/store/hooks/use-app-info-store/useAppInfoStore'
1010
import DockerIcon from 'uiSrc/assets/database/docker.svg?react'
@@ -64,7 +64,7 @@ export const NoDatabases: FC = () => {
6464
<h2 className="pb-3 text-[24px]">
6565
{l10n.t('Links')}
6666
</h2>
67-
{contentCloud && (
67+
{CLOUD_ADS && contentCloud && (
6868
<PromoLink Icon={LogoSvg} onClick={handleClickFree} {...contentCloud} />
6969
)}
7070
{contentDocker && (

src/webviews/src/constants/environment/environment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { toNumber } from 'lodash'
44
export const BASE_APP_URL = import.meta.env.RI_BASE_APP_URL || 'http://localhost'
55
export const APP_PORT = toNumber(window.ri?.appPort) || import.meta.env.RI_APP_PORT || 5541
66
export const APP_PREFIX = import.meta.env.RI_APP_PREFIX || 'api'
7+
export const CLOUD_ADS = import.meta.env.RI_FEATURES_CLOUD_ADS_DEFAULT_FLAG !== 'false'
78

89
const isDevelopment = import.meta.env.NODE_ENV === 'development'
910
const hostedApiBaseUrl = import.meta.env.RI_HOSTED_API_BASE_URL

src/webviews/src/constants/window/helpTexts.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as l10n from '@vscode/l10n'
44
import { Link } from 'react-router-dom'
55

66
import { getUtmExternalLink } from 'uiSrc/utils'
7-
import { EXTERNAL_LINKS, UTM_CAMPAIGNS } from 'uiSrc/constants'
7+
import { CLOUD_ADS, EXTERNAL_LINKS, UTM_CAMPAIGNS } from 'uiSrc/constants'
88
import styles from 'uiSrc/components/popover-delete/styles.module.scss'
99

1010
export const helpTexts = {
@@ -23,16 +23,20 @@ export const helpTexts = {
2323
>
2424
{l10n.t('here. ')}
2525
</Link>
26-
{l10n.t('You can also create a ')}
27-
<Link
28-
onClick={onFreeTrialDbClick}
29-
className="underline hover:no-underline"
30-
data-testid="no-json-module-create-free-db"
31-
to=""
26+
{CLOUD_ADS && (
27+
<>
28+
{l10n.t('You can also create a ')}
29+
<Link
30+
onClick={onFreeTrialDbClick}
31+
className="underline hover:no-underline"
32+
data-testid="no-json-module-create-free-db"
33+
to=""
3234
>
33-
{l10n.t('free trial Redis Cloud database')}
34-
</Link>
35-
{l10n.t(' with built-in JSON support.')}
35+
{l10n.t('free trial Redis Cloud database')}
36+
</Link>
37+
{l10n.t(' with built-in JSON support.')}
38+
</>
39+
)}
3640
</>
3741
),
3842
REMOVE_LAST_ELEMENT: (fieldType: string) => (

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

Lines changed: 5 additions & 1 deletion
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 { OAuthSocialAction, OAuthSocialSource, VscodeMessageAction } from 'uiSrc/constants'
8+
import { CLOUD_ADS, 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,6 +47,10 @@ 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+
5054
return (
5155
<>
5256
{!compressed && <h2 className="pt-8 text-[16px]">{l10n.t('Create free trial Redis Cloud database')}</h2>}

src/webviews/src/pages/WelcomePage/WelcomePage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { VscAdd } from 'react-icons/vsc'
55
import { Link, PromoLink, Separator, Spacer } from 'uiSrc/ui'
66
import { vscodeApi } from 'uiSrc/services'
77
import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/utils'
8-
import { OAuthSocialSource, VscodeMessageAction } from 'uiSrc/constants'
8+
import { CLOUD_ADS, OAuthSocialSource, VscodeMessageAction } from 'uiSrc/constants'
99
import { useAppInfoStore } from 'uiSrc/store/hooks/use-app-info-store/useAppInfoStore'
1010
import DockerIcon from 'uiSrc/assets/database/docker.svg?react'
1111
import GithubIcon from 'uiSrc/assets/database/github.svg?react'
@@ -69,7 +69,7 @@ export const WelcomePage: FC = () => {
6969
<Spacer size="xl" />
7070

7171
<h3>{l10n.t('Create new database')}</h3>
72-
{contentCloud && (
72+
{CLOUD_ADS && contentCloud && (
7373
<PromoLink Icon={ShortLogoSvg} onClick={handleClickFree} {...contentCloud} />
7474
)}
7575
{contentDocker && (

0 commit comments

Comments
 (0)