mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat(console): offer the new Console in a dismissible modal
Users on the old Console get one interruptive prompt with an explicit choice: try the new Console, or carry on with the old one. Closing it by any route counts as choosing to stay. Built on the existing Modal from $lib/components rather than a bespoke full-screen surface. wizard.showCover() would be genuinely full-screen but has never had a consumer, so it is untested in production. Snoozes for a month with backoff via hideNotification, longer than the banner's week because this is the most interruptive of the three surfaces. Never shown during onboarding. utm_medium=modal keeps it comparable with the banner and the promo card.
This commit is contained in:
1 parent
46f82c6f2d
commit
d981a5585b
3 files changed
+69
-1
No files matched your search
@@ -77,6 +77,7 @@ export { default as ImagePreview } from './imagePreview.svelte';
|
||||
export { default as MfaChallengeFormList } from './mfaChallengeFormList.svelte';
|
||||
export { default as BottomModalAlert } from './bottomModalAlert.svelte';
|
||||
export { default as NewConsoleBanner } from './newConsoleBanner.svelte';
|
||||
export { default as NewConsoleModal } from './newConsoleModal.svelte';
|
||||
export { default as Navbar } from './navbar.svelte';
|
||||
export { default as Breadcrumbs } from './breadcrumbs.svelte';
|
||||
export { default as Sidebar } from './sidebar.svelte';
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<script lang="ts">
|
||||
import { trackEvent } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { hideNotification } from '$lib/helpers/notifications';
|
||||
import { Typography } from '@appwrite.io/pink-svelte';
|
||||
|
||||
export let show = false;
|
||||
|
||||
// utm_medium separates this from the banner and the promo card.
|
||||
const href =
|
||||
'https://appwrite.io/?utm_source=old-console&utm_medium=modal&utm_campaign=new-console';
|
||||
|
||||
// The most interruptive of the three surfaces, so it snoozes for a month rather than the
|
||||
// banner's week, and still doubles on each dismissal.
|
||||
const COOL_OFF_HOURS = 24 * 30;
|
||||
|
||||
let recorded = false;
|
||||
|
||||
function record(action: 'try' | 'continue') {
|
||||
if (recorded) return;
|
||||
recorded = true;
|
||||
|
||||
trackEvent('close_new_console_modal', { source: 'new_console_modal', action });
|
||||
hideNotification('newConsoleModal', {
|
||||
coolOffPeriod: COOL_OFF_HOURS,
|
||||
exponentialBackoff: true
|
||||
});
|
||||
}
|
||||
|
||||
// Catches every exit: the close button, Escape, the backdrop, and the footer button. Whatever
|
||||
// route the user takes out of the modal counts as choosing to stay on the old Console.
|
||||
$: if (!show) record('continue');
|
||||
</script>
|
||||
|
||||
<Modal bind:show size="l" title="Try the new Appwrite Console">
|
||||
<Typography.Text slot="description">
|
||||
We rebuilt the Console from the ground up. It's faster, it's cleaner, and everything you're
|
||||
working on comes with you. Nothing to migrate.
|
||||
</Typography.Text>
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text on:click={() => (show = false)}>Continue with the old Console</Button>
|
||||
|
||||
<Button
|
||||
{href}
|
||||
external
|
||||
on:click={() => {
|
||||
record('try');
|
||||
show = false;
|
||||
}}>
|
||||
Try the new Console
|
||||
</Button>
|
||||
</svelte:fragment>
|
||||
</Modal>
|
||||
@@ -44,7 +44,7 @@
|
||||
import { headerAlert } from '$lib/stores/headerAlert';
|
||||
import { UsageRates } from '$lib/components/billing';
|
||||
import { canSeeProjects } from '$lib/stores/roles';
|
||||
import { BottomModalAlert, NewConsoleBanner } from '$lib/components';
|
||||
import { BottomModalAlert, NewConsoleBanner, NewConsoleModal } from '$lib/components';
|
||||
import { shouldShowNotification } from '$lib/helpers/notifications';
|
||||
import { isSmallViewport } from '$lib/stores/viewport';
|
||||
import {
|
||||
@@ -339,6 +339,16 @@
|
||||
}
|
||||
});
|
||||
|
||||
let showNewConsoleModal = false;
|
||||
|
||||
onMount(() => {
|
||||
// Never during onboarding: a first run is the worst moment to interrupt.
|
||||
const isOnOnboarding = page.url.pathname.includes(base + '/onboarding');
|
||||
|
||||
showNewConsoleModal =
|
||||
isCloud && !isOnOnboarding && shouldShowNotification('newConsoleModal');
|
||||
});
|
||||
|
||||
$: (void $headerAlert, ($activeHeaderAlert = headerAlert.getExcluding('impersonation')));
|
||||
</script>
|
||||
|
||||
@@ -375,3 +385,5 @@
|
||||
{/if}
|
||||
|
||||
<BottomModalAlert />
|
||||
|
||||
<NewConsoleModal bind:show={showNewConsoleModal} />
|
||||
Reference in new issue
Block a user