summaryrefslogtreecommitdiff
path: root/src/components/map/groups/DatacenterGroup.js
diff options
context:
space:
mode:
authorGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-08-25 23:03:05 +0200
committerGeorgios Andreadis <g.andreadis@student.tudelft.nl>2017-09-23 10:05:44 +0200
commit8302923a08728d36746af3560ebc35685c2b9da5 (patch)
tree028b0e0db8f7e8e60d9127a522ceea49ec395952 /src/components/map/groups/DatacenterGroup.js
parent8f5e6d1e73f16e3cdd523f961d06e4b4eb5a8cef (diff)
Enable going from building to room and back
Diffstat (limited to 'src/components/map/groups/DatacenterGroup.js')
-rw-r--r--src/components/map/groups/DatacenterGroup.js37
1 files changed, 28 insertions, 9 deletions
diff --git a/src/components/map/groups/DatacenterGroup.js b/src/components/map/groups/DatacenterGroup.js
index d7e349be..cd4baaa5 100644
--- a/src/components/map/groups/DatacenterGroup.js
+++ b/src/components/map/groups/DatacenterGroup.js
@@ -1,23 +1,42 @@
import React from "react";
import {Group} from "react-konva";
+import GrayContainer from "../../../containers/map/GrayContainer";
+import RoomContainer from "../../../containers/map/RoomContainer";
import Shapes from "../../../shapes/index";
-import RoomGroup from "./RoomGroup";
-const DatacenterGroup = ({datacenter}) => {
+const DatacenterGroup = ({datacenter, interactionLevel}) => {
if (!datacenter) {
return <Group/>;
}
- return (
- <Group>
- {datacenter.rooms.map(room => (
- <RoomGroup key={room.id} room={room}/>
- ))}
- </Group>
- );
+
+ if (interactionLevel.mode === "ROOM") {
+ return (
+ <Group>
+ {datacenter.rooms
+ .filter(room => room.id !== interactionLevel.roomId)
+ .map(room => <RoomContainer key={room.id} room={room}/>)
+ }
+ <GrayContainer/>
+ {datacenter.rooms
+ .filter(room => room.id === interactionLevel.roomId)
+ .map(room => <RoomContainer key={room.id} room={room}/>)
+ }
+ </Group>
+ );
+ } else {
+ return (
+ <Group>
+ {datacenter.rooms.map(room => (
+ <RoomContainer key={room.id} room={room}/>
+ ))}
+ </Group>
+ );
+ }
};
DatacenterGroup.propTypes = {
datacenter: Shapes.Datacenter,
+ interactionLevel: Shapes.InteractionLevel,
};
export default DatacenterGroup;