Skip to content

Commit

Permalink
Merge pull request #1684 from appwrite/new-nav
Browse files Browse the repository at this point in the history
update
  • Loading branch information
thejessewinton authored Jan 22, 2025
2 parents c4b0689 + 6cf6f94 commit 81c95e1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 60 deletions.
3 changes: 2 additions & 1 deletion src/lib/experiments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export const posthogServerClient = PUBLIC_POSTHOG_API_KEY
: null;

export const experiments = {
'sticky-navigation_ab-test': ['control', 'sticky-nav']
'sticky-navigation_ab-test': ['control', 'sticky-nav'],
'cta-copy_ab-test': ['control', 'start-for-free_variant', 'start-building_variant']
} as const;

type Key = keyof typeof experiments;
Expand Down
73 changes: 17 additions & 56 deletions src/lib/layouts/Main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,11 @@
import { BANNER_KEY, GITHUB_REPO_LINK, GITHUB_STARS } from '$lib/constants';
import { isVisible } from '$lib/utils/isVisible';
import { createScrollInfo } from '$lib/utils/scroll';
import { hasNewChangelog } from '$routes/changelog/utils';
import { addEventListener } from '@melt-ui/svelte/internal/helpers';
import { onMount } from 'svelte';
import { page } from '$app/stores';
import ProductsSubmenu from '$lib/components/ProductsSubmenu.svelte';
import ProductsMobileSubmenu from '$lib/components/ProductsMobileSubmenu.svelte';
import { PUBLIC_APPWRITE_DASHBOARD } from '$env/static/public';
import AnnouncementBanner from '$lib/components/AnnouncementBanner.svelte';
import InitBanner from '$lib/components/InitBanner.svelte';
import { trackEvent } from '$lib/actions/analytics';
import MainNav from '$lib/components/MainNav.svelte';
Expand Down Expand Up @@ -97,54 +93,21 @@
return setupThemeObserver();
});
$: navLinks = $page.data.isStickyNav
? [
{
label: 'Products',
submenu: ProductsSubmenu,
mobileSubmenu: ProductsMobileSubmenu
},
{
label: 'Docs',
href: '/docs'
},
{
label: 'Pricing',
href: '/pricing'
}
]
: [
{
label: 'Products',
submenu: ProductsSubmenu,
mobileSubmenu: ProductsMobileSubmenu
},
{
label: 'Docs',
href: '/docs'
},
{
label: 'Community',
href: '/community'
},
{
label: 'Blog',
href: '/blog'
},
{
label: 'Integrations',
href: '/integrations'
},
{
label: 'Changelog',
href: '/changelog',
showBadge: hasNewChangelog?.() && !$page.url.pathname.includes('/changelog')
},
{
label: 'Pricing',
href: '/pricing'
}
];
$: navLinks = [
{
label: 'Products',
submenu: ProductsSubmenu,
mobileSubmenu: ProductsMobileSubmenu
},
{
label: 'Docs',
href: '/docs'
},
{
label: 'Pricing',
href: '/pricing'
}
];
$: resolvedTheme = $isMobileNavOpen ? 'dark' : theme;
Expand Down Expand Up @@ -179,7 +142,6 @@
<section
class="web-mobile-header {resolvedTheme}"
class:is-transparent={browser && !$isMobileNavOpen}
class:is-hidden={$isHeaderHidden && !$page.data.isStickyNav}
>
<div class="web-mobile-header-start">
<a href="/">
Expand Down Expand Up @@ -220,11 +182,10 @@
</section>
<header
class="web-main-header is-special-padding {resolvedTheme} is-transparent"
class:is-hidden={$isHeaderHidden && !$page.data.isStickyNav}
class:is-special-padding={!BANNER_KEY.startsWith('init-banner-')}
style={BANNER_KEY === 'init-banner-02' ? 'padding-inline: 0' : ''}
>
{#if !$page.data.isStickyNav}
<!-- {#if !$page.data.isStickyNav}
{#if BANNER_KEY.startsWith('init-banner-')}
<InitBanner />
{:else}
Expand All @@ -236,7 +197,7 @@
</a>
</AnnouncementBanner>
{/if}
{/if}
{/if} -->

<div
class="web-main-header-wrapper"
Expand Down
20 changes: 17 additions & 3 deletions src/routes/+layout.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,29 @@ export const load = async ({ request, getClientAddress }) => {

const distinctId = generateDistinctId(fingerprintData);

const isStickyNav = await getFeatureFlag<'sticky-navigation_ab-test'>(
const isStartBuilding = await getFeatureFlag<'cta-copy_ab-test'>(
'sticky-navigation_ab-test',
'sticky-nav',
'start-building_variant',
distinctId
);

console.log(isStartBuilding);

const isStartForFree = await getFeatureFlag<'cta-copy_ab-test'>(
'sticky-navigation_ab-test',
'start-for-free_variant',
distinctId
);

const ctaCopy = isStartBuilding
? 'Start building'
: isStartForFree
? 'Start for free'
: 'Get started';

return {
ctaCopy,
distinctId,
isStickyNav,
changelogEntries: (await getAllChangelogEntries()).length
};
};

0 comments on commit 81c95e1

Please sign in to comment.