@@ -342,7 +343,7 @@ const roundLevelWidth = (width: number) => {
return Math.ceil(width)
}
-const fluidIcon = (type: number, mode: string = "compact", className: string, isComponent: boolean = true) => {
+const fluidIcon = (type: number, componentMode: ComponentMode = "compact", className: string, isComponent: boolean = true) => {
switch (type) {
case 0:
case 3:
@@ -392,7 +393,7 @@ const fluidIcon = (type: number, mode: string = "compact", className: string, is
interface Props {
tankInstanceId: number
levelWidth?: number
- mode?: "compact" | "full"
+ componentMode?: ComponentMode
orientation?: "vertical" | "horizontal"
parentSize?: { width: number; height: number }
}
diff --git a/src/app/Marine2/components/boxes/Tanks/Tanks.test.js b/src/app/Marine2/components/boxes/Tanks/Tanks.test.js
index 43b343eca..cc5b9f984 100644
--- a/src/app/Marine2/components/boxes/Tanks/Tanks.test.js
+++ b/src/app/Marine2/components/boxes/Tanks/Tanks.test.js
@@ -5,7 +5,7 @@ import { AppViews } from "../../../modules/AppViews"
describe("Tanks element", () => {
describe("compact mode", () => {
- const wrapper = mount(
)
+ const wrapper = mount(
)
it("should show content", () => {
expect(wrapper.find(Tanks).exists()).toBe(true)
diff --git a/src/app/Marine2/components/boxes/Tanks/Tanks.tsx b/src/app/Marine2/components/boxes/Tanks/Tanks.tsx
index 86a2b6cae..5efb85410 100644
--- a/src/app/Marine2/components/boxes/Tanks/Tanks.tsx
+++ b/src/app/Marine2/components/boxes/Tanks/Tanks.tsx
@@ -13,13 +13,14 @@ import ResizeObserver from "resize-observer-polyfill"
import useSize from "@react-hook/size"
import { applyStyles, defaultBoxStyles } from "../../../utils/media"
import classNames from "classnames"
+import { ComponentMode } from "@m2Types/generic/component-mode"
interface Props {
- mode?: "full" | "compact"
+ componentMode?: ComponentMode
className?: string
}
-const Tanks = ({ mode = "full", className }: Props) => {
+const Tanks = ({ componentMode = "full", className }: Props) => {
const { tanks } = useTanks()
const filteredTanks = (tanks || []).filter((tank) => !!tank || tank === 0)
@@ -84,7 +85,7 @@ const Tanks = ({ mode = "full", className }: Props) => {
}, 0)
}
- if (mode === "compact") {
+ if (componentMode === "compact") {
return (
{
{filteredTanks.map((tank) => (
{
{
{
const getBoxByType = (type: BoxTypes) => {
switch (type) {
case BoxTypes.ENERGY:
- return
+ return
case BoxTypes.TANKS:
- return
+ return
case BoxTypes.BATTERIES:
- return
+ return
case BoxTypes.DEVICES:
- return
+ return
case BoxTypes.ENVIRONMENT:
- return
+ return
default:
return null
}
diff --git a/src/app/Marine2/types/generic/component-mode.ts b/src/app/Marine2/types/generic/component-mode.ts
new file mode 100644
index 000000000..45532b05b
--- /dev/null
+++ b/src/app/Marine2/types/generic/component-mode.ts
@@ -0,0 +1 @@
+export type ComponentMode = "compact" | "full"
diff --git a/src/app/Marine2/types/generic/mode.ts b/src/app/Marine2/types/generic/mode.ts
deleted file mode 100644
index ba103d534..000000000
--- a/src/app/Marine2/types/generic/mode.ts
+++ /dev/null
@@ -1 +0,0 @@
-export type Mode = "compact" | "full"