fix: onboarding state

This commit is contained in:
Torsten Dittmann
2022-11-11 10:25:43 +01:00
parent 08fc915efe
commit c2065b66d2
7 changed files with 28 additions and 3 deletions
@@ -22,7 +22,7 @@
import type { Models } from '@aw-labs/appwrite-console';
import { Container, type UsagePeriods } from '$lib/layout';
import { page } from '$app/stores';
import { project } from '../store';
import { onboarding, project } from '../store';
import { usage } from './store';
import { onMount } from 'svelte';
import { afterNavigate } from '$app/navigation';
@@ -61,7 +61,7 @@
{#if $project}
<Container overlapCover>
{#if $project.keys.length === 0 && $project.platforms.length === 0}
{#if $onboarding}
<Onboard {projectId} />
{:else}
{#if $usage}
@@ -1,6 +1,6 @@
<script lang="ts">
import { Wizard } from '$lib/layout';
import { beforeNavigate, goto } from '$app/navigation';
import { beforeNavigate, goto, invalidate } from '$app/navigation';
import { wizard } from '$lib/stores/wizard';
import type { WizardStepsType } from '$lib/layout/wizard.svelte';
import Step1 from './wizard/step1.svelte';
@@ -10,6 +10,8 @@
import { page } from '$app/stores';
import { addNotification } from '$lib/stores/notifications';
import { onDestroy } from 'svelte';
import { onboarding } from '../../store';
import { Dependencies } from '$lib/constants';
async function onFinish() {
try {
@@ -19,6 +21,9 @@
$key.scopes,
$key.expire ?? undefined
);
if ($onboarding) {
invalidate(Dependencies.PROJECT);
}
goto(`/console/project-${$page.params.project}/overview/keys/${$id}`);
} catch (error) {
addNotification({
@@ -9,8 +9,12 @@
import Step3 from './wizard/android/step3.svelte';
import Step4 from './wizard/step4.svelte';
import { Dependencies } from '$lib/constants';
import { onboarding } from '../../store';
async function onFinish() {
if ($onboarding) {
invalidate(Dependencies.PROJECT);
}
invalidate(Dependencies.PLATFORMS);
createPlatform.reset();
wizard.hide();
@@ -9,8 +9,12 @@
import Step3 from './wizard/apple/step3.svelte';
import Step4 from './wizard/step4.svelte';
import { Dependencies } from '$lib/constants';
import { onboarding } from '../../store';
async function onFinish() {
if ($onboarding) {
invalidate(Dependencies.PROJECT);
}
invalidate(Dependencies.PLATFORMS);
createPlatform.reset();
wizard.hide();
@@ -9,8 +9,12 @@
import Step3 from './wizard/flutter/step3.svelte';
import Step4 from './wizard/step4.svelte';
import { Dependencies } from '$lib/constants';
import { onboarding } from '../../store';
async function onFinish() {
if ($onboarding) {
invalidate(Dependencies.PROJECT);
}
invalidate(Dependencies.PLATFORMS);
createPlatform.reset();
wizard.hide();
@@ -9,8 +9,12 @@
import Step3 from './wizard/web/step3.svelte';
import Step4 from './wizard/step4.svelte';
import { Dependencies } from '$lib/constants';
import { onboarding } from '../../store';
async function onFinish() {
if ($onboarding) {
invalidate(Dependencies.PROJECT);
}
invalidate(Dependencies.PLATFORMS);
createPlatform.reset();
wizard.hide();
@@ -4,6 +4,10 @@ import type { Models } from '@aw-labs/appwrite-console';
import type { BarSeriesOption } from 'echarts/charts';
export const project = derived(page, ($page) => $page.data.project as Models.Project);
export const onboarding = derived(
project,
($project) => $project.platforms.length === 0 && $project.keys.length === 0
);
function createStats() {
const { subscribe, set, update } = writable<Map<string, BarSeriesOption['data']>>(new Map());