Add store location map manager #20

Open
nalalangan wants to merge 206 commits from feature/location-map-manager into feature/store-selector-modal
2 changed files with 13 additions and 1 deletions
Showing only changes of commit e3998acc12 - Show all commits

View File

@ -19,6 +19,14 @@ const DISPLAY_CONTROLS = [
["showUnmapped", "Unmapped"],
];
function formatObjectTypeLabel(type) {
return String(type)
.split(/[-_\s]+/)
.filter(Boolean)
.map((part) => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)
.join(" ");
}
export default function LocationMapBottomSheet({
mode,
editorTool,
@ -261,7 +269,7 @@ export default function LocationMapBottomSheet({
onChange={(event) => onObjectField("type", event.target.value)}
>
{MAP_OBJECT_TYPES.map((type) => (
<option key={type} value={type}>{type}</option>
<option key={type} value={type}>{formatObjectTypeLabel(type)}</option>
))}
</select>
</label>

View File

@ -288,6 +288,10 @@ test("admin creates a map from zones, saves a draft, and publishes it", async ({
const bakeryObject = page.locator(".location-map-object", { hasText: "Bakery" }).locator("rect").first();
await bakeryObject.click();
await expect(page.locator(".location-map-sheet-header strong")).toHaveText("Bakery");
const objectTypeSelect = page.getByLabel("Object type");
await expect(objectTypeSelect).toHaveValue("zone");
await expect(objectTypeSelect.locator('option[value="zone"]')).toHaveText("Zone");
await expect(objectTypeSelect.locator('option[value="aisle"]')).toHaveText("Aisle");
const moveBox = await bakeryObject.boundingBox();
expect(moveBox).not.toBeNull();
if (!moveBox) throw new Error("Bakery map object could not be moved");