Skip to content

Frontend rewrite: Tailwind, polished home + endpoint, copy/highlight/send-test, JS extracted#30

Merged
botre merged 2 commits into
masterfrom
feat/frontend-simplify-and-ux
May 8, 2026
Merged

Frontend rewrite: Tailwind, polished home + endpoint, copy/highlight/send-test, JS extracted#30
botre merged 2 commits into
masterfrom
feat/frontend-simplify-and-ux

Conversation

@botre
Copy link
Copy Markdown
Collaborator

@botre botre commented May 8, 2026

Summary

Rewrites the frontend for clarity and adds a focused UX-improvement set, while keeping the backend untouched.

Styling

  • Drop simple.css and the hand-rolled utility CSS in public/index.css (deleted). Switch to Tailwind v4 via Play CDN, light theme only.
  • Focus rings dialled back from ring-2 to ring-1 ring-indigo-400 everywhere; native <select> arrows replaced with a custom SVG chevron anchored next to the value (.app-select class); buttons and <summary> get cursor: pointer globally (Tailwind v4 doesn't set it by default).

JavaScript

  • All inline <script> blocks lifted out of endpoint.html into static files:
    • public/index.js — shared helpers (formatTimeAgo, renderBody, copyToClipboard, parseHeaderLines, loading-dots + cursor + select-chevron CSS injection).
    • public/endpoint.js — Alpine store, WebSocket subscriber, custom request submit, favicon/title indicator. Registers via Alpine.data / Alpine.store inside an alpine:init listener; app scripts load before Alpine so listeners attach before Alpine's first dispatch.
  • setInterval loading-dots replaced with a CSS keyframe.
  • WS/Alpine race workaround in the template removed.

Home page

  • Tighter hero with stronger headline and a single-line subtitle. Larger CTA with arrow icon.
  • New Common use cases section: six cards (test webhooks, inspect form payloads, debug API integrations, mobile & IoT traffic, verify cron jobs, share captures with teammates). Icons unified in indigo (brand colour).
  • Em-dashes replaced with regular punctuation.

Endpoint page

  • Mobile fix: dropped hidden sm:flex from the URL row and send-test panel; everything stays visible at small widths.
  • Copy-to-clipboard buttons on URL, request body, request headers JSON. URL button flashes "Copied!" via reactive label.
  • Tab title + favicon dot indicator while the tab is hidden — increments unread counter on each WS message; resets on visibilitychange.
  • Send-test-request panel (collapsed <details>): pick method, write headers (Key: Value lines), write body, submit. Method and Headers stack vertically.
  • Method-based filter dropdown above search.
  • Syntax highlighting for JSON and XML bodies via highlight.js (browser bundle, CDN-pinned with SRI). JSON pretty-printed.
  • Details and Headers columns aligned: both sections use grid-cols-[10rem_1fr] so values line up vertically across the card.
  • Removed the Google-search-WHOIS link on captured IPs and the search-by-header-key link — privacy + simplification.

Contact page

  • Wrapped in a card with placeholders, autocomplete hints, and a divider row of helper text + submit button.

Server

  • CSP tightened: dropped script-src 'unsafe-inline' (no inline scripts left), added https://cdn.jsdelivr.net for the CDN-pinned Tailwind + highlight.js. 'unsafe-eval' still required by Alpine and the Tailwind Play CDN.

Tests

  • Playwright suite: 26 specs, all passing. Covers copy buttons (URL/body/headers writing the right data to the clipboard), method filter, send-test panel submit, JSON/XML highlighter token presence, tab-title indicator under simulated visibilitychange, common use cases section. Clipboard permissions granted in playwright.config.ts.

Test plan

  • CI test workflow green (go test, Playwright)
  • CI release workflow republishes ghcr.io/formspark/httphq:<tag> after merge
  • Spot-check at 375px width: URL row, send panel, request cards all render correctly

Note on Tailwind Play CDN

The Play CDN is dev-grade (compiles utilities at runtime, prints a console warning). Fine for shipping; for a production-hardening pass we'd swap to the standalone Tailwind CLI in the Dockerfile builder stage and ship a precompiled CSS file. Out of scope here.

botre added 2 commits May 8, 2026 20:18
CSS / styling
- Drop simple.css (jsDelivr) and the hand-rolled utility set in
  public/index.css (deleted). Switch to Tailwind v4 via Play CDN.
- Light-only theme; modern slate/indigo/emerald/rose palette for HTTP method
  badges replaces the old CSS named colors.

JavaScript
- Move all inline <script> blocks out of endpoint.html into static files:
  public/index.js (helpers), public/endpoint.js (Alpine store + WebSocket +
  favicon/title indicator + send-custom-request), public/home.js (recent
  endpoints panel).
- Drop the WS/Alpine race-handling workaround by registering Alpine.data and
  Alpine.store inside an alpine:init listener. App scripts load before Alpine
  so listeners attach before Alpine fires its first event.
- Replace setInterval loading-dots with a CSS keyframe animation injected by
  index.js.

UX/UI
- Mobile fix: drop hidden sm:flex on the URL row and curl example. Layout
  uses Tailwind responsive utilities so everything stays visible on small
  screens.
- Copy-to-clipboard buttons on the endpoint URL, request body, and request
  headers JSON. The URL button flashes "Copied!" via a reactive label.
- Tab title and favicon dot indicator: while the tab is hidden, each new
  WS-delivered request increments an unread counter shown in the title and
  marks the favicon. visibilitychange resets both.
- Endpoint history in localStorage (key httphq:recent-endpoints, capped at
  5). Home page shows a "Recently created" panel that links back.
- Send-test-request panel inside a <details>: pick method, write headers
  (Key: Value lines), write body, submit. Replaces the canned curl link.
- Method-based filter dropdown above the search input. Combined with the
  existing server-side LIKE search.
- Syntax highlighting for JSON and XML bodies via highlight.js (browser
  bundle, CDN-pinned with SRI). JSON bodies are also pretty-printed.
- Remove the Google-search-WHOIS link on captured IPs and the
  google-search-by-name link on header keys. Render plain text instead.

Server
- Update CSP to drop script-src 'unsafe-inline' (no inline scripts left),
  allow unpkg + cdn.jsdelivr.net for the new CDN-served scripts/styles. Keep
  'unsafe-eval' for Alpine and Tailwind Play CDN.

Tests
- Expand Playwright suite from 20 to 28 specs covering: copy buttons (URL,
  body, headers) writing the right data to the clipboard; method filter;
  send-test-request panel; syntax highlighting (JSON + XML token presence);
  recent-endpoints panel; tab-title indicator under simulated visibility
  change. Grant clipboard permissions in playwright.config.
Home page
- Tighter hero: shorter headline ('Inspect HTTP requests in real time'),
  one-line subtitle, larger CTA with arrow icon
- Add Common use cases section with six cards (test webhooks, inspect form
  payloads, debug API integrations, mobile/IoT, verify cron jobs, share
  captures). Icons unified in indigo (brand color)
- Remove the recently-created localStorage panel (deleted public/home.js,
  recentEndpoints helper, related script tag, and tests)
- Replace em-dashes with regular punctuation throughout

Endpoint page
- Stack Method dropdown above Headers textarea in send-test panel (was
  side-by-side at sm+)
- Align Details and Headers value columns: both use grid-cols-[10rem_1fr]
  so values line up vertically across the two sections

Polish across pages
- Buttons, summaries and role=button get cursor:pointer (Tailwind v4
  doesn't set it by default)
- Native selects use a custom SVG chevron via the .app-select class so the
  caret sits next to the value rather than at the field's right edge
- Disclosure chevron in 'Send a test request' moved next to the title
- Focus rings dialed back from ring-2 to ring-1 with ring-indigo-400
- Contact page wrapped in a card with placeholders, autocomplete hints,
  and a footer row with helper text + submit button
@botre botre changed the title Frontend simplify + UX/UI improvements Frontend rewrite: Tailwind, polished home + endpoint, copy/highlight/send-test, JS extracted May 8, 2026
@botre botre merged commit a96b3d2 into master May 8, 2026
2 checks passed
@botre botre deleted the feat/frontend-simplify-and-ux branch May 8, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant