Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: launchpad link in user menu #1089

Merged
merged 1 commit into from
Jan 15, 2025
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
10 changes: 2 additions & 8 deletions src/frontend/src/lib/components/core/Navmenu.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
import { isEmptyString } from '@dfinity/utils';
import { notEmptyString } from '@dfinity/utils';
import { circOut, quintOut } from 'svelte/easing';
import { slide } from 'svelte/transition';
import { page } from '$app/state';
Expand All @@ -10,7 +10,6 @@
import IconFunctions from '$lib/components/icons/IconFunctions.svelte';
import IconHosting from '$lib/components/icons/IconHosting.svelte';
import IconMissionControl from '$lib/components/icons/IconMissionControl.svelte';
import IconRocket from '$lib/components/icons/IconRocket.svelte';
import IconSatellite from '$lib/components/icons/IconSatellite.svelte';
import IconStorage from '$lib/components/icons/IconStorage.svelte';
import IconTelescope from '$lib/components/icons/IconTelescope.svelte';
Expand Down Expand Up @@ -42,12 +41,7 @@

<Menu>
<nav>
{#if isEmptyString(satelliteId)}
<a class="link" href="/">
<IconRocket size="24px" />
<span>{$i18n.satellites.launchpad}</span>
</a>
{:else}
{#if notEmptyString(satelliteId)}
<a
class="link"
href={`/satellite/?s=${satelliteId}`}
Expand Down
24 changes: 18 additions & 6 deletions src/frontend/src/lib/components/core/User.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import IconAnalytics from '$lib/components/icons/IconAnalytics.svelte';
import IconMissionControl from '$lib/components/icons/IconMissionControl.svelte';
import IconRaygun from '$lib/components/icons/IconRaygun.svelte';
import IconRocket from '$lib/components/icons/IconRocket.svelte';
import IconSignIn from '$lib/components/icons/IconSignIn.svelte';
import IconSignOut from '$lib/components/icons/IconSignOut.svelte';
import IconTelescope from '$lib/components/icons/IconTelescope.svelte';
Expand Down Expand Up @@ -45,10 +46,12 @@
visible = true;
};

let home = $derived(page.route.id === '/(home)');
let preferences = $derived(page.route.id === '/(single)/preferences');

// If there is no satellites, we consider the user has a new developer and want to show all links in the user popover that way the user can navigate anyway on the home screen.
let newDeveloper = $derived($satellitesNotLoaded || ($satellitesStore?.length ?? 0) === 0);
let routeId: string | null = $derived(page.route.id);
let showNavigation = $derived(newDeveloper && routeId === '/(home)');
let showNavigation = $derived(newDeveloper && home);
</script>

{#if $authSignedIn}
Expand All @@ -69,6 +72,13 @@

<Popover bind:visible anchor={button} direction="rtl">
<div class="container">
{#if !home && !preferences}
<a href="/" class="menu" role="menuitem" aria-haspopup="menu" onclick={close}>
<IconRocket />
<span>{$i18n.satellites.launchpad}</span>
</a>
{/if}

{#if showNavigation}
<a href="/mission-control" class="menu" role="menuitem" aria-haspopup="menu" onclick={close}>
<IconMissionControl />
Expand Down Expand Up @@ -97,10 +107,12 @@
</a>
{/if}

<a href="/preferences" class="menu" role="menuitem" aria-haspopup="menu" onclick={close}>
<IconRaygun />
<span>{$i18n.preferences.title}</span>
</a>
{#if !preferences}
<a href="/preferences" class="menu" role="menuitem" aria-haspopup="menu" onclick={close}>
<IconRaygun />
<span>{$i18n.preferences.title}</span>
</a>
{/if}

<button type="button" role="menuitem" aria-haspopup="menu" onclick={signOutClose} class="menu">
<IconSignOut />
Expand Down
Loading