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

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

scout/forge:scout/13012-a-new-forge-s-empty-home-shows-one-sente → main 4 commits fork 2 threads · 2 unresolved

  • Merged. scout/13012-a-new-forge-s-empty-home-shows-one-sente was merged into main as 1670853.

Review

Sign in to review this change.
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 {
100100 }
101101
102102 /** 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 {
104104 return html`<section id="next-steps" data-first-tell>
105105 <h2>What do you want built?</h2>
106106 <form id="composer" class="stack" method="post" action="/tell">
@@ -110,7 +110,6 @@ function firstTell(ctx: Ctx, user: User, crew: Html[]): Html {
110110 </form>
111111 <p class="small muted" id="crew-credit-note">${crewFirstLine(ctx.app, ctx.auth.user?.isAdmin === true)}</p>
112112 ${secondPasskeyLine(ctx, user)}
113 ${crew.length > 0 ? html`<ul class="list">${crew}</ul>` : null}
114113 </section>`;
115114 }
116115
@@ -123,7 +122,7 @@ export async function nextStepsCard(
123122 if (!steps || steps.every((s) => s.done)) return null;
outdated

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.

124123 const repos = await spawnedRepos(ctx.app, user);
125124 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);
127126 const primary = steps.find((s) => !s.done)?.key;
128127 const ask = askStatus(ctx.app.db, await askRepos(ctx.app, user), user.id, crewCanRun(ctx.app), user.isAdmin === true);
129128 const others = ask?.state === "building" ? crewAtWork(ctx, besideAsk(repos, ask)) : crew;
@@ -137,18 +136,8 @@ export async function nextStepsCard(
137136 <form id="everyday-keep" method="post" action="/settings/everyday/keep" hidden></form>`,
138137 apps:
139138 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>`,
152141 tell: html`<p class="muted small">
153142 Say what you want in one sentence, in the box below; the crew takes it
154143 from there.
test/first-login.test.ts +7 −4
@@ -213,10 +213,11 @@ describe("the first login to a spawned forge", () => {
213213 expect(main).not.toContain("There is no password");
214214 expect(main).not.toContain("Make your everyday account");
215215 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");
220221 });
221222
222223 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", () => {
232233 expect(home).not.toContain('action="/settings/everyday"');
233234 expect(home.split("Make your everyday account").length - 1).toBe(1);
234235 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/);
235238 expect(home).not.toMatch(/class="[^"]*\bsteps\b/);
236239 expect(home).not.toMatch(/data-step[\s\S]{0,400}row-meta/);
237240 expect(home).toMatch(/<div class="step-body">\s*<p class="muted small">/);

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs