Add store location map manager #20
@ -28,7 +28,7 @@ export default function LocationMapBottomSheet({
|
||||
selectedZoneItems = EMPTY_ITEMS,
|
||||
visibleAssignedItemCount = 0,
|
||||
visibleUnmappedItems = EMPTY_ITEMS,
|
||||
unmappedItemCount,
|
||||
unmappedItemCount = 0,
|
||||
hiddenAreaCount,
|
||||
saving,
|
||||
savingAction,
|
||||
@ -129,6 +129,11 @@ export default function LocationMapBottomSheet({
|
||||
: visibleUnmappedItems.length === unmappedItemCount
|
||||
? String(unmappedItemCount)
|
||||
: `${visibleUnmappedItems.length} shown`;
|
||||
const mapOverviewRows = [
|
||||
{ label: "Areas", value: filters.showZones ? `${visibleAreaCount} shown` : "Hidden" },
|
||||
...(assignedItemCount > 0 ? [{ label: "Mapped items", value: mappedItemSummary }] : []),
|
||||
...(unmappedItemCount > 0 ? [{ label: "Unmapped", value: unmappedItemSummary }] : []),
|
||||
];
|
||||
const resetLayerFilters = () => setFilters({ ...DEFAULT_MAP_FILTERS });
|
||||
const showSelectedZoneItems = () => {
|
||||
setFilters((current) => ({
|
||||
@ -252,11 +257,7 @@ export default function LocationMapBottomSheet({
|
||||
{showMapOverview ? (
|
||||
<LocationMapOverview
|
||||
ariaLabel="Map summary"
|
||||
rows={[
|
||||
{ label: "Areas", value: filters.showZones ? `${visibleAreaCount} shown` : "Hidden" },
|
||||
{ label: "Mapped items", value: mappedItemSummary },
|
||||
{ label: "Unmapped", value: unmappedItemSummary },
|
||||
]}
|
||||
rows={mapOverviewRows}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
|
||||
@ -2777,6 +2777,49 @@ test("viewer shows a compact map overview before selecting an area", async ({ pa
|
||||
await expect(page.locator(".location-map-sheet-header strong")).toHaveText("Bakery");
|
||||
});
|
||||
|
||||
test("viewer omits zero item rows from the map overview", async ({ page }) => {
|
||||
await mockMapShell(page);
|
||||
|
||||
const mapState = {
|
||||
...publishedMapState([
|
||||
{
|
||||
id: 1531,
|
||||
location_map_id: 901,
|
||||
zone_id: 501,
|
||||
zone_name: "Bakery",
|
||||
type: "zone",
|
||||
label: "Bakery",
|
||||
x: 40,
|
||||
y: 40,
|
||||
width: 260,
|
||||
height: 160,
|
||||
rotation: 0,
|
||||
locked: false,
|
||||
visible: true,
|
||||
sort_order: 1,
|
||||
},
|
||||
], true),
|
||||
items: [],
|
||||
unmapped_count: 0,
|
||||
};
|
||||
|
||||
await page.route("**/households/1/locations/10/map", async (route) => {
|
||||
await route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify(mapState),
|
||||
});
|
||||
});
|
||||
|
||||
await page.goto("/stores/100/locations/10/map");
|
||||
|
||||
const overview = page.getByLabel("Map summary");
|
||||
await expect(overview.locator(".location-map-overview-row")).toHaveCount(1);
|
||||
await expect(overview.locator(".location-map-overview-row", { hasText: "Areas" }).locator("strong")).toHaveText("1 shown");
|
||||
await expect(overview.locator(".location-map-overview-row", { hasText: "Mapped items" })).toHaveCount(0);
|
||||
await expect(overview.locator(".location-map-overview-row", { hasText: "Unmapped" })).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("viewer shows a compact overflow cue for long unmapped lists", async ({ page }) => {
|
||||
await mockMapShell(page);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user