diff --git a/CLAUDE.md b/CLAUDE.md index 1e4675b..a5f19df 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -111,7 +111,7 @@ v41 Iris turns the current design, the Interactive Tour, or the Before / After c ### Glint Pro groundwork: waitlist, analytics, accounts and AI credits Not a versioned release; groundwork for a paid plan (Glint Pro: hosted AI, lasting share links, sync). The studio itself stays free, and site copy must keep saying so. Glint Pro itself will be a later numbered release (v42 Junction shipped separately). -- **Accounts and hosted AI credits (Clerk + Neon; Supabase is gone).** Supabase was removed entirely, and cloud project and template sync, the community gallery (`gallery.js`) and live collaboration (`collab.js`) went with it; projects now live only in the browser. Sign-in is Clerk: `src/features/auth.js` loads Clerk's two browser bundles from the Clerk instance's own Frontend API (host decoded from the publishable key), so there is no Clerk package in the build; without a key no sign-in UI shows and nothing loads. It exports `getToken()`, `getUser()`, `onAuthChange()`, `openSignIn()`, `isConfigured()`; the header pill is a Sign in button or Clerk's own user button. The key is read at build time from `VITE_CLERK_PUBLISHABLE_KEY` or `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` (the name Clerk's Vercel Marketplace install adds; `vite.config.js` `envPrefix` lets it through). Server side, `api/_account.js` verifies the Clerk session token with `@clerk/backend` `verifyToken` (`CLERK_SECRET_KEY`, or `CLERK_JWT_KEY` for a networkless check) and keeps plans and credit counts in Neon Postgres through `@neondatabase/serverless` (`DATABASE_URL` or `POSTGRES_URL`). The schema is `api/_account-schema.js` (`subscriptions`, `ai_usage`, and the atomic `glint_use_credits(user, cost, free_limit, pro_limit)` function, keyed by Clerk's text user id); **the server installs it itself** the first time a query fails with a missing function or table, so there is no SQL to run by hand. `metered(kind, handler)` wraps the six hosted AI routes, spends credits before the model call (`CREDIT_COSTS`: 1 for text / vision / enhance / agent, 5 for an image) and refunds them when the route answers with an error. It answers `401 { code: 'sign_in' }` or `402 { code: 'no_credits' }`; a Clerk or database failure answers 503 (closed, not free). **Metering is on only when the deployment has a Clerk key and a database URL**; without them the routes behave as before. Limits default to 20 free and 500 Pro credits a month (`AI_FREE_CREDITS`, `AI_PRO_CREDITS`). `api/account.js` is one function for every account route (`?op=me` today; checkout, portal and the payment webhook go here, not in new files). In the editor, `src/features/account.js` `hostedFetch(path, body)` is the only way to call a hosted AI route: it adds the token, turns a sign-in or out-of-credits answer into a 501 (which every caller already treats as "use the person's own key") and shows why in a toast unless the person has their own key; the `#ai-credits` header chip shows credits left. **A new hosted AI route must be wrapped in `metered()` and called through `hostedFetch()`.** Tests use `ACCOUNT_STORE=memory` and sign throwaway Clerk-shaped tokens. Still to build: checkout + webhook (a merchant of record such as Lemon Squeezy), an account panel, share link perks, real prices. +- **Accounts and hosted AI credits (Clerk + Neon; Supabase is gone).** Supabase was removed entirely, and cloud project and template sync, the community gallery (`gallery.js`) and live collaboration (`collab.js`) went with it; projects now live only in the browser. Sign-in is Clerk: `src/features/auth.js` loads Clerk's two browser bundles from the Clerk instance's own Frontend API (host decoded from the publishable key), so there is no Clerk package in the build; without a key no sign-in UI shows and nothing loads. It exports `getToken()`, `getUser()`, `onAuthChange()`, `openSignIn()`, `isConfigured()`; the header pill is a Sign in button or Clerk's own user button. The key is read at build time from `VITE_CLERK_PUBLISHABLE_KEY` or `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` (the name Clerk's Vercel Marketplace install adds; `vite.config.js` `envPrefix` lets it through). Server side, `api/_account.js` verifies the Clerk session token with `@clerk/backend` `verifyToken` (`CLERK_SECRET_KEY`, or `CLERK_JWT_KEY` for a networkless check) and keeps plans and credit counts in Neon Postgres through `@neondatabase/serverless` (`DATABASE_URL` or `POSTGRES_URL`). The schema is `api/_account-schema.js` (`subscriptions`, `ai_usage`, and the atomic `glint_use_credits(user, cost, free_limit, pro_limit)` function, keyed by Clerk's text user id); **the server installs it itself** the first time a query fails with a missing function or table, so there is no SQL to run by hand. `metered(kind, handler)` wraps the six hosted AI routes, spends credits before the model call (`CREDIT_COSTS`: 1 for text / vision / enhance / agent, 5 for an image) and refunds them when the route answers with an error. It answers `401 { code: 'sign_in' }` or `402 { code: 'no_credits' }`; a Clerk or database failure answers 503 (closed, not free). **Metering is on only when the deployment has a Clerk key and a database URL**; without them the routes behave as before. Limits default to 20 free and 500 Pro credits a month (`AI_FREE_CREDITS`, `AI_PRO_CREDITS`). `api/account.js` is one function for every account route (`?op=me` today; checkout, portal and the payment webhook go here, not in new files). In the editor, `src/features/account.js` `hostedFetch(path, body)` is the only way to call a hosted AI route: it adds the token, turns a sign-in or out-of-credits answer into a 501 (which every caller already treats as "use the person's own key") and shows why in a toast unless the person has their own key; the `#ai-credits` header chip shows credits left and opens the account panel (`src/features/account-panel.js`, `openAccountPanel()`, Cmd-K `account-open`: a native `` with the plan, credits left, what each request costs, the Pro waitlist link, Manage account and Sign out; it reads `account.js` `getAccount()` and redraws on `onAccountChange`; checkout and billing buttons go in its Pro box). **A new hosted AI route must be wrapped in `metered()` and called through `hostedFetch()`.** Tests use `ACCOUNT_STORE=memory` and sign throwaway Clerk-shaped tokens. Still to build: checkout + webhook (a merchant of record such as Lemon Squeezy), share link perks, real prices. - **Waitlist.** The pricing page's Pro card (`pricing/index.html`, `#pro`) has a `form[data-waitlist]` that `public/site.js` (0a) posts to `/api/waitlist`. `api/_waitlist.js` holds both routes as ops of the one share function (`vercel.json` rewrites `/api/waitlist` and `/api/waitlist-export` to `api/share.js`). The Blob store is public, so entries are stored unreadable: the file name is an HMAC of the email (which also de-duplicates) and the body is AES-256-GCM encrypted, both keyed from `SHARE_SIGNING_SECRET`. Changing that secret orphans the list. The join route answers the same whether or not the email was already there. Read the list with `curl -H "Authorization: Bearer $CRON_SECRET" https:///api/waitlist-export?format=csv`. - **Analytics.** Vercel Web Analytics, no cookies. Marketing pages load it from `public/site.js` (0) (skipped on localhost) and send `open_studio` and `waitlist_join`. The editor uses `src/features/analytics.js` (`bindAnalytics()`, `track(name, data)`): `section_used` once per sidebar section per visit (a capture listener, so new sections are covered for free), `export`, `share_link`, `roll_develop`, `ai_blocked` (sign-in needed or out of credits). **Events carry feature names and choices only, never images, file names, colors or typed text;** if you add an event, list it on the privacy page. diff --git a/api/_account.js b/api/_account.js index 953b9e5..872bc72 100644 --- a/api/_account.js +++ b/api/_account.js @@ -199,7 +199,7 @@ export async function me(req, res) { if (req.method !== 'GET') throw new ApiError(405, 'Method not allowed'); const cfg = accountConfig(); if (!cfg.enabled) { res.status(200).json({ enabled: false }); return; } - const base = { enabled: true, hosted: Boolean(serverOpenAIKey()), costs: CREDIT_COSTS, freeCredits: cfg.freeCredits }; + const base = { enabled: true, hosted: Boolean(serverOpenAIKey()), costs: CREDIT_COSTS, freeCredits: cfg.freeCredits, proCredits: cfg.proCredits }; const user = await userFromToken(cfg, readBearer(req)); if (!user) { res.status(200).json({ ...base, signedIn: false }); return; } const usage = await useCredits(cfg, user.id, 0); diff --git a/docs/GLINT-PRO-STATUS.md b/docs/GLINT-PRO-STATUS.md new file mode 100644 index 0000000..187e5ba --- /dev/null +++ b/docs/GLINT-PRO-STATUS.md @@ -0,0 +1,52 @@ +# Glint Pro: where things stand + +A running note so the work can be picked up in any session. Architecture is in +`CLAUDE.md` ("Glint Pro groundwork") and `docs/BACKEND.md`; this file is only +the status and the next steps. + +## Done and live on main + +- Pricing page has a "Glint Pro, coming soon" card with an email waitlist + (PR #32). Read the list with the `CRON_SECRET` bearer on + `/api/waitlist-export?format=csv`. +- Usage analytics on the site and in the editor (PR #32). +- Accounts and hosted AI credits, on Clerk (sign-in) and Neon (database). + Supabase, cloud sync, the community gallery and live collaboration are + removed (PR #34). +- Deployment settings: `CRON_SECRET` is set. Neon is connected as the store + "glint-db", which added `DATABASE_URL` for Production and Preview. Clerk is + connected too (see below). + +## Sign-in and metering: on and checked on the live site + +- Clerk is connected as "glint-signin" with a production instance on the + site's domain (`clerk.` and `accounts.` subdomains plus three mail records, + added to the domain's DNS). `CLERK_SECRET_KEY` and + `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` are set for Production and Preview. +- Checked against the real Clerk and Neon: the editor shows Sign in, a new + account gets 20 credits (the schema installed itself), a Design Agent step + takes the chip to 19, and a signed-out hosted AI call answers `sign_in`. +- A browser with its own API key saved never spends credits (by design), so + test metering in a private window. +- Clerk's deployment check on Vercel is required: a production deploy waits + until Clerk's DNS and certificates are ready. +- Small leftover: the sign-in box says "glint-signin"; rename the application + to Glint in Clerk's settings. + +## Next + +- Checkout and webhook with a merchant of record (Lemon Squeezy was the pick), + as new ops in `api/account.js`. +- Vercel Pro plan before charging anyone (Hobby is non-commercial). +- The account panel is built (click the credits chip, or Cmd-K "Account"): + plan, credits left, costs, waitlist link, manage account, sign out. Add the + Upgrade and Manage billing buttons to it when checkout exists. +- Share link perks for Pro, then real prices on the pricing page. +- Watch whether 20 free credits is enough: the Design Agent spends one per + step. Tune with `AI_FREE_CREDITS`. + +## Decisions made + +- The studio stays free; Pro covers the parts that cost money to run. +- Starting numbers: about $8 a month, 20 free and 500 Pro credits. +- Glint Pro will be its own numbered release (v42 Junction shipped separately). diff --git a/editor/index.html b/editor/index.html index 82b95b7..2457736 100644 --- a/editor/index.html +++ b/editor/index.html @@ -29,7 +29,7 @@ Glint v42 ยท Junction
- +
diff --git a/scripts/regression-tests.mjs b/scripts/regression-tests.mjs index 7068c16..b7440ae 100644 --- a/scripts/regression-tests.mjs +++ b/scripts/regression-tests.mjs @@ -1388,6 +1388,7 @@ async function testHostedAiIsMetered() { const me = await callRoute(accountRouter, shareReq('GET', null, { query: { op: 'me' }, headers: { authorization: `Bearer ${good}` } })); assert.equal(me.body.signedIn, true); + assert.equal(me.body.proCredits, 40, 'the account route tells the panel what Pro gives'); assert.deepEqual([me.body.plan, me.body.used, me.body.limit], ['free', 3, 3]); assert.equal((await callRoute(accountRouter, shareReq('GET', null, { query: { op: 'me' } }))).body.signedIn, false); assert.equal((await callRoute(accountRouter, shareReq('GET', null, { query: { op: 'constructor' } }))).statusCode, 404); diff --git a/src/features/account-panel.js b/src/features/account-panel.js new file mode 100644 index 0000000..918d25b --- /dev/null +++ b/src/features/account-panel.js @@ -0,0 +1,161 @@ +// Glint Pro groundwork: the account panel. One place for the plan, the hosted +// AI credits left this month and what Pro will add. It opens from the credits +// chip in the header and from Cmd-K. Checkout and "manage billing" buttons go +// here once they exist. Everything is built with textContent; nothing from the +// server or from Clerk is rendered as HTML. +import { getUser, isConfigured, openSignIn, openUserProfile, signOut, onAuthChange } from './auth.js'; +import { getAccount, onAccountChange, refreshAccount, hasOwnKey, resetDay } from './account.js'; + +let dlg = null; +let body = null; + +function node(tag, className, text) { + const n = document.createElement(tag); + if (className) n.className = className; + if (text != null) n.textContent = text; + return n; +} + +function button(label, className, run) { + const b = node('button', `btn ${className}`, label); + b.type = 'button'; + b.addEventListener('click', run); + return b; +} + +function build() { + dlg = node('dialog', 'glint-dialog account-panel'); + dlg.setAttribute('aria-labelledby', 'account-panel-title'); + const head = node('div', 'account-head'); + const title = node('h3', '', 'Your account'); + title.id = 'account-panel-title'; + const close = node('button', 'account-close', 'โœ•'); + close.type = 'button'; + close.title = 'Close'; + close.addEventListener('click', () => dlg.close()); + head.append(title, close); + body = node('div', 'account-body'); + dlg.append(head, body); + document.body.appendChild(dlg); + // Keys stay inside, so the editor's shortcuts never act behind the panel. + dlg.addEventListener('keydown', (e) => e.stopPropagation()); + dlg.addEventListener('click', (e) => { if (e.target === dlg) dlg.close(); }); +} + +function costLine(costs) { + const one = costs.text || 1; + const image = costs.image || 5; + const credits = (n) => `${n} credit${n === 1 ? '' : 's'}`; + return `A text or vision request, an enhance or one Design Agent step uses ${credits(one)}. An AI image uses ${credits(image)}.`; +} + +function creditsBox(usage, offer) { + const box = node('div', 'account-box'); + const left = Math.max(0, usage.limit - usage.used); + const count = node('div', 'account-count'); + count.append(node('strong', '', String(left)), node('span', '', `of ${usage.limit} hosted AI credits left this month`)); + const bar = node('div', 'account-bar'); + bar.setAttribute('role', 'img'); + bar.setAttribute('aria-label', `${left} of ${usage.limit} credits left`); + const fill = node('i'); + fill.style.width = `${usage.limit > 0 ? Math.round((left / usage.limit) * 100) : 0}%`; + bar.append(fill); + box.append(count, bar); + const day = usage.resets ? resetDay(usage.resets) : ''; + if (day) box.append(node('p', 'account-note', `They start over on ${day}.`)); + box.append(node('p', 'account-note', costLine((offer && offer.costs) || {}))); + if (hasOwnKey()) { + box.append(node('p', 'account-note', 'This browser has your own API key saved, so AI features use that key and spend no credits.')); + } else if (left === 0) { + box.append(node('p', 'account-note', 'Out of credits? Your own API key (AI settings) works without any.')); + } + return box; +} + +function proBox(usage, offer) { + const box = node('div', 'account-box'); + if (usage && usage.plan === 'pro') { + box.append(node('h4', '', 'You are on Glint Pro'), node('p', 'account-note', 'Thank you for backing Glint. Billing controls will show up here.')); + return box; + } + const pro = offer && offer.proCredits; + box.append( + node('h4', '', 'Glint Pro is coming'), + node('p', 'account-note', `${pro ? `${pro} hosted AI credits a month` : 'More hosted AI credits'} and share links that last. The studio itself stays free.`), + ); + const link = node('a', 'btn btn-primary', 'Join the waitlist'); + link.href = '/pricing/#pro'; + link.target = '_blank'; + link.rel = 'noopener'; + box.append(link); + return box; +} + +function render() { + if (!dlg || !dlg.open) return; + const user = getUser(); + const { usage, offer, loadFailed } = getAccount(); + const parts = []; + + if (!isConfigured()) { + parts.push(node('p', 'account-note', 'Accounts are not set up on this copy of Glint. Everything in the studio works without one, and AI features use your own API key.')); + } else if (!user) { + const free = offer && offer.freeCredits; + const box = node('div', 'account-box'); + box.append( + node('h4', '', 'Sign in for free AI credits'), + node('p', 'account-note', `A free account gives you ${free || 'a set of'} hosted AI credits every month. The studio needs no account, and neither does your own API key.`), + button('Sign in', 'btn-primary', () => { dlg.close(); openSignIn(); }), + ); + parts.push(box, proBox(null, offer)); + } else { + const who = node('div', 'account-who'); + const text = node('div', 'account-who-text'); + text.append(node('div', 'account-name', user.name)); + if (user.email && user.email !== user.name) text.append(node('div', 'account-email', user.email)); + const isPro = Boolean(usage && usage.plan === 'pro'); + who.append(text, node('span', `account-plan${isPro ? ' is-pro' : ''}`, isPro ? 'Glint Pro' : 'Free')); + parts.push(who); + + if (usage) { + parts.push(creditsBox(usage, offer)); + } else { + const box = node('div', 'account-box'); + if (loadFailed) { + box.append(node('p', 'account-note', 'Your credits could not be loaded. Check your connection and try again.'), button('Try again', 'btn-secondary', () => refreshAccount())); + } else if (offer && !offer.hosted) { + box.append(node('p', 'account-note', 'Hosted AI is off on this copy of Glint, so there are no credits to count. AI features use your own API key.')); + } else { + box.append(node('p', 'account-note', 'Loading your credits...')); + } + parts.push(box); + } + parts.push(proBox(usage, offer)); + + const actions = node('div', 'account-actions'); + actions.append( + button('Manage account', 'btn-secondary', () => { dlg.close(); openUserProfile(); }), + button('Sign out', 'btn-secondary', async () => { dlg.close(); await signOut(); }), + ); + parts.push(actions); + } + // Keep focus where it was when a refresh redraws the panel under the reader. + const hadFocus = body.contains(document.activeElement); + body.replaceChildren(...parts); + if (hadFocus) dlg.querySelector('.account-close').focus(); +} + +export function openAccountPanel() { + if (!dlg) build(); + if (!dlg.open) dlg.showModal(); + render(); + // The chip can be a little behind (another tab, another device). + if (isConfigured()) refreshAccount(); +} + +export function bindAccountPanel() { + const chip = document.getElementById('ai-credits'); + if (chip) chip.addEventListener('click', openAccountPanel); + onAccountChange(render); + onAuthChange(render); +} diff --git a/src/features/account.js b/src/features/account.js index c8ed05d..07ae93e 100644 --- a/src/features/account.js +++ b/src/features/account.js @@ -9,13 +9,22 @@ import { showNotification } from '../ui/notification.js'; import { track } from './analytics.js'; let usage = null; // { used, limit, plan, resets } once known +let offer = null; // { costs, freeCredits, proCredits, hosted } from the account route +let loadFailed = false; // the last look at the account did not get an answer +const watchers = []; let lastBlock = null; // { message, at } for the Design Agent's reply const token = () => getToken(); -const hasOwnKey = () => Boolean(getKey('openai') || getKey('anthropic')); +export const hasOwnKey = () => Boolean(getKey('openai') || getKey('anthropic')); -function resetDay(iso) { +// What the account panel shows. `usage` is null while signed out or unknown. +export function getAccount() { + return { usage, offer, loadFailed }; +} +export function onAccountChange(fn) { watchers.push(fn); } + +export function resetDay(iso) { const d = new Date(iso); if (Number.isNaN(d.getTime())) return ''; return d.toLocaleDateString(undefined, { day: 'numeric', month: 'long', timeZone: 'UTC' }); @@ -29,12 +38,13 @@ function renderChip() { chip.style.display = ''; chip.textContent = `${left} AI credit${left === 1 ? '' : 's'}`; const day = usage.resets ? resetDay(usage.resets) : ''; - chip.title = `${left} of ${usage.limit} hosted AI credits left this month${usage.plan === 'pro' ? ' (Glint Pro)' : ''}.${day ? ` They start over on ${day}.` : ''} Your own API key does not use credits.`; + chip.title = `${left} of ${usage.limit} hosted AI credits left this month${usage.plan === 'pro' ? ' (Glint Pro)' : ''}.${day ? ` They start over on ${day}.` : ''} Click for your account.`; } function setUsage(next) { usage = next; renderChip(); + watchers.forEach((fn) => { try { fn(); } catch (e) { console.error(e); } }); } let refreshing = null; @@ -45,14 +55,16 @@ export function refreshAccount() { async function loadAccount() { const t = await token(); - if (!t) { setUsage(null); return; } try { - const r = await fetch('/api/account?op=me', { headers: { Authorization: `Bearer ${t}` }, cache: 'no-store' }); + const r = await fetch('/api/account?op=me', { headers: t ? { Authorization: `Bearer ${t}` } : {}, cache: 'no-store' }); const type = r.headers.get('content-type') || ''; const data = r.ok && type.includes('json') ? await r.json() : null; + loadFailed = !data; + offer = data && data.enabled ? { costs: data.costs || {}, freeCredits: data.freeCredits, proCredits: data.proCredits, hosted: Boolean(data.hosted) } : null; if (data && data.enabled && data.hosted && data.signedIn) setUsage({ used: data.used, limit: data.limit, plan: data.plan, resets: data.resets }); else setUsage(null); } catch (e) { + loadFailed = true; setUsage(null); } } diff --git a/src/features/auth.js b/src/features/auth.js index a16bc56..35d9467 100644 --- a/src/features/auth.js +++ b/src/features/auth.js @@ -108,6 +108,17 @@ export async function openSignIn() { c.openSignIn(); } +// Clerk's own "manage account" window (email, password, delete account). +export async function openUserProfile() { + const c = await ready(); + if (c && c.user) c.openUserProfile(); +} + +export async function signOut() { + const c = await ready(); + if (c && c.user) await c.signOut(); +} + function renderAuthPill() { const pill = document.getElementById('auth-pill'); if (!pill) return; diff --git a/src/features/palette.js b/src/features/palette.js index 482c950..d6b2fab 100644 --- a/src/features/palette.js +++ b/src/features/palette.js @@ -253,6 +253,7 @@ export function registerCommands() { // v42 โ€” the Roll and Pins as gallery links { id: 'share-link-roll', label: 'Share: Create a link to the Roll', icon: '๐Ÿ”—', run: () => import('./share-links.js').then((m) => m.startShare('roll')), when: () => state.mode === 'single' && !!window.__rollCommands?.hasShots() }, { id: 'share-link-pins', label: "Share: Create a link to this page's pins", icon: '๐Ÿ”—', run: () => import('./share-links.js').then((m) => m.startShare('pins')), when: () => state.mode === 'single' && !!state.image && Array.isArray(state.versions) && state.versions.length > 0 }, + { id: 'account-open', label: 'Account: Plan and AI credits', icon: 'โ—Ž', run: () => import('./account-panel.js').then((m) => m.openAccountPanel()) }, { id: 'share-links-open', label: 'Share: Your links', icon: '๐Ÿ”—', run: () => { const s = document.getElementById('share-section'); if (s) { revealSection(s); s.scrollIntoView({ block: 'start', behavior: 'smooth' }); } } }, { id: 'generate-qr', label: 'Generate QR Code for the last link', icon: '๐Ÿ“ฑ', run: () => document.getElementById('qr-btn')?.click(), when: () => !document.getElementById('share-result')?.hidden }, { id: 'export-gif', label: 'Export as GIF', icon: '๐ŸŽฌ', run: () => document.getElementById('gif-export-btn')?.click() }, diff --git a/src/main.js b/src/main.js index 2ac4b8f..b06322a 100644 --- a/src/main.js +++ b/src/main.js @@ -61,6 +61,7 @@ import { bindAiImageEdit } from './features/ai-image-edit.js'; import { bindScreenshotEditor } from './features/ai-screenshot-editor.js'; import { bindAuth } from './features/auth.js'; import { bindAccount } from './features/account.js'; +import { bindAccountPanel } from './features/account-panel.js'; import { bindProjects } from './features/projects.js'; import { bindCampaigns } from './features/campaigns.js'; import { bindPages } from './features/pages.js'; @@ -176,6 +177,7 @@ function init() { bindAiImageEdit(); bindScreenshotEditor(); // v30 โ€” Magic Edit panel bindAccount(); // before bindAuth, so it hears the first sign-in state + bindAccountPanel(); bindAuth(); bindPages(); bindBoard(); // v32 โ€” Open Canvas board surface diff --git a/src/styles.css b/src/styles.css index a94d78d..5cc6186 100644 --- a/src/styles.css +++ b/src/styles.css @@ -1057,6 +1057,33 @@ kbd { border: 1px solid var(--border-color); border-radius: var(--radius-pill); font-size: 11px; } +button.account-pill { color: var(--text-primary); font-family: inherit; cursor: pointer; transition: border-color 0.15s ease; } +button.account-pill:hover { border-color: var(--accent-line); } +button.account-pill:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; } +/* โ”€โ”€โ”€ Account panel (src/features/account-panel.js) โ”€โ”€โ”€ */ +.glint-dialog.account-panel { width: min(400px, calc(100vw - 32px)); } +.account-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; } +.account-head h3 { margin: 0; font-weight: 600; font-size: 15px; letter-spacing: -0.2px; } +.account-close { background: none; border: 0; color: var(--text-secondary); font-size: 14px; line-height: 1; padding: 6px; border-radius: var(--radius-sm); cursor: pointer; } +.account-close:hover { color: var(--text-primary); background: var(--bg-tertiary); } +.account-who { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; } +.account-who-text { min-width: 0; } +.account-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.account-email { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.account-plan { flex: none; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border-color); background: var(--bg-tertiary); } +.account-plan.is-pro { background: var(--accent-primary); border-color: var(--accent-primary); color: var(--on-accent); } +.account-box { border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 14px; margin-bottom: 12px; background: var(--bg-primary); } +.account-count { display: flex; align-items: baseline; gap: 8px; } +.account-count strong { font-size: 30px; font-weight: 600; letter-spacing: -1px; line-height: 1; font-variant-numeric: tabular-nums; } +.account-count span { font-size: 12px; color: var(--text-secondary); } +.account-bar { height: 6px; border-radius: 3px; background: var(--bg-tertiary); margin: 12px 0 10px; overflow: hidden; } +.account-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent-primary); transition: width 0.3s ease; } +.account-note { margin: 0; font-size: 12px; line-height: 1.5; color: var(--text-secondary); } +.account-note + .account-note { margin-top: 6px; } +.account-box h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; } +.account-box .btn { margin-top: 10px; width: 100%; text-align: center; text-decoration: none; display: block; } +.account-actions { display: flex; gap: 8px; margin-top: 4px; } +.account-actions .btn { flex: 1; } .auth-modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);