fix: expose map layer reset
This commit is contained in:
parent
164a95e058
commit
493b0b3d34
@ -97,6 +97,7 @@ export default function LocationMapBottomSheet({
|
|||||||
const maxHeight = Math.max(40, Math.round(mapSize?.height || selectedHeight));
|
const maxHeight = Math.max(40, Math.round(mapSize?.height || selectedHeight));
|
||||||
const saveDraftLabel = savingAction === "save" ? "Saving..." : "Save Draft";
|
const saveDraftLabel = savingAction === "save" ? "Saving..." : "Save Draft";
|
||||||
const publishLabel = savingAction === "publish" ? "Publishing..." : "Publish";
|
const publishLabel = savingAction === "publish" ? "Publishing..." : "Publish";
|
||||||
|
const resetLayerFilters = () => setFilters({ ...DEFAULT_MAP_FILTERS });
|
||||||
const showSelectedZoneItems = () => {
|
const showSelectedZoneItems = () => {
|
||||||
setFilters((current) => ({
|
setFilters((current) => ({
|
||||||
...current,
|
...current,
|
||||||
@ -162,6 +163,17 @@ export default function LocationMapBottomSheet({
|
|||||||
<span>{sheetDescription}</span>
|
<span>{sheetDescription}</span>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
<div className="location-map-layer-actions">
|
||||||
|
{changedLayerCount ? (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
className="location-map-layer-reset"
|
||||||
|
onClick={resetLayerFilters}
|
||||||
|
aria-label="Reset layer filters"
|
||||||
|
>
|
||||||
|
Reset
|
||||||
|
</button>
|
||||||
|
) : null}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
className={`location-map-layer-toggle ${layersOpen ? "active" : ""}`}
|
className={`location-map-layer-toggle ${layersOpen ? "active" : ""}`}
|
||||||
@ -175,18 +187,10 @@ export default function LocationMapBottomSheet({
|
|||||||
) : null}
|
) : null}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{layersOpen ? (
|
{layersOpen ? (
|
||||||
<div className="location-map-display-panel">
|
<div className="location-map-display-panel">
|
||||||
{changedLayerCount ? (
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="location-map-layer-reset"
|
|
||||||
onClick={() => setFilters({ ...DEFAULT_MAP_FILTERS })}
|
|
||||||
>
|
|
||||||
Reset
|
|
||||||
</button>
|
|
||||||
) : null}
|
|
||||||
<div className="location-map-display-controls">
|
<div className="location-map-display-controls">
|
||||||
{DISPLAY_CONTROLS.map(([key, label]) => (
|
{DISPLAY_CONTROLS.map(([key, label]) => (
|
||||||
<label key={key}>
|
<label key={key}>
|
||||||
|
|||||||
@ -412,6 +412,13 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.location-map-layer-actions {
|
||||||
|
flex: 0 0 auto;
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
|
}
|
||||||
|
|
||||||
.location-map-layer-toggle {
|
.location-map-layer-toggle {
|
||||||
min-height: 40px;
|
min-height: 40px;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
@ -452,8 +459,6 @@
|
|||||||
|
|
||||||
.location-map-layer-reset {
|
.location-map-layer-reset {
|
||||||
min-height: 36px;
|
min-height: 36px;
|
||||||
width: fit-content;
|
|
||||||
justify-self: end;
|
|
||||||
padding: 0.35rem 0.65rem;
|
padding: 0.35rem 0.65rem;
|
||||||
border: 1px solid var(--color-border-light);
|
border: 1px solid var(--color-border-light);
|
||||||
border-radius: 999px;
|
border-radius: 999px;
|
||||||
|
|||||||
@ -1403,8 +1403,11 @@ test("viewer wraps long zone labels and keeps item counts visible", async ({ pag
|
|||||||
await expect(produceArea.locator(".location-map-count")).toHaveText("2 items");
|
await expect(produceArea.locator(".location-map-count")).toHaveText("2 items");
|
||||||
await expect(produceArea.locator(".location-map-count")).toHaveAttribute("y", "92");
|
await expect(produceArea.locator(".location-map-count")).toHaveAttribute("y", "92");
|
||||||
|
|
||||||
await page.getByRole("button", { name: "Reset" }).click();
|
await page.getByRole("button", { name: "Layers, 1 changed" }).click();
|
||||||
|
await expect(page.getByRole("button", { name: "Reset layer filters" })).toBeVisible();
|
||||||
|
await page.getByRole("button", { name: "Reset layer filters" }).click();
|
||||||
await expect(page.getByRole("button", { name: "Layers" })).toBeVisible();
|
await expect(page.getByRole("button", { name: "Layers" })).toBeVisible();
|
||||||
|
await expect(page.getByRole("button", { name: "Reset layer filters" })).toHaveCount(0);
|
||||||
await expect(produceArea.locator(".location-map-label tspan")).toHaveCount(2);
|
await expect(produceArea.locator(".location-map-label tspan")).toHaveCount(2);
|
||||||
await expect(produceArea.locator(".location-map-count")).toHaveAttribute("y", "116");
|
await expect(produceArea.locator(".location-map-count")).toHaveAttribute("y", "116");
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user