diff --git a/dashboard/e2e/landing-shots-prs.spec.ts b/dashboard/e2e/landing-shots-prs.spec.ts new file mode 100644 index 00000000..35cb2844 --- /dev/null +++ b/dashboard/e2e/landing-shots-prs.spec.ts @@ -0,0 +1,60 @@ +import { expect, test } from "@playwright/test"; +import { capture, prepare, SHOTS_DIR } from "./landing-shots-kit"; +import { mockOverview } from "./prs-overview-mock"; +import { hideDevOverlay, mockInbox, skipLanding } from "./inbox-data"; + +// The Pull requests pages, and the same list and a merge on a phone, for +// coderhelm.com, from the same made up data as prs.spec.ts, +// prs-overview.spec.ts and phone-inbox.spec.ts (team Acme, invented people). +// Only runs with LANDING_SHOTS_DIR set (see landing-shots-kit.ts). + +test.skip(!SHOTS_DIR, "LANDING_SHOTS_DIR not set"); +test.beforeEach(({ page }) => prepare(page)); + +test.describe("desktop", () => { + test.use({ deviceScaleFactor: 2, viewport: { width: 1280, height: 800 } }); + + // Wide enough for the list and the open pull request side by side. + test("prs: grouped by whose turn it is, one open beside the list", async ({ page }) => { + await page.setViewportSize({ width: 1440, height: 900 }); + await mockOverview(page, "normal"); + await page.goto("/prs?org=acme&pr=acme%2Fweb%23212"); + await expect(page.getByTestId("pr-row").first()).toBeVisible(); + await expect(page.getByRole("region", { name: "Path to merge" })).toBeVisible(); + await capture(page, "prs"); + }); + + test("prs-overview: the written summary of the org's pull requests", async ({ page }) => { + await mockOverview(page, "normal"); + await page.goto("/prs/overview?org=acme"); + await expect(page.getByTestId("overview-summary")).toBeVisible(); + // The page title and the summary, under the tabs. + await page.getByRole("heading", { level: 1 }).scrollIntoViewIfNeeded(); + await page.evaluate(() => window.scrollTo(0, 0)); + await capture(page, "prs-overview"); + }); +}); + +test.describe("phone", () => { + test.use({ deviceScaleFactor: 2, viewport: { width: 375, height: 812 } }); + + test("phone-prs: the Pull requests list above the bottom bar", async ({ page }) => { + await mockOverview(page, "normal"); + await skipLanding(page); + await page.goto("/prs?org=acme"); + await expect(page.getByTestId("pr-row").first()).toBeVisible(); + await expect(page.getByTestId("phone-bar")).toBeVisible(); + await capture(page, "phone-prs"); + }); + + test("phone-merge: merging a pull request from the phone", async ({ page }) => { + await mockInbox(page); + await hideDevOverlay(page); + await skipLanding(page); + await page.goto("/inbox/pr?repo=acme%2Fweb&number=812&run=run_m1"); + await expect(page.getByTestId("pr-verdict")).toContainText("Approved"); + await page.getByTestId("pr-actions").getByRole("button", { name: "Merge" }).click(); + await expect(page.getByRole("dialog", { name: "Merge #812?" })).toBeVisible(); + await capture(page, "phone-merge"); + }); +}); diff --git a/dashboard/scripts/home-shots.py b/dashboard/scripts/home-shots.py index 1c9f7d4b..604ea6c9 100644 --- a/dashboard/scripts/home-shots.py +++ b/dashboard/scripts/home-shots.py @@ -13,8 +13,9 @@ SIDEBAR = 504 # px at 2x: the dashboard's left menu -# site name: (raw file, crop) where crop is None for the full window, or -# "main" for the content area beside the menu, at 16:10. +# site name: (raw file, crop) where crop is None for the full window, +# "main" for the content area beside the menu, at 16:10, or "phone" for a +# whole phone screen, kept at its own width (750 at 2x). JOBS = { "hero": ("run.png", None), "hero-main": ("run.png", "main"), # the hero on phones, without the menu @@ -24,6 +25,10 @@ "release": ("release.png", "main"), "chat": ("chat.png", ("main", 270)), "app-map": ("app-map.png", None), + "prs": ("prs.png", "main"), + "prs-overview": ("prs-overview.png", "main"), + "phone-prs": ("phone-prs.png", "phone"), + "phone-merge": ("phone-merge.png", "phone"), } only = set(sys.argv[3:]) @@ -35,6 +40,12 @@ print(f"{name}: missing {src}") continue im = Image.open(p).convert("RGB") + if crop == "phone": + im.save(out / f"{name}-{im.width}.webp", "WEBP", quality=82, method=6) + im.save(out / f"{name}-{im.width}.avif", "AVIF", quality=60, speed=4) + im.quantize(colors=256, method=Image.Quantize.MEDIANCUT, dither=Image.Dither.NONE).save(out / f"{name}.png", optimize=True) + print(f"{name}: width {im.width} height {im.height}") + continue if crop: top = crop[1] if isinstance(crop, tuple) else 0 w = im.width - SIDEBAR diff --git a/docs/components/home.tsx b/docs/components/home.tsx index 185c0d6e..9dfec742 100644 --- a/docs/components/home.tsx +++ b/docs/components/home.tsx @@ -1,6 +1,6 @@ import Link from 'next/link'; import type { ReactNode } from 'react'; -import { BookOpen, Bot, Cloud, Code, KeyRound, MessagesSquare, Server, ShieldCheck, Sparkles, Wrench } from 'lucide-react'; +import { BookOpen, Bot, ChartColumn, Cloud, Code, GitPullRequest, KeyRound, MessagesSquare, Server, ShieldCheck, Smartphone, Sparkles, Wrench } from 'lucide-react'; // The docs home: three paths (use it, self-host it, build on it), then the // newest features and the topics. The text stays in the MDX, so the page's @@ -9,9 +9,12 @@ import { BookOpen, Bot, Cloud, Code, KeyRound, MessagesSquare, Server, ShieldChe const ICONS = { bot: Bot, book: BookOpen, + chart: ChartColumn, cloud: Cloud, code: Code, key: KeyRound, + phone: Smartphone, + pr: GitPullRequest, chat: MessagesSquare, server: Server, shield: ShieldCheck, diff --git a/docs/content/docs/getting-started/index.mdx b/docs/content/docs/getting-started/index.mdx index a6ab9726..927aeba9 100644 --- a/docs/content/docs/getting-started/index.mdx +++ b/docs/content/docs/getting-started/index.mdx @@ -71,6 +71,7 @@ Open **Runs** in the dashboard. The run moves through Triage, Plan, Build, Test, ## Next steps - [Connect Atlassian](/getting-started/atlassian) to start runs from Jira tickets and read Confluence pages. +- Open [Pull requests](/getting-started/pull-requests) to see every open pull request by whose turn it is, and its [overview](/getting-started/pull-requests-overview) for how your org's pull requests are moving. On a phone, you can [answer, approve and merge](/concepts/phone) from the same dashboard. - Turn on the [PR reviewer](/getting-started/reviewer) for your team's own pull requests, or let [Setup](/getting-started/setup) recommend its settings for each repository. - Turn on [security fixes](/getting-started/security-fixes) for the advisories your code reaches, [infrastructure vulnerabilities](/getting-started/infrastructure-vulnerabilities) for what you run on AWS, and [stale pull requests](/getting-started/stale-pull-requests) to close the ones nobody is working on. - Add a [knowledge base](/concepts/knowledge) so Chat and the agents can search your specs and runbooks. diff --git a/docs/content/docs/index.mdx b/docs/content/docs/index.mdx index a4905e77..9a049469 100644 --- a/docs/content/docs/index.mdx +++ b/docs/content/docs/index.mdx @@ -15,6 +15,8 @@ CoderHelm is an engineering platform for teams on GitHub and Jira. Assign it an - [Connect Atlassian (Jira and Confluence)](/getting-started/atlassian) - [Set up repos](/getting-started/setup) - [Your first run](/getting-started/first-run) +- [Pull requests](/getting-started/pull-requests) +- [Pull requests overview](/getting-started/pull-requests-overview) - [Turn on the reviewer](/getting-started/reviewer) - [Security fixes](/getting-started/security-fixes) - [Infrastructure vulnerabilities](/getting-started/infrastructure-vulnerabilities) @@ -48,6 +50,16 @@ Releases are published on [GitHub](https://github.com/CoderHelm/coderhelm-platfo ## New in CoderHelm +{/* TODO(for-you): add a "For you" tile first when it ships (dashboard #547, platform #990). It covers the phone too, so the phone tile below then points to it. */} + +A written summary of all your org's pull requests: what went stale, what failed, whether review happened and what needs attention, measured against your org's own history. + + +Every open pull request grouped by whose turn it is, with what each needs and from whom, its path to merge, saved views and keyboard shortcuts. + + +Answer CoderHelm's questions, approve and merge, or hand a failing check back to CoderHelm, from the bottom bar. + Do it for me reads each repository and turns on what fits, with the reason for each. Your settings stay, and any change can be undone. diff --git a/e2e/landing.spec.ts b/e2e/landing.spec.ts index b714ae91..3ec1d90c 100644 --- a/e2e/landing.spec.ts +++ b/e2e/landing.spec.ts @@ -16,6 +16,7 @@ for (const width of widths) { const headings = await page.locator("main h2").allTextContents(); expect(headings).toEqual([ "What the platform does", + "Every open pull request, and whose turn it is", "From ticket to pull request", "An example pull request", "After the pull request opens", @@ -72,6 +73,26 @@ test("each part of the platform has its own screenshot, sized and lazy", async ( } }); +test("every open pull request: the overview, the list and the phone, each linked to its docs", async ({ page }) => { + await page.goto("/"); + const s = page.locator("#pull-requests"); + await expect(s.locator("h3")).toHaveText(["Pull requests overview", "Pull requests list", "From your phone"]); + await expect(s.getByRole("link", { name: "Pull requests overview" })).toHaveAttribute("href", "https://docs.coderhelm.com/getting-started/pull-requests-overview/"); + await expect(s.getByRole("link", { name: "Pull requests list" })).toHaveAttribute("href", "https://docs.coderhelm.com/getting-started/pull-requests/"); + await expect(s.getByRole("link", { name: "From your phone" })).toHaveAttribute("href", "https://docs.coderhelm.com/concepts/phone/"); + // Two desktop screens and two phone screens, each described and loading. + const imgs = s.locator("img"); + await expect(imgs).toHaveCount(4); + for (const img of await imgs.all()) { + expect((await img.getAttribute("alt"))?.length ?? 0).toBeGreaterThan(30); + await expect(img).toHaveAttribute("loading", "lazy"); + await img.scrollIntoViewIfNeeded(); + await expect.poll(() => img.evaluate((el) => (el as HTMLImageElement).naturalWidth)).toBeGreaterThan(0); + } + // The phone's Inbox is not named on the page. + expect(await s.innerText()).not.toMatch(/\bInbox\b/); +}); + test("every section shares one container width", async ({ page }) => { await page.setViewportSize({ width: 1440, height: 900 }); await page.goto("/"); diff --git a/public/shots/home/phone-merge-750.avif b/public/shots/home/phone-merge-750.avif new file mode 100644 index 00000000..21fa5460 Binary files /dev/null and b/public/shots/home/phone-merge-750.avif differ diff --git a/public/shots/home/phone-merge-750.webp b/public/shots/home/phone-merge-750.webp new file mode 100644 index 00000000..466992a3 Binary files /dev/null and b/public/shots/home/phone-merge-750.webp differ diff --git a/public/shots/home/phone-merge.png b/public/shots/home/phone-merge.png new file mode 100644 index 00000000..d77fa26c Binary files /dev/null and b/public/shots/home/phone-merge.png differ diff --git a/public/shots/home/phone-prs-750.avif b/public/shots/home/phone-prs-750.avif new file mode 100644 index 00000000..1befd949 Binary files /dev/null and b/public/shots/home/phone-prs-750.avif differ diff --git a/public/shots/home/phone-prs-750.webp b/public/shots/home/phone-prs-750.webp new file mode 100644 index 00000000..7d1661a6 Binary files /dev/null and b/public/shots/home/phone-prs-750.webp differ diff --git a/public/shots/home/phone-prs.png b/public/shots/home/phone-prs.png new file mode 100644 index 00000000..e6aa7a88 Binary files /dev/null and b/public/shots/home/phone-prs.png differ diff --git a/public/shots/home/prs-1280.avif b/public/shots/home/prs-1280.avif new file mode 100644 index 00000000..a445186e Binary files /dev/null and b/public/shots/home/prs-1280.avif differ diff --git a/public/shots/home/prs-1280.webp b/public/shots/home/prs-1280.webp new file mode 100644 index 00000000..f6f5092d Binary files /dev/null and b/public/shots/home/prs-1280.webp differ diff --git a/public/shots/home/prs-2400.avif b/public/shots/home/prs-2400.avif new file mode 100644 index 00000000..e511fda8 Binary files /dev/null and b/public/shots/home/prs-2400.avif differ diff --git a/public/shots/home/prs-2400.webp b/public/shots/home/prs-2400.webp new file mode 100644 index 00000000..e5ade6fd Binary files /dev/null and b/public/shots/home/prs-2400.webp differ diff --git a/public/shots/home/prs-overview-1280.avif b/public/shots/home/prs-overview-1280.avif new file mode 100644 index 00000000..5c2ee94e Binary files /dev/null and b/public/shots/home/prs-overview-1280.avif differ diff --git a/public/shots/home/prs-overview-1280.webp b/public/shots/home/prs-overview-1280.webp new file mode 100644 index 00000000..f471c759 Binary files /dev/null and b/public/shots/home/prs-overview-1280.webp differ diff --git a/public/shots/home/prs-overview-2400.avif b/public/shots/home/prs-overview-2400.avif new file mode 100644 index 00000000..1798f713 Binary files /dev/null and b/public/shots/home/prs-overview-2400.avif differ diff --git a/public/shots/home/prs-overview-2400.webp b/public/shots/home/prs-overview-2400.webp new file mode 100644 index 00000000..138d5d2f Binary files /dev/null and b/public/shots/home/prs-overview-2400.webp differ diff --git a/public/shots/home/prs-overview.png b/public/shots/home/prs-overview.png new file mode 100644 index 00000000..ea35fa31 Binary files /dev/null and b/public/shots/home/prs-overview.png differ diff --git a/public/shots/home/prs.png b/public/shots/home/prs.png new file mode 100644 index 00000000..3ab06588 Binary files /dev/null and b/public/shots/home/prs.png differ diff --git a/src/app/page.tsx b/src/app/page.tsx index f05ab8c3..31fcbf2d 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -106,15 +106,7 @@ function Platform() { )} -

- {p.href ? ( - - {p.title} - - ) : ( - p.title - )} -

+

@@ -126,6 +118,76 @@ function Platform() { ); } +// The title of a part, a link when it has its own page. +function PartTitle({ title, href }: { title: string; href?: string }) { + return ( +

+ {href ? ( + + {title} + + ) : ( + title + )} +

+ ); +} + +// Every open pull request: the overview and the list as two screens, then the +// phone as its own row, its words beside two phone screens. +function PullRequests() { + const s = section("pull-requests"); + const intro = first(s, "p"); + const parts = first(s, "cards").items; + const wide = parts.filter((p) => !p.also); + const phone = parts.find((p) => p.also); + return ( +
+
+

+

+ +

+
    + {wide.map((p) => ( +
  • + {p.shot && ( +
    + +
    + )} + +

    + +

    +
  • + ))} +
+ {phone && ( +
+
+ +

+ +

+
+
+ {[phone.shot, phone.also].map( + (id) => + id && ( +
+ +
+ ), + )} +
+
+ )} +

+
+ ); +} + // Heading on the left, the four steps as a plain numbered list on the right. function HowItWorks() { const s = section("how-it-works"); @@ -287,6 +349,7 @@ export default function Home() { + diff --git a/src/components/ProductShot.tsx b/src/components/ProductShot.tsx index 589ece90..9b51dc9b 100644 --- a/src/components/ProductShot.tsx +++ b/src/components/ProductShot.tsx @@ -9,7 +9,7 @@ export function ProductShot({ id, sizes, priority = false, className = "" }: { i const s = SHOTS[id]; const img = s.desktop; const base = img.src.replace(/\.png$/, ""); - const set = (ext: string) => `${base}-1280.${ext} 1280w, ${base}-2400.${ext} ${s.large ?? 2400}w`; + const set = (ext: string) => (s.only ? `${base}-${s.only}.${ext} ${s.only}w` : `${base}-1280.${ext} 1280w, ${base}-2400.${ext} ${s.large ?? 2400}w`); // Phones get a crop without the dashboard's menu, so the words stay readable. const phoneBase = s.phone?.src.replace(/\.png$/, ""); const phoneSet = (ext: string) => `${phoneBase}-1280.${ext} 1280w`; diff --git a/src/content/shots.ts b/src/content/shots.ts index 11efbf81..330597cf 100644 --- a/src/content/shots.ts +++ b/src/content/shots.ts @@ -12,7 +12,11 @@ type Img = { src: string; width: number; height: number }; // e2e/landing-shots-*.spec.ts, made by dashboard/scripts/home-shots.py into `.png` // (1280 wide), `-1280.{avif,webp}` and `-2400.{avif,webp}`, the // larger one `large` pixels wide. Cropped ones leave out the dashboard's menu. -type Shot = { alt: string; desktop: Img; phone?: Img; large?: number }; +// `only` is a picture made at one width alone (`-.{avif,webp}`), +// as the phone screens are. +type Shot = { alt: string; desktop: Img; phone?: Img; large?: number; only?: number }; + +const phoneScreen = (name: string, alt: string): Shot => ({ alt, only: 750, desktop: { src: `/shots/home/${name}.png`, width: 750, height: 1624 } }); const home = (name: string, alt: string, large = 2056): Shot => ({ alt, large, desktop: { src: `/shots/home/${name}.png`, width: 1280, height: 800 } }); @@ -58,5 +62,9 @@ export const SHOTS: Record = { homeAlert: home("alert", "A checkout 5xx incident in acme/api on the Logs page: its cause, a payments timeout lowered to 2 seconds, the checks CoderHelm ran, and fix pull request #482 waiting for a person's review."), homeRelease: home("release", "The Releases page with acme/api v3.8.0 open: published to GitHub, Confluence and email, and its release notes listing five pull requests."), homeChat: home("chat", "CoderHelm Chat answering how checkout talks to the payments service in four numbered steps, each citing a file, above the list of cited source files from acme/web and acme/api."), + homePrs: home("prs", "The Pull requests list for team Acme, grouped by whose turn it is: two waiting on you, each with one sentence on what it needs, and acme/web #212 open beside the list, where CoderHelm is fixing a failing lint check, above its path to merge."), + homePrsOverview: home("prs-overview", "The Pull requests overview for team Acme: Healthy, 38 merged in the usual range and a shorter median time to merge, tiles for stale, failures and reviewed, and three pull requests that need attention, each with an owner and an age."), + homePhonePrs: phoneScreen("phone-prs", "The Pull requests list on a phone, grouped by whose turn it is, above the bottom bar that keeps runs, pull requests and Chat in reach."), + homePhoneMerge: phoneScreen("phone-merge", "Merging acme/web #812 from a phone: a sheet that says the checks pass and nothing blocks it, with Merge on GitHub."), homeAppMap: home("app-map", "The App map of an online store: the website, API, payments service, background jobs, data stores and outside services as cards joined by lines, with its journeys and screens listed beside them.", 2400), }; diff --git a/src/content/site.ts b/src/content/site.ts index 787829a4..7b345f2c 100644 --- a/src/content/site.ts +++ b/src/content/site.ts @@ -117,6 +117,25 @@ const home: Page = { }, ], }, + { + id: "pull-requests", + heading: "Every open pull request, and whose turn it is", + blocks: [ + { + type: "p", + text: "People's, bots' and CoderHelm's, in every repository it is installed on. Each one says what it needs next and from whom.", + }, + { + type: "cards", + items: [ + { title: "Pull requests overview", text: "A written summary of your org's pull requests: what went stale, what failed, whether review happened, and what needs attention, with an owner and an age for each. Waits are compared with your org's own history, not someone else's.", href: `${SITE.docsUrl}/getting-started/pull-requests-overview/`, shot: "homePrsOverview" }, + { title: "Pull requests list", text: "Every open pull request grouped by whose turn it is, with one sentence on what it needs and from whom. Open one for its path to merge, where its time went and its timeline. Saved views and keyboard shortcuts keep it quick.", href: `${SITE.docsUrl}/getting-started/pull-requests/`, shot: "homePrs" }, + { title: "From your phone", text: "Answer CoderHelm's questions, approve and merge from your phone, or hand a failing check back to CoderHelm. The bottom bar keeps runs, pull requests and Chat in reach.", href: `${SITE.docsUrl}/concepts/phone/`, shot: "homePhonePrs", also: "homePhoneMerge" }, + // TODO(for-you): add the "For you" card here when it ships (dashboard #547, platform #990). It covers the desktop and the phone, so the phone card above then points to it. + ], + }, + ], + }, { id: "how-it-works", heading: "From ticket to pull request", diff --git a/src/content/types.ts b/src/content/types.ts index 4b4c0527..ccec3742 100644 --- a/src/content/types.ts +++ b/src/content/types.ts @@ -37,7 +37,12 @@ export type ShotId = | "homeAlert" | "homeRelease" | "homeChat" - | "homeAppMap"; + | "homeAppMap" + | "homePrs" + | "homePrsOverview" + // Phone screens, kept at their own width (750 at 2x) with no crop. + | "homePhonePrs" + | "homePhoneMerge"; // A real pull request CoderHelm opened in a public repository, quoted word // for word: the review thread and the commits, with links to check them. @@ -55,7 +60,8 @@ export type Block = | { type: "p"; text: string } | { type: "list"; items: string[] } | { type: "steps"; items: { title: string; text: string }[] } - | { type: "cards"; items: { title: string; text: string; href?: string; shot?: ShotId }[] } + // `also` is a second picture shown beside `shot`, such as two phone screens. + | { type: "cards"; items: { title: string; text: string; href?: string; shot?: ShotId; also?: ShotId }[] } | { type: "faq"; items: { q: string; a: string }[] } | { type: "table"; head: string[]; rows: string[][] } | { type: "pr"; pr: PullRequest }