mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
update: logic.
This commit is contained in:
1 parent
9dba43cd8d
commit
8df183b190
2 files changed
+14
-5
No files matched your search
@@ -94,7 +94,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<div bind:this={formHolderElement} style:padding-block-start="1.5rem">
|
||||
<div id="update-budget-section" bind:this={formHolderElement} style:padding-block-start="1.5rem">
|
||||
<Form onSubmit={updateBudget}>
|
||||
<CardGrid>
|
||||
<Heading tag="h2" size="6">Billing alerts</Heading>
|
||||
|
||||
@@ -6,6 +6,18 @@
|
||||
import { HeaderAlert } from '$lib/layout';
|
||||
import { hideBillingHeaderRoutes, readOnly, showBudgetAlert } from '$lib/stores/billing';
|
||||
import { base } from '$app/paths';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
$: isSameUrl = $page.url.pathname === redirectUrl;
|
||||
$: redirectUrl = `${base}/organization-${$organization.$id}/billing`;
|
||||
|
||||
function scrollOrNavigate() {
|
||||
if (isSameUrl) {
|
||||
document.querySelector('#update-budget-section')?.scrollIntoView({ block: 'nearest' });
|
||||
} else {
|
||||
goto(`${redirectUrl}#update-budget`);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if $showBudgetAlert && $organization?.$id && $organization?.billingPlan !== BillingPlan.FREE && $readOnly && !hideBillingHeaderRoutes.includes($page.url.pathname)}
|
||||
@@ -18,10 +30,7 @@
|
||||
<Button href={`${base}/organization-${$organization.$id}/usage`} text fullWidthMobile>
|
||||
<span class="text">View usage</span>
|
||||
</Button>
|
||||
<Button
|
||||
href={`${base}/organization-${$organization.$id}/billing#update-budget`}
|
||||
secondary
|
||||
fullWidthMobile>
|
||||
<Button secondary fullWidthMobile on:click={scrollOrNavigate}>
|
||||
<span class="text">Update limit</span>
|
||||
</Button>
|
||||
</svelte:fragment>
|
||||
|
||||
Reference in new issue
Block a user