summaryrefslogtreecommitdiff
path: root/src/components/app/map/elements/RackFillBar.js
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-06-29 15:47:09 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 16:08:41 +0200
commit90fae26aa4bd0e0eb3272ff6e6524060e9004fbb (patch)
treebf6943882f5fa5f3114c01fc571503c79ee1056d /src/components/app/map/elements/RackFillBar.js
parent7032a007d4431f5a0c4c5e2d3f3bd20462d49950 (diff)
Prepare frontend repository for monorepo
This change prepares the frontend Git repository for the monorepo residing at https://github.com/atlarge-research.com/opendc. To accomodate for this, we move all files into a frontend subdirectory.
Diffstat (limited to 'src/components/app/map/elements/RackFillBar.js')
-rw-r--r--src/components/app/map/elements/RackFillBar.js89
1 files changed, 0 insertions, 89 deletions
diff --git a/src/components/app/map/elements/RackFillBar.js b/src/components/app/map/elements/RackFillBar.js
deleted file mode 100644
index 43701d97..00000000
--- a/src/components/app/map/elements/RackFillBar.js
+++ /dev/null
@@ -1,89 +0,0 @@
-import PropTypes from "prop-types";
-import React from "react";
-import { Group, Rect } from "react-konva";
-import {
- RACK_ENERGY_BAR_BACKGROUND_COLOR,
- RACK_ENERGY_BAR_FILL_COLOR,
- RACK_SPACE_BAR_BACKGROUND_COLOR,
- RACK_SPACE_BAR_FILL_COLOR
-} from "../../../../util/colors";
-import {
- OBJECT_BORDER_WIDTH_IN_PIXELS,
- OBJECT_MARGIN_IN_PIXELS,
- RACK_FILL_ICON_OPACITY,
- RACK_FILL_ICON_WIDTH,
- TILE_SIZE_IN_PIXELS
-} from "../MapConstants";
-import ImageComponent from "./ImageComponent";
-
-const RackFillBar = ({ positionX, positionY, type, fillFraction }) => {
- const halfOfObjectBorderWidth = OBJECT_BORDER_WIDTH_IN_PIXELS / 2;
- const x =
- positionX * TILE_SIZE_IN_PIXELS +
- OBJECT_MARGIN_IN_PIXELS +
- (type === "space"
- ? halfOfObjectBorderWidth
- : 0.5 * (TILE_SIZE_IN_PIXELS - 2 * OBJECT_MARGIN_IN_PIXELS));
- const startY =
- positionY * TILE_SIZE_IN_PIXELS +
- OBJECT_MARGIN_IN_PIXELS +
- halfOfObjectBorderWidth;
- const width =
- 0.5 * (TILE_SIZE_IN_PIXELS - OBJECT_MARGIN_IN_PIXELS * 2) -
- halfOfObjectBorderWidth;
- const fullHeight =
- TILE_SIZE_IN_PIXELS -
- OBJECT_MARGIN_IN_PIXELS * 2 -
- OBJECT_BORDER_WIDTH_IN_PIXELS;
-
- const fractionHeight = fillFraction * fullHeight;
- const fractionY =
- (positionY + 1) * TILE_SIZE_IN_PIXELS -
- OBJECT_MARGIN_IN_PIXELS -
- halfOfObjectBorderWidth -
- fractionHeight;
-
- return (
- <Group>
- <Rect
- x={x}
- y={startY}
- width={width}
- height={fullHeight}
- fill={
- type === "space"
- ? RACK_SPACE_BAR_BACKGROUND_COLOR
- : RACK_ENERGY_BAR_BACKGROUND_COLOR
- }
- />
- <Rect
- x={x}
- y={fractionY}
- width={width}
- height={fractionHeight}
- fill={
- type === "space"
- ? RACK_SPACE_BAR_FILL_COLOR
- : RACK_ENERGY_BAR_FILL_COLOR
- }
- />
- <ImageComponent
- src={"/img/topology/rack-" + type + "-icon.png"}
- x={x + width * 0.5 - RACK_FILL_ICON_WIDTH * 0.5}
- y={startY + fullHeight * 0.5 - RACK_FILL_ICON_WIDTH * 0.5}
- width={RACK_FILL_ICON_WIDTH}
- height={RACK_FILL_ICON_WIDTH}
- opacity={RACK_FILL_ICON_OPACITY}
- />
- </Group>
- );
-};
-
-RackFillBar.propTypes = {
- positionX: PropTypes.number.isRequired,
- positionY: PropTypes.number.isRequired,
- type: PropTypes.string.isRequired,
- fillFraction: PropTypes.number.isRequired
-};
-
-export default RackFillBar;