#!/usr/bin/env python3 """Build UI-REVIEW.pdf from walkthrough screenshots + report text.""" from __future__ import annotations from pathlib import Path from reportlab.lib import colors from reportlab.lib.enums import TA_LEFT from reportlab.lib.pagesizes import letter from reportlab.lib.styles import ParagraphStyle, getSampleStyleSheet from reportlab.lib.units import inch from reportlab.platypus import ( Image, PageBreak, Paragraph, SimpleDocTemplate, Spacer, Table, TableStyle, ) ROOT = Path(__file__).resolve().parents[1] SHOTS = ROOT / "screenshots" OUT = ROOT / "UI-REVIEW.pdf" ACCENT = colors.HexColor("#4f46e5") INK = colors.HexColor("#171a26") MUTED = colors.HexColor("#6b7186") PAGES = [ ("01-console-fleet.png", "Operator console — Fleet", "Open http://127.0.0.1:3850/. Role chips replace the truncated text field. Power is a status (on / paused / off), not a toggle. Replica and service actions live in the overflow menu."), ("01b-console-fleet-overflow.png", "Fleet — replica overflow", "Click the overflow control on a replica. Pause, resume, and restart are in one menu. Confirm still guards restart."), ("02-console-trace.png", "Operator console — Trace", "Trace tab. Orange box is fault inject only. Run step, then read hops on the right."), ("02b-console-trace-run.png", "Trace after a run", "Hop names wrap. Module column no longer clips. Monitors sit under the console."), ("03-console-docs.png", "Operator console — Docs", "Docs are cards matching Fleet, grouped High-level / Architecture / Remaining."), ("04-simulator.png", "Standalone simulator", "http://127.0.0.1:3847/ uses the indigo shell. Orange is the Inject faults panel only."), ("04b-simulator-run.png", "Simulator after a run", "Same hop grid as the console Trace tab. Run step or a scenario button."), ("05-cs.png", "Customer service — review", "http://127.0.0.1:3011/. Enter a customer id, Review account. Amounts are dollars."), ("05-cs-credit.png", "Customer service — credit applied", "Amount (USD) 5.00 → Apply credit. Prepaid and the credits table update in dollars."), ("06-sales.png", "Sales — review", "http://127.0.0.1:3012/. Review account or Show quote. Quote is a named card, not a JSON dump."), ("07-accounting.png", "Accounting — review", "http://127.0.0.1:3013/. Review plus QuickBooks IIF / CSV export buttons."), ("08-access-staff.png", "Staff access plane", "http://127.0.0.1:3025/. Same indigo review/credit UI after authz."), ("09-admin-login.png", "Admin — sign in", "http://127.0.0.1:3000/admin/. Seed user admin / admin-dev-key."), ("10-admin-rate-card.png", "Admin — rate card", "Landing tab after sign-in. Per-endpoint list prices."), ("12-admin-customers.png", "Admin — customers list", "Read-only table: name, email, type, billing. Edit opens the drawer."), ("12b-admin-customer-drawer.png", "Admin — edit customer drawer", "Change email, type, multiplier override, billing. Save or Cancel."), ("14-admin-invoices.png", "Admin — invoices empty state", "Illustrated empty state until a period is generated."), ("16-portal-login.png", "Portal — sign in / create account", "http://127.0.0.1:3000/portal/. Create an account or sign in."), ("17-portal-dashboard.png", "Portal — dashboard", "API key is masked. Reveal, Copy, or Regenerate. Copy puts the full key on the clipboard."), ("18-portal-invoices-empty.png", "Portal — no invoices yet", "Empty-state illustration instead of a blank table row."), ("19-portal-statement.png", "Portal — statement", "Prepaid, credits, usage, payments in dollars."), ("20-portal-api-pricing.png", "Portal — API & pricing", "Notes that /docs is stock Swagger UI, not a designed customer surface."), ("21-swagger-stock.png", "Swagger /docs (stock)", "Left as vendor Swagger. Do not treat it as the customer portal."), ("22-catalog.png", "PDF catalog", "https://zapier.georgelambert.org/ uses system-ui on the indigo header, not Georgia."), ] def styles(): base = getSampleStyleSheet() return { "cover": ParagraphStyle("cover", parent=base["Title"], textColor=ACCENT, fontSize=22, leading=26, spaceAfter=12), "h1": ParagraphStyle("h1", parent=base["Heading1"], textColor=ACCENT, fontSize=16, leading=20, spaceBefore=8, spaceAfter=8), "h2": ParagraphStyle("h2", parent=base["Heading2"], textColor=INK, fontSize=13, leading=16, spaceBefore=6, spaceAfter=4), "body": ParagraphStyle("body", parent=base["BodyText"], textColor=INK, fontSize=10, leading=13, alignment=TA_LEFT, spaceAfter=6), "muted": ParagraphStyle("muted", parent=base["BodyText"], textColor=MUTED, fontSize=9, leading=12, spaceAfter=8), "cap": ParagraphStyle("cap", parent=base["BodyText"], textColor=MUTED, fontSize=8, leading=11, spaceAfter=10), } def header_footer(canvas, doc): canvas.saveState() canvas.setFillColor(ACCENT) canvas.rect(0, letter[1] - 18, letter[0], 18, fill=1, stroke=0) canvas.setFillColor(colors.white) canvas.setFont("Helvetica", 8) canvas.drawString(0.75 * inch, letter[1] - 13, "Verae Time x Zapier · UI review") canvas.setFillColor(MUTED) canvas.drawRightString(letter[0] - 0.75 * inch, 0.45 * inch, f"{doc.page}") canvas.restoreState() def p(text, style): return Paragraph(text.replace("&", "&"), style) def main(): s = styles() story = [] story.append(p("UI review report", s["cover"])) story.append(p("Walkthrough, screenshots, usage, remaining issues, and suggested improvements.", s["muted"])) story.append(p("Captured 2026-09-11. Browser console: no application errors after favicon data-URI (catalog static server still 404s a missing favicon.ico until the next full site deploy).", s["body"])) story.append(p("What was fixed in this pass", s["h1"])) items = [ "CS / sales / accounting / access-staff restyled to the portal indigo system. Dollars and names, not cents forms.", "Fleet replica and service actions collapsed to one overflow menu. Power column is status, not on/off toggles.", "Add-machine roles are chips. Header copy is operator LAN · binds 0.0.0.0:3850 (NATS stays private).", "Docs tab is cards. Trace hop grid wraps. Skip link and focus rings on staff and console.", "Simulator indigo; orange only on Inject faults.", "Portal API key masked with Reveal / Copy / Regenerate. Invoice empty-state illustration.", "Admin customers: list vs edit drawer. Invoice empty state.", "Catalog body font is system-ui. Swagger /docs labeled stock.", ] for it in items: story.append(p("• " + it, s["body"])) story.append(p("How to use each surface", s["h1"])) story.append(p("Operator: open :3850, Fleet for replicas, Trace to inject a Zap step, Docs for PDFs. Staff: CS :3011 credit in USD; Sales :3012 quote; Accounting :3013 export; Staff plane :3025 after authz. Customers: /portal. Ops: /admin. Lab: simulator :3847.", s["body"])) story.append(p("Issues still to consider", s["h1"])) remaining = [ ["Severity", "Issue", "Suggestion"], ["High", "Staff UIs look up by customer id; ledger often has no display name, so the heading is cust_1 not Ada.", "Join account-balance statements to zappier-edge customer name, or add a typeahead of customers."], ["High", "Staff, portal, and admin have no session login on CS/sales/accounting HTML (LAN trust).", "Put a staff SSO or shared cookie in front of :3011–:3013 and :3025 before any non-lab bind."], ["Med", "Catalog is still a long bibliography. Font is fixed; information architecture is not.", "Card index like the console Docs tab: Start here / Architecture / Modules."], ["Med", "Swagger /docs remains stock.", "Keep it for integrators; do not skin it. Link it as 'OpenAPI explorer' only."], ["Med", "Fleet add-machine form is dense; identity file still truncates in a narrow field.", "Two-row form: identity + roles on the second row with a file picker."], ["Med", "lan-134 shows degraded/disabled in yellow while local/ns1 are green — correct, but the disable button looks like a fault.", "When a machine is intentionally disabled, use a neutral grey card, not degraded yellow."], ["Low", "Portal statement empty cells still embed the empty illustration inside a table row.", "Drop the table when the list is empty; use the same card empty state as invoices."], ["Low", "Overflow menus can open off-screen at the bottom of a long fleet table.", "Flip the menu upward when near the viewport edge."], ["Low", "Access-staff and CS are nearly the same page.", "Keep both (plane vs department) but share one HTML template file."], ["Low", "Simulator empty console is a large black void before the first run.", "Placeholder hop: 'Run a step to fill this trace.'"], ] body = getSampleStyleSheet()["BodyText"] body.fontSize = 8 body.leading = 10 rows = [] for i, row in enumerate(remaining): rows.append([Paragraph(f"{c}" if i == 0 else c, body) for c in row]) grid = Table(rows, colWidths=[0.7 * inch, 2.6 * inch, 3.4 * inch], repeatRows=1) grid.setStyle(TableStyle([ ("BACKGROUND", (0, 0), (-1, 0), ACCENT), ("TEXTCOLOR", (0, 0), (-1, 0), colors.white), ("VALIGN", (0, 0), (-1, -1), "TOP"), ("GRID", (0, 0), (-1, -1), 0.4, colors.HexColor("#e5e7f0")), ("LEFTPADDING", (0, 0), (-1, -1), 6), ("RIGHTPADDING", (0, 0), (-1, -1), 6), ("TOPPADDING", (0, 0), (-1, -1), 5), ("BOTTOMPADDING", (0, 0), (-1, -1), 5), ("ROWBACKGROUNDS", (0, 1), (-1, -1), [colors.white, colors.HexColor("#f4f5fb")]), ])) story.append(grid) story.append(PageBreak()) story.append(p("Screenshot atlas with usage notes", s["h1"])) max_w = 6.5 * inch max_h = 7.2 * inch for fname, title, how in PAGES: path = SHOTS / fname if not path.exists(): story.append(p(f"Missing {fname}", s["muted"])) continue story.append(p(title, s["h2"])) story.append(p(how, s["body"])) img = Image(str(path)) iw, ih = img.imageWidth, img.imageHeight scale = min(max_w / iw, max_h / ih) img.drawWidth = iw * scale img.drawHeight = ih * scale img.hAlign = "CENTER" story.append(img) story.append(p(fname, s["cap"])) story.append(PageBreak()) story.append(p("Revalidation", s["h1"])) story.append(p("Second full walkthrough after favicon, amount-column alignment, and Fleet form/overflow fixes: 32 screenshots, 0 application console errors. Surfaces are visually consistent (indigo, 12px radius, dollars). Tasks (review, credit, quote, edit customer, mask key, run trace) are obvious from primary buttons. Remaining work is identity join, staff auth, and catalog IA — listed above.", s["body"])) doc = SimpleDocTemplate( str(OUT), pagesize=letter, leftMargin=0.75 * inch, rightMargin=0.75 * inch, topMargin=0.7 * inch, bottomMargin=0.7 * inch, title="Verae Time × Zapier UI review", author="UI-Docs", ) doc.build(story, onFirstPage=header_footer, onLaterPages=header_footer) print(OUT) if __name__ == "__main__": main()