From 9896068ca651cf2f401060e316004059bbe5ce08 Mon Sep 17 00:00:00 2001 From: Darshan Date: Thu, 2 Jan 2025 13:36:25 +0530 Subject: [PATCH] address comments. --- .../billing/budgetAlert.svelte | 7 +- .../billing/planSummary.svelte | 322 ++++++++++-------- 2 files changed, 177 insertions(+), 152 deletions(-) diff --git a/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte b/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte index 02632fad9..cd3e6a4cb 100644 --- a/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte +++ b/src/routes/(console)/organization-[organization]/billing/budgetAlert.svelte @@ -40,7 +40,7 @@ if (alerts.some((alert) => alert === selectedAlert)) { return; } - if (alerts.length <= 2) { + if (alerts.length <= 3) { alerts = [...alerts, selectedAlert ? selectedAlert : parseInt(search)]; search = ''; selectedAlert = null; @@ -60,7 +60,7 @@ addNotification({ type: 'success', isHtml: true, - message: `A budget alert has been added to ${$organization.name}` + message: ` ${alerts.length === 0 ? 'Budget alerts removed from' : alerts.length > 1 ? `Budget alerts added to` : 'A budget alert has been added to'} ${$organization.name} ` }); trackEvent(Submit.BudgetAlertsUpdate, { alerts @@ -112,12 +112,13 @@ id="alerts" {options} bind:search + interactiveOutput bind:value={selectedAlert} on:select={() => (search = selectedAlert.toString())} />
diff --git a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte index 668a110d5..f5c219bd3 100644 --- a/src/routes/(console)/organization-[organization]/billing/planSummary.svelte +++ b/src/routes/(console)/organization-[organization]/billing/planSummary.svelte @@ -45,153 +45,168 @@

-
- - {tierToPlan($organization?.billingPlan)?.name} plan -
- {isTrial || $organization?.billingPlan === BillingPlan.GITHUB_EDUCATION - ? formatCurrency(0) - : currentPlan - ? formatCurrency(currentPlan?.price) - : ''} -
-
- {#if $organization?.billingPlan !== BillingPlan.FREE && $organization?.billingPlan !== BillingPlan.GITHUB_EDUCATION && extraUsage > 0} - - - Add-ons{extraMembers ? extraAddons + 1 : extraAddons} -
- -
-
- -
- - {formatCurrency(extraUsage >= 0 ? extraUsage : 0)} - -
-
- -
    - {#if extraMembers} -
  • -
    -
    - Additional members -
    -
    - {formatCurrency( - extraMembers * - (currentPlan?.addons?.member?.price ?? 0) - )} -
    -
    -
    -
    - {extraMembers} -
    -
    -
  • - {/if} - {#if currentInvoice?.usage} - {#each currentInvoice.usage as excess, i} -
  • 0 || extraMembers}> - {#if ['storage', 'bandwidth'].includes(excess.name)} - {@const excessValue = humanFileSize(excess.value)} -
    -
    - {excess.name} -
    - {formatCurrency(excess.amount)} -
    -
    - {excessValue.value ?? 0}{excessValue.unit} -
    - {/if} - {#if ['users', 'executions'].includes(excess.name)} -
    -
    - {excess.name} -
    - {formatCurrency(excess.amount)} -
    -
    - {abbreviateNumber(excess.value)} -
    - {/if} -
  • - {/each} - {/if} -
-
- {/if} - - {#if $organization?.billingPlan !== BillingPlan.FREE && availableCredit > 0} - - - - - Credits to be applied - -
- -{formatCurrency( - Math.min(availableCredit, currentInvoice?.amount ?? 0) - )} -
-
- {/if} - - {#if $organization?.billingPlan !== BillingPlan.FREE && $organization?.billingPlan !== BillingPlan.GITHUB_EDUCATION} - - Current total (USD) - - - +
+
+ + {tierToPlan($organization?.billingPlan)?.name} plan
- {formatCurrency( - Math.max( - (currentInvoice?.amount ?? 0) - - Math.min(availableCredit, currentInvoice?.amount ?? 0), - 0 - ) - )} + {isTrial || + $organization?.billingPlan === BillingPlan.GITHUB_EDUCATION + ? formatCurrency(0) + : currentPlan + ? formatCurrency(currentPlan?.price) + : ''}
- - {/if} +
+ + {#if $organization?.billingPlan !== BillingPlan.FREE && $organization?.billingPlan !== BillingPlan.GITHUB_EDUCATION && extraUsage > 0} + + + Add-ons{extraMembers ? extraAddons + 1 : extraAddons} +
+ +
+
+ +
+ + {formatCurrency(extraUsage >= 0 ? extraUsage : 0)} + +
+
+ +
    + {#if extraMembers} +
  • +
    +
    + Additional members +
    +
    + {formatCurrency( + extraMembers * + (currentPlan?.addons?.member?.price ?? + 0) + )} +
    +
    +
    +
    + {extraMembers} +
    +
    +
  • + {/if} + {#if currentInvoice?.usage} + {#each currentInvoice.usage as excess, i} +
  • 0 || extraMembers}> + {#if ['storage', 'bandwidth'].includes(excess.name)} + {@const excessValue = humanFileSize( + excess.value + )} +
    +
    + {excess.name} +
    + {formatCurrency(excess.amount)} +
    +
    + {excessValue.value ?? 0}{excessValue.unit} +
    + {/if} + {#if ['users', 'executions'].includes(excess.name)} +
    +
    + {excess.name} +
    + {formatCurrency(excess.amount)} +
    +
    + {abbreviateNumber(excess.value)} +
    + {/if} +
  • + {/each} + {/if} +
+
+ {/if} + + {#if $organization?.billingPlan !== BillingPlan.FREE && availableCredit > 0} + + + + + Credits to be applied + +
+ -{formatCurrency( + Math.min(availableCredit, currentInvoice?.amount ?? 0) + )} +
+
+ {/if} + + {#if $organization?.billingPlan !== BillingPlan.FREE && $organization?.billingPlan !== BillingPlan.GITHUB_EDUCATION} + + Current total (USD) + + + +
+ {formatCurrency( + Math.max( + (currentInvoice?.amount ?? 0) - + Math.min( + availableCredit, + currentInvoice?.amount ?? 0 + ), + 0 + ) + )} +
+
+ {/if} +
@@ -239,24 +254,33 @@ {/if}