Skip to content

Commit bd265cc

Browse files
committed
fix: add credit wizard
1 parent ead4c42 commit bd265cc

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/lib/components/billing/couponInput.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
</span>
6969
</slot>
7070
</div>
71-
<Button text on:click={removeCoupon}>Remove</Button>
71+
<Button round text on:click={removeCoupon}><span class="icon-x"></span></Button>
7272
</div>
7373
{/if}
7474
</FormList>

src/routes/console/organization-[organization]/billing/availableCredit.svelte

+4-3
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@
7171
<p class="text">Appwrite credit will automatically be applied to your next invoice.</p>
7272
<svelte:fragment slot="aside">
7373
<div class="u-flex u-cross-center u-main-space-between">
74-
<h4 class="body-text-1 u-bold">
75-
Credit balance <span class="inline-tag">${balance}</span>
76-
</h4>
74+
<div class="u-flex u-gap-8 u-cross-center">
75+
<h4 class="body-text-1 u-bold">Credit balance</h4>
76+
<span class="inline-tag">${balance}</span>
77+
</div>
7778
{#if creditList?.total}
7879
<Button secondary on:click={handleCredits}>
7980
<span class="icon-plus" aria-hidden="true"></span>

src/routes/console/organization-[organization]/billing/wizard/addCredit.svelte

+10-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import type { Coupon } from '$lib/sdk/billing';
55
import { sdk } from '$lib/stores/sdk';
66
import { wizard } from '$lib/stores/wizard';
7+
import { onMount } from 'svelte';
78
import { addCreditWizardStore } from '../store';
89
910
let coupon: string;
@@ -18,6 +19,7 @@
1819
try {
1920
const response = await sdk.forConsole.billing.getCoupon(coupon);
2021
couponData = response;
22+
$addCreditWizardStore.coupon = coupon;
2123
coupon = null;
2224
} catch (error) {
2325
couponData.code = coupon;
@@ -26,6 +28,13 @@
2628
throw new Error(error);
2729
}
2830
}
31+
32+
onMount(() => {
33+
if ($addCreditWizardStore.coupon) {
34+
coupon = $addCreditWizardStore.coupon;
35+
validateCoupon();
36+
}
37+
});
2938
</script>
3039

3140
<WizardStep beforeSubmit={validateCoupon}>
@@ -41,6 +50,6 @@
4150
$addCreditWizardStore.coupon = e.detail.code;
4251
}}
4352
let:data>
44-
<span>{data.code} has been successfully added</span>
53+
<span>{data.code.toUpperCase()} has been successfully added</span>
4554
</CouponInput>
4655
</WizardStep>

0 commit comments

Comments
 (0)