From df0d01db9e8efea748805694f264d3630a3bda00 Mon Sep 17 00:00:00 2001 From: Coracle-Bot Date: Thu, 24 Sep 2026 23:41:36 +0000 Subject: [PATCH] Always offer the directory map, empty or not --- e2e/USER_STORIES.md | 5 +++-- e2e/specs/people.spec.ts | 11 +++++++++-- src/routes/spaces/[relay]/directory/+page.svelte | 14 +++++++------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/e2e/USER_STORIES.md b/e2e/USER_STORIES.md index 9e55059a..b9898011 100644 --- a/e2e/USER_STORIES.md +++ b/e2e/USER_STORIES.md @@ -1569,8 +1569,9 @@ Acceptance: 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 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 - with their avatar, and opens a pin's profile when it is clicked. +- The directory offers a map, pins every member who has a geohash with their + 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. ### US-098 — Browse and create hosted spaces diff --git a/e2e/specs/people.spec.ts b/e2e/specs/people.spec.ts index 6b9323a2..3cfcdfe5 100644 --- a/e2e/specs/people.spec.ts +++ b/e2e/specs/people.spec.ts @@ -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") // 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( form.getByRole("button", {name: "Portland Avenue, Oregon, United States"}), ).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.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 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(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() }) diff --git a/src/routes/spaces/[relay]/directory/+page.svelte b/src/routes/spaces/[relay]/directory/+page.svelte index 524faab5..46e764d6 100644 --- a/src/routes/spaces/[relay]/directory/+page.svelte +++ b/src/routes/spaces/[relay]/directory/+page.svelte @@ -125,15 +125,15 @@ type="text" placeholder="Search people or roles..." /> - {#if $pins.length > 0} - - {/if} + - {#if showMap} + {#if showMap && visiblePins.length > 0} + {:else if showMap} +

No locations found.

{:else if visibleMembers.length === 0}

No members found.

{:else}