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

Commit 3ff0f07

Browse files
authored
Svelte: more welcome banner behavior updates (#64311)
This makes some requested changes to the welcome banner. Notably: - We no longer show the dialog unless the user switches into the svelte version from react - We don't show the dialog on every switch - The dialog is accessible in the React via the "Learn more" button in the menu - Copy is updated to be less verbose - The request for feedback is only shown once when switching out of the svelte webapp
1 parent 61b4181 commit 3ff0f07

File tree

12 files changed

+3765
-83
lines changed

12 files changed

+3765
-83
lines changed

client/shared/src/settings/temporary/TemporarySettings.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ export interface TemporarySettingsSchema {
9898
'openCodeGraph.annotations.visible': boolean
9999

100100
'webNext.welcomeOverlay.dismissed': boolean
101+
'webNext.welcomeOverlay.show': boolean
101102
'webNext.departureMessage.dismissed': boolean
103+
'webNext.departureMessage.show': boolean
102104
}
103105

104106
/**
@@ -165,7 +167,9 @@ const TEMPORARY_SETTINGS: Record<keyof TemporarySettings, null> = {
165167
'cody.onboarding.completed': null,
166168
'openCodeGraph.annotations.visible': null,
167169
'webNext.welcomeOverlay.dismissed': null,
170+
'webNext.welcomeOverlay.show': null,
168171
'webNext.departureMessage.dismissed': null,
172+
'webNext.departureMessage.show': null,
169173
}
170174

171175
export const TEMPORARY_SETTINGS_KEYS = Object.keys(TEMPORARY_SETTINGS) as readonly (keyof TemporarySettings)[]

client/web-sveltekit/src/lib/navigation/FeedbackDialog.svelte

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,7 @@
1313
{/if}
1414
</div>
1515
<div class="section">
16-
<p class="m0">
17-
You're currently on the new, faster Code Search user experience. It's in beta, and is our effort to rebuild
18-
the tool from the ground up for performance.
19-
</p>
20-
</div>
21-
<div class="section">
22-
<p>Got feedback for us on the beta? We'd love to hear from you.</p>
16+
<p>Have feedback for us on the beta? We’d love to hear from you.</p>
2317
<a
2418
class={getButtonClassName({ variant: 'secondary' })}
2519
href="https://community.sourcegraph.com/c/code-search/9"

client/web-sveltekit/src/lib/navigation/GlobalHeader.svelte

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,21 +125,14 @@
125125

126126
<div class="web-next-notice">
127127
<ProductStatusBadge status="beta" />
128-
<a
129-
class={getButtonClassName({ variant: 'secondary', size: 'sm' })}
130-
href="https://community.sourcegraph.com/c/code-search/9"
131-
target="_blank"
132-
rel="noreferrer noopener"
133-
>
134-
Feedback
135-
</a>
136128
<Popover let:registerTrigger let:toggle placement="bottom-end">
137129
<button
138130
use:registerTrigger
139131
class={getButtonClassName({ variant: 'secondary', size: 'sm' })}
140132
on:click={() => toggle()}
141133
>
142-
<Icon icon={ILucideEllipsis} inline />
134+
New UI Feedback
135+
<Icon icon={ILucideChevronDown} inline />
143136
</button>
144137
<FeedbackDialog slot="content" {handleOptOut} />
145138
</Popover>

client/web-sveltekit/src/routes/+layout.svelte

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,11 @@
8383
$: handleOptOut = currentUserID
8484
? async (): Promise<void> => {
8585
// Show departure message after switching off
86-
$temporarySettingsStorage.set('webNext.departureMessage.dismissed', false)
86+
$temporarySettingsStorage.set('webNext.departureMessage.show', true)
8787
await data.disableSvelteFeatureFlags(currentUserID)
8888
window.location.reload()
8989
}
9090
: undefined
91-
92-
$: welcomeOverlayDismissed = $temporarySettingsStorage.get('webNext.welcomeOverlay.dismissed', false)
93-
$: showWelcomeOverlay = !($welcomeOverlayDismissed ?? true)
94-
function handleDismissWelcomeOverlay() {
95-
$temporarySettingsStorage.set('webNext.welcomeOverlay.dismissed', true)
96-
}
9791
</script>
9892

9993
<svelte:head>
@@ -112,7 +106,7 @@
112106
<slot />
113107
</main>
114108

115-
<WelcomeOverlay show={showWelcomeOverlay} handleDismiss={handleDismissWelcomeOverlay} />
109+
<WelcomeOverlay />
116110

117111
<FuzzyFinderContainer />
118112

client/web-sveltekit/src/routes/WelcomeOverlay.svelte

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@
22
import { allHotkey } from '$lib/fuzzyfinder/keys'
33
import Icon from '$lib/Icon.svelte'
44
import KeyboardShortcut from '$lib/KeyboardShortcut.svelte'
5+
import { temporarySetting } from '$lib/temporarySettings'
56
import { isLightTheme } from '$lib/theme'
67
import Button from '$lib/wildcard/Button.svelte'
78
import ProductStatusBadge from '$lib/wildcard/ProductStatusBadge.svelte'
89
910
import WelcomeOverlayScreenshotDark from './WelcomeOverlayScreenshotDark.svelte'
1011
import WelcomeOverlayScreenshotLight from './WelcomeOverlayScreenshotLight.svelte'
1112
12-
export let show: boolean
13-
export let handleDismiss: () => void
14-
1513
let dialog: HTMLDialogElement | undefined
1614
let inner: HTMLDivElement | undefined
15+
16+
$: activated = temporarySetting('webNext.welcomeOverlay.show', false)
17+
$: dismissed = temporarySetting('webNext.welcomeOverlay.dismissed', false)
18+
$: show = !$activated.loading && $activated.data && !$dismissed.loading && !$dismissed.data
19+
20+
function handleDismiss() {
21+
dismissed.setValue(true)
22+
}
1723
function handleClickOutside(event: MouseEvent) {
1824
// Use an inner div because the whole backdrop registers as part of the dialog
1925
if (inner && !inner.contains(event.target as Node)) {

client/web/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,7 @@ ts_project(
16511651
"src/storm/pages/SearchPageWrapper/SearchPageWrapper.tsx",
16521652
"src/storm/pages/SearchPageWrapper/index.ts",
16531653
"src/storm/routes.tsx",
1654+
"src/sveltekit/LearnMoreOverlay.tsx",
16541655
"src/sveltekit/SvelteKitNavItem.tsx",
16551656
"src/sveltekit/WebNextAwareLink.tsx",
16561657
"src/sveltekit/routes.ts",

0 commit comments

Comments
 (0)