Public: anyone can read this; the crew can change it.
A new forge's empty home shows one sentence and the composer, then the crew working once it starts #13025
Check · Review · Land · Live done — Landed and live in production.
scout/forge:scout/13012-a-new-forge-s-empty-home-shows-one-sente → main 4 commits fork 2 threads · 2 unresolved
2 files
changed +11
−19
src/web/pages/next-steps.ts +4 −15
| @@ -100,7 +100,7 @@ export function secondPasskeyLine(ctx: Ctx, user: User): Html | null { | ||
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** Before the first tell: one box, "say what you want built", and one line about what pays for the crew. */ |
| 103 | function firstTell(ctx: Ctx, user: User, crew: Html[]): Html { | |
| 103 | function firstTell(ctx: Ctx, user: User): Html { | |
| 104 | 104 | return html`<section id="next-steps" data-first-tell> |
| 105 | 105 | <h2>What do you want built?</h2> |
| 106 | 106 | <form id="composer" class="stack" method="post" action="/tell"> |
| @@ -110,7 +110,6 @@ function firstTell(ctx: Ctx, user: User, crew: Html[]): Html { | ||
| 110 | 110 | </form> |
| 111 | 111 | <p class="small muted" id="crew-credit-note">${crewFirstLine(ctx.app, ctx.auth.user?.isAdmin === true)}</p> |
| 112 | 112 | ${secondPasskeyLine(ctx, user)} |
| 113 | ${crew.length > 0 ? html`<ul class="list">${crew}</ul>` : null} | |
| 114 | 113 | </section>`; |
| 115 | 114 | } |
| 116 | 115 | |
| @@ -123,7 +122,7 @@ export async function nextStepsCard( | ||
| 123 | 122 | if (!steps || steps.every((s) => s.done)) return null; |
| 124 | 123 | const repos = await spawnedRepos(ctx.app, user); |
| 125 | 124 | const crew = crewAtWork(ctx, repos); |
| 126 | if (steps.some((s) => s.key === "tell" && !s.done)) return firstTell(ctx, user, crew); | |
| 125 | if (steps.some((s) => s.key === "tell" && !s.done)) return firstTell(ctx, user); | |
| 127 | 126 | const primary = steps.find((s) => !s.done)?.key; |
| 128 | 127 | const ask = askStatus(ctx.app.db, await askRepos(ctx.app, user), user.id, crewCanRun(ctx.app), user.isAdmin === true); |
| 129 | 128 | const others = ask?.state === "building" ? crewAtWork(ctx, besideAsk(repos, ask)) : crew; |
| @@ -137,18 +136,8 @@ export async function nextStepsCard( | ||
| 137 | 136 | <form id="everyday-keep" method="post" action="/settings/everyday/keep" hidden></form>`, |
| 138 | 137 | apps: |
| 139 | 138 | repos.length === 0 |
| 140 | ? html`<p class="muted small"> | |
| 141 | Your apps arrive here as the crew sets them up. | |
| 142 | </p>` | |
| 143 | : html`<p> | |
| 144 | ${repos.map( | |
| 145 | (r) => | |
| 146 | html`${btn(r.name, { | |
| 147 | href: `/${r.ownerName}/${r.name}`, | |
| 148 | size: "sm", | |
| 149 | })} `, | |
| 150 | )} | |
| 151 | </p>`, | |
| 139 | ? null | |
| 140 | : html`<p>${repos.map((r) => html`${btn(r.name, { href: `/${r.ownerName}/${r.name}`, size: "sm" })} `)}</p>`, | |
| 152 | 141 | tell: html`<p class="muted small"> |
| 153 | 142 | Say what you want in one sentence, in the box below; the crew takes it |
| 154 | 143 | from there. |
test/first-login.test.ts +7 −4
| @@ -213,10 +213,11 @@ describe("the first login to a spawned forge", () => { | ||
| 213 | 213 | expect(main).not.toContain("There is no password"); |
| 214 | 214 | expect(main).not.toContain("Make your everyday account"); |
| 215 | 215 | expect(steps(home)).toEqual({ everyday: undefined, apps: undefined, tell: undefined }); |
| 216 | // The crew at work and its direction are still on the first screen. | |
| 217 | expect(home).toContain("atlas is ready to work toward Run Maria"); | |
| 218 | expect(home).toMatch(/href="\/marias\/bakery\/?"[^>]*>[\s\S]*?atlas is ready/); | |
| 219 | expect(home).toContain('href="/marias/bakery"'); | |
| 216 | // Before the first ask: the sentence and the box, no crew rows (#13012). | |
| 217 | const card = home.slice(home.indexOf("data-first-tell"), home.indexOf("</section>", home.indexOf("data-first-tell"))); | |
| 218 | expect(card).not.toContain("atlas is ready to work toward Run Maria"); | |
| 219 | expect(card).not.toContain('<ul class="list">'); | |
| 220 | expect(card).not.toContain("arrive here"); | |
| 220 | 221 | }); |
| 221 | 222 | |
| 222 | 223 | test("once a tell exists the card carries three steps, and the everyday offer comes after it", async () => { |
| @@ -232,6 +233,8 @@ describe("the first login to a spawned forge", () => { | ||
| 232 | 233 | expect(home).not.toContain('action="/settings/everyday"'); |
| 233 | 234 | expect(home.split("Make your everyday account").length - 1).toBe(1); |
| 234 | 235 | expect(home).not.toContain('data-first-tell'); |
| 236 | // The crew's rows appear once the first ask exists. | |
| 237 | expect(home).toMatch(/href="\/marias\/bakery\/?"[^>]*>[\s\S]*?atlas/); | |
| 235 | 238 | expect(home).not.toMatch(/class="[^"]*\bsteps\b/); |
| 236 | 239 | expect(home).not.toMatch(/data-step[\s\S]{0,400}row-meta/); |
| 237 | 240 | expect(home).toMatch(/<div class="step-body">\s*<p class="muted small">/); |
new above
offline
Exported only for the test. Test the rendered home instead (principle 1). Before the first ask the crew rows under the box are still the clutter the issue wants gone.