| 1 | import { esc, page } from "./shell"; |
| 2 | import { type User, userNav } from "./auth"; |
| 3 | |
| 4 | export function renderAccount(user: User): string { |
| 5 | const pending = user.role === "pending"; |
| 6 | const status = pending |
| 7 | ? `<div class="notice err">Your account is awaiting approval. An admin needs to grant you access before the diagnostic reports dashboard becomes visible.</div>` |
| 8 | : `<div class="notice ok">You have <b>${esc(user.role)}</b> access. <a href="/stats">Open the dashboard →</a></div>`; |
| 9 | return page( |
| 10 | "Reasonix · Account", |
| 11 | "account", |
| 12 | `<h1>Account</h1><p class="sub">${esc(user.email)} · joined ${esc(user.created_at.slice(0, 10))}</p> |
| 13 | ${status} |
| 14 | <div class="card" style="max-width:480px;margin-top:24px"><h2>Identity</h2> |
| 15 | <p class="sub">Your email and password are managed by your Reasonix account.</p> |
| 16 | <a class="btn" href="https://reasonix.io/account/">Manage your account →</a></div>`, |
| 17 | userNav(user), |
| 18 | ); |
| 19 | } |
| 20 |