From 8df183b190d307f0f88671ff6eb25d5c30e8ea24 Mon Sep 17 00:00:00 2001 From: Darshan Date: Mon, 17 Mar 2025 14:56:36 +0530 Subject: [PATCH] update: logic. --- .../billing/budgetAlert.svelte | 2 +- .../budgetLimitAlert.svelte | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte b/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte index 3bc8c9f66..e86a3f210 100644 --- a/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte +++ b/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte @@ -94,7 +94,7 @@ } -
+
Billing alerts diff --git a/src/routes/(console)/organization-[organization]/budgetLimitAlert.svelte b/src/routes/(console)/organization-[organization]/budgetLimitAlert.svelte index bffa7e44a..5d51ce528 100644 --- a/src/routes/(console)/organization-[organization]/budgetLimitAlert.svelte +++ b/src/routes/(console)/organization-[organization]/budgetLimitAlert.svelte @@ -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`); + } + } {#if $showBudgetAlert && $organization?.$id && $organization?.billingPlan !== BillingPlan.FREE && $readOnly && !hideBillingHeaderRoutes.includes($page.url.pathname)} @@ -18,10 +30,7 @@ -