Always offer the directory map, empty or not

This commit is contained in:
Coracle-Bot 2026-09-24 23:41:36 +00:00
parent c84077b86e
commit df0d01db9e
3 changed files with 19 additions and 11 deletions

View file

@ -1569,8 +1569,9 @@ Acceptance:
states and countries, and publishes what was picked to kind 0. states and countries, and publishes what was picked to kind 0.
- Choosing a city publishes a geohash with it; choosing a state or a country - Choosing a city publishes a geohash with it; choosing a state or a country
publishes the name alone, so nothing finer than the answer given goes out. publishes the name alone, so nothing finer than the answer given goes out.
- The directory offers a map whenever a member has a geohash, pins each of them - The directory offers a map, pins every member who has a geohash with their
with their avatar, and opens a pin's profile when it is clicked. avatar, and opens a pin's profile when it is clicked. A map with nobody on it
says so.
- The directory's search narrows the map as it narrows the list. - The directory's search narrows the map as it narrows the list.
### US-098 — Browse and create hosted spaces ### US-098 — Browse and create hosted spaces

View file

@ -687,7 +687,7 @@ test("US-131 say where you are and find members on a map", async ({seed, as}) =>
await form.getByPlaceholder("Search for a city").fill("portl") await form.getByPlaceholder("Search for a city").fill("portl")
// A state is a place to be from; a street is not. // A state is a place to be from; a street is not.
await expect(form.getByRole("button", {name: "Oregon, United States"})).toBeVisible() await expect(form.getByRole("button", {name: "Oregon, United States", exact: true})).toBeVisible()
await expect( await expect(
form.getByRole("button", {name: "Portland Avenue, Oregon, United States"}), form.getByRole("button", {name: "Portland Avenue, Oregon, United States"}),
).toHaveCount(0) ).toHaveCount(0)
@ -742,7 +742,7 @@ test("US-131 say where you are and find members on a map", async ({seed, as}) =>
await secondForm.getByRole("button", {name: "Clear location"}).click() await secondForm.getByRole("button", {name: "Clear location"}).click()
await secondForm.getByPlaceholder("Search for a city").fill("oreg") await secondForm.getByPlaceholder("Search for a city").fill("oreg")
await secondForm.getByRole("button", {name: "Oregon, United States"}).click() await secondForm.getByRole("button", {name: "Oregon, United States", exact: true}).click()
await secondForm.getByRole("button", {name: "Save Changes"}).click() await secondForm.getByRole("button", {name: "Save Changes"}).click()
await expect(page.getByRole("alert")).toContainText("Your profile has been updated!") await expect(page.getByRole("alert")).toContainText("Your profile has been updated!")
@ -751,4 +751,11 @@ test("US-131 say where you are and find members on a map", async ({seed, as}) =>
expect(JSON.parse(republished[1].content).location).toBe("Oregon, United States") expect(JSON.parse(republished[1].content).location).toBe("Oregon, United States")
expect(republished[1].tags.map(tag => tag[0])).not.toContain("g") expect(republished[1].tags.map(tag => tag[0])).not.toContain("g")
// The map is offered whether or not anyone is on it, so an empty one says so.
await page.goto(`${spacePath(url)}/directory`)
await page.getByPlaceholder("Search people or roles...").fill("Anders")
await page.getByRole("button", {name: "Map"}).click()
await expect(pageContent(page).getByText("No locations found.")).toBeVisible()
}) })

View file

@ -125,15 +125,15 @@
type="text" type="text"
placeholder="Search people or roles..." /> placeholder="Search people or roles..." />
</label> </label>
{#if $pins.length > 0} <Button class="button button-neutral shrink-0" onclick={toggleMap}>
<Button class="button button-neutral shrink-0" onclick={toggleMap}> <Icon size={4} icon={showMap ? UsersGroup : MapIcon} />
<Icon size={4} icon={showMap ? UsersGroup : MapIcon} /> {showMap ? "List" : "Map"}
{showMap ? "List" : "Map"} </Button>
</Button>
{/if}
</div> </div>
{#if showMap} {#if showMap && visiblePins.length > 0}
<SpaceMemberMap {url} pins={visiblePins} /> <SpaceMemberMap {url} pins={visiblePins} />
{:else if showMap}
<p class="flex flex-col items-center py-20 text-center">No locations found.</p>
{:else if visibleMembers.length === 0} {:else if visibleMembers.length === 0}
<p class="flex flex-col items-center py-20 text-center">No members found.</p> <p class="flex flex-col items-center py-20 text-center">No members found.</p>
{:else} {:else}