From 024c7637a5bae0e2da11b47bf9ff7cd08900d512 Mon Sep 17 00:00:00 2001 From: oliver Date: Tue, 9 Jun 2026 14:53:29 -0300 Subject: [PATCH] c --- app.js | 72 +++++++++------------------------------------------------- 1 file changed, 11 insertions(+), 61 deletions(-) diff --git a/app.js b/app.js index b84c696..338f55a 100644 --- a/app.js +++ b/app.js @@ -494,10 +494,8 @@ function populateDemoShell() { document.getElementById("contract-body").innerHTML = `
- Auto - Monthly - No expiration + Junior \u2013 Monthly
- Cancel
`; // Backups @@ -1436,72 +1434,24 @@ function renderContract(data) { return; } - const item = data[0]; - const type = (item.type || "").trim(); - const expires = item.expires || ""; - - // Determine status - const t = type.toLowerCase(); - let expired = false; - if (expires && expires.trim()) { - try { - expired = new Date(expires) < new Date(); - } catch (_) {} - } - - let statusClass; - if (!type || expired || t.includes("none")) { - statusClass = "contract-dot--red"; - } else if (t.includes("auto")) { - statusClass = "contract-dot--green"; - } else { - statusClass = "contract-dot--yellow"; - } - - // Update the header dot - headerDot.className = `contract-dot ${statusClass}`; + headerDot.className = "contract-dot contract-dot--green"; headerDot.style.visibility = "visible"; - // Empty type — show placeholder row with extend button on the right - if (!type) { - body.innerHTML = ` -
-
- No contract - Stripe payments can take up to 24hrs to be recognized. -
- Extend Contract -
`; - return; - } + const item = data[0]; + const product = stripQuotes(item.product || ""); + const period = stripQuotes(item.period || ""); + const type = stripQuotes(item.type || ""); - const expLabel = - expires && expires.trim() - ? new Date(expires).toLocaleDateString("en-US", { - month: "short", - day: "numeric", - year: "numeric", - }) - : "No expiration"; - - const extendHtml = - statusClass === "contract-dot--red" - ? `Extend Contract` - : ""; - - const cancelHtml = - statusClass === "contract-dot--green" - ? `Cancel` - : ""; + const label = + product && period + ? `${product} \u2013 ${period}` + : product || period || type || "—"; body.innerHTML = `
- ${escHtml(type)} - ${escHtml(expLabel)} - ${extendHtml} + ${escHtml(label)}
- ${cancelHtml}
`; }