diff --git a/src/Map.js b/src/Map.js index 4e912ca..477a564 100644 --- a/src/Map.js +++ b/src/Map.js @@ -160,7 +160,7 @@ function floorList(connectedFloors, callbackChangeFloor) { // Returns under html format a list of floors connected // listed in connectedFloors - // Auxiliary function used when creating a Lift/Strairs component + // Auxiliary function used when creating a Lift/Stairs component let htmlFloorList = []; for (const floor in connectedFloors) { @@ -171,6 +171,21 @@ function floorList(connectedFloors, callbackChangeFloor) return htmlFloorList; } +function roomNameList(nameList) +{ + // Returns under html format a list of room names + // (without bullet points) listed in nameList + // Auxiliary function used when creating a Room component + let htmlNameList = []; + for (const ind in nameList) + { + htmlNameList = [...htmlNameList,
+ {nameList[ind]} +
]; + } + return htmlNameList; +} + function newPolygon(element, positions, selectedRoom, callbackRoomSelected, callbackChangeFloor) { // Auxiliary function to return the appropriate polygon depending @@ -180,12 +195,11 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call // and for S or L, we add a Popup with the list of connected floors and possibility to load the // map of a connected floor const color = selectedRoom === element["id"] ? 'red' : 'grey'; - console.log(element); if (element["type"] === "S") { // In this case, the room is a staircase so we add a Stairs component return callbackRoomSelected(element["id"])}}> - {element["names"]} + {roomNameList(element["names"])} {floorList(element["connectedFloors"], callbackChangeFloor)} @@ -197,7 +211,7 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call { // In this case the room is a lift so we add a Lift component return callbackRoomSelected(element["id"])}}> - {element["names"]} + {roomNameList(element["names"])} {floorList(element["connectedFloors"], callbackChangeFloor)} @@ -208,7 +222,7 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call else if (element["type"] === "T") { return callbackRoomSelected(element["id"])}}> - {element["names"]} + {roomNameList(element["names"])} } @@ -216,7 +230,7 @@ function newPolygon(element, positions, selectedRoom, callbackRoomSelected, call { // In this case it is a regular room return callbackRoomSelected(element["id"])}}> - {element["names"]} + {roomNameList(element["names"])} } else if (element["type"] === "C")