Merge pull request #2402 from appwrite/fix-DAT-752

This commit is contained in:
Darshan
2025-09-25 13:13:05 +05:30
committed by GitHub
3 changed files with 40 additions and 29 deletions
+3 -3
View File
@@ -15,10 +15,10 @@
import { formatCurrency } from '$lib/helpers/numbers';
let {
projectName = $bindable(''),
id = $bindable(''),
projectName = $bindable(),
id = $bindable(),
regions = [],
region = $bindable(''),
region = $bindable(),
showTitle = true,
billingPlan = undefined,
projects = undefined,
@@ -15,10 +15,13 @@
import { user } from '$lib/stores/user';
let isLoading = false;
let id: string = ID.unique();
let startAnimation = false;
let projectName = 'Appwrite project';
let region = Region.Fra;
let projectId = ID.unique();
let projectRegion = Region.Fra;
let projectName = 'Appwrite Project';
const projectIdForLog = projectId;
export let data;
@@ -39,17 +42,17 @@
try {
const teamId = data.organization.$id;
const project = await sdk.forConsole.projects.create({
projectId: id ?? ID.unique(),
projectId: projectId ?? ID.unique(),
name: projectName,
teamId,
region: isCloud ? region : undefined
region: isCloud ? projectRegion : undefined
});
markOnboardingComplete();
trackEvent(Submit.ProjectCreate, {
customId: !!id,
teamId
teamId,
customId: projectId !== projectIdForLog
});
startAnimation = true;
@@ -95,11 +98,11 @@
alt="Appwrite Logo" />
<Card.Base variant="primary" padding="l">
<CreateProject
regions={$regionsStore?.regions}
showTitle
bind:projectName
bind:id
bind:region
showTitle={true}>
bind:id={projectId}
bind:region={projectRegion}
regions={$regionsStore?.regions}>
{#snippet submit()}
<Layout.Stack direction="row" justifyContent="flex-end">
<Button.Button
@@ -3,7 +3,7 @@
import { onDestroy } from 'svelte';
import { goto, invalidate } from '$app/navigation';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { ID, type Models, Region as ConsoleRegion, Region } from '@appwrite.io/console';
import { ID, type Models, Region } from '@appwrite.io/console';
import { base } from '$app/paths';
import CreateProject from '$lib/layout/createProject.svelte';
import { Modal } from '$lib/components';
@@ -16,10 +16,12 @@
export let showCreateProjectCloud: boolean;
export let regions: Array<Models.ConsoleRegion> = [];
let id: string = null;
let error: string = null;
let name: string = 'New project';
let region: ConsoleRegion = Region.Fra;
let projectId = ID.unique();
let projectRegion = Region.Fra;
let projectName = 'New project';
let projectIdForLog = projectId;
let showSubmissionLoader = false;
@@ -30,14 +32,18 @@
try {
project = await sdk.forConsole.projects.create({
projectId: id ?? ID.unique(),
name,
projectId: projectId ?? ID.unique(),
name: projectName,
teamId,
region
region: projectRegion
});
await goto(`${base}/project-${project.region}-${project.$id}`);
trackEvent(Submit.ProjectCreate, { customId: !!id, teamId, region: region });
trackEvent(Submit.ProjectCreate, {
teamId,
region: projectRegion,
customId: projectId !== projectIdForLog
});
} catch (e) {
error = e.message;
trackError(e, Submit.ProjectCreate);
@@ -52,11 +58,13 @@
}
onDestroy(() => {
id = null;
name = null;
error = null;
region = Region.Fra;
projectId = ID.unique();
projectName = 'New project';
projectRegion = Region.Fra;
showCreateProjectCloud = false;
projectIdForLog = projectId;
});
</script>
@@ -67,12 +75,12 @@
onSubmit={create}
bind:error>
<CreateProject
{regions}
{projects}
showTitle={false}
bind:id
bind:projectName={name}
bind:region
{regions} />
bind:projectName
bind:id={projectId}
bind:region={projectRegion} />
<svelte:fragment slot="footer">
<Button
submit