Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import { Dependencies } from '$lib/constants';
import { page } from '$app/state';
import { Submit, trackEvent, trackError } from '$lib/actions/analytics';
import { ID, Region as ConsoleRegion, type Models } from '@appwrite.io/console';
import { createProject } from './wizard/store';
import { ID, Region as ConsoleRegion, type Models, Region } from '@appwrite.io/console';
import { Button } from '@appwrite.io/pink-svelte';
import { base } from '$app/paths';
import CreateProject from '$lib/layout/createProject.svelte';
Expand All @@ -17,6 +16,10 @@
export let regions: Array<Models.ConsoleRegion> = [];
export let showCreateProjectCloud: boolean;
let id: string = null;
let name: string = 'Appwrite project';
let region: string = Region.Fra;
async function onFinish() {
await invalidate(Dependencies.FUNCTIONS);
}
Expand All @@ -25,19 +28,19 @@
try {
// TODO: fix typing once SDK is updated
const project = await sdk.forConsole.projects.create(
$createProject?.id ?? ID.unique(),
$createProject.name,
id ?? ID.unique(),
name,
teamId,
$createProject.region as ConsoleRegion
region as ConsoleRegion
);
trackEvent(Submit.ProjectCreate, {
customId: !!$createProject?.id,
customId: !!id,
teamId,
region: $createProject.region
region: region
});
addNotification({
type: 'success',
message: `${$createProject.name} has been created`
message: `${name} has been created`
});
await onFinish();
await goto(`${base}/project-${project.region}-${project.$id}`);
Expand All @@ -51,21 +54,14 @@
}
onDestroy(() => {
$createProject = {
id: null,
name: null,
region: 'fra'
};
id = null;
name = null;
region = 'fra';
});
</script>

<Modal bind:show={showCreateProjectCloud} title={'Create project'} onSubmit={create}>
<CreateProject
showTitle={false}
bind:id={$createProject.id}
bind:projectName={$createProject.name}
bind:region={$createProject.region}
{regions}>
<CreateProject showTitle={false} bind:id bind:projectName={name} bind:region {regions}>
</CreateProject>
<svelte:fragment slot="footer">
<Button.Button type="submit" variant="primary" size="s">Create</Button.Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
});

$: avatars = $members.memberships?.map((m) => m.userName || m.userEmail) ?? [];
$: organizationId = page.params.organization;
$: organizationId = $organization?.$id ?? page.params.organization;
$: path = `${base}/organization-${organizationId}`;
$: tabs = [
{
Expand Down Expand Up @@ -75,7 +75,7 @@
].filter((tab) => !tab.disabled);
</script>

{#if $organization?.$id}
{#if $organization.$id}
<Cover>
<svelte:fragment slot="header">
<span class="u-flex u-cross-center u-gap-8 u-min-width-0">
Expand Down
11 changes: 0 additions & 11 deletions src/routes/(console)/organization-[organization]/wizard/store.ts

This file was deleted.