From 107e4ea82cd2c79bbc6dc545b030c34dc3a0dc86 Mon Sep 17 00:00:00 2001 From: Arman Date: Tue, 10 Oct 2023 20:06:35 +0200 Subject: [PATCH] feat: more plan limits --- src/lib/components/alert.svelte | 8 +++---- src/lib/layout/activity.svelte | 14 +++++------- src/lib/layout/containerHeader.svelte | 22 ++++++++----------- src/lib/stores/billing.ts | 2 ++ .../auth/templates/+page.svelte | 15 +++++++++++++ .../auth/user-[user]/sessions/+page.svelte | 10 ++++++++- .../function-[function]/+page.svelte | 14 ++++++++---- .../deployment-[deployment]/+page.svelte | 20 ++++++++++++++++- .../executions/+page.svelte | 16 +++++--------- .../storage/bucket-[bucket]/+page.svelte | 22 +++++-------------- 10 files changed, 82 insertions(+), 61 deletions(-) diff --git a/src/lib/components/alert.svelte b/src/lib/components/alert.svelte index b935f72a5..c553d6042 100644 --- a/src/lib/components/alert.svelte +++ b/src/lib/components/alert.svelte @@ -1,6 +1,7 @@ - Activity + {#if logs.total} diff --git a/src/lib/layout/containerHeader.svelte b/src/lib/layout/containerHeader.svelte index abe135796..d44e9d59d 100644 --- a/src/lib/layout/containerHeader.svelte +++ b/src/lib/layout/containerHeader.svelte @@ -1,5 +1,5 @@ {#if isCloud && total && limit !== 0 && total >= limit} - - + + You've reached the maximum number of {title.toLowerCase()} for the {tier} plan. - for additional {title.toLocaleLowerCase()}. @@ -89,14 +88,11 @@ {#if isCloud}
- +

Your are limited to {limit} {title.toLocaleLowerCase()} per project on the {tier}. - for addtional {title.toLocaleLowerCase()}.

diff --git a/src/lib/stores/billing.ts b/src/lib/stores/billing.ts index 269056ede..83ee597a3 100644 --- a/src/lib/stores/billing.ts +++ b/src/lib/stores/billing.ts @@ -34,8 +34,10 @@ export function getCreditCardImage(brand: string, width = 46, height = 32) { } export function getServiceLimit(serviceId: string): number { + if (!isCloud) return 0; if (!serviceId) return 0; const plan = get(plansInfo).plans.find((p) => p.$id === get(organization)?.billingPlan); + console.log(plan); return plan[serviceId]; } diff --git a/src/routes/console/project-[project]/auth/templates/+page.svelte b/src/routes/console/project-[project]/auth/templates/+page.svelte index 69ba5ca1d..c906da7ae 100644 --- a/src/routes/console/project-[project]/auth/templates/+page.svelte +++ b/src/routes/console/project-[project]/auth/templates/+page.svelte @@ -40,6 +40,9 @@ // import { baseEmailTemplate, baseSmsTemplate, emailTemplate, smsTemplate } from './store'; import { baseEmailTemplate, emailTemplate } from './store'; import { Button } from '$lib/elements/forms'; + import { organization } from '$lib/stores/organization'; + import ChangeOrganizationTierCloud from '$routes/console/changeOrganizationTierCloud.svelte'; + import { wizard } from '$lib/stores/wizard'; const projectId = $page.params.project; @@ -114,6 +117,18 @@

+ {#if $organization.billingPlan === 'tier-0'} + wizard.start(ChangeOrganizationTierCloud) + } + ]}> + All emails sent using the Free plan will include attribution to Appwrite in the + signature. To send attribution-free emails, upgrade your plan. + + {/if} - + {#if data.sessions.total} {/if} + + +

+ You are limited to {limit} hour of logs on the {tier} plan. + to increase log retention for a longer period. +

+
{#if data.sessions.total} diff --git a/src/routes/console/project-[project]/functions/function-[function]/+page.svelte b/src/routes/console/project-[project]/functions/function-[function]/+page.svelte index 18f42e9d7..20e1e32d6 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/+page.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/+page.svelte @@ -26,7 +26,7 @@ TableScroll } from '$lib/elements/table'; import { deploymentList, execute, func, proxyRuleList } from './store'; - import { Container } from '$lib/layout'; + import { Container, ContainerHeader } from '$lib/layout'; import { app } from '$lib/stores/app'; import { calculateSize, humanFileSize } from '$lib/helpers/sizeConvertion'; import type { Models } from '@appwrite.io/console'; @@ -56,10 +56,16 @@ -
- Deployments + + +

+ You are limited to {limit} hour of logs on the {tier} plan. + to increase log retention for a longer period. +

+
-
+ {#if $deploymentList?.total} {@const activeDeployment = data.activeDeployment}
diff --git a/src/routes/console/project-[project]/functions/function-[function]/deployment-[deployment]/+page.svelte b/src/routes/console/project-[project]/functions/function-[function]/deployment-[deployment]/+page.svelte index 42d3a8d70..de28fa44e 100644 --- a/src/routes/console/project-[project]/functions/function-[function]/deployment-[deployment]/+page.svelte +++ b/src/routes/console/project-[project]/functions/function-[function]/deployment-[deployment]/+page.svelte @@ -1,6 +1,6 @@ + {#if isCloud && limit !== 0 && limit < Infinity} + + You are limited to {limit} hour of logs on the {tier} plan. + to increase log retention for a longer period. + + {/if}
- +

You are limited to {limit} of storage on the {tier} plan. - for addtional storage.