Commit graph

39 commits

Author SHA1 Message Date
King Omar
e9ddf8bb34 Add user profile settings with photo upload
- Profile avatar button fixed top-left on all pages (initials fallback with
  hashed color when no photo set)
- Profile modal: change display name, upload photo, switch theme
- PATCH /api/users/:id updates name in D1; syncs back to currentUser
- POST /api/users/:id/avatar uploads image to R2 as avatars/{userId}.ext,
  stores URL in D1 users.avatar_url (new column via ALTER TABLE)
- Author avatars shown on proposal cards, modal view, and comments
- serveMedia fixed to use R2 httpMetadata contentType and full key path

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-12 21:14:07 +10:00
King Omar
786a23667d SEO: fix head placement, add sitemap/robots, update title to The Radical Party
- Move canonical, robots, JSON-LD, sitemap link inside <head> (were incorrectly
  placed after </head>, causing Google to ignore them)
- Title changed to "The Radical Party | Direct Democracy for Australia" so the
  party name shows up in search results
- Description now leads with "The Radical Party" for brand recognition
- Keywords updated to include "The Radical Party", "radical party australia", CIR
- JSON-LD updated to dual WebSite + Organization schema with richer data
- Added /robots.txt endpoint (was 404) pointing crawlers to sitemap
- Added /sitemap.xml endpoint (was 404) with homepage + top 50 proposals

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-12 13:44:44 +10:00
King Omar
69f77b1e46 Add admin dashboard + member DB storage
worker.js:
- Store join submissions in new 'members' D1 table (in addition to email)
- Add GET /api/admin/members — full member list, password gated
- Add GET /api/admin/stats — member counts, by-state breakdown, recent
  signups, top petitions, site stats; all password gated ('dictator')

admin.html:
- Password gate → full dashboard
- AEC progress bar (X/2000 with % and members-to-go)
- Stat cards: total members, this week, site users, proposals, votes
- State breakdown with mini bars
- Recent signups (last 10, NEW badge for this week)
- Top 10 petitions by signature count
- Full searchable/filterable/sortable member table with NEW badges
- CSV export (respects active search + state filter)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-01 04:32:53 +10:00
King Omar
e1b3c7600e Fix comments not loading: disable 24hr Cloudflare cache on comments endpoint
getComments was using createResponse default cacheDuration=86400 (24 hours).
Cloudflare was serving a stale cached response, so comments appeared empty
or outdated on every load. Set cacheDuration=0 (no-store) so each request
hits the DB fresh.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-27 03:38:12 +10:00
King Omar
b726dc1e24 Redesign petition SVG share image; remove flag/report button
SVG: clean two-zone layout — dark header with RADICAL wordmark + PETITION
badge, full-width text area with left accent bar and large quote mark,
footer band with signature count, author, date and CTA. Proper word-wrap
centred in the card. Looks like a real share card now.

Remove flag button and handleFlag from proposal cards entirely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-27 03:13:53 +10:00
King Omar
a6e7989a10 Add Join The Movement form, fix login route, fix images, update copyright to 2026
- Add /api/join worker endpoint that emails membership details to party contact
- Register /api/login route (was missing — emoji login was broken)
- Add full AEC-compliant member registration form in index.html (#join section)
- Update copyright year to 2026 in index.html and login.html
- Fix dictator/target image URLs: radical.omar-c29.workers.dev → theradicalparty.com
- Add onerror handlers to all login page images for graceful degradation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-27 01:31:30 +10:00
King Omar
5c291d29ea feat: leaderboard, milestones, email capture, postcode, flag, stats bar
- Vote state now persists on page load (user_vote in proposals query)
- Stats bar: live votes-today / citizens / proposals counts
- Leaderboard section: top 10 proposals with milestone progress bars
- Milestone system: 100→viral, 500→community, 1k→publish, 5k→minister, 10k→media
- Email capture modal after 3rd vote (postcode optional)
- Milestone email notifications via Resend (requires RESEND_API_KEY secret)
- Weekly digest cron (Monday 9am AEST) to all subscribers
- Share-as-image button opens dynamic SVG in new tab
- Flag/report button hides proposals after 5 flags
- Proposals with hidden=1 excluded from all feeds
- DB: users.email, users.postcode, proposals.flag_count, proposals.hidden,
       proposal_flags, milestone_notifications tables

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 01:07:30 +10:00
King Omar
876d0c438c fix: votes, comments and feed refresh all broken due to safeFetch misuse
safeFetch already returns parsed JSON and throws on non-2xx — callers were
treating the result as a Response object and checking .ok / .json(), which
made votes, comment votes, and comment posts silently fail every time.

Also: fetchProposals was missing cache:'no-store' so newly posted proposals
were invisible until the 24hr browser cache expired; getProposals was sending
24hr Cache-Control so Cloudflare CDN served stale data; getShareableImageUrl
had a double slash (/api//petition-svg); wrangler.toml had an invalid [pages]
stanza that caused a warning on every deploy.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-05 00:35:31 +10:00
Omar Najjar
927313e8da Revert "x"
This reverts commit 330bd1ff61.
2025-04-30 19:46:18 +10:00
Omar Najjar
3c675a7a0a Revert "x"
This reverts commit d105a753b4.
2025-04-30 19:45:58 +10:00
Omar Najjar
29936e8365 Revert "x"
This reverts commit 9e6a2ba4fc.
2025-04-30 19:45:42 +10:00
Omar Najjar
9e6a2ba4fc x 2025-04-30 19:29:26 +10:00
Omar Najjar
d105a753b4 x 2025-04-30 19:20:42 +10:00
Omar Najjar
330bd1ff61 x 2025-04-30 19:19:43 +10:00
Omar Najjar
25e2921d74 x 2025-04-13 04:47:32 +10:00
Omar Najjar
c785511f3f x 2025-04-13 04:41:44 +10:00
Omar Najjar
1b3c0db99f x 2025-04-13 04:34:23 +10:00
Omar Najjar
ae357d2ab8 x 2025-04-13 04:16:17 +10:00
Omar Najjar
7d7e5720c2 x 2025-04-13 04:10:26 +10:00
Omar Najjar
3a3e6b4363 x 2025-04-13 03:58:58 +10:00
Omar Najjar
1fa9b3ddc3 x 2025-04-13 03:46:27 +10:00
Omar Najjar
3ca10f079d X 2025-04-13 03:40:07 +10:00
Omar Najjar
99b3f6b326 x 2025-04-13 03:36:47 +10:00
Omar Najjar
e5d43d1147 X 2025-04-13 03:30:59 +10:00
Omar Najjar
b77d7372d0 x 2025-04-13 02:58:51 +10:00
Omar Najjar
2689855629 x 2025-04-13 02:57:04 +10:00
Omar Najjar
e35571fd3b x 2025-04-13 02:55:28 +10:00
Omar Najjar
95a66ea6b0 x 2025-04-13 02:27:50 +10:00
Omar Najjar
9e8260d1cb x 2025-04-02 22:14:26 +11:00
Omar Najjar
62d4d8f2da x 2025-04-02 21:52:18 +11:00
Omar Najjar
5e32daa7b4 x 2025-04-02 21:48:07 +11:00
Omar Najjar
29f3c669c1 x 2025-04-02 21:05:48 +11:00
Omar Najjar
3cb78a90d8 x 2025-04-02 20:37:49 +11:00
Omar Najjar
9f98c853db x 2025-03-31 18:36:54 +11:00
Omar Najjar
8a0e32ce38 x 2025-03-31 18:09:41 +11:00
Omar Najjar
3424ca9456 x 2025-03-31 17:53:35 +11:00
Omar Najjar
3076e6fd88 x 2025-03-31 17:45:31 +11:00
Omar Najjar
ac53015842 x 2025-03-31 17:30:42 +11:00
Omar Najjar
bbd4c8c870 x 2025-03-31 17:24:34 +11:00