From 66c662f471f5f44e34a1f02632180345fd78a130 Mon Sep 17 00:00:00 2001 From: Ovidiu U Date: Sat, 11 Apr 2026 17:23:03 +0100 Subject: [PATCH] docs: add homepage search implementation plan --- .../plans/2026-04-11-homepage-search.md | 335 ++++++++++++++++++ 1 file changed, 335 insertions(+) create mode 100644 docs/superpowers/plans/2026-04-11-homepage-search.md diff --git a/docs/superpowers/plans/2026-04-11-homepage-search.md b/docs/superpowers/plans/2026-04-11-homepage-search.md new file mode 100644 index 0000000..559c6b8 --- /dev/null +++ b/docs/superpowers/plans/2026-04-11-homepage-search.md @@ -0,0 +1,335 @@ +# Homepage Search Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Wire up the homepage `SearchBar` to perform a live station search and render a map + station list inline below the hero section. + +**Architecture:** `SearchBar` emits `{ postcode, fuelType, radius }` on button click. `Home.vue` calls `useStations.search()` with those params and renders `LeafletMap` (open by default) + `StationList` in a full-width section below the hero. `LeafletMap` gains a `defaultOpen` prop to auto-initialise without user toggle. + +**Tech Stack:** Vue 3 Composition API (` +``` + +- [ ] **Step 2: Commit** + +```bash +git add resources/js/components/SearchBar.vue +git commit -m "feat: add fuel type and radius selects to SearchBar" +``` + +--- + +## Task 2: Update LeafletMap — defaultOpen prop + +**Files:** +- Modify: `resources/js/components/LeafletMap.vue` + +- [ ] **Step 1: Add `defaultOpen` prop and auto-init on mount** + +Replace the ` +``` + +- [ ] **Step 2: Commit** + +```bash +git add resources/js/components/LeafletMap.vue +git commit -m "feat: add defaultOpen prop to LeafletMap" +``` + +--- + +## Task 3: Wire up Home.vue — results section + +**Files:** +- Modify: `resources/js/views/Home.vue` + +- [ ] **Step 1: Update the script block** + +Replace the ` +``` + +- [ ] **Step 2: Add the results section to the template** + +Add this new `
` block directly after the closing `
` tag of the hero section (after line `` that closes `id="hero"`), before the `` section: + +```html + +
+
+ + +
+
+ + Finding stations near you… +
+
+ + +
+ + {{ error.general?.[0] ?? 'Unable to load stations. Please try again.' }} +
+ + + + +
+
+``` + +- [ ] **Step 3: Verify the `` tag in the hero still has `@search="onSearch"`** + +In the hero section, the tag should read: +```html + +``` + +- [ ] **Step 4: Commit** + +```bash +git add resources/js/views/Home.vue +git commit -m "feat: wire up homepage search with map and station list" +``` + +--- + +## Task 4: Manual browser verification + +- [ ] **Step 1: Start the dev server** (if not already running) + +```bash +npm run dev +``` + +- [ ] **Step 2: Open the homepage** at the URL from `herd` (e.g. `https://fuel-price.test`) + +- [ ] **Step 3: Verify the search bar has three controls** — postcode input, fuel type select, radius select + +- [ ] **Step 4: Enter a valid UK postcode** (e.g. `SW1A 1AA`) and click "Find Prices" + +- [ ] **Step 5: Verify the results section appears below the hero** with: + - Loading spinner shown briefly + - Map opens automatically with markers at each station + - Station list renders below the map with sort tabs (Price / Distance / Updated) + - Cheapest station price is highlighted in green + +- [ ] **Step 6: Click a sort tab** (e.g. Distance) and verify the list re-fetches and reorders + +- [ ] **Step 7: Click "Hide map" toggle** and verify the map collapses; click "Show map" and verify it reopens + +- [ ] **Step 8: Enter an invalid postcode** and verify an error message appears instead of the results