remove: web onboarding flow, add: todo for Ernst.

This commit is contained in:
Darshan committed 2025-01-24 19:51:08 +05:30
1 parent 94a06f6ec5
commit d8b6d06197
6 files changed
+6 -243

No files matched your search

@@ -73,7 +73,9 @@
<div class="grid">
<button
class="onboarding-card platform-card"
on:click={() => addPlatform(0)}>
on:click={() => {
// TODO: @ernst web starter > sites websites/starter flow
}}>
<img
src={$app.themeInUse === 'dark'
? PlatformWebImgSourceDark
@@ -5,7 +5,6 @@
import CreateAndroid from './createAndroid.svelte';
import CreateApple from './createApple.svelte';
import CreateFlutter from './createFlutter.svelte';
import CreateWeb from './createWeb.svelte';
import CreateReactNative from './createReactNative.svelte';
import { versions } from './wizard/store';
@@ -23,7 +22,6 @@
}
const platforms = {
[Platform.Web]: CreateWeb,
[Platform.Flutter]: CreateFlutter,
[Platform.Android]: CreateAndroid,
[Platform.Apple]: CreateApple,
@@ -56,7 +54,6 @@
'flutter-macos' = 'macOS',
'flutter-windows' = 'Windows',
'flutter-web' = 'Web',
'web' = 'Web',
'react-native-android' = 'Android',
'react-native-ios' = 'iOS'
}
@@ -73,8 +70,6 @@
return 'color/apple';
} else if (platform.includes('android')) {
return 'color/android';
} else if (platform.includes('web')) {
return 'grayscale/code';
} else {
return 'unknown';
}
@@ -95,7 +90,6 @@
</Button>
{/if}
<svelte:fragment slot="list">
<DropListItem on:click={() => addPlatform(Platform.Web)}>Web app</DropListItem>
<DropListItem on:click={() => addPlatform(Platform.Flutter)}>Flutter app</DropListItem>
<DropListItem on:click={() => addPlatform(Platform.Android)}>Android app</DropListItem>
<DropListItem on:click={() => addPlatform(Platform.Apple)}>Apple app</DropListItem>
@@ -169,9 +163,6 @@
</Button>
{/if}
<svelte:fragment slot="list">
<DropListItem on:click={() => addPlatform(Platform.Web)}>
Web
</DropListItem>
<DropListItem on:click={() => addPlatform(Platform.Flutter)}>
Flutter
</DropListItem>
@@ -181,6 +172,9 @@
<DropListItem on:click={() => addPlatform(Platform.Apple)}>
Apple
</DropListItem>
<DropListItem on:click={() => addPlatform(Platform.ReactNative)}>
React Native
</DropListItem>
</svelte:fragment>
</DropList>
</div>
@@ -1,47 +0,0 @@
<script lang="ts">
import { WizardWithSteps } from '$lib/layout';
import { invalidate } from '$app/navigation';
import { wizard } from '$lib/stores/wizard';
import { createPlatform } from './wizard/store';
import type { WizardStepsType } from '$lib/layout/wizardWithSteps.svelte';
import Step1 from './wizard/web/step1.svelte';
import Step2 from './wizard/web/step2.svelte';
import Step3 from './wizard/web/step3.svelte';
import Step4 from './wizard/step4.svelte';
import { Dependencies } from '$lib/constants';
async function onFinish() {
await Promise.all([invalidate(Dependencies.PROJECT), invalidate(Dependencies.PLATFORMS)]);
createPlatform.reset();
wizard.hide();
}
const stepsComponents: WizardStepsType = new Map();
stepsComponents.set(1, {
label: 'Settings',
component: Step1
});
stepsComponents.set(2, {
label: 'Install',
component: Step2,
optional: true
});
stepsComponents.set(3, {
label: 'Import',
component: Step3,
optional: true
});
stepsComponents.set(4, {
label: 'Build',
component: Step4,
optional: true
});
</script>
<WizardWithSteps
title="Add a web platform"
steps={stepsComponents}
on:finish={onFinish}
on:exit={onFinish}
finalAction="Go to dashboard" />
@@ -1,84 +0,0 @@
<script lang="ts">
import { page } from '$app/stores';
import { Alert } from '$lib/components';
import { Pill } from '$lib/elements';
import { FormList, InputText } from '$lib/elements/forms';
import { WizardStep } from '$lib/layout';
import { sdk } from '$lib/stores/sdk';
import { createPlatform } from '../store';
import { Submit, trackEvent } from '$lib/actions/analytics';
import { PlatformType } from '@appwrite.io/console';
const projectId = $page.params.project;
const suggestions = ['*.vercel.app', '*.netlify.app', '*.gitpod.io'];
async function beforeSubmit() {
if ($createPlatform.$id) {
await sdk.forConsole.projects.updatePlatform(
projectId,
$createPlatform.$id,
$createPlatform.name,
$createPlatform.key || undefined,
$createPlatform.store || undefined,
$createPlatform.hostname || undefined
);
return;
}
const platform = await sdk.forConsole.projects.createPlatform(
projectId,
PlatformType.Web,
$createPlatform.name,
undefined,
undefined,
$createPlatform.hostname || undefined
);
trackEvent(Submit.PlatformCreate, {
type: 'web'
});
$createPlatform.$id = platform.$id;
}
</script>
<WizardStep {beforeSubmit}>
<svelte:fragment slot="title">Hostname registration</svelte:fragment>
<FormList>
<InputText
id="name"
label="Name"
placeholder="My Web App"
required
bind:value={$createPlatform.name} />
<div>
<InputText
id="hostname"
label="Hostname"
placeholder="localhost"
tooltip="The hostname that your website will use to interact with the Appwrite APIs in production or development environments. No protocol or port number required."
required
bind:value={$createPlatform.hostname} />
<div class="u-flex u-gap-16 u-margin-block-start-8">
{#each suggestions as suggestion}
<Pill
button
selected={$createPlatform.hostname === suggestion}
on:click={() => ($createPlatform.hostname = suggestion)}>
{suggestion}
</Pill>
{/each}
</div>
</div>
<Alert type="warning">
Using wildcard hostnames in production can become insecure. You can read about
<a
href="https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS"
target="_blank"
rel="noopener noreferrer"
class="link">
Cross-Origin Resource Sharing (CORS)</a> for more information.
</Alert>
</FormList>
</WizardStep>
@@ -1,64 +0,0 @@
<script lang="ts">
import { versions } from '../store';
import { Code } from '$lib/components';
import { Pill } from '$lib/elements';
import { WizardStep } from '$lib/layout';
enum Method {
NPM,
CDN
}
let method: Method = Method.NPM;
const example1 = `import { Client } from 'appwrite';`;
const example2 =
`<script src="https://cdn.jsdelivr.net/npm/appwrite@${$versions['client-web']}"></script` +
`>\n` +
`<script>
const { Client } = Appwrite;
</script` +
`>`; // Prevent svelte from processing the closing script tag
</script>
<WizardStep>
<svelte:fragment slot="title">Install</svelte:fragment>
<svelte:fragment slot="subtitle">
Choose your preferred method of installation
<div class="u-flex u-gap-16 u-margin-block-start-8">
<Pill button on:click={() => (method = Method.NPM)} selected={method === Method.NPM}>
NPM
</Pill>
<Pill button on:click={() => (method = Method.CDN)} selected={method === Method.CDN}>
CDN
</Pill>
</div>
</svelte:fragment>
{#if method === Method.NPM}
<p>
Use <a
href="https://npmjs.com/package/appwrite"
target="_blank"
rel="noopener noreferrer"
class="link">NPM (node package manager)</a> from your command line to add Appwrite SDK
to your project.
</p>
<Code label="Bash" language="sh" code="npm install appwrite" withCopy />
<p class="common-section">
If you're using a bundler like <a
href="https://vitejs.dev"
target="_blank"
rel="noopener noreferrer"
class="link">Vite</a>
or
<a href="https://rollupjs.org" target="_blank" rel="noopener noreferrer" class="link"
>Rollup</a
>, import Appwrite as a module.
</p>
<Code label="Web SDK" labelIcon="code" language="js" code={example1} withCopy />
{:else if method === Method.CDN}
<p>Add the following script tags to install Appwrite with a CDN.</p>
<Code label="HTML" language="html" code={example2} withCopy />
{/if}
</WizardStep>
@@ -1,38 +0,0 @@
<script lang="ts">
import { Code } from '$lib/components';
import Id from '$lib/components/id.svelte';
import { WizardStep } from '$lib/layout';
import { sdk } from '$lib/stores/sdk';
import { isCloud } from '$lib/system';
const { endpoint, project } = sdk.forProject.client.config;
const code = `const client = new Client();
${
isCloud
? `client.setProject('${project}');`
: `client
.setEndpoint('${endpoint}')
.setProject('${project}');`
}`;
</script>
<WizardStep>
<svelte:fragment slot="title">Initialize SDK</svelte:fragment>
<h2 class="heading-level-7">Initialize your SDK</h2>
<p>
Initialize your SDK by pointing the client to your Appwrite project using your <Id
value={project}>Project ID</Id
>.
</p>
<div class="u-margin-block-start-16">
<Code
label="Web SDK"
labelIcon="code"
language="js"
{code}
withCopy
withLineNumbers
noMargin />
</div>
</WizardStep>