mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
Merge pull request #1656 from appwrite/fixes-navigation
Fixes navigation
This commit is contained in:
8 files changed
+48
-25
No files matched your search
@@ -31,6 +31,7 @@
|
||||
import { logout } from '$lib/helpers/logout';
|
||||
import { app } from '$lib/stores/app';
|
||||
import { isTabletViewport } from '$lib/stores/viewport';
|
||||
import { isCloud } from '$lib/system.js';
|
||||
|
||||
let showSupport = false;
|
||||
|
||||
@@ -40,6 +41,7 @@
|
||||
name: string;
|
||||
$id: string;
|
||||
isSelected: boolean;
|
||||
showUpgrade: boolean;
|
||||
tierName: string;
|
||||
projects: Array<{ name: string; $id: string; isSelected: boolean }>;
|
||||
}>;
|
||||
@@ -73,6 +75,8 @@
|
||||
export let avatar: $$Props['avatar'];
|
||||
export let sideBarIsOpen: $$Props['sideBarIsOpen'] = false;
|
||||
export let showAccountMenu = false;
|
||||
|
||||
$: currentOrg = organizations.find((org) => org.isSelected);
|
||||
</script>
|
||||
|
||||
<Navbar.Base {...$$props}>
|
||||
@@ -93,7 +97,15 @@
|
||||
</div>
|
||||
<div slot="right" class="only-desktop">
|
||||
<div class="right">
|
||||
<Layout.Stack gap="l" direction="row">
|
||||
<Layout.Stack gap="l" direction="row" alignItems="center">
|
||||
{#if isCloud && currentOrg?.showUpgrade}
|
||||
<Button.Anchor
|
||||
size="s"
|
||||
variant="primary"
|
||||
href={`${base}/organization-${currentOrg.$id}/change-plan`}
|
||||
>Upgrade</Button.Anchor>
|
||||
{/if}
|
||||
|
||||
<DropList show={$feedback.show} scrollable on:blur={toggleFeedback}>
|
||||
<Button.Button type="button" variant="compact" on:click={toggleFeedback}
|
||||
>Feedback
|
||||
@@ -135,7 +147,9 @@
|
||||
on:click={() => {
|
||||
showAccountMenu = !showAccountMenu;
|
||||
}}>
|
||||
<Avatar size="s" src={avatar} />
|
||||
<div style:user-select="none">
|
||||
<Avatar size="s" src={avatar} />
|
||||
</div>
|
||||
</Link.Button>
|
||||
{#if showAccountMenu}
|
||||
<div class="account-container">
|
||||
|
||||
@@ -134,8 +134,9 @@
|
||||
<Layout.Stack direction="column" gap="s">
|
||||
<Tooltip inline={false} placement="right" disabled={state !== 'icons'}>
|
||||
<a
|
||||
href={`/console/project-${project.$id}`}
|
||||
href={`/console/project-${project.$id}/overview`}
|
||||
class="link"
|
||||
class:active={pathname.includes('platforms')}
|
||||
on:click={() => {
|
||||
sideBarIsOpen = false;
|
||||
}}
|
||||
@@ -225,7 +226,10 @@
|
||||
{#if project}
|
||||
<div class="only-desktop">
|
||||
<Tooltip inline={false} placement="right" disabled={state !== 'icons'}>
|
||||
<a href={`/console/project-${project.$id}/settings`} class="link"
|
||||
<a
|
||||
href={`/console/project-${project.$id}/settings`}
|
||||
class="link"
|
||||
class:active={pathname.includes('settings')}
|
||||
><span class="link-icon"><Icon icon={IconCog} size="s" /></span><span
|
||||
class:no-text={state === 'icons'}
|
||||
class:has-text={state === 'open'}
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
import { type Models } from '@appwrite.io/console';
|
||||
import { isCloud } from '$lib/system';
|
||||
import SideNavigation from '$lib/layout/navigation.svelte';
|
||||
import { isTabletViewport } from '$lib/stores/viewport';
|
||||
import { hasOnboardingDismissed } from '$lib/helpers/onboarding';
|
||||
import { isSidebarOpen } from '$lib/stores/sidebar';
|
||||
import { BillingPlan } from '$lib/constants';
|
||||
|
||||
export let showSideNavigation = false;
|
||||
export let showHeader = true;
|
||||
@@ -27,13 +27,20 @@
|
||||
|
||||
$: selectedProject = loadedProjects.find((project) => project.isSelected);
|
||||
let y: number;
|
||||
let showContentTransition = true;
|
||||
let showContentTransition = false;
|
||||
let timeoutId: NodeJS.Timeout;
|
||||
|
||||
page.subscribe(({ url }) => {
|
||||
$showSubNavigation = url.searchParams.get('openNavbar') === 'true';
|
||||
setTimeout(() => {
|
||||
showContentTransition = !url.pathname.includes('organization');
|
||||
}, 1000);
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
if (url.pathname.includes('project-')) {
|
||||
timeoutId = setTimeout(() => {
|
||||
showContentTransition = true;
|
||||
}, 1000);
|
||||
} else {
|
||||
showContentTransition = false;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -66,6 +73,7 @@
|
||||
return {
|
||||
name: org.name,
|
||||
$id: org.$id,
|
||||
showUpgrade: org.billingPlan === BillingPlan.FREE,
|
||||
tierName: isCloud ? tierToPlan(org.billingPlan).name : null,
|
||||
isSelected: $organization?.$id === org.$id,
|
||||
projects: loadedProjects
|
||||
@@ -77,7 +85,6 @@
|
||||
let subNavigation: undefined | ComponentType = $page.data.subNavigation;
|
||||
let state: undefined | 'open' | 'closed' | 'icons' = 'closed';
|
||||
$: state = $isSidebarOpen ? 'open' : 'closed';
|
||||
$: state = !$isTabletViewport ? 'icons' : $isSidebarOpen ? 'open' : 'closed';
|
||||
|
||||
function handleResize() {
|
||||
$isSidebarOpen = false;
|
||||
|
||||
@@ -10,6 +10,7 @@ export const load: LayoutLoad = async ({ params, fetch, depends, parent }) => {
|
||||
await parent();
|
||||
depends(Dependencies.RUNTIMES);
|
||||
depends(Dependencies.CONSOLE_VARIABLES);
|
||||
depends(Dependencies.ORGANIZATION);
|
||||
|
||||
const prefs = await sdk.forConsole.account.getPrefs();
|
||||
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { base } from '$app/paths';
|
||||
import type { PageLoad } from './$types';
|
||||
import { hasOnboardingDismissed } from '$lib/helpers/onboarding';
|
||||
|
||||
export const load: PageLoad = async ({ params }) => {
|
||||
redirect(302, `${base}/project-${params.project}/overview`);
|
||||
if (hasOnboardingDismissed(params.project)) {
|
||||
redirect(302, `${base}/project-${params.project}/overview`);
|
||||
}
|
||||
redirect(302, `${base}/project-${params.project}/get-started`);
|
||||
};
|
||||
@@ -1,6 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores';
|
||||
import { project } from '../store';
|
||||
import Onboard from '../overview/onboard.svelte';
|
||||
|
||||
$: projectId = $page.params.project;
|
||||
@@ -10,4 +9,4 @@
|
||||
<title>Console - Appwrite</title>
|
||||
</svelte:head>
|
||||
|
||||
<Onboard {projectId} hasPlatforms={$project.platforms.length > 0} />
|
||||
<Onboard {projectId} hasPlatforms={$page.data.project.platforms.length > 0} />
|
||||
@@ -4,11 +4,12 @@
|
||||
import { Cover } from '$lib/layout';
|
||||
import { project } from '../store';
|
||||
import { hasOnboardingDismissed, setHasOnboardingDismissed } from '$lib/helpers/onboarding';
|
||||
import { goto } from '$app/navigation';
|
||||
import { goto, invalidate } from '$app/navigation';
|
||||
import { base } from '$app/paths';
|
||||
import { Layout, Button, Typography } from '@appwrite.io/pink-svelte';
|
||||
import { user } from '$lib/stores/user';
|
||||
import { isSmallViewport } from '$lib/stores/viewport';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
</script>
|
||||
|
||||
{#if !$page.url.pathname.includes('get-started')}
|
||||
@@ -41,11 +42,10 @@
|
||||
size="s"
|
||||
on:click={async () => {
|
||||
await setHasOnboardingDismissed($project.$id);
|
||||
if (location.href.endsWith('get-started')) {
|
||||
goto(`${base}/project-${$project.$id}`);
|
||||
} else {
|
||||
location.reload();
|
||||
}
|
||||
goto(`${base}/project-${$project.$id}/overview`);
|
||||
requestAnimationFrame(() => {
|
||||
invalidate(Dependencies.ORGANIZATION);
|
||||
});
|
||||
}}>Dismiss this page</Button.Button>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -371,12 +371,6 @@
|
||||
background-size: cover;
|
||||
background-position: bottom;
|
||||
background-repeat: no-repeat;
|
||||
|
||||
@media (min-width: 768px) {
|
||||
background-size: contain;
|
||||
background-position: top;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
}
|
||||
.full-height-card {
|
||||
height: 100%;
|
||||
|
||||
Reference in new issue
Block a user