Skip to content

Commit e800b0b

Browse files
authored
Merge pull request #1721 from appwrite/revert-1675-feat-budget-nullable
Revert "Console Feat: make budget cap nullable"
2 parents 055846a + aaf9885 commit e800b0b

File tree

4 files changed

+7
-14
lines changed

4 files changed

+7
-14
lines changed

src/routes/(console)/create-organization/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
171171
trackEvent(Submit.OrganizationCreate, {
172172
plan: tierToPlan(billingPlan)?.name,
173-
budget_cap_enabled: billingBudget !== null,
173+
budget_cap_enabled: !!billingBudget,
174174
members_invited: collaborators?.length
175175
});
176176

src/routes/(console)/organization-[organization]/billing/+page.svelte

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts">
22
import { Container } from '$lib/layout';
33
import { organization } from '$lib/stores/organization';
4+
import BudgetAlert from './budgetAlert.svelte';
45
import BudgetCap from './budgetCap.svelte';
56
import PlanSummary from './planSummary.svelte';
67
import BillingAddress from './billingAddress.svelte';
@@ -127,6 +128,7 @@
127128
<BillingAddress billingAddress={data?.billingAddress} />
128129
<TaxId />
129130
<BudgetCap />
131+
<BudgetAlert />
130132
<AvailableCredit />
131133
</Container>
132134

src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
import { sdk } from '$lib/stores/sdk';
2121
import { onMount } from 'svelte';
2222
23-
export let alertsEnabled = false;
24-
2523
let search: string;
2624
let selectedAlert: number;
2725
let alerts: number[] = [];
@@ -76,8 +74,7 @@
7674
}
7775
}
7876
79-
$: isButtonDisabled =
80-
symmetricDifference(alerts, $organization.budgetAlerts).length === 0 || !alertsEnabled;
77+
$: isButtonDisabled = symmetricDifference(alerts, $organization.budgetAlerts).length === 0;
8178
</script>
8279

8380
<Form onSubmit={updateBudget}>
@@ -110,7 +107,6 @@
110107

111108
<div class="u-flex u-gap-16">
112109
<InputSelectSearch
113-
disabled={!alertsEnabled}
114110
label="Percentage (%) of budget cap"
115111
placeholder="Select a percentage"
116112
id="alerts"
@@ -122,9 +118,7 @@
122118
<div style="align-self: flex-end">
123119
<Button
124120
secondary
125-
disabled={alerts.length > 3 ||
126-
(!search && !selectedAlert) ||
127-
!alertsEnabled}
121+
disabled={alerts.length > 3 || (!search && !selectedAlert)}
128122
on:click={addAlert}>
129123
Add alert
130124
</Button>

src/routes/(console)/organization-[organization]/billing/budgetCap.svelte

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99
import { organization, currentPlan } from '$lib/stores/organization';
1010
import { sdk } from '$lib/stores/sdk';
1111
import { onMount } from 'svelte';
12-
import BudgetAlert from './budgetAlert.svelte';
1312
1413
let capActive = false;
1514
let budget: number;
1615
1716
onMount(() => {
1817
budget = $organization?.billingBudget;
19-
capActive = $organization?.billingBudget !== null;
18+
capActive = !!$organization?.billingBudget;
2019
});
2120
2221
async function updateBudget() {
@@ -45,7 +44,7 @@
4544
}
4645
4746
$: if (!capActive) {
48-
budget = null;
47+
budget = 0;
4948
}
5049
</script>
5150

@@ -114,5 +113,3 @@
114113
</svelte:fragment>
115114
</CardGrid>
116115
</Form>
117-
118-
<BudgetAlert alertsEnabled={capActive && budget > 0} />

0 commit comments

Comments
 (0)