Files
pad/web
xarmian b783d06144 feat(web): last-used auth method banner on /login (TASK-923) (#323)
Returning users who are logged out land on /login with no context about
how they signed in before. This adds a soft "last time, you used X to
sign in" hint and visually elevates the matching CTA so the right next
step reads at a glance — without overwhelming first-time visitors who
still see all methods equally.

Implementation
--------------
- New helper `web/src/lib/auth/lastMethod.ts` reads/writes a
  `pad_last_auth_method` value (`'password' | 'github' | 'google'`) and
  a `pad_last_auth_at` timestamp in localStorage. Wrapped in try/catch
  so SSR, private mode, and disabled storage never break auth pages.
- Login page records `password` on successful credential or 2FA login,
  and records the OAuth provider speculatively on button click. The
  OAuth handshake completes outside the SPA (provider → pad-cloud →
  pad backend session → redirect), so there's no JS callback to hang
  the write on. If the user bails at the consent screen the value still
  reflects "what the user tried last", which is the right answer for
  the next-visit banner.
- Register page records `password` on successful registration so newly
  registered users see the same hint when they next return logged out.
- Banner above the form names the method; matching OAuth button gets a
  border lift + "Last used" pill. Banner is suppressed when an OAuth
  error banner for the same provider is already showing — surfacing
  both at once muddles the message.

Privacy
-------
- Only the method *name* is stored — never an email, user ID, or token.
- localStorage is per-origin and never sent over the wire.
- No cookie, no URL param, no server log entry, no new endpoints.

Parent: PLAN-776 (Post-launch Backlog).
Promotes IDEA-922.
2026-04-30 17:14:56 -04:00
..
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00
2026-03-26 01:52:36 +00:00

Pad Web UI

SvelteKit 2 + Svelte 5 frontend for Pad, compiled to static files and embedded into the Go binary.

Development

npm install
npm run dev          # Dev server at localhost:5173 (proxies API to localhost:7777)
npm run build        # Production build to build/
npm run check        # Type checking with svelte-check

When developing, run the Go backend separately with make dev from the project root.

Building for Production

Do not build in isolation. Always use make build from the project root — this builds the web frontend, then compiles the Go binary with the build output embedded via //go:embed.

Stack

  • Svelte 5 with runes ($state, $derived, $effect)
  • SvelteKit 2 with adapter-static (SPA mode)
  • Tiptap block editor with markdown round-trip
  • svelte-dnd-action for drag-and-drop in board/list views
  • SSE for real-time updates
  • TypeScript throughout

Structure

src/
  routes/                    SvelteKit pages
    +layout.svelte           App shell (sidebar + main)
    +page.svelte             Landing/redirect
    [workspace]/
      +page.svelte           Dashboard (collections, phases, activity)
      +layout.svelte         SSE connection per workspace
      [collection]/
        +page.svelte         Collection view (board/list)
      [collection]/[item]/
        +page.svelte         Item detail + editor
      conventions/            Purpose-built conventions page
      playbooks/              Purpose-built playbooks page
      settings/               Workspace settings
  lib/
    api/client.ts            HTTP API client
    components/
      layout/                Sidebar, navigation
      editor/                Tiptap editor, raw markdown editor
      fields/                FieldEditor, relation picker
      items/                 ItemCard, ItemDetail
      collections/           BoardView, ListView
      common/                StatusBadge, badges, modals
      search/                CommandPalette
      activity/              ActivityFeed
    stores/                  Svelte 5 reactive stores
      workspace.svelte.ts    Workspace state
      collections.svelte.ts  Collection + item state
      ui.svelte.ts           Sidebar, mobile state
    types/index.ts           TypeScript types and constants
  app.css                    Global styles and design tokens