affiliate area

This commit is contained in:
oliver
2026-06-22 17:41:45 -03:00
parent 365c69871e
commit 70549554ad
3 changed files with 219 additions and 126 deletions
+13
View File
@@ -1104,6 +1104,19 @@ function copyAffiliateCode() {
.then(() => toast("Affiliate link copied!", "success")); .then(() => toast("Affiliate link copied!", "success"));
} }
function switchAccountTab(tab) {
// update tab buttons
document
.querySelectorAll(".acct-settings-tab")
.forEach((btn) => btn.classList.remove("active"));
document.getElementById(`acct-tab-${tab}`).classList.add("active");
// show/hide panels
document
.querySelectorAll(".acct-tab-content")
.forEach((p) => (p.style.display = "none"));
document.getElementById(`acct-tabpanel-${tab}`).style.display = "";
}
function closeUserPanel() { function closeUserPanel() {
document.getElementById("account-backdrop").classList.remove("open"); document.getElementById("account-backdrop").classList.remove("open");
const inp = document.getElementById("acct-pw-input"); const inp = document.getElementById("acct-pw-input");
+172 -126
View File
@@ -824,136 +824,182 @@
<div class="account-modal-body"> <div class="account-modal-body">
<!-- ── Left: settings ───────────────────────── --> <!-- ── Left: settings ───────────────────────── -->
<div class="account-col account-col--settings"> <div class="account-col account-col--settings">
<div class="acct-section"> <div class="acct-settings-tabs">
<div class="acct-field-label">Email</div> <button
<div class="acct-field-val" id="acct-email-display"> type="button"
class="acct-settings-tab active"
</div> id="acct-tab-content"
</div> onclick="switchAccountTab('content')"
<div class="acct-divider"></div>
<div class="acct-section">
<div class="form-group">
<label>Change Password</label>
<div class="pw-input-wrap">
<input
type="password"
id="acct-pw-input"
placeholder="New password"
autocomplete="new-password"
oninput="
toggleAccountPwSave(this.value)
"
onkeydown="
if (event.key === 'Enter')
saveAccountPassword();
"
/>
<button
type="button"
id="acct-pw-save-btn"
class="pw-save-btn"
onclick="saveAccountPassword()"
title="Save password"
style="display: none"
>
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2.5"
stroke-linecap="round"
stroke-linejoin="round"
>
<polyline points="20 6 9 17 4 12" />
</svg>
</button>
</div>
<p class="ssh-hint" style="margin-bottom: 0">
Min. 8 characters.
</p>
</div>
</div>
<div class="acct-divider"></div>
<div class="acct-section">
<div class="form-group">
<label>Invoice Email</label>
<div class="pw-input-wrap">
<input
type="email"
id="invoice-email-input"
placeholder="invoices@example.com"
autocomplete="email"
oninput="
toggleInvoiceEmailSave(this.value)
"
onkeydown="
if (event.key === 'Enter')
saveInvoiceEmail();
"
/>
<button
type="button"
id="invoice-email-save-btn"
class="pw-save-btn"
onclick="saveInvoiceEmail()"
title="Save invoice email"
style="display: none"
>
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2.5"
stroke-linecap="round"
stroke-linejoin="round"
>
<polyline points="20 6 9 17 4 12" />
</svg>
</button>
</div>
</div>
</div>
<div class="acct-divider"></div>
<div class="acct-section">
<div class="acct-field-label">
Manage Subscriptions
</div>
<div
class="acct-affiliate-row"
style="justify-content: flex-end"
> >
<button Content
type="button" </button>
id="portal-btn" <button
class="btn btn-ghost btn-sm" type="button"
onclick="openBillingPortal()" class="acct-settings-tab"
id="acct-tab-affiliate"
onclick="switchAccountTab('affiliate')"
>
Affiliate Settings
</button>
</div>
<!-- ── Content tab ─────────────────────── -->
<div
id="acct-tabpanel-content"
class="acct-tab-content"
>
<div class="acct-section">
<div class="acct-field-label">Email</div>
<div
class="acct-field-val"
id="acct-email-display"
> >
Portal &rarr;
</button> </div>
</div>
<div class="acct-divider"></div>
<div class="acct-section">
<div class="form-group">
<label>Change Password</label>
<div class="pw-input-wrap">
<input
type="password"
id="acct-pw-input"
placeholder="New password"
autocomplete="new-password"
oninput="
toggleAccountPwSave(this.value)
"
onkeydown="
if (event.key === 'Enter')
saveAccountPassword();
"
/>
<button
type="button"
id="acct-pw-save-btn"
class="pw-save-btn"
onclick="saveAccountPassword()"
title="Save password"
style="display: none"
>
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2.5"
stroke-linecap="round"
stroke-linejoin="round"
>
<polyline
points="20 6 9 17 4 12"
/>
</svg>
</button>
</div>
<p
class="ssh-hint"
style="margin-bottom: 0"
>
Min. 8 characters.
</p>
</div>
</div>
<div class="acct-divider"></div>
<div class="acct-section">
<div class="form-group">
<label>Invoice Email</label>
<div class="pw-input-wrap">
<input
type="email"
id="invoice-email-input"
placeholder="invoices@example.com"
autocomplete="email"
oninput="
toggleInvoiceEmailSave(
this.value,
)
"
onkeydown="
if (event.key === 'Enter')
saveInvoiceEmail();
"
/>
<button
type="button"
id="invoice-email-save-btn"
class="pw-save-btn"
onclick="saveInvoiceEmail()"
title="Save invoice email"
style="display: none"
>
<svg
width="14"
height="14"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2.5"
stroke-linecap="round"
stroke-linejoin="round"
>
<polyline
points="20 6 9 17 4 12"
/>
</svg>
</button>
</div>
</div>
</div>
<div class="acct-divider"></div>
<div class="acct-section">
<div class="acct-field-label">
Manage Subscriptions
</div>
<div
class="acct-affiliate-row"
style="justify-content: flex-end"
>
<button
type="button"
id="portal-btn"
class="btn btn-ghost btn-sm"
onclick="openBillingPortal()"
>
Portal &rarr;
</button>
</div>
</div> </div>
</div> </div>
<div class="acct-divider"></div>
<div class="acct-section"> <!-- ── Affiliate Settings tab ──────────── -->
<div class="acct-field-label">Affiliate Code</div> <div
<div class="acct-affiliate-row"> id="acct-tabpanel-affiliate"
<span class="acct-tab-content"
class="acct-affiliate-code" style="display: none"
id="acct-affiliate-code" >
></span <div class="acct-section">
> <div class="acct-field-label">
<button Affiliate Code
type="button" </div>
id="acct-affiliate-copy-btn" <div class="acct-affiliate-row">
class="btn btn-ghost btn-sm" <span
onclick="copyAffiliateCode()" class="acct-affiliate-code"
style="display: none" id="acct-affiliate-code"
> ></span
Copy Affiliate Link >
</button> <button
type="button"
id="acct-affiliate-copy-btn"
class="btn btn-ghost btn-sm"
onclick="copyAffiliateCode()"
style="display: none"
>
Copy Affiliate Link
</button>
</div>
</div> </div>
</div> </div>
</div> </div>
+34
View File
@@ -1486,6 +1486,40 @@ body::after {
padding: 18px 20px; padding: 18px 20px;
} }
.acct-settings-tabs {
display: flex;
gap: 0;
margin-bottom: 16px;
border-bottom: 1px solid var(--border);
padding-bottom: 8px;
}
.acct-settings-tab {
flex: 1;
background: none;
border: none;
color: var(--text-muted);
font-family: inherit;
font-size: 12px;
padding: 6px 8px;
cursor: pointer;
transition: color 0.15s;
text-align: center;
}
.acct-settings-tab:hover {
color: var(--text);
}
.acct-settings-tab.active {
color: var(--accent);
}
.acct-tab-content {
display: flex;
flex-direction: column;
}
.account-col-divider { .account-col-divider {
width: 1px; width: 1px;
background: var(--border); background: var(--border);