Commit Graph

55 Commits

Author SHA1 Message Date
Deeman
0b8350c770 fix webhook crashes on null custom_data, migrate to SDK Verifier
Paddle sandbox sends lifecycle events (subscription.updated, etc.) with
"custom_data": null. The .get("custom_data", {}) default only applies
when the key is missing, not when the value is explicitly null, causing
AttributeError on the next .get() call. Also guarded subscription.activated
to skip when user_id is absent (was inserting user_id=0 → FK violation).

Replaced manual HMAC verification with paddle_billing.Notifications.Verifier
via a lightweight _WebhookRequest wrapper satisfying the SDK's Request Protocol.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 22:43:40 +01:00
Deeman
df8a747463 add credit system and supplier webhook test suites, remove dead test
24 tests for credits.py (balance, spend, unlock, refill, ledger) and
10 integration tests for supplier webhook handlers (credit packs, sticky
boosts, subscription activation, business plan purchase). Removed
test_mobile_nav_no_overflow which never asserted its JS result.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 22:02:09 +01:00
Deeman
0fe5ab1259 fix supplier dashboard UX, Paddle integration, and dev tooling
Supplier dashboard: impersonate redirects to supplier dashboard when user
owns a supplier, sidenav active tab updates on click, listing preview
capped at 420px, insufficient-credits error shows balance and buy CTA,
boost buy buttons resolve Paddle price IDs server-side.

Dev tooling: dev_run.sh kills child processes on Ctrl-C (process
substitution fix), syncs Paddle products to DB on each run,
setup_paddle.py gains --sync mode and fixes Duration/Interval SDK change.

Seed data: each claimed supplier gets its own owner user and subscription.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 19:40:06 +01:00
Deeman
891b875cd1 fix dev_run.sh not stopping child processes on Ctrl-C
run_with_label piped output through a while loop, so $! tracked the
formatter PID instead of the actual command. Ctrl-C killed the formatters
but left app/worker/css-watch running as orphans. Switch to process
substitution so $! is the real command PID, and pkill -P children before
killing tracked PIDs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:38:26 +01:00
Deeman
4c14b14bef add clickable admin list rows and supplier owner impersonation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 17:25:42 +01:00
Deeman
4e61e9b1ab fix broken webhook signature verification and stale billing tests
Webhook handler called Verifier().verify() with raw bytes instead of a
request object, so signature verification always failed. Replaced with
manual HMAC check matching Paddle's ts=...;h1=... format. Updated tests
to produce correct signature format, mock the SDK instead of httpx for
manage/cancel routes, and expect JSON for overlay checkout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 16:49:23 +01:00
Deeman
61bf855103 add programmatic SEO content engine with article generation pipeline and tests
Adds a complete content generation system for producing SEO articles
at scale with embedded financial scenario widgets. Includes DB schema
(published_scenarios, article_templates, template_data, articles with
FTS5), bulk generation pipeline with staggered publish dates, admin CRUD
for templates/scenarios/articles, public markets hub with HTMX filtering,
catch-all article serving from pre-rendered static HTML, sitemap
integration, and 94 pytest tests covering the full stack.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 16:40:11 +01:00
Deeman
0b218f35ca add Paddle webhook auto-setup, ngrok tunnel, and clean DB on each dev run
setup_paddle.py creates a notification destination in Paddle and writes
the webhook secret + setting ID to .env. dev_run.sh resets the DB, seeds
data, and starts an ngrok tunnel to update the webhook URL automatically
for end-to-end checkout testing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 14:01:02 +01:00
Deeman
77da44f3c8 add dev setup/run scripts and Resend test email docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 12:16:37 +01:00
Deeman
b99cd3c7d8 fix quote form state loss, admin errors, UI polish; add seed data and playwright tests
Quote wizard _accumulated hidden inputs used double-quote attribute delimiters
which broke on tojson output containing literal " characters — all step data was
lost by step 9. Admin dashboard crashed on credit_ledger queries referencing
wrong column names (amount/entry_type vs delta/event_type). Also: opaque nav bar,
pricing card button alignment, newsletter boost replaced with card color boost,
admin CRUD for suppliers/leads, dev seed data script, and playwright quote wizard
tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 09:37:13 +01:00
Deeman
7d3aa3141d update README with local testing guide, fix feedback placeholder, sync .env.example
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 22:29:40 +01:00
Deeman
f29c56cbaa add Phase 2: supplier dashboard, business plan PDF, Paddle.js checkout, admin tools
Migrate all checkouts to Paddle.js overlay (no redirect), move Paddle price
IDs from env vars to DB table, add 4-tab supplier dashboard (overview, leads,
listing, boosts), business plan PDF export with WeasyPrint, enhanced supplier
landing page with live stats, admin supplier management + feedback widget.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 22:23:43 +01:00
Deeman
6a10f82b5d add double opt-in email verification for quote requests
Guest quote submissions now require email verification before the lead
goes live. The verification click also creates a user account and logs
them in. Logged-in users submitting with their own email skip verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 17:02:32 +01:00
Deeman
e0563d62ff polish nav, planner UX, country pills, and dev magic link
- Nav: Zillow-style centered logo, solid blue Sign In button
- Planner: center app at 72rem, center wizard steps/header/preview
- Country pills: UK/USA labels, remove Other, show permits slider
  inline under country so the effect is transparent and adjustable
- Reset button: inline confirm (red "Sure? Reset") instead of alert
- Worker: print magic link to console when DEBUG=true for local dev

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:36:26 +01:00
Deeman
cefdb7ce3a fix directory search: SQL param order and HTMX include selector
Parameter bindings for ORDER BY (now, country) were placed before WHERE
params, causing mismatched bindings when any filter was active. Also
switched hx-include from .dir-search class (shared by form + inputs)
to #dir-search-form ID to prevent duplicate parameters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:16:21 +01:00
Deeman
fc410920d8 add supplier tiers, directory redesign, CTA cleanup, and ROI fix
Phase 0 features: ungate planner, lead qualifier with heat scoring,
quote form (migrations 0002-0003), supplier directory with FTS5 search
(migration 0004), landing page redesign with ROI calculator and FAQ.

Phase 1 improvements: supplier tier system with Growth/Pro paid plans
(migration 0005), HTMX live directory search, three-tier card design,
Zillow-style sticky nav, "Get Matched" → "Get Quotes" CTA rename,
remove "Free" messaging site-wide, realistic ROI calculator defaults
(~3.9yr payback / ~26% ROI), mandatory form validation with 422 errors,
supplier pricing page with boost add-ons.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 14:11:35 +01:00
Deeman
02d216bc94 update landing journey: 5-stage funnel with Coming Soon badges
Explore → Plan → Finance → Build → Grow, with .grid-5 layout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 18:30:16 +01:00
Deeman
7cb41d91f2 fix planner toggle active state, improve space defaults
- Toggle buttons (Indoor/Outdoor, Rent/Buy) now visually update
  their active state on click
- Space requirement sliders start from minimum court size
  (200m² double, 120m² single) instead of 0
- Defaults updated to court + 2m buffer (336/240/312/216 m²)
- Reference dimensions panel shows standard court sizes
- Chart.js font updated from JetBrains Mono to Commit Mono

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 18:06:03 +01:00
Deeman
11999bdc5d add scratch stuff 2026-02-16 18:03:00 +01:00
Deeman
1d744bbf6d style transactional emails with branded layout
Wrap magic link and welcome emails in a proper HTML email template
with navy header, white card body, CTA button, and muted footer.
Fallback plain-text URL included below the button.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 16:29:13 +01:00
Deeman
72077fdd46 migrate from Pico CSS to Tailwind CSS v4
Replace Pico CSS CDN with Tailwind v4 standalone CLI (no Node.js).
Brand theme with navy/electric/accent palette, component classes,
self-hosted Commit Mono font. Docker multi-stage CSS build.
Logo links to dashboard when logged in.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 14:45:32 +01:00
Deeman
2763bcd943 updates 2026-02-16 13:24:42 +01:00
Deeman
e62f99553a fix admin template collision with auth/dashboard blueprints
Namespace admin templates under admin/ subdirectory to prevent
Quart's template loader from resolving auth's login.html and
dashboard's index.html instead of admin's own templates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:17:15 +01:00
Deeman
c7d2e5d756 fix leftover stripe references in admin user detail
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 12:06:00 +01:00
Deeman
97e3310998 add migration docs & tests, fix empty env var crash
- Expand migrate.py docstring with algorithm, protocol, and design decisions
- Add 20-test suite for migration framework (test_migrations.py)
- Fix: empty env vars (SECRET_KEY=) now fall back to defaults via _env() helper

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:37:00 +01:00
Deeman
674e051084 fix 0001 migration: skip rename if columns already renamed
Production DB had already been migrated by the manual script, so
the old lemonsqueezy columns no longer exist. Check column names
before attempting the rename.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:07:25 +01:00
Deeman
5bcc048183 update changelog with sequential migration system
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 10:58:42 +01:00
Deeman
c10cd4d714 add sequential migration system with version tracking
Replace the simple schema.sql runner with a proper sequential
migration system that tracks applied versions in a _migrations table.
Absorb scripts/migrate_to_paddle.py as versions/0001.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 10:57:28 +01:00
Deeman
25d06a80d5 switch payment provider from LemonSqueezy to Paddle
Run copier update with payment_provider=paddle to switch all billing
integration: routes, config, schema columns, webhook handling, tests,
and CI deploy secrets. Add one-time migration script for renaming
lemonsqueezy_* columns to paddle_* in production DB.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 10:40:40 +01:00
Deeman
53ca195a49 update copier src_path to match renamed template directory
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 21:55:25 +01:00
Deeman
ac9ce179fd add favicon extracted from logo P glyph
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 20:06:23 +01:00
Deeman
484428d71f redesign landing page: better teaser calc, value-focused CTAs
Replace toy-like sliders (rent/m², exit multiple) with more intuitive
inputs (build cost per court, equity %). Replace outputs (annual revenue,
equity IRR) with payback period and cash-on-cash return. Show model
assumptions inline. Remove "free" messaging from all CTAs and meta tags,
focus on the plan→suppliers→financing value chain instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 02:36:33 +01:00
Deeman
9c2465e4c5 force heading colors with !important to beat Pico's cascade
The variable-based overrides (--pico-h1-color, --pico-color) weren't
reliably winning against Pico's multi-layer cascade of theme selectors,
prefers-color-scheme media queries, and variable indirection. Headings
were rendering near-white (#f0f1f3) on dark-OS systems despite
data-theme="light". Using !important on color is the pragmatic fix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 02:11:53 +01:00
Deeman
f562df8437 fix heading colors on dark-OS systems, increase logo size
The heading color override (bare h1 selector, specificity 0,0,1) was
losing to Pico's theme-scoped heading rules ([data-theme=light] h1,
specificity 0,1,1). On systems with prefers-color-scheme: dark, Pico's
dark heading colors (#f0f1f3 — near white) leaked through, making
headings invisible on the light background.

Fix: scope heading overrides under [data-theme="light"] to match Pico's
specificity. Also bump nav logo from 24px to 32px, footer to 24px.

Visual tests now run with color_scheme="dark" to catch this class of bug.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 00:16:31 +01:00
Deeman
6bba19f628 skip visual tests in CI — require explicit -m visual flag
Playwright visual tests need browser binaries (playwright install
chromium) which CI doesn't have. Mark them with pytest.mark.visual
and add addopts = "-m 'not visual'" so they're skipped by default.

Run locally with: uv run pytest -m visual tests/test_visual.py -v

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:59:53 +01:00
Deeman
dc685e8e7b fix logo sizing, heading colors, and add Playwright visual tests
- Trim logo background to transparent, use inline style height to
  override Pico's img { height: auto } — nav 24px, footer 20px
- Fix heading colors by setting --pico-h1-color through --pico-h6-color
  variables and --pico-color override on heading elements
- Add white-space:nowrap on nav CTA button to prevent wrapping
- Add Playwright visual test suite (11 tests): screenshots of landing,
  login, signup, mobile; assertions for light background, dark headings,
  logo presence, nav layout, no dark remnants
- Screenshots saved to tests/screenshots/ for manual review

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:56:39 +01:00
Deeman
6df3f8d388 switch from dark to light theme matching Court Tech brand guide
Replace dark navy backgrounds with soft white, update all CSS variables,
Chart.js colors, and inline styles across the app. Add logo to nav and
footer. Landing page teaser calculator, planner, and all inherited pages
now use the light theme with deep navy headings and electric blue accents.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:06:12 +01:00
Deeman
1e56087060 fix deploy.sh stopping router during blue-green switch
docker compose --profile stop also stops non-profiled services (router,
litestream), causing 502. Now explicitly names only slot services to stop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 22:16:19 +01:00
Deeman
337816c6c1 fix env_file path to use padelnomics/.env
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 16:44:33 +01:00
Deeman
a94408051e update readme 2026-02-13 16:10:25 +01:00
Deeman
be35738997 fix ruff lint errors across all source files
Auto-fixed import sorting (I001) and unused imports (F401) via ruff --fix.
Manually fixed unused variable month_ago (F841) and lambda assignment (E731).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 16:00:37 +01:00
Deeman
76ef8f1c29 fix pytest call 2026-02-13 14:52:56 +01:00
Deeman
fa09fc81c9 add CI/CD pipeline with blue-green deployment
GitLab CI runs pytest + ruff on master/MRs, then auto-deploys via SSH.
Blue-green strategy using Docker Compose profiles with an nginx router
on port 5000 for zero-downtime switching between slots.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 14:39:15 +01:00
Deeman
3dbdd17ddb remove local path from changelog entry
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 12:17:16 +01:00
Deeman
9703651562 add hybrid calculator refactor and comprehensive billing test suite
Move planner financial model from client-side JS to server-side Python
(calculator.py + /planner/calculate endpoint). Add full test coverage:
227 calculator tests and 371 billing tests covering SQL helpers,
webhooks, routes, and subscription gating with Hypothesis fuzzing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 12:05:03 +01:00
Deeman
cf11add1e5 add Podscan-inspired teaser calculator to landing page
Interactive ROI estimate with 5 sliders (courts, peak rate, utilization,
rent/sqm, exit multiple) and 4 output metrics (investment, monthly cash flow,
annual revenue, equity IRR). Simplified model with Newton-Raphson IRR solver.
Soft-gates full planner behind signup CTA.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 08:24:54 +01:00
Deeman
9b1963618c apply Court Tech brand design across app
Switch from Outfit/red accent to Inter/Electric Blue (Court Tech Proposal 1).
Updates Pico CSS overrides, planner CSS variables, Chart.js colors, and
Google Fonts. Deep Navy #0F172A backgrounds, Electric Blue #3B82F6 accent,
Vibrant Green #10B981 success, Soft White #F8FAFC headings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 08:22:06 +01:00
Deeman
ae0be85544 add minimal README.md required by hatchling build
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 08:13:34 +01:00
Deeman
2ef9822d95 apply copier update: switch to LemonSqueezy payment provider
Update from materia_saas_boilerplate template with payment_provider=lemonsqueezy.
Adds full LemonSqueezy billing routes (checkout, webhooks, subscription management),
HMAC webhook verification, subscriptions/API keys schema, and removes Caddy in favor
of Nginx Proxy Manager.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 08:09:31 +01:00
Deeman
2f4be38e07 add scratch 2026-02-13 07:53:24 +01:00