From 0e3b39ee5f8c2fdf0ed24dc493d6d7f1fdb79cd1 Mon Sep 17 00:00:00 2001 From: Mehar Khanna Date: Mon, 16 Nov 2026 17:20:59 -0500 Subject: [PATCH] Dashboard and account pages: fit a phone (360 to 414 px) No page scrolls sideways at 360, 375 or 414 any more (249 page views checked, every dashboard view included). The dashboard header fits, problem cards and route lists wrap, tables built by the dashboard script sit in their own scroll box, charts draw at the phone's width so their labels stay readable, and the tour's spotlight stays under the header. The burger drawer uses the dynamic viewport height and its closed links leave the tab order; Export gets a rail link on phones, where the product menu is hidden. Account pages: fields are 16 px on phones (iOS no longer zooms in on focus), the Apps table stacks, plan cards fold their longer feature lists behind "N more" on a phone (desktop shows every line), long emails wrap, the sign-in button rows wrap, and the report email no longer widens past the screen. Desktop is unchanged. Co-Authored-By: Claude Opus 5.5 --- telemetry-worker/src/account-pages.ts | 22 +++--- telemetry-worker/src/billing-pages.ts | 29 ++++++-- telemetry-worker/src/github/pages.ts | 3 +- telemetry-worker/src/pages.ts | 97 +++++++++++++++++++++------ telemetry-worker/src/report-email.ts | 4 +- telemetry-worker/src/report-routes.ts | 15 ++++- telemetry-worker/src/studio.ts | 50 ++++++++++---- telemetry-worker/test/pages.test.ts | 2 +- telemetry-worker/test/plans.test.ts | 2 +- 9 files changed, 170 insertions(+), 54 deletions(-) diff --git a/telemetry-worker/src/account-pages.ts b/telemetry-worker/src/account-pages.ts index cb31387d..bcd3575a 100644 --- a/telemetry-worker/src/account-pages.ts +++ b/telemetry-worker/src/account-pages.ts @@ -33,7 +33,7 @@ export const ACCOUNT_CSS = ` :root[data-theme="light"]{--paper:#fcfcfc;--panel:#f7f7f7;--ink:#171717;--ink2:#525252;--ink3:#6b6b6b;--rule:#e6e6e6;--rule2:#dcdcdc;--line:#8a8a8a;--accent:#0a7c4a;--accent-x:#0a7c4a;--accent-f:#0a7c4a;--accent-t:#e8f5ee;--warn:#c2410c;--warn-f:#d9480f;--warn-t:#fdeee9;--bar:#6b6b6b;--bar2:#0a7c4a;--bar3:#d9480f;--ink-h:#000000;--green-h:#086a3f;--on-green:#ffffff;--head:rgba(252,252,252,.8);--code:#f3f3f3;--codeink:#171717} code{font-family:var(--mono);font-size:.9em} .eb{font:500 12.5px var(--mono);letter-spacing:.04em;text-transform:uppercase;color:var(--accent)} -.auth{max-width:440px;margin:0 auto;padding:44px 0 64px} +.auth{max-width:440px;margin:0 auto;padding:44px 0 64px;overflow-wrap:anywhere} .auth>.logo{display:inline-flex;margin-bottom:44px} .auth h1{font:500 clamp(28px,5vw,34px)/1.15 var(--display);letter-spacing:-.04em;margin-top:10px;text-wrap:balance} .auth h2{font:500 16px var(--sans);letter-spacing:-.015em;margin:0} @@ -41,7 +41,7 @@ code{font-family:var(--mono);font-size:.9em} body.mesh{isolation:isolate} body.mesh canvas[data-mesh]{position:fixed;inset:0;width:100%;height:100%;z-index:-1;pointer-events:none} body.mesh main.wrap{max-width:none;margin:0;padding:0;display:grid;grid-template-columns:minmax(0,40%) 1fr;min-height:100vh;min-height:100dvh} -body.mesh header.top~main.wrap{min-height:calc(100dvh - 64px)} +body.mesh header.top~main.wrap{min-height:calc(100dvh - 65px)} body.mesh .auth{grid-column:1;align-self:center;justify-self:center;width:min(440px,100%);max-width:none;margin:0;padding:48px 24px 56px} body.mesh .auth>*{animation:gcin .7s cubic-bezier(.2,.7,.2,1) both} body.mesh .auth>:nth-child(2){animation-delay:.05s}body.mesh .auth>:nth-child(3){animation-delay:.1s}body.mesh .auth>:nth-child(4){animation-delay:.15s}body.mesh .auth>:nth-child(n+5){animation-delay:.2s} @@ -49,7 +49,7 @@ body.mesh .auth>:nth-child(2){animation-delay:.05s}body.mesh .auth>:nth-child(3) .mesh-cap{position:fixed;right:16px;bottom:12px;margin:0;font:11px/1.4 var(--mono);color:var(--ink3);pointer-events:none} .mesh-cap span+span::before{content:" · "} .mesh-cap span:empty{display:none} -@media (max-width:900px){body.mesh main.wrap{grid-template-columns:1fr}body.mesh .auth{padding:40px 16px 56px}body.mesh canvas[data-mesh]{opacity:.25}.mesh-cap{display:none}} +@media (max-width:900px){body.mesh main.wrap{grid-template-columns:minmax(0,1fr)}body.mesh .auth{padding:40px 16px 56px}body.mesh canvas[data-mesh]{opacity:.25}.mesh-cap{display:none}} @media (prefers-reduced-motion:reduce){body.mesh .auth>*{animation:none}} .auth .lead{font-size:16px;line-height:1.55;color:var(--ink2);margin-top:12px} .auth .ways{margin-top:30px;padding-top:24px;border-top:1px solid var(--rule2);display:grid;gap:10px} @@ -71,7 +71,7 @@ body.mesh .auth>:nth-child(2){animation-delay:.05s}body.mesh .auth>:nth-child(3) .alt a,.alt button.lnk,.lnk.ul{color:var(--ink);text-decoration:underline;text-underline-offset:3px;min-height:32px;display:inline-flex;align-items:center;gap:7px} .alt svg{width:16px;height:16px;flex:none} .pwf .row{display:flex;justify-content:space-between;align-items:baseline;gap:12px} -.pwf .row a{font-size:13px;color:var(--ink2)} +.pwf .row a{font-size:13px;color:var(--ink2);padding:4px 0;margin:-4px 0} .or::before,.or::after{content:"";flex:1;border-top:1px solid var(--rule)} .auth label,.acct-form label{display:block;font:500 12.5px var(--mono);color:var(--ink3);margin-bottom:7px} .auth input,.acct-form input{min-height:46px;width:100%;padding:0 12px;border-radius:0;border:1px solid var(--line);background:var(--paper);color:var(--ink);font:16px var(--sans)} @@ -98,9 +98,10 @@ dl.req dt{font:500 12.5px var(--mono);color:var(--ink3);padding-top:13px;padding ul.scope{margin:10px 0 0;padding-left:20px;font-size:14.5px;line-height:1.5;color:var(--ink2)} details.scope-d{margin-top:16px;font-size:14.5px;color:var(--ink2)} details.scope-d summary{cursor:pointer;color:var(--ink)} +@media (max-width:600px){details.scope-d summary{padding:11px 0}} details.scope-d .lead{margin-top:10px} ul.scope li{margin-top:5px} -.acts{display:flex;gap:10px;margin-top:22px} +.acts{display:flex;flex-wrap:wrap;gap:10px;margin-top:22px} .acts .btn{flex:1} .step{margin-top:26px;padding-top:18px;border-top:1px solid var(--rule);display:grid;gap:10px;justify-items:start} .step p{font-size:14.5px;color:var(--ink2)} @@ -708,6 +709,7 @@ export const ORG_CSS = ` .pcard .pk{font:12px var(--mono);color:var(--ink3);margin-top:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap} .pcard .meta{display:flex;flex-wrap:wrap;gap:8px;align-items:center;font-size:12.5px;color:var(--ink3);margin-top:auto} .pcard .acts{position:relative;z-index:1;display:flex;flex-wrap:wrap;gap:6px;align-items:center;font-size:12px;color:var(--ink3)} +.pcard .acts>span{min-width:0;overflow-wrap:anywhere} .pnew{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;min-height:176px;border:1px dashed var(--rule2);border-radius:6px;color:var(--ink3);text-decoration:none;font-size:13px} .pnew:hover{border-color:var(--rule3);color:var(--ink);background:var(--s75)} .empty-p{grid-column:1/-1;display:flex;flex-direction:column;align-items:center;gap:12px;padding:56px 16px;border:1px dashed var(--rule2);border-radius:6px;text-align:center} @@ -717,15 +719,16 @@ export const ORG_CSS = ` .empty-p.trial h2{font-size:22px;letter-spacing:-.01em} .empty-p.trial .tp{font-size:14px;color:var(--ink);font-weight:600} .empty-p.trial ul{list-style:none;padding:0;margin:2px 0 0;display:grid;gap:5px;text-align:left;font-size:13px} -.empty-p.trial li::before{content:"\\2713";color:var(--accent);margin-right:8px} +.empty-p.trial li{display:flex;gap:8px} +.empty-p.trial li::before{content:"\\2713";color:var(--accent);margin-right:0} .empty-p.trial .pmore{font-size:12.5px;color:var(--ink3);margin-bottom:4px} .empty-p.trial .pmore ul{margin-top:5px} -.pmore summary{cursor:pointer;list-style:none;color:var(--ink3);text-decoration:underline;text-underline-offset:2px} +.pmore summary{cursor:pointer;list-style:none;color:var(--ink3);text-decoration:underline;text-underline-offset:2px;padding:4px 0;margin:-4px 0} .pmore summary::-webkit-details-marker{display:none} .pmore[open] summary{display:none} .empty-p.trial .btn{padding:11px 22px;font-size:14.5px} .empty-p.trial .skipit{font-size:11px;margin-top:6px} -.empty-p.trial .skipit a{color:var(--ink3)} +.empty-p.trial .skipit a{color:var(--ink3);display:inline-block;padding:6px 12px;margin:-6px -12px} .acct-form{display:flex;flex-wrap:wrap;gap:10px;align-items:flex-end;margin-top:16px;max-width:720px} .acct-form .f{flex:1 1 260px;min-width:0} .acct-form label{display:block;font-size:13px;color:var(--ink2);margin-bottom:6px} @@ -765,7 +768,10 @@ table.dt td form{display:inline} table.dt.rows td:empty{display:none} table.dt.rows td[data-l]::before{content:attr(data-l) " ";font-size:12px;color:var(--ink3)} table.dt.rows td.act{text-align:left;padding-top:8px} + table.dt.rows td.act a:not(.btn){display:inline-flex;align-items:center;min-height:32px} } +@media (max-width:560px){.ptool .psearch{flex:1 1 100%}.pcard{min-height:0}.pcard h2{white-space:normal;overflow-wrap:anywhere;padding-right:0}.pnew{min-height:56px;flex-direction:row}} +@media (max-width:767px){.pcard .bdg,table.dt td .tag{font-size:12px}} `; /** The organization's rail (Studio's: Projects, Billing, and its settings at the foot). */ diff --git a/telemetry-worker/src/billing-pages.ts b/telemetry-worker/src/billing-pages.ts index 9cdf454e..d57d1129 100644 --- a/telemetry-worker/src/billing-pages.ts +++ b/telemetry-worker/src/billing-pages.ts @@ -8,7 +8,7 @@ // Talk to us, a mailto link, whatever the key. Which plans include something is said from billing/plans.json // (plansWith), never by name. -import { CLIENT_JS, ORG_CSS, orgRail, pitchList, time } from "./account-pages.js"; +import { CLIENT_JS, ORG_CSS, orgRail, PITCH_SHOWN, pitchList, time } from "./account-pages.js"; import type { Env } from "./collector.js"; import type { D1Like, Project, Range } from "./dashboard.js"; import { integrationRows, integrationsKey, KIND_NAMES, KINDS, maskConfig, openConfig, DATADOG_SITES, POSTHOG_HOSTS, type Kind } from "./forward.js"; @@ -112,6 +112,20 @@ const BILLING_CSS = ` .team td.act{text-align:right;white-space:nowrap} .team .acct-form{margin-top:14px} @media (max-width:860px){.plans{grid-template-columns:1fr}} +/* stacked on a phone, a plan shows PITCH_SHOWN lines and folds the rest behind "N more" (the desktop columns show all) */ +.pfold{display:none} +@supports selector(:has(a)){@media (max-width:860px){.plan .pfold{display:block;font-size:13px}.plan:has(>.pfold:not([open])) li.folded{display:none}}} +/* the Apps table: rows stack on a phone, as the Team tables do (ORG_CSS table.dt.rows); its tag gets the warn colour from here, not a style attribute the CSP blocks */ +#projects td .tag{color:var(--warn);border-color:var(--warn)} +@media (max-width:600px){ + #projects table thead{display:none} + #projects table tr{display:block;padding:12px 0;border-bottom:1px solid var(--rule)} + #projects table td{display:block;border:0;padding:3px 20px;white-space:normal;overflow-wrap:anywhere} + #projects table td:first-child{font-weight:500} + #projects table td.act{text-align:left;padding-top:8px} + #projects table td.act a:not(.btn){display:inline-flex;align-items:center;min-height:32px} +} +@media (max-width:767px){.plan .tag{font-size:12px}} `; function statusLine(v: BillingView, plan: Plan): string { @@ -185,9 +199,14 @@ function planColumn(v: BillingView, p: Plan, current: Plan): string { else if (byAgreement(p)) act = talk; else if (v.live && !waiting) act = buy; const features = p.features - .map((f) => `${esc(f.text)}${f.available || /coming next/i.test(f.text) ? "" : " (coming next)"}`) + .map((f, i) => { + const cls = [f.available ? "" : "soon", i >= PITCH_SHOWN ? "folded" : ""].filter(Boolean).join(" "); + return `${esc(f.text)}${f.available || /coming next/i.test(f.text) ? "" : " (coming next)"}`; + }) .join(""); - return `

${esc(p.name)}

${esc(priceText(p))}

${esc(p.summary)}

    ${features}
${act}
`; + const more = p.features.length - PITCH_SHOWN; + const fold = more > 0 ? `
${more} more
` : ""; + return `

${esc(p.name)}

${esc(priceText(p))}

${esc(p.summary)}

    ${features}
${fold}
${act}
`; } /** The account's projects, each with its plan and the way to change it (its own page). */ @@ -208,7 +227,7 @@ function projectsSection(v: BillingView): string { return `

Apps

What your plan covers

Free covers ${FREE_APPS === 1 ? "one app" : `${FREE_APPS} apps`}${PAID_PLANS[0] ? `; ${esc(PAID_PLANS[0].name)} covers ${PAID_PLANS[0].limits.apps ? `up to ${PAID_PLANS[0].limits.apps} apps` : "every app"}, ${esc(priceText(PAID_PLANS[0]))}` : ""}. More apps come with Enterprise.

- ${rows}
ProjectPlan
+
${rows}
ProjectPlan
`; } @@ -403,7 +422,7 @@ ${notice}${test} user: { label, sub: orgName(label) }, ...orgRail("billing"), railLabel: "Organization", - css: DASH_CSS + ORG_CSS + BILLING_CSS + ".planpage .sb-ph{text-align:center}.planpage .sb-ph>div{margin:0 auto}.planpage #plan{background:none;border:0;box-shadow:none;padding:0;display:flex;flex-direction:column;align-items:center;gap:0}.planpage #plan .intro{margin:20px auto 0;text-align:center}.planpage #plan .err:empty{display:none}.planpage .notice{max-width:440px;margin-left:auto;margin-right:auto}.planpage .acct-form{justify-content:center}.plan.big{width:100%;max-width:440px;padding:24px 24px 22px;gap:8px}.plan.big h3{font-size:24px;letter-spacing:-.01em}.plan.big .price{font-size:15px;font-weight:600;margin-top:2px}.plan.big ul{margin-top:6px;gap:6px}.plan.big li{font-size:13.5px}.plan.big .pmore{font-size:12.5px}.plan.big .pmore ul{margin-top:6px}.plan.big .act{padding-top:12px}.plan.big .act .btn{width:100%;justify-content:center;padding:11px 16px;font-size:14.5px}.free{margin-top:12px;font-size:11px;width:100%;max-width:440px;text-align:center}.linkish{background:none;border:0;padding:0;font:inherit;font-size:11px;color:var(--ink3);text-decoration:underline;cursor:pointer}.linkish:disabled{opacity:.6;cursor:default}.trialnote{margin:10px 0 0;font-size:13px;color:var(--ink3);text-align:center;width:100%}dialog.why{margin:auto;max-height:calc(100vh - 32px);overflow:auto;max-width:460px;width:calc(100% - 32px);border:1px solid var(--rule);border-radius:14px;background:var(--paper);color:var(--ink);padding:24px 24px 20px}dialog.why::backdrop{background:rgba(0,0,0,.62)}dialog.why h2{font-size:21px;margin:0 0 4px}dialog.why fieldset{border:0;padding:0;margin:14px 0 6px}dialog.why label{display:flex;gap:10px;align-items:center;padding:7px 0;font-size:15px;cursor:pointer}dialog.why textarea{margin-top:6px}.why-act{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}", + css: DASH_CSS + ORG_CSS + BILLING_CSS + ".planpage .sb-ph{text-align:center}.planpage .sb-ph>div{margin:0 auto}.planpage #plan{background:none;border:0;box-shadow:none;padding:0;display:flex;flex-direction:column;align-items:center;gap:0}.planpage #plan .intro{margin:20px auto 0;text-align:center}.planpage #plan .err:empty{display:none}.planpage .notice{max-width:440px;margin-left:auto;margin-right:auto}.planpage .acct-form{justify-content:center}.plan.big{width:100%;max-width:440px;padding:24px 24px 22px;gap:8px}.plan.big h3{font-size:24px;letter-spacing:-.01em}.plan.big .price{font-size:15px;font-weight:600;margin-top:2px}.plan.big ul{margin-top:6px;gap:6px}.plan.big li{font-size:13.5px}.plan.big .pmore{font-size:12.5px}.plan.big .pmore ul{margin-top:6px}.plan.big .act{padding-top:12px}.plan.big .act .btn{width:100%;justify-content:center;padding:11px 16px;font-size:14.5px}.free{margin-top:12px;font-size:11px;width:100%;max-width:440px;text-align:center}.linkish{background:none;border:0;padding:0;font:inherit;font-size:11px;color:var(--ink3);text-decoration:underline;cursor:pointer}.linkish:disabled{opacity:.6;cursor:default}.planpage .linkish{display:inline-block;padding:6px 12px;margin:-6px -12px}.trialnote{margin:10px 0 0;font-size:13px;color:var(--ink3);text-align:center;width:100%}dialog.why{margin:auto;max-height:calc(100vh - 32px);overflow:auto;max-width:460px;width:calc(100% - 32px);border:1px solid var(--rule);border-radius:14px;background:var(--paper);color:var(--ink);padding:24px 24px 20px}dialog.why::backdrop{background:rgba(0,0,0,.62)}dialog.why h2{font-size:21px;margin:0 0 4px}dialog.why fieldset{border:0;padding:0;margin:14px 0 6px}dialog.why label{display:flex;gap:10px;align-items:center;padding:7px 0;font-size:15px;cursor:pointer}dialog.why textarea{margin-top:6px}.why-act{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}", body, script: CLIENT_JS + script, }); diff --git a/telemetry-worker/src/github/pages.ts b/telemetry-worker/src/github/pages.ts index a2440596..b1455ea1 100644 --- a/telemetry-worker/src/github/pages.ts +++ b/telemetry-worker/src/github/pages.ts @@ -58,6 +58,7 @@ ul.facts b{color:var(--ink);font-weight:500} @media (max-width:620px){.gh-wf{grid-template-columns:minmax(0,1fr)}} details.gh-more{max-width:76ch;border-top:1px solid var(--rule);padding-top:14px} details.gh-more>summary{cursor:pointer;font-size:14px;font-weight:500;color:var(--ink2)} +@media (max-width:620px){details.gh-more>summary{padding:11px 0}} details.gh-more>summary:hover{color:var(--ink)} details.gh-more[open]>summary{margin-bottom:6px} .gh-st{font-size:13px;color:var(--ink2)} @@ -412,7 +413,7 @@ export function accountGithubPage(nonce: string, v: GithubAccountView): string { ? `

This server cannot ask GitHub who you are, so repositories cannot be linked here. Reviews work without it.

` : v.connected ? `

Connected as ${esc(v.connected.login)}. GitHub's answer about your repositories is used for 30 minutes, then this page asks again.${v.connected.more ? " Only the first 300 repositories are listed." : ""} Refresh from GitHub

` - : `

To link a repository, this page asks GitHub which installations of ${esc(v.slug)}[bot] and which repositories you can reach. Your GitHub token is used for that question and not kept.

`; + : `

To link a repository, this page asks GitHub which installations of ${esc(v.slug)}[bot] and which repositories you can reach. Your GitHub token is used for that question and not kept.

`; const table = v.repos.length ? `
${rows}
RepositoryWhat the app is doingGenClass app
${ adds diff --git a/telemetry-worker/src/pages.ts b/telemetry-worker/src/pages.ts index 89c9190c..e5b536cc 100644 --- a/telemetry-worker/src/pages.ts +++ b/telemetry-worker/src/pages.ts @@ -152,6 +152,7 @@ header.top nav .so button,button.lnk{background:none;border:0;padding:0;font:inh @media (max-width:620px){header.top .wrap{gap:12px}header.top nav{gap:14px}header.top nav .hm{display:none}} @media (max-width:420px){header.top nav .dc{display:none}} @media (max-width:360px){header.top .wrap{gap:10px}} +@media (max-width:340px){header.top nav{gap:10px}header.top nav .btn{padding:0 10px}} h1,h2,h3{font-family:var(--display);text-wrap:balance} h1{font-size:clamp(26px,4vw,40px);line-height:1.15;letter-spacing:-.04em;font-weight:500} h2{font-size:17px;letter-spacing:-.015em;font-weight:500;margin-bottom:10px} @@ -324,6 +325,14 @@ export function setupCommand(token: string): string { return `npx ${RUNTIME_PKG} init --token ${token} --mode heal`; } +/** The setup command as HTML: each flag (--token, --mode) kept on one line, so a wrapped command still reads right. */ +function cmdHtml(cmd: string): string { + return cmd + .split(" ") + .map((a) => (a.startsWith("-") ? `${esc(a)}` : esc(a))) + .join(" "); +} + /** The shortest prompt that gets a coding agent to do the same; --yes because an agent has no Y/n to answer. */ export function agentPrompt(token: string): string { return `Add GenClass to this web app: run \`${setupCommand(token)} --yes\` in the app's folder (ask me which folder if this one has no web app). Then start the app, check that it still works, and tell me what changed. \`npx ${RUNTIME_PKG} remove\` undoes it.`; @@ -375,6 +384,7 @@ export const START_CSS = ` .setup h1{font-size:clamp(28px,4vw,36px)} .setup-agents{align-items:center} #appst:empty{display:none} +.cmdbox code .nw{white-space:nowrap} .setup-steps{margin:0;padding-left:20px;display:grid;gap:8px} .setup-status{display:inline-flex;align-items:center;gap:8px} .setup-status i{width:8px;height:8px;border-radius:50%;background:var(--warn);flex:none} @@ -449,7 +459,7 @@ export function setupPage(nonce: string, v: SetupView): string { const connect = v.endpoint ? "" : `
-
${esc(cmd)}
+
${cmdHtml(cmd)}
Or let your agent do it:${agents}

`; @@ -832,6 +842,7 @@ body.sampling::after{content:"Sample data";position:fixed;top:60px;left:50%;tran .cmdbox{display:flex;align-items:center;gap:10px;background:var(--code);padding:10px 12px;min-width:0;margin:8px 0} .cmdbox code{flex:1;min-width:0;font:13.5px/1.5 var(--mono);overflow-wrap:anywhere} .cmdbox .btn{flex:none} +.cmdbox code .nw{white-space:nowrap} /* the measured checks' key: hatched in the muted ink, never a problem type's hue */ :root{--chk:repeating-linear-gradient(135deg,var(--ink2) 0 2px,transparent 2px 4px)} .find h3 .bdg,.adv h3 .bdg{margin-left:2px} @@ -881,6 +892,7 @@ table.dt td .bdg{margin-left:8px;vertical-align:middle} .uh{display:flex;flex-wrap:wrap;gap:8px 16px;align-items:center;justify-content:space-between;margin:48px 0 16px} .prolock{display:flex;flex-wrap:wrap;gap:12px 20px;align-items:center;justify-content:space-between;border:1px solid var(--accent-b,var(--rule));background:var(--accent-t,transparent);border-radius:12px;padding:16px 18px;margin:0 0 24px}.prolock p{margin:4px 0 0;color:var(--ink2);max-width:640px} .uh h2{font-size:18px;color:var(--ink2)} +.uh .acts{display:flex;flex-wrap:wrap;gap:8px} .uh h2 b{color:var(--ink);font-weight:400} .getc{border:1px dashed var(--rule2);border-radius:6px;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));background:var(--s75)} .getc>*{display:flex;gap:12px;align-items:flex-start;padding:18px 20px;text-align:left;background:none;border:0;color:inherit;font:inherit;cursor:pointer;text-decoration:none;min-width:0} @@ -894,6 +906,7 @@ table.dt td .bdg{margin-left:8px;vertical-align:middle} .adv article .top{display:flex;justify-content:space-between;gap:12px;align-items:center} .adv article h3{display:flex;align-items:center;gap:8px;font-size:14px} .adv article p{font-size:13px;color:var(--ink3);line-height:1.5} +.adv article p.mono{overflow-wrap:anywhere} .adv article .acts{display:flex;gap:8px;margin-top:auto;padding-top:4px} .adv .none{grid-column:1/-1;display:flex;flex-direction:column;align-items:center;gap:8px;padding:48px 16px;border:1px solid var(--rule);border-radius:6px;color:var(--ink3);font-size:13px} @media (max-width:1100px){.usage{grid-template-columns:repeat(2,minmax(0,1fr))}.adv{grid-template-columns:repeat(2,minmax(0,1fr))}} @@ -930,15 +943,16 @@ figcaption{font-size:12px;color:var(--ink3);margin-top:12px;line-height:1.5} .tip .r b{font-variant-numeric:tabular-nums;font-weight:400} /* Problems: one card per kind, as Studio's advisor cards */ .finds{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(340px,100%),1fr));gap:16px} -.find{background:var(--s75);border:1px solid var(--rule);border-radius:6px;padding:16px 18px;display:grid;gap:10px;align-content:start;min-width:0} +.find{background:var(--s75);border:1px solid var(--rule);border-radius:6px;padding:16px 18px;display:grid;grid-template-columns:minmax(0,1fr);gap:10px;align-content:start;min-width:0} .find .top{display:flex;justify-content:space-between;align-items:baseline;gap:12px} -.find h3{font-size:14px;display:flex;align-items:center;gap:8px} +.find h3{font-size:14px;display:flex;align-items:center;gap:8px;min-width:0;overflow-wrap:anywhere} +.find .top>*{min-width:0} .find .nw{text-align:right;white-space:nowrap} .find .n{font:400 22px/1 var(--display);font-variant-numeric:tabular-nums} -.find p{font-size:13px;color:var(--ink2);line-height:1.55} +.find p{font-size:13px;color:var(--ink2);line-height:1.55;overflow-wrap:anywhere} .find p.fix b{color:var(--ink);font-weight:500} .find .acts{display:flex;gap:8px;flex-wrap:wrap} -.where{list-style:none;display:grid;gap:2px} +.where{list-style:none;display:grid;grid-template-columns:minmax(0,1fr);gap:2px} .where li{display:flex;justify-content:space-between;gap:12px;font:12px var(--mono);padding:3px 0;border-bottom:1px dashed var(--rule)} .where li code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;font:inherit;color:var(--ink2)} .where li span{color:var(--ink3);font-variant-numeric:tabular-nums;flex:none} @@ -955,6 +969,8 @@ table.dt td.wide{width:40%} .blk .tablewrap table.dt{width:100%;margin:0} .blk table.dt th:first-child,.blk table.dt td:first-child{padding-left:20px} .blk table.dt th:last-child,.blk table.dt td:last-child{padding-right:20px} +/* the Devices tables sit in the .kv grid's columns: no bleed to the panel's edges */ +.kv .tablewrap{margin:0;width:auto} .mix{display:flex;gap:2px;height:6px} .mix i{display:block;height:6px;border-radius:2px;min-width:3px} .chip{display:inline-flex;align-items:center;gap:7px} @@ -992,7 +1008,7 @@ details.more summary:hover{color:var(--ink)} .steps .no{width:24px;height:24px;border-radius:50%;border:1px solid var(--rule2);display:flex;align-items:center;justify-content:center;font:12px var(--mono);color:var(--ink2)} .steps b{font-weight:400;color:var(--ink);font-size:14px} .steps li>div>span{display:block;font-size:13px;color:var(--ink3);margin-top:2px} -@media (max-width:620px){.steps li{grid-template-columns:28px minmax(0,1fr)}.steps li .btn{grid-column:2;justify-self:start}} +@media (max-width:620px){.steps li{grid-template-columns:28px minmax(0,1fr)}.steps li>.btn,.steps li>.bdg{grid-column:2;justify-self:start}.steps .cmdbox{flex-wrap:wrap}.steps .cmdbox code{flex:1 1 100%}} /* the Connect dialog: its status line, tabs, the key, the ways in, the copy-prompt blocks */ .cstat{display:flex;align-items:center;gap:9px;padding:10px 12px;margin-bottom:4px;font-size:13px;color:var(--ink2);border:1px solid var(--rule);border-radius:6px;background:var(--s75)} .cstat i{width:8px;height:8px;border-radius:50%;background:var(--amber);flex:none;animation:gcpulse 1.6s ease-in-out infinite} @@ -1087,6 +1103,24 @@ table.dt.tools-t td{white-space:normal} .blk-h.sub{margin-top:44px;border-bottom-color:var(--rule)} .blk-h.sub h3{font-size:17px;font-weight:500;margin:0} .dash-only{display:contents} +/* a phone: the dashboard's tables tighter, their headings and routes wrapping (an ellipsis's full text is only a + tooltip, which a touch screen cannot show), so most fit and the rest scroll less in their box; the loop diagrams + drawn at their written size in their scroller, its right edge faded; small labels at 12px, the tools from the left, + taller touch rows */ +@media (max-width:560px){ + .phead~* table.dt th{white-space:normal} + .phead~* table.dt th,.phead~* table.dt td{padding-left:8px;padding-right:8px} + .phead~* table.dt td.route{white-space:normal;overflow-wrap:break-word;max-width:150px} + .flowwrap{padding-right:56px;-webkit-mask-image:linear-gradient(90deg,var(--ink) calc(100% - 64px),transparent);mask-image:linear-gradient(90deg,var(--ink) calc(100% - 64px),transparent)} + .flow{min-width:1000px} + .flow .col,.flow .el{font-size:12px} + .plot text{font-size:12px} + .ok-t,.bad-t{font-size:12px;height:22px} + .ucard .ax{font-size:12px} + .tools{justify-content:flex-start} + details.more summary{padding:6px 0} + .mcpc .opts label{min-height:32px} +} `; const DASH_JS = ` @@ -1205,6 +1239,14 @@ const DASH_JS = ` host.appendChild(stat("Model loaded", share(ready, ready + failed), ready ? "average " + (T0.modelLoadAvgMs >= 1000 ? (T0.modelLoadAvgMs / 1000).toFixed(1) + " s" : fmt(T0.modelLoadAvgMs) + " ms") : "")); } // ---------- problems over time + // a phone draws the charts at their box's own width, so their labels keep their written size; a wider window keeps + // the 720-unit drawing scaled to fit + function chartW(host){ + var de = document.documentElement, vw = de.clientWidth || window.innerWidth || 1000; + if (vw > 560) return 720; + var w = (host && host.clientWidth) || vw - 74; + return Math.max(240, Math.min(720, Math.round(w))); + } function trend(S){ var host = document.getElementById("trendplot"), leg = document.getElementById("legend"), tbl = document.getElementById("trendtable"); host.textContent = ""; leg.textContent = ""; tbl.textContent = ""; @@ -1225,7 +1267,7 @@ const DASH_JS = ` if (total || ptotal) trendTable(tbl, rows, order, hourly, poss, ptotal); if (!total) { host.appendChild(el("p", "quiet", "No problems found in this period.")); return; } if (order.length > 1 || order[0] === "checks") order.forEach(function(s){ var x = el("span"); x.appendChild(key(colorOf(s))); x.appendChild(document.createTextNode(slotName(s))); leg.appendChild(x); }); - var W = 720, H = 210, PL = 30, PB = 24, PT = 6, n = rows.length, plotW = W - PL, plotH = H - PB - PT; + var W = chartW(host), H = W < 560 ? 180 : 210, PL = 30, PB = 24, PT = 6, n = rows.length, plotW = W - PL, plotH = H - PB - PT; var max = niceMax(Math.max.apply(null, rows.map(function(r){ return r.total; }))); var g = svg("svg", { viewBox: "0 0 " + W + " " + H, role: "img", "aria-label": "Problems found per " + (hourly ? "hour" : "day") + " by type" }); // the measured checks' hatch (the legend's --chk, as an SVG pattern) @@ -1242,7 +1284,7 @@ const DASH_JS = ` var x = PL + i * step + (step - bw) / 2, y = PT + plotH, drawn = order.filter(function(s){ return r.parts[s]; }); drawn.forEach(function(s, j){ var h = plotH * r.parts[s] / max; y -= h; - g.appendChild(svg("rect", { x: x, y: y, width: bw, height: Math.max(1, h), rx: j === drawn.length - 1 ? 3 : 0, fill: s === "checks" ? "url(#chkp)" : colorOf(s), stroke: "var(--paper)", "stroke-width": drawn.length > 1 ? 2 : 0, "data-slot": s })); + g.appendChild(svg("rect", { x: x, y: y, width: bw, height: Math.max(1, h), rx: j === drawn.length - 1 ? 3 : 0, fill: s === "checks" ? "url(#chkp)" : colorOf(s), stroke: "var(--paper)", "stroke-width": drawn.length > 1 ? (W < 560 ? 1 : 2) : 0, "data-slot": s })); }); if (i === 0 || i === n - 1 || i === Math.floor(n / 2)) { var lt = svg("text", { x: PL + i * step + step / 2, y: H - 6, "text-anchor": i === 0 ? "start" : i === n - 1 ? "end" : "middle" }); lt.textContent = label(r.bucket, hourly); g.appendChild(lt); @@ -1276,7 +1318,7 @@ const DASH_JS = ` document.getElementById("possn").textContent = plural(total, "possible issue", "possible issues"); fig.classList.toggle("hidden", !total); if (!total) return; - var W = 720, H = 120, PL = 30, PB = 24, PT = 6, n = rows.length, plotW = W - PL, plotH = H - PB - PT; + var W = chartW(host), H = W < 560 ? 100 : 120, PL = 30, PB = 24, PT = 6, n = rows.length, plotW = W - PL, plotH = H - PB - PT; var max = niceMax(Math.max.apply(null, rows.map(function(r){ return r.n; }))); var g = svg("svg", { viewBox: "0 0 " + W + " " + H, role: "img", "aria-label": "Possible issues (lower confidence) per " + (hourly ? "hour" : "day") }); [0, max].forEach(function(v){ @@ -1569,7 +1611,7 @@ const DASH_JS = ` if (anyPoss) tr.appendChild(el("td", "num poss-n", r.poss ? fmt(r.poss) : "-")); body.appendChild(tr); }); - tb.appendChild(body); host.appendChild(tb); + tb.appendChild(body); var tw_tb = el("div", "tablewrap"); tw_tb.appendChild(tb); host.appendChild(tw_tb); var notes = [], withPage = T0.detectionsWithPage; if (typeof withPage === "number" && T0.detections > withPage) notes.push(plural(T0.detections - withPage, "problem", "problems") + " arrived without a page."); var possWithPage = T0.possibleWithPage; @@ -1594,7 +1636,7 @@ const DASH_JS = ` var td = el("td", "wide"), mix = el("div", "mix"), i = el("i"); i.style.width = (100 * x.count / max) + "%"; i.style.background = "var(--accent-f)"; mix.appendChild(i); td.appendChild(mix); tr.appendChild(td); body.appendChild(tr); }); - tb.appendChild(body); host.appendChild(tb); + tb.appendChild(body); var tw_tb = el("div", "tablewrap"); tw_tb.appendChild(tb); host.appendChild(tw_tb); var o = map(B.action_outcome), applied = o.applied || T0.interventions || 0, notes = []; if (applied || !cf.applied) notes.push(plural(o.undone || 0, "change", "changes") + " undone" + (applied ? " (" + Math.round(100 * (o.undone || 0) / applied) + "%)" : "") + (o.failed ? ", " + plural(o.failed, "action", "actions") + " failed" : "") + "."); if (cf.applied) notes.push(plural(cf.undone || 0, "check fix", "check fixes") + " undone."); @@ -1687,7 +1729,7 @@ const DASH_JS = ` var td = el("td", "wide"), mix = el("div", "mix"), i = el("i"); i.style.width = (100 * x.count / max) + "%"; i.style.background = "var(--accent-f)"; mix.appendChild(i); td.appendChild(mix); tr.appendChild(td); body.appendChild(tr); }); - tb.appendChild(body); host.appendChild(tb); + tb.appendChild(body); var tw_tb = el("div", "tablewrap"); tw_tb.appendChild(tb); host.appendChild(tw_tb); } // a.b.c(-pre.n) older than b.c.d(-pre.n); unreadable versions are not older function vOlder(a, b){ @@ -1725,13 +1767,13 @@ const DASH_JS = ` var td = el("td", "wide"), mix = el("div", "mix"), i = el("i"); i.style.width = (100 * x.count / max) + "%"; i.style.background = "var(--t1)"; mix.appendChild(i); td.appendChild(mix); tr.appendChild(td); body.appendChild(tr); }); - tb.appendChild(body); host.appendChild(tb); + tb.appendChild(body); var tw_tb = el("div", "tablewrap"); tw_tb.appendChild(tb); host.appendChild(tw_tb); } /** Visits per hour or day: one bar each. */ function visitChart(host, S){ var hourly = S.range === "24h", rows = (S.series || []).map(function(b){ return { bucket: b.bucket, n: b.ix_sessions || 0 }; }); if (!rows.some(function(r){ return r.n; })) return; - var W = 720, H = 130, PL = 34, PB = 24, PT = 6, n = rows.length, plotW = W - PL, plotH = H - PB - PT; + var W = chartW(host), H = W < 560 ? 110 : 130, PL = 34, PB = 24, PT = 6, n = rows.length, plotW = W - PL, plotH = H - PB - PT; var max = niceMax(Math.max.apply(null, rows.map(function(r){ return r.n; }))); var g = svg("svg", { viewBox: "0 0 " + W + " " + H, role: "img", "aria-label": "Visits per " + (hourly ? "hour" : "day") }); [0, max].forEach(function(v){ @@ -1811,7 +1853,7 @@ const DASH_JS = ` tr.appendChild(el("td", "num", share(Math.min(r["100"] || 0, x.count), x.count))); body.appendChild(tr); }); - tb.appendChild(body); host.appendChild(tb); + tb.appendChild(body); var tw_tb = el("div", "tablewrap"); tw_tb.appendChild(tb); host.appendChild(tw_tb); } ixTable(document.getElementById("ixclicks"), pairs(B.ix_click), "Clicks", "No clicks recorded in this period."); var flags = pairs(B.ix_rage).map(function(x){ return { route: x.route, key: x.key + " (rage)", count: x.count }; }) @@ -1877,7 +1919,7 @@ const DASH_JS = ` var td = el("td", "wide"), mix = el("div", "mix"), i = el("i"); i.style.width = (100 * x.count / max) + "%"; i.style.background = "var(--accent-f)"; mix.appendChild(i); td.appendChild(mix); tr.appendChild(td); body.appendChild(tr); }); - tb.appendChild(body); ph.appendChild(tb); + tb.appendChild(body); var tw_tb = el("div", "tablewrap"); tw_tb.appendChild(tb); ph.appendChild(tw_tb); } var sh = document.getElementById("ixsteps"); sh.textContent = ""; var gaps = map(B.ix_nav_ms), steps = pairs(B.ix_nav).sort(function(a, b){ return b.count - a.count; }); @@ -1891,7 +1933,7 @@ const DASH_JS = ` tr.appendChild(el("td", "num", x.count ? dur((gaps[x.route + "\\t" + x.key] || 0) / x.count) : "-")); body2.appendChild(tr); }); - tb2.appendChild(body2); sh.appendChild(tb2); + tb2.appendChild(body2); var tw_tb2 = el("div", "tablewrap"); tw_tb2.appendChild(tb2); sh.appendChild(tw_tb2); } var xh = document.getElementById("ixexits"); xh.textContent = ""; var vm = map(B.ix_views), em = map(B.ix_entry), xm = map(B.ix_exit), fn = map(B.ix_first_n), fms = map(B.ix_first_ms), back = {}, firsts = {}; @@ -1912,7 +1954,7 @@ const DASH_JS = ` tr.appendChild(el("td", "num", fn[x.key] ? dur((fms[x.key] || 0) / fn[x.key]) : "-")); body3.appendChild(tr); }); - tb3.appendChild(body3); xh.appendChild(tb3); + tb3.appendChild(body3); var tw_tb3 = el("div", "tablewrap"); tw_tb3.appendChild(tb3); xh.appendChild(tw_tb3); } // ---------- funnels: the app's funnels, the visits that reached each step in order, and their editor var funnelsUrl = P.funnelsUrl || ("/api/projects/" + encodeURIComponent(secret) + "/funnels"), editing = false, lastS = null; @@ -2407,7 +2449,8 @@ const DASH_JS = ` current = v; parts.forEach(function(s){ s.classList.toggle("vh", !has(s, v)); }); var rv = PARENT[v] || v; - var r = links.filter(function(a){ return inRail(a) && hrefOf(a) === id; })[0] || links.filter(function(a){ return inRail(a) && VIEW[hrefOf(a)] === rv; })[0]; + // (a rail link the window does not show, such as Export from 901px, gives way to its parent's) + var r = links.filter(function(a){ return inRail(a) && hrefOf(a) === id && a.getClientRects().length; })[0] || links.filter(function(a){ return inRail(a) && VIEW[hrefOf(a)] === rv; })[0]; var m = links.filter(function(a){ return !inRail(a) && hrefOf(a) === id; })[0] || links.filter(function(a){ return !inRail(a) && VIEW[hrefOf(a)] === v; })[0]; links.forEach(function(a){ a.setAttribute("aria-current", String(a === r || a === m)); }); var t = TITLE[v], vt = document.getElementById("vtitle"), vd = document.getElementById("vdesc"); @@ -2433,6 +2476,18 @@ const DASH_JS = ` gcShow = function(id){ return show(id, true); }; })(); mcpAll(); alinkShow(); + (function(){ + var lw = document.documentElement.clientWidth, rt = 0; + window.addEventListener("resize", function(){ + clearTimeout(rt); + rt = setTimeout(function(){ + var w = document.documentElement.clientWidth; if (w === lw) return; + var was = lw; lw = w; + if (!shownS || (was > 560 && w > 560)) return; + try { trend(shownS); possibleTrend(shownS); var se = document.getElementById("ixsess"), f = se && se.querySelector("figure"); if (f) { f.remove(); visitChart(se, shownS); } } catch (e) {} + }, 200); + }); + })(); var mdb = document.getElementById("mdcopy"); if (mdb) mdb.addEventListener("click", function(){ if (shownS) gcCopy(mdb, markdown(shownS), null); }); var btn = document.getElementById("refresh"); @@ -2884,7 +2939,7 @@ export function dashboardPage( // what a new app's dashboard says first: the same one command as /start/ (a self-hosted collector has no CLI) const firstStep = opts.endpoint ? `
Add the key
` - : `
Install
${esc(setupCommand(project.token))}
`; + : `
Install
${cmdHtml(setupCommand(project.token))}
`; const connect = connectDialog({ token: project.token, account: !!acct, @@ -2937,7 +2992,7 @@ ${ [ { href: "#mcp", label: "MCP", icon: "bot" }, { href: "#loop", label: "Closed loop", icon: "loop" }, - ...(opts.extra ? [{ href: "#forwarding", label: "Integrations", icon: "blocks" } as RailItem] : []), + ...(opts.extra ? [{ href: "#forwarding", label: "Integrations", icon: "blocks" } as RailItem, { href: "#export", label: "Export", icon: "download", phoneOnly: true } as RailItem] : []), ], ]; const menus: ProductMenu[] = [ diff --git a/telemetry-worker/src/report-email.ts b/telemetry-worker/src/report-email.ts index ecb33a1b..78897571 100644 --- a/telemetry-worker/src/report-email.ts +++ b/telemetry-worker/src/report-email.ts @@ -329,7 +329,7 @@ function appsSection(r: Report): string { const fixed = r.apps.some((x) => !x.demo && x.totals.fixed > 0); const border = `border-bottom:1px solid ${C.rule}`; const th = (t: string, right = true) => `${esc(t)}`; - const td = (h: string, right = true) => `${h}`; + const td = (h: string, right = true) => `${h}`; const sub = (t: string) => (t ? `
${esc(t)}` : ""); const name = (x: AppReport, status: string) => `${a(x.dashboard, x.name)}${sub(`${x.pro ? "Pro" : "Free"} · ${status}`)}`; const demo = r.apps.filter((x) => x.demo); @@ -554,7 +554,7 @@ export function htmlOf(r: Report): string { ${preview}
-
+
${head}
${leadHtml(r, l)}
${details}${footer(r)}
diff --git a/telemetry-worker/src/report-routes.ts b/telemetry-worker/src/report-routes.ts index e5fa57a4..5b5f8947 100644 --- a/telemetry-worker/src/report-routes.ts +++ b/telemetry-worker/src/report-routes.ts @@ -67,17 +67,26 @@ const PAGE_CSS = ` .rp-ch legend{font-size:14px;font-weight:500;margin-bottom:6px;padding:0} .rp-ch label{display:grid;grid-template-columns:auto 1fr;gap:2px 10px;align-items:start;padding:12px 14px;border:1px solid var(--rule2,var(--rule));border-radius:8px;cursor:pointer} .rp-ch label:has(input:checked){border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)} -.rp-ch input{margin:3px 0 0} +.rp-ch input{margin:3px 0 0;accent-color:var(--accent)} .rp-ch b{font-weight:500} .rp-ch small{grid-column:2;color:var(--ink3);font-size:13px} .rp-al{display:flex;gap:10px;align-items:flex-start;font-size:14px} -.rp-al input{margin-top:3px} +.rp-al input{margin-top:3px;accent-color:var(--accent)} .rp-acts{display:flex;gap:10px;flex-wrap:wrap;align-items:center} .rp-note{color:var(--ink3);font-size:13px;margin:0} .rp-ok{color:var(--accent-f,var(--accent));font-size:14px;margin:0} .rp-err{color:var(--warn-f,#e5484d);font-size:14px;margin:0} .rp-err:empty,.rp-ok:empty{display:none} -.rp-pr{white-space:pre-wrap;word-break:break-word;font-family:"Source Code Pro",ui-monospace,monospace;font-size:13px;line-height:1.55;padding:14px 16px;border:1px solid var(--rule);border-radius:8px;background:var(--panel,transparent);max-height:55vh;overflow:auto} +.rp-pr{white-space:pre-wrap;word-break:break-word;font-family:var(--mono);font-size:13px;line-height:1.55;padding:14px 16px;border:1px solid var(--rule);border-radius:0;background:var(--panel,transparent);max-height:55vh;overflow:auto;margin-top:20px} +.rp-pr+.rp-acts,.rp-acts+.rp-note{margin-top:16px} +.who{overflow-wrap:anywhere} +.rp{margin-top:20px} +/* the bare pages load ACCOUNT_CSS first: its .auth label / .auth input (the sign-in fields) must not reach the choices */ +.auth .rp-ch label,.auth .rp-al{margin:0;font:400 14px/1.5 var(--sans);color:var(--ink)} +.auth .rp-al{display:flex;color:var(--ink2)} +.auth .rp-ch input,.auth .rp-al input{min-height:0;width:auto;padding:0;border:0;flex:none;accent-color:var(--accent)} +.auth .rp-ch label{border-radius:0} +.rp+.rp-note{margin-top:16px} `; function choices(every: Every, alerts: boolean): string { diff --git a/telemetry-worker/src/studio.ts b/telemetry-worker/src/studio.ts index 82afa510..1d5f3651 100644 --- a/telemetry-worker/src/studio.ts +++ b/telemetry-worker/src/studio.ts @@ -260,7 +260,7 @@ code,pre,.mono{font-family:var(--mono)} .btn.xl{min-height:40px;padding:0 18px;font-size:14px} .btn .ic{width:14px;height:14px} .btn.ico{padding:0;width:26px;min-height:26px} -@media (pointer:coarse){.btn,.btn.sm,.btn.tiny{min-height:40px}.btn.ico{width:40px}} +@media (pointer:coarse){.btn,.btn.sm,.btn.tiny{min-height:40px}.btn.ico{width:40px}.js .sb-x{min-width:40px;min-height:40px;align-items:center;justify-content:center;margin:-10px -10px -10px 0}} button.lnk{background:none;border:0;padding:0;font:inherit;color:inherit;cursor:pointer} /* inputs: Studio's control fill and 6px corners; the border at 3:1 for contrast */ input[type=text],input[type=email],input[type=password],input[type=url],input[type=date],input[type=search],select,textarea{min-height:34px;width:100%;padding:0 12px;border-radius:6px;border:1px solid var(--line);background:var(--ctl);color:var(--ink);font:14px var(--sans)} @@ -426,17 +426,38 @@ main.wrap{flex:1;min-width:0} } @media (max-width:767px){ .sb-ib.sb-burger{display:inline-flex;margin-left:8px} + .sb-ib,.sb-av{flex:none} .sb-home{width:40px} - .sb-rail{position:fixed;left:0;top:48px;height:calc(100vh - 48px);width:0;z-index:60} - .sb-rail nav{width:0;padding:8px 0;border-right:0} - body.sb-open .sb-rail nav{width:240px;padding:8px;border-right:1px solid var(--rule);box-shadow:var(--shadow-r)} + .sb-rail{position:fixed;left:0;top:48px;height:calc(100vh - 48px);height:calc(100dvh - 48px);width:0;z-index:60} + .sb-rail nav{width:0;padding:8px 0;border-right:0;visibility:hidden;transition:width .15s ease,visibility 0s .15s} + body.sb-open .sb-rail nav{width:240px;padding:8px;border-right:1px solid var(--rule);box-shadow:var(--shadow-r);visibility:visible;transition:width .15s ease} .sb-cr .nm{max-width:120px} .sb-crumbs .bdg,.sb-fb{display:none} .sb-page{padding:20px 16px 48px} .sb-acts .btn span{display:none} .sb-acts .btn{padding:0 8px} } -@media (max-width:420px){.sb-crumbs .sb-org{display:none}.sb-crumbs .sb-org+.sb-div{display:none}} +/* the org switcher gives way on a phone; the divider before it goes too, the one before the project stays */ +@media (max-width:420px){.sb-crumbs .sb-org{display:none}.sb-crumbs>.sb-div:first-child{display:none}} +/* a phone: the header's groups closer together, so they fit from 360px without pushing the page sideways */ +@media (max-width:480px){.sb-top{gap:2px;padding-right:8px}.sb-acts{margin-left:4px;gap:4px}.sb-right{gap:2px}.sb-mid{padding:0 2px}} +/* the narrowest phones: the theme follows the phone's own setting, so its button gives its room to Sign in and the menus */ +@media (max-width:400px){.sb-right>span:first-child{display:none}} +/* a phone: the project's name gets the header's spare room (the live status stays on the overview), fields at 16px + so iOS does not zoom the page on focus, small labels at 12px, the rail's counts too */ +@media (max-width:560px){ + .sb-home{width:36px}.sb-ib.sb-burger{margin-left:6px} + .sb-acts .bdg{display:none} + .sb-cr .nm{max-width:none} + input[type=text],input[type=email],input[type=password],input[type=url],input[type=date],input[type=search],select,textarea{font-size:16px} + .bdg{font-size:12px;height:22px} + .sb-rail a .cnt{font-size:12px} +} +/* Sign in: its word, and on the narrowest phones its icon instead, so the project's name keeps some room */ +.sb-in .ic{display:none} +@media (max-width:360px){.sb-in .ic{display:block}.sb-in span{display:none}.btn.sb-in{padding:0 7px}} +/* the phone-only rail links (what the product menu holds there): the menu shows them from 901px */ +@media (min-width:901px){.sb-rail a.ph-only{display:none}} `; // --------------------------------------------------------------------------------------------- copy @@ -631,13 +652,16 @@ document.addEventListener("keydown", function(e){ } function place(){ if (!pop || !list[at]) return; - var s = list[at], vw = window.innerWidth, vh = window.innerHeight, pw = pop.offsetWidth, ph = pop.offsetHeight, x, y; + // the layout viewport's own size (window.innerWidth grows with a page wider than a phone's screen) + var s = list[at], de = document.documentElement, vw = de.clientWidth || window.innerWidth, vh = de.clientHeight || window.innerHeight, pw = pop.offsetWidth, ph = pop.offsetHeight, x, y; if (!s.n) { spot.className = "tour-spot mid"; spot.style.top = spot.style.left = "50%"; spot.style.width = spot.style.height = "0px"; pop.style.left = Math.max(16, (vw - pw) / 2) + "px"; pop.style.top = Math.max(16, (vh - ph) / 2) + "px"; return; } var r = s.n.getBoundingClientRect(), pad = 6; // the part of it on screen (a tall section is cut at the viewport) - var top = Math.max(r.top, 52), bottom = Math.min(r.bottom, vh - 8), left = Math.max(r.left, 0), right = Math.min(r.right, vw); + // (under the sticky header, unless the part is in the header) + var hd = document.querySelector(".sb-top"), hb = hd && !hd.contains(s.n) ? hd.getBoundingClientRect().bottom + 4 : 0; + var top = Math.max(r.top, hb), bottom = Math.min(r.bottom, vh - 8), left = Math.max(r.left, 0), right = Math.min(r.right, vw); spot.className = "tour-spot"; - spot.style.top = (top - pad) + "px"; spot.style.left = (left - pad) + "px"; spot.style.width = (right - left + pad * 2) + "px"; spot.style.height = Math.max(0, bottom - top + pad * 2) + "px"; + var st = Math.max(top - pad, 0); spot.style.top = st + "px"; spot.style.left = (left - pad) + "px"; spot.style.width = (right - left + pad * 2) + "px"; spot.style.height = Math.max(0, bottom + pad - st) + "px"; if (bottom - top > vh * 0.5) { // tall: beside it when there is room, else in its lower right corner if (vw - right > pw + 32) { x = right + 16; y = Math.min(Math.max(16, top + 24), vh - ph - 16); } @@ -663,7 +687,7 @@ document.addEventListener("keydown", function(e){ next.textContent = i === 0 ? "Show me" : last ? (s.connect ? "Connect my app" : "Done") : "Next"; if (s.n && s.n.scrollIntoView) { var r = s.n.getBoundingClientRect(); - try { s.n.scrollIntoView({ block: r.height > window.innerHeight * 0.5 ? "start" : "center" }); } catch (e) { try { s.n.scrollIntoView(); } catch (x) {} } + try { s.n.scrollIntoView({ block: r.height > (document.documentElement.clientHeight || window.innerHeight) * 0.5 ? "start" : "center" }); } catch (e) { try { s.n.scrollIntoView(); } catch (x) {} } } place(); setTimeout(place, 200); try { next.focus({ preventScroll: true }); } catch (e) {} @@ -722,6 +746,8 @@ export interface RailItem { current?: boolean; /** an element id for the link */ id?: string; + /** only in the rail below 901px, where the product menu that holds it is hidden; never in the command menu */ + phoneOnly?: boolean; } /** A product menu: a title and groups of links; `view` shows it only with that view (data-v). */ @@ -773,7 +799,7 @@ export interface StudioOptions { } const railLink = (r: RailItem): string => - `${icon(r.icon, 20)}${esc(r.label)}${ + `${icon(r.icon, 20)}${esc(r.label)}${ r.count ? `` : "" }`; @@ -836,7 +862,7 @@ function header(o: StudioOptions): string { "receipt", 14, )}Billing
` - : 'Sign in'; + : `${icon("user", 14)}Sign in`; return `
${MARK} @@ -867,7 +893,7 @@ function protectDialog(): string { function commandMenu(o: StudioOptions): string { const groups: Record = {}; const add = (g: string, label: string, href: string, ic: IconName) => (groups[g] ??= []).push(`
  • ${icon(ic, 16)}${esc(label)}
  • `); - for (const r of [...o.rail.flat(), ...(o.railEnd ?? [])]) add(o.project ? "Project" : "Organization", r.label, r.href, r.icon); + for (const r of [...o.rail.flat(), ...(o.railEnd ?? [])]) if (!r.phoneOnly) add(o.project ? "Project" : "Organization", r.label, r.href, r.icon); for (const m of o.menus ?? []) for (const g of m.groups) for (const i of g.items) add(m.title, i.label, i.href, i.icon ?? "file"); for (const c of o.commands ?? []) add(c.group, c.label, c.href, c.icon ?? "file"); for (const p of o.projects ?? []) add("Projects", p.name, `/account/apps/${p.id}`, "box"); diff --git a/telemetry-worker/test/pages.test.ts b/telemetry-worker/test/pages.test.ts index 9cd9406c..2cf455ec 100644 --- a/telemetry-worker/test/pages.test.ts +++ b/telemetry-worker/test/pages.test.ts @@ -555,7 +555,7 @@ describe("pages: the sign-in pages sit on genclass.dev's self-healing sphere, as // the column on the left, the sphere on the right; one column over a dimmed sphere on a phone const login = loginPage("n", { google: true, github: true, next: null }); expect(login).toContain("body.mesh main.wrap{max-width:none;margin:0;padding:0;display:grid;grid-template-columns:minmax(0,40%) 1fr;"); - expect(login).toContain("@media (max-width:900px){body.mesh main.wrap{grid-template-columns:1fr}"); + expect(login).toContain("@media (max-width:900px){body.mesh main.wrap{grid-template-columns:minmax(0,1fr)}"); }); it("the CSP allows the site's fonts and nothing more for scripts: the mesh loads by nonce", () => { diff --git a/telemetry-worker/test/plans.test.ts b/telemetry-worker/test/plans.test.ts index a95fc393..4635a968 100644 --- a/telemetry-worker/test/plans.test.ts +++ b/telemetry-worker/test/plans.test.ts @@ -475,7 +475,7 @@ describe("Pro (id team) is the one plan sold on the site, for the account; Enter expect(page).toContain(live ? "You are on the Free plan.

    " : "You are on the Free plan. Paid plans are not on sale yet.

    "); expect(page).toContain("grid-template-columns:repeat(3,minmax(0,1fr))"); expect(page).toContain('

    $15 / developer / month

    '); - expect(page).toContain("
  • Your team on it, $15 a developer
  • "); + expect(page).toMatch(/Your team on it, \$15 a developer<\/li>/); // folded behind "N more" on a phone only expect(page).toContain("
  • More than 3 apps
  • "); expect(page.match(/
  • Your own classifier/g)).toHaveLength(1); // bought for the account here, with how many developers (no project to choose first)