Skip to content

Project changes #1829

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
15 changes: 14 additions & 1 deletion src/lib/layout/createProject.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
<script lang="ts">
import { Layout, Typography, Input, Tag, Icon } from '@appwrite.io/pink-svelte';
import { Layout, Typography, Input, Tag, Icon, Alert } from '@appwrite.io/pink-svelte';
import { IconPencil } from '@appwrite.io/pink-icons-svelte';
import { CustomId } from '$lib/components/index.js';
import type { Region } from '$lib/sdk/billing';
import { getFlagUrl } from '$lib/helpers/flag';
import { isCloud } from '$lib/system.js';
import { currentPlan } from '$lib/stores/organization';
import { Button } from '$lib/elements/forms';
import { base } from '$app/paths';
import { page } from '$app/state';

export let projectName: string;
export let id: string;
export let regions: Array<Region> = [];
export let region: string;
export let showTitle = true;
export let projects: number = undefined;

let showCustomId = false;

Expand Down Expand Up @@ -44,6 +49,14 @@
{#if showTitle}
<Typography.Title size="l">Create your project</Typography.Title>
{/if}
{#if projects && projects >= $currentPlan?.projects}
<Alert.Inline status="warning" title="You’ve reached your limit of 2 projects">
Extra projects are available on paid plans for an additional fee
<svelte:fragment slot="actions">
<Button href={`${base}/organization-${page.params.organization}/billing`} external text>Upgrade</Button>
</svelte:fragment>
</Alert.Inline>
{/if}
<Layout.Stack direction="column" gap="xxl">
<Layout.Stack direction="column" gap="xxl">
<Layout.Stack direction="column" gap="s">
Expand Down
1 change: 1 addition & 0 deletions src/lib/sdk/billing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ export type Plan = {
webhooks: number;
users: number;
teams: number;
projects: number;
databases: number;
buckets: number;
fileSize: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,5 +240,5 @@
<CreateOrganization bind:show={addOrganization} />
<CreateProject bind:show={showCreate} teamId={page.params.organization} />
{#if showCreateProjectCloud}
<CreateProjectCloud bind:showCreateProjectCloud regions={$regionsStore.regions} />
<CreateProjectCloud projects={data.projects.total} bind:showCreateProjectCloud regions={$regionsStore.regions} />
{/if}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
const teamId = page.params.organization;
export let regions: Array<Region> = [];
export let showCreateProjectCloud: boolean;
export let projects: number;

async function onFinish() {
await invalidate(Dependencies.FUNCTIONS);
Expand Down Expand Up @@ -62,6 +63,7 @@

<Modal bind:show={showCreateProjectCloud} title={'Create project'} onSubmit={create}>
<CreateProject
projects={projects}
showTitle={false}
bind:id={$createProject.id}
bind:projectName={$createProject.name}
Expand Down
Loading