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

Commit 46f82c6

Browse files
authored
Merge pull request #3193 from appwrite/fix-new-console-banner-tablet
fix(console): make the new Console banner responsive and snoozeable
2 parents ca32b85 + 897f8e3 commit 46f82c6

5 files changed

Lines changed: 26 additions & 13 deletions

File tree

‎bun.lock‎

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
"cookie": "^0.7.0",
114114
"ws": "^8.21.0",
115115
"postcss": "^8.5.18",
116-
"nanoid": "^3.3.18"
116+
"nanoid": "^3.3.18",
117+
"browserslist": ">=4.28.7"
117118
}
118119
}

‎src/lib/components/newConsoleBanner.svelte‎

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
import { trackEvent } from '$lib/actions/analytics';
33
import { Button } from '$lib/elements/forms';
44
import { Layout, Typography } from '@appwrite.io/pink-svelte';
5-
import { isSmallViewport } from '$lib/stores/viewport';
5+
import { isTabletViewport } from '$lib/stores/viewport';
6+
import { hideNotification } from '$lib/helpers/notifications';
67
import { headerAlert } from '$lib/stores/headerAlert';
78
import { activeHeaderAlert } from '$routes/(console)/store';
89
import GradientBanner from './billing/gradientBanner.svelte';
@@ -13,13 +14,18 @@
1314
1415
function handleClose() {
1516
const { id } = $activeHeaderAlert;
16-
localStorage.setItem(id, new Date().getTime().toString());
17+
1718
trackEvent('close_new_console_banner', { source: 'new_console_banner' });
1819
1920
// Clear the store entry, not just this component. headerAlert.get() picks the highest
2021
// importance and breaks ties by registration order, so an entry left visible keeps
2122
// winning the importance-1 tie and hides the next eligible promo behind an empty slot.
2223
headerAlert.updateShow(id, false);
24+
25+
// A migration runs for months, so dismissal is a snooze rather than a permanent opt-out:
26+
// a week at first, doubling each time. Someone who keeps closing it stops seeing it, but a
27+
// single stray click on the X does not remove the message for the whole rollout.
28+
hideNotification(id, { coolOffPeriod: 24 * 7, exponentialBackoff: true });
2329
}
2430
</script>
2531

@@ -28,15 +34,15 @@
2834
gap="m"
2935
alignItems="center"
3036
alignContent="center"
31-
direction={$isSmallViewport ? 'column' : 'row'}>
32-
<Typography.Text>
37+
justifyContent="center"
38+
direction={$isTabletViewport ? 'column' : 'row'}>
39+
<Typography.Text align={$isTabletViewport ? 'center' : 'start'}>
3340
Introducing the new Appwrite Console, rebuilt from the ground up.
3441
</Typography.Text>
3542

3643
<Button
3744
secondary
3845
external
39-
fullWidthMobile
4046
class="u-line-height-1"
4147
{href}
4248
on:click={() => trackEvent('click_new_console', { source: 'new_console_banner' })}>

‎src/lib/layout/alertStack.svelte‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
afterNavigate(() => setNavigationHeight());
5858
</script>
5959

60+
<!-- The stack owns the shell offset for every alert inside it, so it has to re-measure when
61+
the viewport changes and an alert reflows to a different height. -->
62+
<svelte:window on:resize={setNavigationHeight} />
63+
6064
<div bind:this={container} class="alert-stack">
6165
<slot />
6266
</div>

‎src/routes/(console)/+layout.svelte‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import { UsageRates } from '$lib/components/billing';
4646
import { canSeeProjects } from '$lib/stores/roles';
4747
import { BottomModalAlert, NewConsoleBanner } from '$lib/components';
48+
import { shouldShowNotification } from '$lib/helpers/notifications';
4849
import { isSmallViewport } from '$lib/stores/viewport';
4950
import {
5051
IconAnnotation,
@@ -328,7 +329,7 @@
328329
onMount(() => {
329330
// Same shape as newDevUpgradePro: promo tier (importance 1) so it can never outrank a
330331
// payment or usage warning, dismissal keyed on the alert id in localStorage.
331-
if (isCloud && !localStorage.getItem('newConsoleBanner')) {
332+
if (isCloud && shouldShowNotification('newConsoleBanner')) {
332333
headerAlert.add({
333334
id: 'newConsoleBanner',
334335
component: NewConsoleBanner,

0 commit comments

Comments
 (0)