From 2b50f2b496fe7eca2243d68f102ad9e3307ddb7d Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Mon, 7 Sep 2026 21:51:59 +0700 Subject: [PATCH] Spot form: enforce required spot type, guard submit during Quick Snap upload, drop debug log (1.2.26) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CreateSpotPage: - Spot type is marked required (*) and drives the quality meter, but submit never validated it — a spot could be published with no type. Now validated with a clear toast, matching the title/coordinate checks. - Submit was allowed while the Quick Snap photo was still uploading in the background, which would publish the spot WITHOUT the photo the user just took. Submit is now blocked (with an "Uploading photo…" button state and a reassuring toast) until the upload settles. - Removed a leftover console.log of the full event payload. EditSpotPage: - Same missing spot-type validation (also marked * in its UI) — added the same guard for consistency. Co-authored-by: shakespeare.diy --- package.json | 2 +- src/pages/CreateSpotPage.tsx | 32 +++++++++++++++++++++++++------- src/pages/EditSpotPage.tsx | 9 +++++++++ 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 688716d..76ef175 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "skate-spots", "private": true, - "version": "1.2.25", + "version": "1.2.26", "type": "module", "homepage": "https://skate-spots.com", "scripts": { diff --git a/src/pages/CreateSpotPage.tsx b/src/pages/CreateSpotPage.tsx index ec86096..a045e60 100644 --- a/src/pages/CreateSpotPage.tsx +++ b/src/pages/CreateSpotPage.tsx @@ -239,6 +239,25 @@ export default function CreateSpotPage() { return; } + if (!selectedCategory) { + toast({ + title: 'Spot type required', + description: 'Please pick a spot type so skaters know what they’re rolling up to.', + variant: 'destructive', + }); + return; + } + + // Don't publish while the Quick Snap photo is still uploading — otherwise the + // spot would go out without the photo the user just took. + if (isUploadingQuickPhoto) { + toast({ + title: 'Hang tight', + description: 'Your photo is still uploading. It’ll be attached in a second.', + }); + return; + } + try { // Generate geohash from coordinates (7 chars = ~153m precision) const geohash = ngeohash.encode(lat, lng, 7); @@ -322,12 +341,6 @@ export default function CreateSpotPage() { // Add alt tag for NIP-31 (human-readable description) eventTags.push(['alt', `Skate spot: ${title.trim()}`]); - console.log('Publishing spot event:', { - kind: SKATE_SPOT_KIND, - tags: eventTags, - content: description.trim() - }); - await createEvent({ kind: SKATE_SPOT_KIND, content: description.trim(), @@ -696,13 +709,18 @@ export default function CreateSpotPage() {