From 6dbba8e326458cfe3f6a05c534e2498500571ebf Mon Sep 17 00:00:00 2001
From: Frank
Date: Mon, 15 Sep 2025 15:21:04 -0400
Subject: [PATCH] wip: zen
---
cloud/app/src/routes/workspace/[id].tsx | 175 ++++++++++++++----------
1 file changed, 104 insertions(+), 71 deletions(-)
diff --git a/cloud/app/src/routes/workspace/[id].tsx b/cloud/app/src/routes/workspace/[id].tsx
index f2b7bf76..5844f1af 100644
--- a/cloud/app/src/routes/workspace/[id].tsx
+++ b/cloud/app/src/routes/workspace/[id].tsx
@@ -283,8 +283,6 @@ function BalanceSection() {
const balanceInfo = createAsync(() => getBillingInfo(params.id))
const createCheckoutUrlAction = useAction(createCheckoutUrl)
const createCheckoutUrlSubmission = useSubmission(createCheckoutUrl)
- const createSessionUrlAction = useAction(createSessionUrl)
- const createSessionUrlSubmission = useSubmission(createSessionUrl)
const disableReloadSubmission = useSubmission(disableReload)
const reloadSubmission = useSubmission(reload)
@@ -337,13 +335,13 @@ function BalanceSection() {
You will be automatically reloading $20 (+$1.23 processing fee) when your balance reaches{" "}
$5.
+ You will be able to continue using the API with the remaining credits after disabling billing.
- You will be able to continue using the API with the remaining credits after disabling billing.
<>
@@ -367,57 +365,52 @@ function BalanceSection() {
>
-
-
-
- ••••
- {balanceInfo()?.paymentMethodLast4}
-
-
-
- No spending limit set.}>
-
- Spending limit is ${balanceInfo()?.monthlyLimit ?? 0}. Current usage for the month of{" "}
- {new Date().toLocaleDateString("en-US", { month: "long", timeZone: "UTC" })} is $
- {(() => {
- const dateLastUsed = balanceInfo()?.timeMonthlyUsageUpdated
- if (!dateLastUsed) return "0"
-
- const current = new Date().toLocaleDateString("en-US", {
- year: "numeric",
- month: "long",
- timeZone: "UTC",
- })
- const lastUsed = dateLastUsed.toLocaleDateString("en-US", {
- year: "numeric",
- month: "long",
- timeZone: "UTC",
- })
- if (current !== lastUsed) return "0"
- return ((balanceInfo()?.monthlyUsage ?? 0) / 100000000).toFixed(2)
- })()}
-
-
-
>
+
+
+
+
)
}
+function BalancePaymentForm() {
+ const params = useParams()
+ const createSessionUrlAction = useAction(createSessionUrl)
+ const createSessionUrlSubmission = useSubmission(createSessionUrl)
+ const balanceInfo = createAsync(() => getBillingInfo(params.id))
+
+ return (
+ <>
+
+
Payment Method
+
+
+
+
+ ••••
+ {balanceInfo()?.paymentMethodLast4}
+
+
+
+ >
+ )
+}
+
function BalanceLimitForm() {
const params = useParams()
const submission = useSubmission(setMonthlyLimit)
@@ -451,32 +444,72 @@ function BalanceLimitForm() {
}
return (
- show()}>
- {balanceInfo()?.monthlyLimit ? "Edit Spending Limit" : "Set Spending Limit"}
-
- }
- >
-