From 20b6f207b15bf791536c7af9012c64069dfcdb7d Mon Sep 17 00:00:00 2001 From: Arman Date: Wed, 22 May 2024 16:07:09 +0200 Subject: [PATCH] feat: more logic fixes --- src/lib/layout/unauthenticated.svelte | 15 ++++++----- src/routes/console/apply-credit/+page.svelte | 28 +++++++++++++------- src/routes/console/apply-credit/+page.ts | 2 +- src/routes/login/+page.svelte | 2 +- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/src/lib/layout/unauthenticated.svelte b/src/lib/layout/unauthenticated.svelte index 0894bcb65..bf59fba09 100644 --- a/src/lib/layout/unauthenticated.svelte +++ b/src/lib/layout/unauthenticated.svelte @@ -4,15 +4,16 @@ import AppwriteLogoLight from '$lib/images/appwrite-logo-light.svg'; import LoginDark from '$lib/images/login/login-dark-mode.png'; import LoginLight from '$lib/images/login/login-light-mode.png'; + import type { Coupon } from '$lib/sdk/billing'; import { app } from '$lib/stores/app'; import { user } from '$lib/stores/user'; export const imgLight = LoginLight; export const imgDark = LoginDark; - export let campaign: string = null; + export let coupon: Coupon = null; - $: variation = campaign ? 'card' : 'default'; + $: variation = coupon?.code ? 'card' : 'default';
@@ -52,19 +53,19 @@ {:else if variation === 'card'}
promo
- You've received $15 in credits + You've received ${coupon.credits} in credits

- Get $15 in credits when you sign up and create an organization with a Pro - plan. + Get ${coupon.credits} in credits when you upgrade or create an organization with + a Pro plan.

diff --git a/src/routes/console/apply-credit/+page.svelte b/src/routes/console/apply-credit/+page.svelte index f3a099d6e..665346cd5 100644 --- a/src/routes/console/apply-credit/+page.svelte +++ b/src/routes/console/apply-credit/+page.svelte @@ -13,6 +13,7 @@ WizardSecondaryHeader } from '$lib/layout'; import { type PaymentList } from '$lib/sdk/billing'; + import { app } from '$lib/stores/app'; import { addNotification } from '$lib/stores/notifications'; import { organizationList, type Organization } from '$lib/stores/organization'; import { sdk } from '$lib/stores/sdk'; @@ -180,16 +181,23 @@ {/if} - {#if selectedOrg?.billingPlan} -
- -
- - {/if} +
+ + promo +
+
diff --git a/src/routes/console/apply-credit/+page.ts b/src/routes/console/apply-credit/+page.ts index 0c0762b5e..d29101ba0 100644 --- a/src/routes/console/apply-credit/+page.ts +++ b/src/routes/console/apply-credit/+page.ts @@ -14,7 +14,7 @@ export const load = async ({ url }) => { } } if (!couponData?.campaign) { - redirect(303, `${base}/console`); + // redirect(303, `${base}/console`); } return { diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte index a643c0072..e566fa09d 100644 --- a/src/routes/login/+page.svelte +++ b/src/routes/login/+page.svelte @@ -89,7 +89,7 @@ Sign in - Appwrite - + Sign in