= ({ api }) => {
+ const lang = useLang();
+ const ha = useHAConnection();
+ const version = process.env.REACT_APP_BUILD_VERSION ?? "n/a";
+ const [isOpen, setOpen] = useState(false);
+
+ return (
+
+
+
+
+
+
+ HA{" "}
+ {ha.status === "loaded"
+ ? lang.get("CONNECTED")
+ : ha.status === "error"
+ ? lang.get("FAILED")
+ : lang.get("LOADING")}
+
+ 🟢
+
+
+ version: {version}
+
+
+ );
+};
diff --git a/webapp/src/components/ConditionEditor/ConditionNodeBase.stories.tsx b/webapp/src/components/ConditionEditor/ConditionNodeBase.stories.tsx
index 074caa2..37eadaf 100644
--- a/webapp/src/components/ConditionEditor/ConditionNodeBase.stories.tsx
+++ b/webapp/src/components/ConditionEditor/ConditionNodeBase.stories.tsx
@@ -1,22 +1,17 @@
-import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
import { useState } from "react";
import { AutomationCondition } from "types/automations/conditions";
import { ConditionNodeBase } from "./ConditionNodeBase";
-export default {
- title: "ConditionEditor/NodeBase",
- component: ConditionNodeBase,
- parameters: { actions: { argTypesRegex: "^on.*" } },
-} as ComponentMeta;
+import { makeStory } from "devUtils";
-const Template: ComponentStory = ({
- condition,
- ...args
-}) => {
- const [data, setData] = useState(condition);
- return (
-
+const { make, componentMeta } = makeStory({
+ Component: ConditionNodeBase,
+ meta: {
+ title: "ConditionEditor/NodeBase",
+ },
+ BaseTemplate: ({ condition, ...args }) => {
+ const [data, setData] = useState(condition);
+ return (
= ({
setData(data);
}}
/>
-
- );
-};
+ );
+ },
+});
-export const TemplateViewer = Template.bind({});
-TemplateViewer.args = {
+export default componentMeta;
+
+export const TemplateViewer = make({
condition: {
condition: "template",
value_template: "states('switch.light_kitchen') == 'on'",
} as AutomationCondition,
-};
+});
-export const MultipleThings = Template.bind({});
-MultipleThings.args = {
+export const MultipleThings = make({
condition: {
condition: "or",
conditions: [
@@ -62,4 +57,4 @@ MultipleThings.args = {
},
],
} as AutomationCondition,
-};
+});
diff --git a/webapp/src/components/ConditionEditor/index.stories.tsx b/webapp/src/components/ConditionEditor/index.stories.tsx
index ebb6c1f..4e08c22 100644
--- a/webapp/src/components/ConditionEditor/index.stories.tsx
+++ b/webapp/src/components/ConditionEditor/index.stories.tsx
@@ -1,26 +1,22 @@
import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
+import { MockPage, Page } from "components/Page";
import { useState } from "react";
import { AutomationCondition } from "types/automations/conditions";
import { ConditionEditor } from ".";
+import { makeStory } from "devUtils";
-export default {
- title: "ConditionEditor",
- component: ConditionEditor,
- parameters: { actions: { argTypesRegex: "^on.*" } },
- args: {
- initialViewMode: "edit",
+const { make, componentMeta } = makeStory({
+ Component: ConditionEditor,
+ meta: {
+ title: "ConditionEditor",
+ args: {
+ initialViewMode: "edit",
+ },
},
-} as ComponentMeta;
-
-const Template: ComponentStory = ({
- condition,
- ...args
-}) => {
- const [data, setData] = useState(condition);
- return (
-
+ BaseTemplate: ({ condition, ...args }) => {
+ const [data, setData] = useState(condition);
+ return (
= ({
setData(data);
}}
/>
-
- );
-};
+ );
+ },
+});
-export const TemplateViewer = Template.bind({});
-TemplateViewer.args = {
+export default componentMeta;
+
+export const TemplateViewer = make({
condition: {
condition: "template",
value_template: "states('switch.light_kitchen') == 'on'",
} as AutomationCondition,
-};
+});
-export const NumericStateViewer = Template.bind({});
-NumericStateViewer.args = {
+export const NumericStateViewer = make({
condition: {
condition: "numeric_state",
entity_id: "sensor.humidity_kitchen",
above: "10",
} as AutomationCondition,
-};
+});
-export const LogicCondition = Template.bind({});
-LogicCondition.args = {
+export const LogicCondition = make({
condition: {
condition: "or",
conditions: [
@@ -81,9 +76,8 @@ LogicCondition.args = {
},
],
} as AutomationCondition,
-};
-export const TimeCondition = Template.bind({});
-TimeCondition.args = {
+});
+export const TimeCondition = make({
condition: {
condition: "or",
conditions: [
@@ -104,7 +98,7 @@ TimeCondition.args = {
},
],
} as AutomationCondition,
-};
+});
export const MultipleConditions: ComponentStory = (
args
@@ -134,12 +128,12 @@ export const MultipleConditions: ComponentStory = (
],
});
return (
-
+
{}}
condition={state}
/>
-
+
);
};
diff --git a/webapp/src/components/DAGGraph/board/index.stories.tsx b/webapp/src/components/DAGGraph/board/index.stories.tsx
index 8e2a490..c675afa 100644
--- a/webapp/src/components/DAGGraph/board/index.stories.tsx
+++ b/webapp/src/components/DAGGraph/board/index.stories.tsx
@@ -1,46 +1,34 @@
-import React from "react";
-import { ComponentMeta, ComponentStory } from "@storybook/react";
import { DAGGraphBoard } from ".";
-import { Page } from "components/Page";
import { SimpleErrorElement } from "components/SimpleErrorElement";
-export default {
- title: "DAGGraph/Board",
- component: DAGGraphBoard,
- parameters: { actions: { argTypesRegex: "^on.*" } },
- args: {},
-} as ComponentMeta;
+import { makeStory } from "devUtils";
-const Template: ComponentStory = (args) => {
- return (
-
-
-
- );
-};
+const { make, componentMeta } = makeStory({
+ Component: DAGGraphBoard,
+ meta: {
+ title: "DAGGraph/Board",
+ },
+});
-export const Loading = Template.bind({});
-Loading.args = {
- ...Loading.args,
+export default componentMeta;
+export const Example = make({});
+
+export const Loading = make({
state: {
ready: false,
},
-};
+});
-export const Errored = Template.bind({});
-Errored.args = {
- ...Loading.args,
+export const Errored = make({
state: {
ready: true,
data: {
error: ,
},
},
-};
+});
-export const Empty = Template.bind({});
-Empty.args = {
- ...Empty.args,
+export const Empty = make({
state: {
ready: true,
data: {
@@ -50,11 +38,9 @@ Empty.args = {
},
},
},
-};
+});
-export const Basic = Template.bind({});
-Basic.args = {
- ...Basic.args,
+export const Basic = make({
state: {
ready: true,
data: {
@@ -88,4 +74,4 @@ Basic.args = {
},
},
},
-};
+});
diff --git a/webapp/src/components/DAGGraph/nodes/ButtonNode/Button.stories.tsx b/webapp/src/components/DAGGraph/nodes/ButtonNode/Button.stories.tsx
index ee1fb07..010896b 100644
--- a/webapp/src/components/DAGGraph/nodes/ButtonNode/Button.stories.tsx
+++ b/webapp/src/components/DAGGraph/nodes/ButtonNode/Button.stories.tsx
@@ -1,6 +1,6 @@
import React from "react";
import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
+import { MockPage } from "components/Page";
import { ButtonNode } from "./ButtonNode";
import { DAGGraphBoard } from "components/DAGGraph/board";
import { ButtonNodeMaker } from ".";
@@ -25,7 +25,7 @@ const Template: ComponentStory = (args) => {
...args,
};
return (
-
+
{}}
state={{
@@ -80,7 +80,7 @@ const Template: ComponentStory = (args) => {
},
}}
/>
-
+
);
};
diff --git a/webapp/src/components/DAGGraph/nodes/CollectionNode/CollectionNodes.stories.tsx b/webapp/src/components/DAGGraph/nodes/CollectionNode/CollectionNodes.stories.tsx
index 33e117d..c6085c4 100644
--- a/webapp/src/components/DAGGraph/nodes/CollectionNode/CollectionNodes.stories.tsx
+++ b/webapp/src/components/DAGGraph/nodes/CollectionNode/CollectionNodes.stories.tsx
@@ -1,7 +1,6 @@
import React, { FC } from "react";
import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
-import { CollectionNode } from "./CollectionNode";
+import { MockPage } from "components/Page";
import { DAGGraphBoard } from "components/DAGGraph/board";
import { CollectionNodeMaker } from "./index";
import { DEFAULT_DIMS } from "components/DAGGraph/elements/constants";
@@ -19,7 +18,7 @@ type DemoProps = {
};
const Demo: FC = (args) => {
return (
-
+
{}}
state={{
@@ -64,7 +63,7 @@ const Demo: FC = (args) => {
},
}}
/>
-
+
);
};
@@ -84,7 +83,7 @@ export const Colors: ComponentStory = (args) => ;
export const Empty: ComponentStory = (args) => {
return (
-
+
{}}
state={{
@@ -124,7 +123,7 @@ export const Empty: ComponentStory = (args) => {
},
}}
/>
-
+
);
};
@@ -135,7 +134,7 @@ Empty.args = {
export const ReturnTarget: ComponentStory = (args) => {
return (
-
+
{}}
state={{
@@ -222,7 +221,7 @@ export const ReturnTarget: ComponentStory = (args) => {
},
}}
/>
-
+
);
};
diff --git a/webapp/src/components/DAGGraph/nodes/SequenceNode/SequenceNode.stories.tsx b/webapp/src/components/DAGGraph/nodes/SequenceNode/SequenceNode.stories.tsx
index b8c8e07..dda6ee9 100644
--- a/webapp/src/components/DAGGraph/nodes/SequenceNode/SequenceNode.stories.tsx
+++ b/webapp/src/components/DAGGraph/nodes/SequenceNode/SequenceNode.stories.tsx
@@ -1,6 +1,6 @@
import React from "react";
import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
+import { MockPage } from "components/Page";
import { SequenceNode } from "./SequenceNode";
import { DAGGraphBoard } from "components/DAGGraph/board";
import { SequenceNodeMaker } from "./index";
@@ -21,7 +21,7 @@ export default {
const Template: ComponentStory = (args) => {
return (
-
+
{}}
state={{
@@ -46,13 +46,13 @@ const Template: ComponentStory = (args) => {
},
}}
/>
-
+
);
};
export const Colors: ComponentStory = (args) => {
return (
-
+
{}}
state={{
@@ -85,7 +85,7 @@ export const Colors: ComponentStory = (args) => {
},
}}
/>
-
+
);
};
diff --git a/webapp/src/components/ErrorBoundary/index.stories.tsx b/webapp/src/components/ErrorBoundary/index.stories.tsx
index cd4c72b..9eff3c8 100644
--- a/webapp/src/components/ErrorBoundary/index.stories.tsx
+++ b/webapp/src/components/ErrorBoundary/index.stories.tsx
@@ -1,35 +1,43 @@
import React, { FC } from "react";
-import { ComponentMeta, ComponentStory } from '@storybook/react';
import { ErrorBoundary } from ".";
-import { Page } from "components/Page";
+import { makeStory } from "devUtils";
+import { MockPage } from "components/Page";
+import { ComponentStory } from "@storybook/react";
-export default {
- title: 'ErrorBoundary',
+const { make, componentMeta } = makeStory({
+ Component: () => Example
,
+ meta: {
+ title: "ErrorBoundary",
component: ErrorBoundary,
- parameters: { actions: { argTypesRegex: '^on.*' } },
- args: {
- }
-} as ComponentMeta
+ },
+});
-export const ErrorThrown: ComponentStory = args => {
- const BadComponent: FC = () => {
- throw new Error("!!!")
- }
- return
-
-
-
-
-}
+export default componentMeta;
+export const Example = make({});
-export const NoError: ComponentStory = args => {
- const GoodComponent: FC = () => {
- return All Good.
- }
- return
-
-
-
-
-}
\ No newline at end of file
+export const ErrorThrown: ComponentStory = (args) => {
+ const BadComponent: FC = () => {
+ throw new Error("!!!");
+ };
+ return (
+
+
+
+
+
+ );
+};
+
+export const NoError: ComponentStory = (args) => {
+ const GoodComponent: FC = () => {
+ return All Good.;
+ };
+ return (
+
+
+
+
+
+ );
+};
diff --git a/webapp/src/components/Icons/index.stories.tsx b/webapp/src/components/Icons/index.stories.tsx
index 01beec4..9974390 100644
--- a/webapp/src/components/Icons/index.stories.tsx
+++ b/webapp/src/components/Icons/index.stories.tsx
@@ -12,7 +12,7 @@ import {
GearIcon,
} from ".";
import { ButtonIcon } from "./ButtonIcons";
-import { Page } from "components/Page";
+import { MockPage } from "components/Page";
export default {
title: "Icons",
@@ -21,7 +21,7 @@ export default {
export const IconList: ComponentStory = (args) => {
return (
-
+
@@ -29,7 +29,7 @@ export const IconList: ComponentStory = (args) => {
-
+
);
};
IconList.args = {
@@ -39,9 +39,9 @@ IconList.args = {
export const ButtonIconExample: ComponentStory = (args) => {
return (
-
+
} />
-
+
);
};
ButtonIconExample.args = {
diff --git a/webapp/src/components/Inputs/AutoComplete/InputDevice.stories.tsx b/webapp/src/components/Inputs/AutoComplete/InputDevice.stories.tsx
index c3eab70..8cf5b10 100644
--- a/webapp/src/components/Inputs/AutoComplete/InputDevice.stories.tsx
+++ b/webapp/src/components/Inputs/AutoComplete/InputDevice.stories.tsx
@@ -1,36 +1,39 @@
-import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
import { useState } from "react";
import { InputDevice } from "./InputDevice";
-export default {
- title: 'Inputs/InputDevice',
- component: InputDevice,
- parameters: { actions: { argTypesRegex: '^on.*' } },
- argTypes: {}
-} as ComponentMeta;
+import { makeStory } from "devUtils";
+const { make, componentMeta } = makeStory({
+ Component: InputDevice,
+ meta: {
+ title: "Inputs/InputDevice",
+ },
+ BaseTemplate: (args) => {
+ const [value, setValue] = useState(args.value);
+ return (
+
+ {
+ setValue(v);
+ args.onChange(v as any);
+ }}
+ />
+
+ );
+ },
+});
+export default componentMeta;
+export const Example = make({});
-const Template: ComponentStory = args => {
- const [value, setValue] = useState(args.value)
- return
-
- {
- setValue(v)
- args.onChange(v as any)
- }} />
-
-
-
-}
-
-export const Single = Template.bind({})
-Single.args = {
- ...Single.args,
+export const Single = make({
multiple: false,
- value: 'sensor.humidity_bathroom'
-} as any
+ value: "sensor.humidity_bathroom",
+});
diff --git a/webapp/src/components/Inputs/AutoComplete/InputEntityID.stories.tsx b/webapp/src/components/Inputs/AutoComplete/InputEntityID.stories.tsx
index 7742541..f67bc4a 100644
--- a/webapp/src/components/Inputs/AutoComplete/InputEntityID.stories.tsx
+++ b/webapp/src/components/Inputs/AutoComplete/InputEntityID.stories.tsx
@@ -1,84 +1,77 @@
-import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
import { useState } from "react";
import { InputEntity } from "./InputEntities";
-export default {
- title: 'Inputs/InputEntity',
- component: InputEntity,
- parameters: { actions: { argTypesRegex: '^on.*' } },
- argTypes: {}
-} as ComponentMeta;
+import { makeStory } from "devUtils";
+const { make, componentMeta } = makeStory({
+ Component: InputEntity,
+ meta: {
+ title: "Inputs/InputEntity",
+ },
+ BaseTemplate: (args) => {
+ const [value, setValue] = useState(args.value);
+ return (
+
+ {
+ setValue(v);
+ args.onChange(v as any);
+ }}
+ />
+
+ );
+ },
+});
+export default componentMeta;
+export const Example = make({});
-const Template: ComponentStory = args => {
- const [value, setValue] = useState(args.value)
- return
-
- {
- setValue(v)
- args.onChange(v as any)
- }} />
-
-
-
-}
-
-export const Single = Template.bind({})
-Single.args = {
- ...Single.args,
+export const Single = make({
multiple: false,
- value: 'sensor.bathroom'
-} as any
+ value: "sensor.bathroom",
+});
-export const Many = Template.bind({})
-Many.args = {
- ...Many.args,
+export const Many = make({
multiple: true,
- value: ['sensor.bathroom', 'person.ari']
-} as any
+ value: ["sensor.bathroom", "person.ari"],
+});
-export const ManyEmpty = Template.bind({})
-ManyEmpty.args = {
- ...ManyEmpty.args,
+export const ManyEmpty = make({
multiple: true,
- value: []
-} as any
+ value: [],
+});
-
-export const ManyButGotSingle = Template.bind({})
-ManyButGotSingle.args = {
- ...ManyButGotSingle.args,
+export const ManyButGotSingle = make({
multiple: true,
- value: 'sensor.bathroom'
-} as any
+ value: "sensor.bathroom",
+});
-
-export const InvalidDomain = Template.bind({})
-InvalidDomain.args = {
- ...InvalidDomain.args,
+export const InvalidDomain = make({
multiple: true,
- value: 'sensor.bathroom',
- restrictToDomain: ['zone'],
-} as any
+ value: "sensor.bathroom",
+ restrictToDomain: ["zone"],
+});
-
-export const InvalidManyDomain = Template.bind({})
-InvalidManyDomain.args = {
- ...InvalidManyDomain.args,
+export const InvalidManyDomain = make({
multiple: true,
- value: 'sensor.bathroom',
- restrictToDomain: ['zone', 'switch'],
-} as any
+ value: "sensor.bathroom",
+ restrictToDomain: ["zone", "switch"],
+});
-export const InvalidLots = Template.bind({})
-InvalidLots.args = {
- ...InvalidLots.args,
+export const InvalidLots = make({
multiple: true,
- value: ['person.ari', 'sensor.bathroom', 'binary_sensor.ping_tv', 'device_tracker.phone'],
- restrictToDomain: ['zone', 'switch'],
-} as any
+ value: [
+ "person.ari",
+ "sensor.bathroom",
+ "binary_sensor.ping_tv",
+ "device_tracker.phone",
+ ],
+ restrictToDomain: ["zone", "switch"],
+});
diff --git a/webapp/src/components/Inputs/AutoComplete/InputService.stories.tsx b/webapp/src/components/Inputs/AutoComplete/InputService.stories.tsx
index f6d2db9..4657677 100644
--- a/webapp/src/components/Inputs/AutoComplete/InputService.stories.tsx
+++ b/webapp/src/components/Inputs/AutoComplete/InputService.stories.tsx
@@ -1,36 +1,39 @@
-import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
import { useState } from "react";
import { InputService } from "./InputService";
-export default {
- title: 'Inputs/InputService',
- component: InputService,
- parameters: { actions: { argTypesRegex: '^on.*' } },
- argTypes: {}
-} as ComponentMeta;
+import { makeStory } from "devUtils";
+const { make, componentMeta } = makeStory({
+ Component: InputService,
+ meta: {
+ title: "Inputs/InputService",
+ },
+ BaseTemplate: (args) => {
+ const [value, setValue] = useState(args.value);
+ return (
+
+ {
+ setValue(v);
+ args.onChange(v as any);
+ }}
+ />
+
+ );
+ },
+});
+export default componentMeta;
+export const Example = make({});
-const Template: ComponentStory = args => {
- const [value, setValue] = useState(args.value)
- return
-
- {
- setValue(v)
- args.onChange(v as any)
- }} />
-
-
-
-}
-
-export const Single = Template.bind({})
-Single.args = {
- ...Single.args,
+export const Single = make({
multiple: false,
- value: ''
-} as any
+ value: "",
+});
diff --git a/webapp/src/components/Inputs/AutoComplete/InputTimeEntity.stories.tsx b/webapp/src/components/Inputs/AutoComplete/InputTimeEntity.stories.tsx
index 8bd4877..9bc54d6 100644
--- a/webapp/src/components/Inputs/AutoComplete/InputTimeEntity.stories.tsx
+++ b/webapp/src/components/Inputs/AutoComplete/InputTimeEntity.stories.tsx
@@ -1,19 +1,17 @@
-import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
import { useState } from "react";
import { InputTimeEntity } from "./InputTimeEntity";
-export default {
- title: "Inputs/InputTimeEntity",
- component: InputTimeEntity,
- parameters: { actions: { argTypesRegex: "^on.*" } },
-} as ComponentMeta;
+import { makeStory } from "devUtils";
-const Template: ComponentStory = (args) => {
- const [value, setValue] = useState("");
- return (
-
+const { make, componentMeta } = makeStory({
+ Component: InputTimeEntity,
+ meta: {
+ title: "Inputs/InputTimeEntity",
+ },
+ BaseTemplate: (args) => {
+ const [value, setValue] = useState("");
+ return (
= (args) => {
}}
/>
-
- );
-};
+ );
+ },
+});
-export const SimpleText = Template.bind({});
+export const SimpleText = make({});
diff --git a/webapp/src/components/Inputs/AutoComplete/extras-SearchItem.stories.tsx b/webapp/src/components/Inputs/AutoComplete/extras-SearchItem.stories.tsx
index 2563b0d..c970608 100644
--- a/webapp/src/components/Inputs/AutoComplete/extras-SearchItem.stories.tsx
+++ b/webapp/src/components/Inputs/AutoComplete/extras-SearchItem.stories.tsx
@@ -1,18 +1,14 @@
-import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
-
import { SearchItem } from "./extras";
-export default {
- title: "Inputs/Extras/SearchItem",
- component: SearchItem,
- parameters: { actions: { argTypesRegex: "^on.*" } },
- argTypes: {},
-} as ComponentMeta;
+import { makeStory } from "devUtils";
-const Template: ComponentStory = (args) => {
- return (
-
+const { make, componentMeta } = makeStory({
+ Component: SearchItem,
+ meta: {
+ title: "Inputs/Extras/SearchItem",
+ },
+ BaseTemplate: (args) => {
+ return (
= (args) => {
>
-
- );
-};
+ );
+ },
+});
-export const Simple = Template.bind({});
-Simple.args = {
+export default componentMeta;
+
+export const Simple = make({
id: "sensor.humidity_main_bedroom",
label: "Main Bedroom Humidity",
searchTerm: "bedroom",
listProps: {},
onlyShowLabel: false,
-};
+});
diff --git a/webapp/src/components/Inputs/Base/InputBoolean.stories.tsx b/webapp/src/components/Inputs/Base/InputBoolean.stories.tsx
index f880043..fd4e5b7 100644
--- a/webapp/src/components/Inputs/Base/InputBoolean.stories.tsx
+++ b/webapp/src/components/Inputs/Base/InputBoolean.stories.tsx
@@ -4,24 +4,30 @@ import { useState } from "react";
import InputBoolean from "./InputBoolean";
-export default {
- title: 'Inputs/InputBoolean',
- component: InputBoolean,
- parameters: { actions: { argTypesRegex: '^on.*' } },
-} as ComponentMeta;
+import { makeStory } from "devUtils";
+const { make, componentMeta } = makeStory({
+ Component: InputBoolean,
+ meta: {
+ title: "Inputs/InputBoolean",
+ args: {
+ label: "Template",
+ },
+ },
+ BaseTemplate: (args) => {
+ const [state, onChange] = useState(args.value);
+ return (
+ {
+ args.onChange(v);
+ onChange(v);
+ }}
+ />
+ );
+ },
+});
-const Template: ComponentStory = args => {
- const [state, onChange] = useState(args.value)
- return
- {
- args.onChange(v)
- onChange(v)
- }} />
-
-}
-
-export const SimpleText = Template.bind({})
-SimpleText.args = {
- label: "Template",
-}
+export default componentMeta;
+export const Example = make({});
diff --git a/webapp/src/components/Inputs/Base/InputNumber.stories.tsx b/webapp/src/components/Inputs/Base/InputNumber.stories.tsx
index 2923787..524823e 100644
--- a/webapp/src/components/Inputs/Base/InputNumber.stories.tsx
+++ b/webapp/src/components/Inputs/Base/InputNumber.stories.tsx
@@ -1,32 +1,31 @@
-import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
import { useState } from "react";
import InputNumber from "./InputNumber";
-export default {
- title: 'Inputs/InputNumber',
- component: InputNumber,
- parameters: { actions: { argTypesRegex: '^on.*' } },
- argTypes: {
- label: {
- defaultValue: 'Sample Title'
- }
- }
-} as ComponentMeta;
+import { makeStory } from "devUtils";
+const { make, componentMeta } = makeStory({
+ Component: InputNumber,
+ meta: {
+ title: "Inputs/InputNumber",
+ argTypes: {
+ label: {
+ defaultValue: "Sample Title",
+ },
+ },
+ },
+ BaseTemplate: (args) => {
+ const [value, setValue] = useState(args.value);
+ return ;
+ },
+});
-export const NullStart: ComponentStory = args => {
+export default componentMeta;
- const [value, setValue] = useState(undefined)
- return
-
-
-}
-export const SomeStuffAtStart: ComponentStory = args => {
+export const NullStart = make({
+ value: undefined,
+});
- const [value, setValue] = useState(10)
- return
-
-
-}
+export const SomeStuffAtStart = make({
+ value: 10,
+});
diff --git a/webapp/src/components/Inputs/Base/InputText.stories.tsx b/webapp/src/components/Inputs/Base/InputText.stories.tsx
index da06e1e..406b205 100644
--- a/webapp/src/components/Inputs/Base/InputText.stories.tsx
+++ b/webapp/src/components/Inputs/Base/InputText.stories.tsx
@@ -4,22 +4,21 @@ import { useState } from "react";
import InputText from "./InputText";
-export default {
- title: 'Inputs/InputText',
- component: InputText,
- parameters: { actions: { argTypesRegex: '^on.*' } },
-} as ComponentMeta;
+import { makeStory } from "devUtils";
+const { make, componentMeta } = makeStory({
+ Component: InputText,
+ meta: {
+ title: "Inputs/InputText",
+ },
+ BaseTemplate: (args) => {
+ const [value, setValue] = useState("");
+ return ;
+ },
+});
-const Template: ComponentStory = args => {
+export default componentMeta;
- const [value, setValue] = useState('')
- return
-
-
-}
-
-export const SimpleText = Template.bind({})
-SimpleText.args = {
+export const SimpleText = make({
label: "Entity ID",
-}
+});
diff --git a/webapp/src/components/Inputs/Base/InputTime.stories.tsx b/webapp/src/components/Inputs/Base/InputTime.stories.tsx
index a3422bd..fd41726 100644
--- a/webapp/src/components/Inputs/Base/InputTime.stories.tsx
+++ b/webapp/src/components/Inputs/Base/InputTime.stories.tsx
@@ -1,20 +1,15 @@
-import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
import { useState } from "react";
import { AutomationTime } from "types/automations/common";
import { InputTime } from "./InputTime";
-export default {
- title: "Inputs/InputTime",
- component: InputTime,
- parameters: { actions: { argTypesRegex: "^on.*" } },
-} as ComponentMeta;
+import { makeStory } from "devUtils";
-const Template: ComponentStory = (args) => {
- const [value, setValue] = useState(undefined);
- return (
-
+const { make, componentMeta } = makeStory({
+ Component: InputTime,
+ BaseTemplate: (args) => {
+ const [value, setValue] = useState(undefined);
+ return (
= (args) => {
}}
/>
-
- );
-};
+ );
+ },
+ meta: {
+ title: "Inputs/InputTime",
+ },
+});
-export const SimpleText = Template.bind({});
-SimpleText.args = {
+export default componentMeta;
+export const Example = make({});
+
+export const SimpleText = make({
label: "Time Stamp",
value: "10",
-};
+});
diff --git a/webapp/src/components/Inputs/Base/InputYaml.stories.tsx b/webapp/src/components/Inputs/Base/InputYaml.stories.tsx
index 7adb1dc..fbfbad5 100644
--- a/webapp/src/components/Inputs/Base/InputYaml.stories.tsx
+++ b/webapp/src/components/Inputs/Base/InputYaml.stories.tsx
@@ -4,24 +4,24 @@ import { useState } from "react";
import InputYaml from "./InputYaml";
-export default {
- title: 'Inputs/InputYaml',
- component: InputYaml,
- parameters: { actions: { argTypesRegex: '^on.*' } },
-} as ComponentMeta;
+import { makeStory } from "devUtils";
+const { make, componentMeta } = makeStory({
+ Component: InputYaml,
+ BaseTemplate: (args) => {
+ const [value, setValue] = useState({
+ test: "data",
+ });
+ return ;
+ },
+ meta: {
+ title: "Inputs/InputYaml",
+ },
+});
-const Template: ComponentStory = args => {
+export default componentMeta;
+export const Example = make({});
- const [value, setValue] = useState({
- "test": "data"
- })
- return
-
-
-}
-
-export const SimpleText = Template.bind({})
-SimpleText.args = {
+export const SimpleText = make({
label: "Template",
-}
+});
diff --git a/webapp/src/components/Inputs/InputAutoText.stories.tsx b/webapp/src/components/Inputs/InputAutoText.stories.tsx
index 809c922..4ba2c71 100644
--- a/webapp/src/components/Inputs/InputAutoText.stories.tsx
+++ b/webapp/src/components/Inputs/InputAutoText.stories.tsx
@@ -1,29 +1,22 @@
-import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
import InputAutoText from "./InputAutoText";
-export default {
- title: "Inputs/InputAutoText",
- component: InputAutoText,
- parameters: { actions: { argTypesRegex: "^on.*" } },
- args: {
- label: "Something",
- value: "",
- options: ["test", "usa", "canada"],
+import { makeStory } from "devUtils";
+
+const { make, componentMeta } = makeStory({
+ Component: InputAutoText,
+ meta: {
+ title: "Inputs/InputAutoText",
+ args: {
+ label: "Something",
+ value: "",
+ options: ["test", "usa", "canada"],
+ },
},
-} as ComponentMeta;
+});
-const Template: ComponentStory = (args) => {
- return (
-
-
-
- );
-};
+export default componentMeta;
+export const Example = make({});
-export const Basic = Template.bind({});
-export const WithError = Template.bind({});
-WithError.args = {
- ...WithError.args,
+export const WithError = make({
error: "Oh no!",
-};
+});
diff --git a/webapp/src/components/Inputs/InputList.stories.tsx b/webapp/src/components/Inputs/InputList.stories.tsx
index 70a3fdd..ac1458e 100644
--- a/webapp/src/components/Inputs/InputList.stories.tsx
+++ b/webapp/src/components/Inputs/InputList.stories.tsx
@@ -1,47 +1,35 @@
-import { ComponentMeta, ComponentStory } from "@storybook/react";
import { Page } from "components/Page";
-import { useState, useEffect } from 'react';
+import { useState, useEffect } from "react";
import { InputList } from "./InputList";
-export default {
- title: 'Inputs/InputList',
- component: InputList,
- parameters: { actions: { argTypesRegex: '^on.*' } },
-} as ComponentMeta;
+import { makeStory } from "devUtils";
+const { make, componentMeta } = makeStory({
+ Component: InputList,
+ BaseTemplate: (args) => {
+ const [value, setValue] = useState(args.current);
+ useEffect(() => {
+ if (value !== args.current) {
+ setValue(args.current);
+ }
+ }, [args.current]);
+ return ;
+ },
+ meta: {
+ title: "Inputs/InputList",
+ },
+});
-const Template: ComponentStory = args => {
+export default componentMeta;
- const [value, setValue] = useState(args.current);
- useEffect(() => {
- if (value !== args.current) {
- setValue(args.current)
- }
- }, [args.current])
- return
-
-
-}
-
-export const SimpleText = Template.bind({})
-SimpleText.args = {
+export const SimpleText = make({
label: "Entity ID",
- options: [
- 'Bob',
- 'Martin',
- "Toots"
- ]
-}
+ options: ["Bob", "Martin", "Toots"],
+});
-
-export const InvalidSelection = Template.bind({})
-InvalidSelection.args = {
+export const InvalidSelection = make({
current: "Derek",
label: "Entity ID",
- options: [
- 'Bob',
- 'Martin',
- "Toots"
- ]
-}
+ options: ["Bob", "Martin", "Toots"],
+});
diff --git a/webapp/src/components/Inputs/InputMultiSelect.stories.tsx b/webapp/src/components/Inputs/InputMultiSelect.stories.tsx
index 182005c..28e43fe 100644
--- a/webapp/src/components/Inputs/InputMultiSelect.stories.tsx
+++ b/webapp/src/components/Inputs/InputMultiSelect.stories.tsx
@@ -1,24 +1,19 @@
-import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
import { useEffect, useState } from "react";
import InputMultiSelect from "./InputMultiSelect";
-export default {
- title: "Inputs/InputMultiSelect",
- component: InputMultiSelect,
- parameters: { actions: { argTypesRegex: "^on.*" } },
-} as ComponentMeta;
+import { makeStory } from "devUtils";
-const Template: ComponentStory = (args) => {
- const [value, setValue] = useState(args.selected);
+const { make, componentMeta } = makeStory({
+ Component: InputMultiSelect,
+ BaseTemplate: (args) => {
+ const [value, setValue] = useState(args.selected);
- useEffect(() => {
- setValue(args.selected);
- }, [args.selected]);
+ useEffect(() => {
+ setValue(args.selected);
+ }, [args.selected]);
- return (
-
+ return (
{
@@ -28,14 +23,18 @@ const Template: ComponentStory = (args) => {
options={args.options}
selected={value}
/>
-
- );
-};
+ );
+ },
+ meta: {
+ title: "Inputs/InputMultiSelect",
+ },
+});
-export const Simple = Template.bind({});
-Simple.args = {
+export default componentMeta;
+
+export const Simple = make({
label: "Room Tags",
options: ["Bears", "Cats", "Kitchen", "Bathroom"],
selected: [1],
max: 2,
-};
+});
diff --git a/webapp/src/components/Inputs/InputTextBubble.stories.tsx b/webapp/src/components/Inputs/InputTextBubble.stories.tsx
index 6ab4326..5f9064d 100644
--- a/webapp/src/components/Inputs/InputTextBubble.stories.tsx
+++ b/webapp/src/components/Inputs/InputTextBubble.stories.tsx
@@ -1,58 +1,49 @@
-import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
import { useState } from "react";
import InputTextBubble from "./InputTextBubble";
-export default {
- title: 'Inputs/InputTextBubble',
- component: InputTextBubble,
- parameters: { actions: { argTypesRegex: '^on.*' } },
- argTypes: {
- label: {
- defaultValue: 'Sample Title'
- }
- }
-} as ComponentMeta;
+import { makeStory } from "devUtils";
+const { make, componentMeta } = makeStory({
+ Component: InputTextBubble,
+ BaseTemplate: (args) => {
+ const [value, setValue] = useState(args.value ?? "");
+ return (
+
+
+
+ );
+ },
+ meta: {
+ title: "Inputs/InputTextBubble",
+ argTypes: {
+ label: {
+ defaultValue: "Sample Title",
+ },
+ },
+ },
+});
-export const ArrayText: ComponentStory = args => {
+export default componentMeta;
- const [value, setValue] = useState(['wow', 'lots of bubbles', 'itchen', 'bathroom'])
- return
-
-
-
-
-}
+export const ArrayText = make({
+ value: ["wow", "lots of bubbles", "itchen", "bathroom"],
+});
+export const JustText = make({
+ value: "hello",
+});
-export const JustText: ComponentStory = args => {
-
- const [value, setValue] = useState('hello')
- return
-
-
-}
-
-export const ManyOptions: ComponentStory = args => {
-
- const [value, setValue] = useState('hello')
- return
-
-
-}
-
-ManyOptions.args = {
- ...ManyOptions.args,
+export const ManyOptions = make({
+ value: "hello",
options: [
- 'sensor.humidity_bathroom',
- 'sensor.humidity_bedroom',
- 'sensor.humidity_laundry',
- 'sensor.temp_bathroom',
- 'sensor.temp_bedroom',
- 'switch.living_room',
- 'switch.bathroom',
- 'light.bedroom_main',
- 'light.bedroom_second',
- ]
-}
\ No newline at end of file
+ "sensor.humidity_bathroom",
+ "sensor.humidity_bedroom",
+ "sensor.humidity_laundry",
+ "sensor.temp_bathroom",
+ "sensor.temp_bedroom",
+ "switch.living_room",
+ "switch.bathroom",
+ "light.bedroom_main",
+ "light.bedroom_second",
+ ],
+});
diff --git a/webapp/src/components/Inputs/InputTextView.stories.tsx b/webapp/src/components/Inputs/InputTextView.stories.tsx
index d998de8..d30fdab 100644
--- a/webapp/src/components/Inputs/InputTextView.stories.tsx
+++ b/webapp/src/components/Inputs/InputTextView.stories.tsx
@@ -4,17 +4,11 @@ import InputText from "./Base/InputText";
import { InputTextView } from "./InputTextView";
-export default {
- title: "Inputs/InputTextView",
- component: InputTextView,
- parameters: { actions: { argTypesRegex: "^on.*" } },
- args: {
- value: "example",
- },
-} as ComponentMeta;
+import { makeStory } from "devUtils";
-export const Basic: ComponentStory = (args) => (
-
+const { make, componentMeta } = makeStory({
+ Component: InputTextView,
+ BaseTemplate: (args) => (
= (args) => (
-
-);
+ ),
+ meta: {
+ title: "Inputs/InputTextView",
+ args: {
+ value: "example",
+ },
+ },
+});
+
+export default componentMeta;
+
+export const Basic = make({});
diff --git a/webapp/src/components/NodeEditor/index.stories.tsx b/webapp/src/components/NodeEditor/index.stories.tsx
index 6b1d7f0..e4a15d5 100644
--- a/webapp/src/components/NodeEditor/index.stories.tsx
+++ b/webapp/src/components/NodeEditor/index.stories.tsx
@@ -2,11 +2,10 @@ import React from "react";
import { ComponentStory } from "@storybook/react";
import { NodeEditor, NodeEditorProps } from ".";
-import { AutomationCondition } from "types/automations/conditions";
import { Button } from "components/Inputs/Buttons/Button";
import { useState } from "react";
import { Modal } from "components/Modal";
-import { Page } from "components/Page";
+import { MockPage } from "components/Page";
import { makeStory } from "devUtils";
const { componentMeta, make } = makeStory({
@@ -23,16 +22,14 @@ const { componentMeta, make } = makeStory({
Component: (props: NodeEditorProps) => {
const [state, setState] = useState(props.node);
return (
-
- {
- setState(s);
- props.onSave && props.onSave(s);
- }}
- />
-
+ {
+ setState(s);
+ props.onSave && props.onSave(s);
+ }}
+ />
);
},
});
@@ -77,12 +74,12 @@ export const DeviceTriggerExample = make({
export const InAModal: ComponentStory = (props) => {
const [open, setOpen] = useState(false);
return (
-
+
setOpen(!open)} />
-
+
);
};
diff --git a/webapp/src/components/Page/index.css b/webapp/src/components/Page/index.css
index a60d3ed..39bb315 100644
--- a/webapp/src/components/Page/index.css
+++ b/webapp/src/components/Page/index.css
@@ -15,4 +15,9 @@
/* background */
background-color: var(--mui-background-default);
+}
+
+.page>.page-contents {
+ flex: 1;
+ overflow: hidden;
}
\ No newline at end of file
diff --git a/webapp/src/components/Page/index.tsx b/webapp/src/components/Page/index.tsx
index c16c683..af13640 100644
--- a/webapp/src/components/Page/index.tsx
+++ b/webapp/src/components/Page/index.tsx
@@ -1,5 +1,5 @@
import "./index.css";
-import { createRef, FC, ReactNode, useEffect, useRef } from "react";
+import { createRef, FC, PropsWithChildren, useEffect, useRef } from "react";
import {
createTheme,
Palette,
@@ -7,23 +7,21 @@ import {
ThemeProvider,
useTheme,
} from "@mui/material/styles";
-import { VersionBox } from "components/VersionBox";
+import { BottomBar } from "components/BottomBar";
import { SnackbarKey, SnackbarProvider, useSnackbar } from "notistack";
import Button from "@mui/material/Button";
import { useHAConnection } from "haService/connection";
import { ConfirmProvider } from "material-ui-confirm";
import { Color } from "@mui/material";
import useWindowSize from "utils/useWindowSize";
+import { ApiService } from "apiService/core";
+import { useMockApiService } from "apiService";
-const theme = createTheme({
- palette: {
- mode: "dark",
- },
-});
+export type PageProps = PropsWithChildren<{
+ api: ApiService;
+}>;
-export const InternalPage: FC<{
- children: ReactNode;
-}> = ({ children }) => {
+export const InternalPage: FC = ({ children, api }) => {
const conn = useHAConnection();
const theme = useTheme();
const snackbar = useSnackbar();
@@ -62,25 +60,31 @@ export const InternalPage: FC<{
}, [conn, snackbar]);
return (
-
+
+ {children}
+
-
- {children}
);
};
-export const Page: FC<{
- children: ReactNode;
-}> = ({ children }) => {
+export const Page: FC = (props) => {
const notistackRef = createRef();
const onClickDismiss = (key: SnackbarKey) => () => {
notistackRef.current.closeSnackbar(key);
};
+ const theme = createTheme({
+ palette: {
+ mode: props.api.state.theme,
+ },
+ });
+
return (
@@ -96,13 +100,18 @@ export const Page: FC<{
dense
preventDuplicate
>
- {children}
+
);
};
+export const MockPage: FC> = (props) => {
+ const api = useMockApiService([]);
+ return ;
+};
+
export const convertPaletteToCss = (p: Palette): string => {
let out = ``;
for (const k of [
diff --git a/webapp/src/components/ServiceEditor/index.stories.tsx b/webapp/src/components/ServiceEditor/index.stories.tsx
index fc9f281..bee7eea 100644
--- a/webapp/src/components/ServiceEditor/index.stories.tsx
+++ b/webapp/src/components/ServiceEditor/index.stories.tsx
@@ -1,21 +1,15 @@
-import React, { FC, useEffect, useState } from "react";
-import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
+import React, { useState } from "react";
import { ServiceEditor } from ".";
import { TypedHassService } from "haService/fieldTypes";
import InputYaml from "components/Inputs/Base/InputYaml";
-export default {
- title: "Services/ServiceEditor",
- component: ServiceEditor,
- parameters: { actions: { argTypesRegex: "^on.*" } },
- args: {},
-} as ComponentMeta;
+import { makeStory } from "devUtils";
-const Template: ComponentStory = (props) => {
- const [state, setState] = useState(props.data);
- return (
-
+const { make, componentMeta } = makeStory({
+ Component: ServiceEditor,
+ BaseTemplate: (props) => {
+ const [state, setState] = useState(props.data);
+ return (
= (props) => {
/>
-
- );
-};
+ );
+ },
+ meta: {
+ title: "Services/ServiceEditor",
+ },
+});
-const makeExample = (service: TypedHassService) => {
- const Eg = Template.bind({});
- Eg.args = {
- ...Eg,
+export default componentMeta;
+export const Example = make({});
+
+const makeExample = (service: TypedHassService) =>
+ make({
service,
data: {
target: {},
field: {},
},
- };
- return Eg;
-};
+ });
export const NumberSetValue = makeExample({
name: "Set",
diff --git a/webapp/src/components/SpeedDial/index.stories.tsx b/webapp/src/components/SpeedDial/index.stories.tsx
index afbaadb..d7b059e 100644
--- a/webapp/src/components/SpeedDial/index.stories.tsx
+++ b/webapp/src/components/SpeedDial/index.stories.tsx
@@ -6,26 +6,27 @@ import SettingsApplicationsIcon from "@mui/icons-material/SettingsApplications";
import { ButtonIcon } from "components/Icons/ButtonIcons";
import { DeleteForeverOutlined } from "@mui/icons-material";
import EditIcon from "@mui/icons-material/Edit";
+import { makeStory } from "devUtils";
-export default {
- title: "Nav/SpeedDial",
- component: SpeedDial,
-};
+const { make, componentMeta } = makeStory({
+ Component: SpeedDial,
+ BaseTemplate: () => (
+
+ }>
+ } />
+ } />
+
+
+ ),
+ meta: {
+ title: "Nav/SpeedDial",
+ },
+});
-export const IconList: ComponentStory = () => {
- return (
-
-
- }>
- } />
- } />
-
-
-
- );
-};
+export default componentMeta;
+export const IconList = make({});
diff --git a/webapp/src/components/VersionBox/index.css b/webapp/src/components/VersionBox/index.css
deleted file mode 100644
index 2371a2c..0000000
--- a/webapp/src/components/VersionBox/index.css
+++ /dev/null
@@ -1,21 +0,0 @@
-.version-box {
- position: absolute;
- bottom: -0.5em;
- right: 0;
- font-size: 0.5em;
-}
-
-.version-box #circle {
- color: var(--mui-primary-main);
- height: 1em;
- width: 1em;
-}
-
-.version-box #circle.error {
- color: var(--mui-error-main);
-}
-
-
-.version-box #circle.loaded {
- color: var(--mui-success-light);
-}
\ No newline at end of file
diff --git a/webapp/src/components/VersionBox/index.tsx b/webapp/src/components/VersionBox/index.tsx
deleted file mode 100644
index 24bd57d..0000000
--- a/webapp/src/components/VersionBox/index.tsx
+++ /dev/null
@@ -1,17 +0,0 @@
-import "./index.css";
-import { FC } from "react";
-import { useHAConnection } from "haService/connection";
-
-export const VersionBox: FC = () => {
- const ha = useHAConnection();
- const version = process.env.REACT_APP_BUILD_VERSION ?? "n/a";
-
- return (
-
- version: {version} / HA Connection{" "}
-
- 🟢
-
-
- );
-};
diff --git a/webapp/src/devUtils/index.tsx b/webapp/src/devUtils/index.tsx
index 9bcb442..d9fbcdb 100644
--- a/webapp/src/devUtils/index.tsx
+++ b/webapp/src/devUtils/index.tsx
@@ -2,6 +2,8 @@ import "styles/root.css";
import { ComponentMeta, ComponentStory } from "@storybook/react";
import { Page } from "components/Page";
import { ComponentProps, JSXElementConstructor } from "react";
+import { ApiService } from "apiService/core";
+import { useConnectedApiService, useMockApiService } from "apiService";
export type MakeStoryArgs<
T extends keyof JSX.IntrinsicElements | JSXElementConstructor
@@ -9,6 +11,7 @@ export type MakeStoryArgs<
Component: T;
BaseTemplate?: ComponentStory;
meta: Partial> & { title: string };
+ useLiveApi?: boolean;
};
export const makeStory = <
T extends keyof JSX.IntrinsicElements | JSXElementConstructor
@@ -16,6 +19,7 @@ export const makeStory = <
BaseTemplate,
Component,
meta,
+ useLiveApi = false,
}: MakeStoryArgs) => {
const componentMeta: ComponentMeta = {
component: Component as any,
@@ -24,8 +28,15 @@ export const makeStory = <
...meta,
};
const Template: ComponentStory = (args) => {
+ let api: ApiService;
+ if (useLiveApi) {
+ api = useConnectedApiService();
+ } else {
+ api = useMockApiService([]);
+ }
+
return (
-
+
{BaseTemplate ? : }
);
diff --git a/webapp/src/haService/automation.stories.tsx b/webapp/src/haService/automation.stories.tsx
index fe0a123..d709b64 100644
--- a/webapp/src/haService/automation.stories.tsx
+++ b/webapp/src/haService/automation.stories.tsx
@@ -78,17 +78,14 @@ const Test: FC = () => {
);
};
-export default {
- title: "Services/HA Service",
- component: Test,
- parameters: { actions: { argTypesRegex: "^on.*" } },
- args: {},
-} as ComponentMeta;
+import { makeStory } from "devUtils";
-export const AutomationCall: ComponentStory = (props) => {
- return (
-
-
-
- );
-};
+const { make, componentMeta } = makeStory({
+ Component: Test,
+ meta: {
+ title: "Services/HA Service",
+ },
+});
+
+export default componentMeta;
+export const AutomationCall = make({});
diff --git a/webapp/src/haService/dr.stories.tsx b/webapp/src/haService/dr.stories.tsx
index 4dac319..65c5997 100644
--- a/webapp/src/haService/dr.stories.tsx
+++ b/webapp/src/haService/dr.stories.tsx
@@ -1,8 +1,7 @@
import React, { FC } from "react";
-import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
import { useHADeviceRegistry } from "haService";
import InputYaml from "components/Inputs/Base/InputYaml";
+import { makeStory } from "devUtils";
const Test: FC<{ onRender: () => void }> = ({ onRender }) => {
const conn = useHADeviceRegistry();
@@ -35,17 +34,12 @@ const Test: FC<{ onRender: () => void }> = ({ onRender }) => {
return Loading...;
};
-export default {
- title: "Services/Device Registry",
- component: Test,
- parameters: { actions: { argTypesRegex: "^on.*" } },
- args: {},
-} as ComponentMeta;
+const { make, componentMeta } = makeStory({
+ Component: Test,
+ meta: {
+ title: "Services/Device Registry",
+ },
+});
-export const Base: ComponentStory = (props) => {
- return (
-
-
-
- );
-};
+export default componentMeta;
+export const Basic = make({});
diff --git a/webapp/src/haService/entities.stories.tsx b/webapp/src/haService/entities.stories.tsx
index 526fd6a..60c74b2 100644
--- a/webapp/src/haService/entities.stories.tsx
+++ b/webapp/src/haService/entities.stories.tsx
@@ -1,6 +1,6 @@
import React, { FC, useState } from "react";
import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
+import { MockPage } from "components/Page";
import { useHAEntities } from "haService/HAEntities";
const Test: FC<{ onRender: () => void }> = ({ onRender }) => {
@@ -50,8 +50,8 @@ export default {
export const Base: ComponentStory = (props) => {
return (
-
+
-
+
);
};
diff --git a/webapp/src/haService/er.stories.tsx b/webapp/src/haService/er.stories.tsx
index 902e3e2..8f8c334 100644
--- a/webapp/src/haService/er.stories.tsx
+++ b/webapp/src/haService/er.stories.tsx
@@ -1,6 +1,6 @@
import React, { FC } from "react";
import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
+import { MockPage } from "components/Page";
import { useHAEntityRegistry } from "haService";
const Test: FC<{ onRender: () => void }> = ({ onRender }) => {
@@ -43,8 +43,8 @@ export default {
export const Base: ComponentStory = (props) => {
return (
-
+
-
+
);
};
diff --git a/webapp/src/haService/services.stories.tsx b/webapp/src/haService/services.stories.tsx
index 8fb83cb..98277b9 100644
--- a/webapp/src/haService/services.stories.tsx
+++ b/webapp/src/haService/services.stories.tsx
@@ -1,6 +1,6 @@
import React, { FC, useEffect, useState } from "react";
import { ComponentMeta, ComponentStory } from "@storybook/react";
-import { Page } from "components/Page";
+import { MockPage } from "components/Page";
import { useHA } from "haService";
import InputYaml from "components/Inputs/Base/InputYaml";
import { InputList } from "components/Inputs/InputList";
@@ -89,8 +89,8 @@ export default {
export const ServiceCall: ComponentStory = (props) => {
return (
-
+
-
+
);
};
diff --git a/webapp/src/lang/eng.json b/webapp/src/lang/eng.json
index 515df76..496e58c 100644
--- a/webapp/src/lang/eng.json
+++ b/webapp/src/lang/eng.json
@@ -59,6 +59,10 @@
"SUN": "Sun",
"MQTT": "MQTT",
+ "CONNECTED": "Connected",
+ "FAILED": "Failed",
+ "LOADING": "Loading",
+
"DAY_MON": "Monday",
"DAY_TUE": "Tuesday",
"DAY_WED": "Wednesday",
@@ -70,6 +74,9 @@
"WEEKDAY": "Weekday",
"OPTION": "Option",
+ "THEME": "Theme",
+ "LANGUAGE": "Language",
+
"SELECT_AUTOMATION": "Select automation",
"TRIGGER_AUTOMATION": "Trigger automation",
"DELETE_AUTOMATION": "Delete automation",
diff --git a/webapp/src/lang/fra.json b/webapp/src/lang/fra.json
index 51b504e..712ea4e 100644
--- a/webapp/src/lang/fra.json
+++ b/webapp/src/lang/fra.json
@@ -57,6 +57,10 @@
"SUN": "Sol",
"MQTT": "MQTT",
+ "CONNECTED": "Connecté",
+ "FAILED": "Manquée",
+ "LOADING": "Chargement",
+
"AND": "et",
"NOT": "non",
"NUMERIC_STATE": "État numérique",
@@ -73,6 +77,9 @@
"WEEKDAY": "Jour de la semaine",
"OPTION": "Option",
+ "THEME": "Thème",
+ "LANGUAGE": "Langue",
+
"SELECT_AUTOMATION": "Sélectionnez l'automatisation",
"TRIGGER_AUTOMATION": "Déclencher l'automatisation",
"DELETE_AUTOMATION": "Supprimer l'automatisation",