Public: anyone can read this; the crew can change it.
The signed-in home speaks the public home page's language, with looks before and after #9610
scout/forge:scout/9584-the-signed-in-home-speaks-the-public-hom → main 2 commits fork
2 files
changed +30
−10
src/web/studio/living.ts +14 −10
| @@ -14,7 +14,7 @@ import type { User } from "../../core/users.ts"; | ||
| 14 | 14 | import type { Ctx } from "../../http/context.ts"; |
| 15 | 15 | import { html, type Html } from "../html.ts"; |
| 16 | 16 | import { fragment } from "../layout.ts"; |
| 17 | import { btn, listCard, row, timeAgo } from "../ui.ts"; | |
| 17 | import { btn, row, timeAgo } from "../ui.ts"; | |
| 18 | 18 | import { notePhase, takeSessionTime, timePhase } from "../../core/route_timing.ts"; |
| 19 | 19 | import type { NowStage } from "../../flow/now_rows.ts"; |
| 20 | 20 | import { nowHref } from "../pages/now.ts"; |
| @@ -67,7 +67,9 @@ function listOf(label: string, rows: readonly MovingRow[], empty: string): Html | ||
| 67 | 67 | shown.push(row({ title: html`<span class="muted small">${i === 0 ? empty : " "}</span>` })); |
| 68 | 68 | return html`<section aria-label="${label}"> |
| 69 | 69 | <h2 class="small muted">${label}</h2> |
| 70 | ${listCard(shown)} | |
| 70 | <ul class="list"> | |
| 71 | ${shown} | |
| 72 | </ul> | |
| 71 | 73 | </section>`; |
| 72 | 74 | } |
| 73 | 75 | |
| @@ -114,9 +116,11 @@ export function tellBox(ctx: Ctx, user: User): Html { | ||
| 114 | 116 | <option value="${FORGE_TARGET}">the forge</option> |
| 115 | 117 | </select>`} |
| 116 | 118 | ${btn("Tell", { variant: "primary" })} |
| 117 | ${btn("Notes", { href: "/notes", icon: "comment", title: "Your notes and where they stand" })} | |
| 118 | ${btn("Talk", { href: "/talk", icon: "comment", title: "Talk to the forge" })} | |
| 119 | </form>`; | |
| 119 | </form> | |
| 120 | <p class="small muted"> | |
| 121 | <a href="/notes" title="Your notes and where they stand">Notes</a> · | |
| 122 | <a href="/talk" title="Talk to the forge">Talk</a> | |
| 123 | </p>`; | |
| 120 | 124 | } |
| 121 | 125 | |
| 122 | 126 | /** Your apps as chips, each a link to the app, and a plus for a new one. */ |
| @@ -124,11 +128,11 @@ export function appChips(ctx: Ctx, user: User): Html { | ||
| 124 | 128 | const { repos } = writableAppsOf(ctx, user); |
| 125 | 129 | return html`<section aria-label="Your apps" id="live-chips" data-live="app.serving,app.stopped,app.created,app.deleted" data-live-src="/live/chips"> |
| 126 | 130 | <h2 class="small muted">Your apps</h2> |
| 127 | <div class="bar"> | |
| 128 | ${repos.slice(0, 12).map((r) => btn(r.name, { href: repoBase(r), size: "sm" }))} | |
| 129 | ${btn("New app", { href: "/apps/new", size: "sm", icon: "plus" })} | |
| 130 | ${repos.length > 12 ? btn(`All ${repos.length}`, { href: "/apps", size: "sm" }) : null} | |
| 131 | </div> | |
| 131 | <p class="bar small"> | |
| 132 | ${repos.slice(0, 12).map((r) => html`<a href="${repoBase(r)}">${r.name}</a>`)} | |
| 133 | <a href="/apps/new">New app</a> | |
| 134 | ${repos.length > 12 ? html`<a href="/apps">All ${repos.length}</a>` : null} | |
| 135 | </p> | |
| 132 | 136 | </section>`; |
| 133 | 137 | } |
| 134 | 138 |
test/home-living.test.ts +16
| @@ -215,4 +215,20 @@ describe("the feed page", () => { | ||
| 215 | 215 | const stranger = await get("/feed"); |
| 216 | 216 | expect(stranger.status).not.toBe(200); |
| 217 | 217 | }); |
| 218 | ||
| 219 | test("the home speaks in rows and plain links, not boxes and button strips (#9584)", async () => { | |
| 220 | const page = await home(aliceCookie); | |
| 221 | // The tell box has one button; Notes and Talk are muted links. | |
| 222 | const form = /<form id="tell-box"[\s\S]*?<\/form>/.exec(page)![0]; | |
| 223 | expect(form).not.toContain('href="/notes"'); | |
| 224 | expect(page).toMatch(/<p class="small muted">\s*<a href="\/notes"[^>]*>Notes<\/a>/); | |
| 225 | // Your apps are links, not chips with buttons. | |
| 226 | const apps = /<section aria-label="Your apps"[\s\S]*?<\/section>/.exec(page)![0]; | |
| 227 | expect(apps).not.toContain('class="btn'); | |
| 228 | expect(apps).toContain('href="/apps/new"'); | |
| 229 | // The moving lists are rows, not a card. | |
| 230 | const moving = /<section aria-label="Being built">[\s\S]*?<\/section>/.exec(page)![0]; | |
| 231 | expect(moving).toContain('<ul class="list">'); | |
| 232 | expect(moving).not.toContain('class="card'); | |
| 233 | }); | |
| 218 | 234 | }); |
new above
offline