diff --git a/web/frontend/app/features/breweries/BREWERY_INDEX_HANDOFF.md b/web/frontend/app/features/breweries/BREWERY_INDEX_HANDOFF.md new file mode 100644 index 00000000..15e74e85 --- /dev/null +++ b/web/frontend/app/features/breweries/BREWERY_INDEX_HANDOFF.md @@ -0,0 +1,10 @@ +# Brewery index redesign — data gaps + +Frontend for the new `/breweries` layout is integrated with real data wherever the API already supports it. These gaps are filled with lorem-ipsum-style filler until the backend catches up: + +- **Featured brewery** — no "editorially flagged" concept exists (no field, no endpoint). Currently defaults to the most recently created brewery. Needs a real flag (e.g. `IsFeatured` + an admin toggle, or a rotation query) plus the "week" cadence implied by the "THIS WEEK" badge. +- **Brewery tagline / one-line note** — `SimplifiedBreweryDto` (used by both `/locations` and `/locations/nearby`) has no description-like field. The nearby list and recently-added cards use filler note text. Needs a short field added to that DTO (or a truncated `Description`). +- **Founded year, beers listed count, house style** — none of these exist anywhere in the domain (`BreweryPost` has no founding date or style; there's no beer-count aggregate; `Features.Beers` has no query handlers at all yet). Featured card stats are entirely filler. +- **Total brewery count** — no lightweight count endpoint. CTA copy ("All N partner breweries...") uses a filler number rather than an unbounded fetch just to count rows. Needs something like `GET /api/brewery/count`. +- **Distance** is computed client-side (Haversine) from the coordinates `/locations/nearby` already returns — no backend change needed there. +- **Manual location entry** — "Change location" button re-requests browser geolocation only; there's no geocoding/place-search endpoint to resolve a typed address, so free-text entry isn't wired up yet. diff --git a/web/frontend/app/features/breweries/breweries.server.ts b/web/frontend/app/features/breweries/breweries.server.ts index cc8a4629..a2db14ce 100644 --- a/web/frontend/app/features/breweries/breweries.server.ts +++ b/web/frontend/app/features/breweries/breweries.server.ts @@ -86,6 +86,30 @@ export const getBreweryLocations = async (): Promise => { return body.payload; }; +export const getBreweryLocationsNearby = async ( + latitude: number, + longitude: number, + rangeInMetres: number, +): Promise => { + const params = new URLSearchParams({ + latitude: String(latitude), + longitude: String(longitude), + rangeInMetres: String(rangeInMetres), + }); + + const res = await fetchApi(`/api/brewery/locations/nearby?${params}`); + + if (!res.ok) { + throw data(`Failed to load nearby breweries (${res.status}).`, { + status: res.status, + statusText: res.statusText, + }); + } + + const body: ApiResponse = await res.json(); + return body.payload; +}; + export const getBreweryById = async (id: string): Promise => { const res = await fetchApi(`/api/brewery/${encodeURIComponent(id)}`);