Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

web: remove integrations banners and corresponding pings #38715

Merged
merged 18 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ All notable changes to Sourcegraph are documented in this file.

- The direct DataDog trace export integration has been removed. ([#37654](https://github.com/sourcegraph/sourcegraph/pull/37654))
- Removed the deprecated git exec forwarder. [#38092](https://github.com/sourcegraph/sourcegraph/pull/38092)
- Browser and IDE extensions banners. [#38715](https://github.com/sourcegraph/sourcegraph/pull/38715)

## 3.41.0

Expand Down
9 changes: 0 additions & 9 deletions client/shared/src/components/CtaAlert.module.scss

This file was deleted.

35 changes: 0 additions & 35 deletions client/shared/src/components/CtaAlert.story.tsx

This file was deleted.

71 changes: 0 additions & 71 deletions client/shared/src/components/CtaAlert.tsx

This file was deleted.

1 change: 0 additions & 1 deletion client/vscode/src/settings/LocalStorageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ export class LocalStorageService {
export const SELECTED_SEARCH_CONTEXT_SPEC_KEY = 'selected-search-context-spec'
export const INSTANCE_VERSION_NUMBER_KEY = 'sourcegraphVersionNumber'
export const ANONYMOUS_USER_ID_KEY = 'sourcegraphAnonymousUid'
export const DISMISS_SEARCH_CTA_KEY = 'sourcegraphSearchCtaDismissed'
export const DISMISS_WORKSPACERECS_CTA_KEY = 'sourcegraphWorkspaceRecsCtaDismissed'
48 changes: 0 additions & 48 deletions client/vscode/src/webview/search-panel/SearchResultsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
} from '@sourcegraph/search-ui'
import { wrapRemoteObservable } from '@sourcegraph/shared/src/api/client/api/common'
import { fetchHighlightedFileLineRanges } from '@sourcegraph/shared/src/backend/file'
import { CtaAlert } from '@sourcegraph/shared/src/components/CtaAlert'
import { collectMetrics } from '@sourcegraph/shared/src/search/query/metrics'
import {
appendContextFilter,
Expand All @@ -30,14 +29,11 @@ import { LATEST_VERSION, RepositoryMatch, SearchMatch } from '@sourcegraph/share
import { globbingEnabledFromSettings } from '@sourcegraph/shared/src/util/globbing'
import { buildSearchURLQuery } from '@sourcegraph/shared/src/util/url'

import { VSCE_LINK_AUTH } from '../../common/links'
import { DISMISS_SEARCH_CTA_KEY } from '../../settings/LocalStorageService'
import { SearchResultsState } from '../../state'
import { WebviewPageProps } from '../platform/context'

import { fetchSearchContexts } from './alias/fetchSearchContext'
import { setFocusSearchBox } from './api'
import { SearchBetaIcon } from './components/icons'
import { SavedSearchCreateForm } from './components/SavedSearchForm'
import { SearchResultsInfoBar } from './components/SearchResultsInfoBar'
import { MatchHandlersContext, useMatchHandlers } from './MatchHandlersContext'
Expand All @@ -64,28 +60,11 @@ export const SearchResultsView: React.FunctionComponent<React.PropsWithChildren<
'repository' | 'branches' | 'description'
> | null>(null)

// Check VS Code local storage to see if user has clicked dismiss button before
const [dismissSearchCta, setDismissSearchCta] = useState(false)
// Return empty string if not in vs code local storage or 'search' if it exists
const showCtaAlert = useMemo(() => extensionCoreAPI.getLocalStorageItem(DISMISS_SEARCH_CTA_KEY), [extensionCoreAPI])
const onDismissCtaAlert = useCallback(async () => {
setDismissSearchCta(true)
await extensionCoreAPI.setLocalStorageItem(DISMISS_SEARCH_CTA_KEY, 'true')
}, [extensionCoreAPI])

const isSourcegraphDotCom = useMemo(() => {
const hostname = new URL(instanceURL).hostname
return hostname === 'sourcegraph.com' || hostname === 'www.sourcegraph.com'
}, [instanceURL])

useEffect(() => {
showCtaAlert
.then(result => {
setDismissSearchCta(result.length > 0)
})
.catch(() => setDismissSearchCta(false))
}, [showCtaAlert])

// Editor focus.
const editorReference = useRef<IEditor>()
const setEditor = useCallback((editor: IEditor) => {
Expand Down Expand Up @@ -321,18 +300,6 @@ export const SearchResultsView: React.FunctionComponent<React.PropsWithChildren<
[context]
)

const onSignUpClick = useCallback(
(event?: React.FormEvent): void => {
event?.preventDefault()
platformContext.telemetryService.log(
'VSCECreateAccountBannerClick',
{ campaign: 'Sign up link' },
{ campaign: 'Sign up link' }
)
},
[platformContext.telemetryService]
)

const matchHandlers = useMatchHandlers({
platformContext,
extensionCoreAPI,
Expand Down Expand Up @@ -389,21 +356,6 @@ export const SearchResultsView: React.FunctionComponent<React.PropsWithChildren<

{!repoToShow ? (
<div className={styles.resultsViewScrollContainer}>
{isSourcegraphDotCom && !authenticatedUser && !dismissSearchCta && (
<CtaAlert
title="Sign up to add your public and private repositories and unlock search flow"
description="Do all the things editors can’t: search multiple repos & commit history, monitor, save
searches and more."
cta={{
label: 'Get started',
href: VSCE_LINK_AUTH('sign-up'),
onClick: onSignUpClick,
}}
icon={<SearchBetaIcon />}
className={classNames('percy-display-none', styles.ctaContainer)}
onClose={onDismissCtaAlert}
/>
)}
<SearchResultsInfoBar
onShareResultsClick={onShareResultsClick}
showSavedSearchForm={showSavedSearchForm}
Expand Down
22 changes: 1 addition & 21 deletions client/web/src/IdeExtensionTracker.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import React, { useEffect, useState } from 'react'
import React, { useEffect } from 'react'

import { useLocation } from 'react-router'

import { useTemporarySetting } from '@sourcegraph/shared/src/settings/temporary/useTemporarySetting'

const ONE_MONTH = 1000 * 60 * 60 * 24 * 30

/**
* This component uses UTM parameters to detect incoming traffic from our IDE extensions (VS Code
* and JetBrains) and updates a temporary setting whenever these are found.
Expand Down Expand Up @@ -35,21 +33,3 @@ export const IdeExtensionTracker: React.FunctionComponent<React.PropsWithChildre

return null
}

export const useIsActiveIdeIntegrationUser = (): undefined | boolean => {
const [lastVSCodeDetection] = useTemporarySetting('integrations.vscode.lastDetectionTimestamp', 0)
const [lastJetBrainsDetection] = useTemporarySetting('integrations.jetbrains.lastDetectionTimestamp', 0)
Comment on lines -40 to -41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment here, should we remove these keys?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review, @limitedmage!

Given that we removed all IDE banners, I wonder if we still need <IdeExtensionTracker /> component?
What do you think @vdavid, @philipp-spiess?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as far as I know, only the CTAs used the IDE extension detection, so that code can go as well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔪

const [now] = useState<number>(Date.now())

if (lastVSCodeDetection === undefined || lastJetBrainsDetection === undefined) {
return undefined
}

if (now - lastVSCodeDetection < ONE_MONTH) {
return true
}
if (now - lastJetBrainsDetection < ONE_MONTH) {
return true
}
return false
}
12 changes: 1 addition & 11 deletions client/web/src/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Suspense, useCallback, useEffect, useMemo } from 'react'
import React, { Suspense, useEffect, useMemo } from 'react'

import classNames from 'classnames'
import { Redirect, Route, RouteComponentProps, Switch, matchPath } from 'react-router'
Expand Down Expand Up @@ -42,7 +42,6 @@ import { GlobalAlerts } from './global/GlobalAlerts'
import { GlobalDebug } from './global/GlobalDebug'
import { SurveyToast } from './marketing/toast'
import { GlobalNavbar } from './nav/GlobalNavbar'
import { useExtensionAlertAnimation } from './nav/UserNavItem'
import { OrgAreaRoute } from './org/area/OrgArea'
import { OrgAreaHeaderNavItem } from './org/area/OrgHeader'
import { RepoContainerRoute } from './repo/RepoContainer'
Expand Down Expand Up @@ -172,13 +171,6 @@ export const Layout: React.FunctionComponent<React.PropsWithChildren<LayoutProps

const breadcrumbProps = useBreadcrumbs()

// Control browser extension discoverability animation here.
// `Layout` is the lowest common ancestor of `UserNavItem` (target) and `RepoContainer` (trigger)
const { isExtensionAlertAnimating, startExtensionAlertAnimation } = useExtensionAlertAnimation()
const onExtensionAlertDismissed = useCallback(() => {
startExtensionAlertAnimation()
}, [startExtensionAlertAnimation])

useScrollToLocationHash(props.location)

// Note: this was a poor UX and is disabled for now, see https://github.com/sourcegraph/sourcegraph/issues/30192
Expand Down Expand Up @@ -207,7 +199,6 @@ export const Layout: React.FunctionComponent<React.PropsWithChildren<LayoutProps
...props,
...themeProps,
...breadcrumbProps,
onExtensionAlertDismissed,
isMacPlatform: isMacPlatform(),
}

Expand Down Expand Up @@ -249,7 +240,6 @@ export const Layout: React.FunctionComponent<React.PropsWithChildren<LayoutProps
}
minimalNavLinks={minimalNavLinks}
isSearchAutoFocusRequired={!isSearchAutoFocusRequired}
isExtensionAlertAnimating={isExtensionAlertAnimating}
isRepositoryRelatedPage={isRepositoryRelatedPage}
/>
)}
Expand Down
10 changes: 9 additions & 1 deletion client/web/src/auth/VsCodeSignUpPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { ThemeProps } from '@sourcegraph/shared/src/theme'
import { Link, Icon, H2 } from '@sourcegraph/wildcard'

import { BrandLogo } from '../components/branding/BrandLogo'
import { VSCodeIcon } from '../components/CtaIcons'
import { AuthProvider, SourcegraphContext } from '../jscontext'

import { ExternalsAuth } from './ExternalsAuth'
Expand All @@ -26,6 +25,15 @@ interface Props extends ThemeProps, TelemetryProps {
context: Pick<SourcegraphContext, 'authProviders' | 'experimentalFeatures'>
}

const VSCodeIcon: React.FC = () => (
<svg width="30" height="30" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M22.0834 21.3325V8.46915L13.5834 14.9008L22.0834 21.3325ZM1.14506 11.0192C0.939444 10.7993 0.822721 10.511 0.817486 10.21C0.812252 9.90905 0.918879 9.61685 1.11672 9.38999L2.81672 7.81749C3.10006 7.56249 3.79422 7.44915 4.30422 7.81749L9.14922 11.515L20.3834 1.24415C20.8367 0.79082 21.6159 0.606653 22.5084 1.07415L28.1751 3.77999C28.6851 4.07749 29.1667 4.54499 29.1667 5.40915V24.5342C29.1667 25.1008 28.7559 25.71 28.3167 25.9508L22.0834 28.9258C21.6301 29.11 20.7801 28.94 20.4826 28.6425L9.12089 18.3008L4.30422 21.9842C3.76589 22.3525 3.10006 22.2533 2.81672 21.9842L1.11672 20.4258C0.663389 19.9583 0.720056 19.1933 1.18756 18.7258L5.43756 14.9008"
fill="#339AF0"
/>
</svg>
)

/**
* Sign up page specifically from users via our VS Code integration
*/
Expand Down
Loading