From 44c4ac12dd7d6794e0e82b09934aafeb829562a2 Mon Sep 17 00:00:00 2001 From: Ari Date: Tue, 24 May 2022 21:12:01 -0400 Subject: [PATCH] initial work with mui --- Dockerfile | 1 + .../AutomationEditor/AutoInfoBox.stories.tsx | 5 +- .../AutomationEditor/index.stories.tsx | 5 +- .../AutomationList/AutomationList.stories.tsx | 5 +- .../AutomationListBox.stories.tsx | 5 +- .../ConnectedAutomationList.stories.tsx | 5 +- .../ConditionEditor.stories.tsx | 5 +- .../ConditionEditor/index.stories.tsx | 5 +- .../DAGFlow/DAGErrorNode.stories.tsx | 5 +- .../components/DAGFlow/DAGNode.stories.tsx | 5 +- .../src/components/DAGFlow/index.stories.tsx | 5 +- .../ErrorBoundary/index.stories.tsx | 9 +- webapp/src/components/Icons/index.stories.tsx | 9 +- webapp/src/components/Inputs/InputBoolean.css | 24 ----- .../Inputs/InputBoolean.stories.tsx | 5 +- webapp/src/components/Inputs/InputBoolean.tsx | 11 ++- .../components/Inputs/InputList.stories.tsx | 5 +- .../Inputs/InputMultiSelect.stories.tsx | 5 +- .../components/Inputs/InputNumber.stories.tsx | 9 +- .../components/Inputs/InputText.stories.tsx | 5 +- webapp/src/components/Inputs/InputText.tsx | 98 ++++++++++++------- .../Inputs/InputTextArea.stories.tsx | 5 +- .../Inputs/InputTextBubble.stories.tsx | 13 +-- .../components/Inputs/InputTime.stories.tsx | 5 +- .../components/Inputs/InputYaml.stories.tsx | 5 +- .../MultiNodeEditors/index.stories.tsx | 9 +- .../components/NodeEditor/index.stories.tsx | 9 +- webapp/src/components/Page/index.css | 18 ++++ webapp/src/components/Page/index.tsx | 23 +++++ webapp/src/components/VersionBox/index.css | 6 ++ webapp/src/components/VersionBox/index.tsx | 10 ++ webapp/src/routes/automation.tsx | 5 +- webapp/src/styles/page.css | 18 ---- webapp/src/styles/root.css | 3 + webapp/src/styles/theme.ts | 1 - 35 files changed, 216 insertions(+), 145 deletions(-) delete mode 100644 webapp/src/components/Inputs/InputBoolean.css create mode 100644 webapp/src/components/Page/index.css create mode 100644 webapp/src/components/Page/index.tsx create mode 100644 webapp/src/components/VersionBox/index.css create mode 100644 webapp/src/components/VersionBox/index.tsx delete mode 100644 webapp/src/styles/page.css diff --git a/Dockerfile b/Dockerfile index e053776..069ac81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,7 @@ RUN pip install . /app # <--- Webapp Build --> COPY webapp/ /app/web-builder RUN cd /app/web-builder && \ + echo "REACT_APP_BUILD_VERSION=${BUILD_VERSION} >> /app/web-builder/.env.production" \ yarn && \ yarn build && \ cp -r /app/web-builder/build /app/web && \ diff --git a/webapp/src/components/AutomationEditor/AutoInfoBox.stories.tsx b/webapp/src/components/AutomationEditor/AutoInfoBox.stories.tsx index 69a529a..0123138 100644 --- a/webapp/src/components/AutomationEditor/AutoInfoBox.stories.tsx +++ b/webapp/src/components/AutomationEditor/AutoInfoBox.stories.tsx @@ -1,4 +1,5 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { Page } from "components/Page"; import { useState } from "react"; import { AutoInfoBox } from "./AutoInfoBox"; @@ -12,7 +13,7 @@ export default { export const NoTags: ComponentStory = args => { const [[metadata, tags], setState] = useState([args.metadata, args.tags]) return ( -
+ = args => { setState([m, t]) }} /> -
+ ) } NoTags.args = { diff --git a/webapp/src/components/AutomationEditor/index.stories.tsx b/webapp/src/components/AutomationEditor/index.stories.tsx index efd2548..152aaa9 100644 --- a/webapp/src/components/AutomationEditor/index.stories.tsx +++ b/webapp/src/components/AutomationEditor/index.stories.tsx @@ -3,6 +3,7 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import { AutomationEditor } from './index'; import { useState } from 'react'; import * as dgconst from 'components/DAGFlow/constants'; +import { Page } from "components/Page"; export default { @@ -16,7 +17,7 @@ export default { const Template: ComponentStory = args => { const [state, setState] = useState(args.automation) - return
+ return = args => { window.setTimeout(() => setState(s), 3000) }} /> -
+ } export const Loading = Template.bind({}); diff --git a/webapp/src/components/AutomationList/AutomationList.stories.tsx b/webapp/src/components/AutomationList/AutomationList.stories.tsx index 9f990ea..1de1738 100644 --- a/webapp/src/components/AutomationList/AutomationList.stories.tsx +++ b/webapp/src/components/AutomationList/AutomationList.stories.tsx @@ -4,6 +4,7 @@ import { useState } from "react"; import { AutomationList } from "."; import { createMockAuto } from "utils/mocks"; import * as dgconst from 'components/DAGFlow/constants'; +import { Page } from "components/Page"; export default { title: 'App/AutomationList', @@ -17,7 +18,7 @@ export default { const Template: ComponentStory = args => { const [autos, setAutos] = useState(args.automations) - return
+ return { args.onAdd(a); @@ -39,7 +40,7 @@ const Template: ComponentStory = args => { ]); }} /> -
+ } export const EmptyStart = Template.bind({}) diff --git a/webapp/src/components/AutomationList/AutomationListBox.stories.tsx b/webapp/src/components/AutomationList/AutomationListBox.stories.tsx index c0428b7..ddb5823 100644 --- a/webapp/src/components/AutomationList/AutomationListBox.stories.tsx +++ b/webapp/src/components/AutomationList/AutomationListBox.stories.tsx @@ -2,6 +2,7 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; import { useState } from "react"; import { AutomationListBox } from "./AutomationListBox"; import { createMockAuto } from "utils/mocks"; +import { Page } from "components/Page"; export default { title: 'App/AutomationList/Box', @@ -14,12 +15,12 @@ export default { const Template: ComponentStory = args => { const [selected, setSelected] = useState(args.selected) - return
+ return { setSelected(i) args.onSelectAutomation(i) }} /> -
+ } export const EmptyStart = Template.bind({}) diff --git a/webapp/src/components/AutomationList/ConnectedAutomationList.stories.tsx b/webapp/src/components/AutomationList/ConnectedAutomationList.stories.tsx index 69ca731..495a9f5 100644 --- a/webapp/src/components/AutomationList/ConnectedAutomationList.stories.tsx +++ b/webapp/src/components/AutomationList/ConnectedAutomationList.stories.tsx @@ -3,6 +3,7 @@ import { ConnectedAutomationList } from "."; import { createMockAuto } from "utils/mocks"; import { useMockApiService } from "apiService"; import { DEFAULT_DIMS } from 'components/DAGFlow/constants'; +import { Page } from "components/Page"; export default { title: 'App/AutomationList/Connected', @@ -17,12 +18,12 @@ export default { const Template: ComponentStory = args => { const api = useMockApiService(args.initialAutomations); - return
+ return -
+ } export const EmptyStart = Template.bind({}) diff --git a/webapp/src/components/ConditionEditor/ConditionEditor.stories.tsx b/webapp/src/components/ConditionEditor/ConditionEditor.stories.tsx index c7e1d61..20ea035 100644 --- a/webapp/src/components/ConditionEditor/ConditionEditor.stories.tsx +++ b/webapp/src/components/ConditionEditor/ConditionEditor.stories.tsx @@ -2,6 +2,7 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; import { useState } from "react"; import { ConditionEditor } from "."; import { AutomationCondition } from 'types/automations/conditions'; +import { Page } from "components/Page"; export default { title: 'ConditionEditor', @@ -40,12 +41,12 @@ export const Basic: ComponentStory = args => { ] }) return ( -
+ { }} condition={state} /> -
+ ) } diff --git a/webapp/src/components/ConditionEditor/index.stories.tsx b/webapp/src/components/ConditionEditor/index.stories.tsx index fa6c36c..cd7fbc2 100644 --- a/webapp/src/components/ConditionEditor/index.stories.tsx +++ b/webapp/src/components/ConditionEditor/index.stories.tsx @@ -1,4 +1,5 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { Page } from "components/Page"; import { useState } from "react"; import { AutomationCondition } from "types/automations/conditions"; @@ -14,14 +15,14 @@ export default { const Template: ComponentStory = ({ condition, ...args }) => { const [data, setData] = useState(condition); - return
+ return { setData(data) }} /> -
+ } export const TemplateViewer = Template.bind({}) diff --git a/webapp/src/components/DAGFlow/DAGErrorNode.stories.tsx b/webapp/src/components/DAGFlow/DAGErrorNode.stories.tsx index d674978..45910a4 100644 --- a/webapp/src/components/DAGFlow/DAGErrorNode.stories.tsx +++ b/webapp/src/components/DAGFlow/DAGErrorNode.stories.tsx @@ -7,6 +7,7 @@ import * as dgconst from "components/DAGFlow/constants"; import ReactFlow, { Controls } from 'react-flow-renderer'; import { DAGErrorNode } from "./DAGErrorNode"; import { convertToFlowNode } from "./helpers"; +import { Page } from "components/Page"; export default { @@ -29,7 +30,7 @@ export const Examples: ComponentStory = args => { "y": 50 + dgconst.NODE_HEIGHT * dgconst.DISTANCE_FACTOR * i } })); - return
+ return = args => { > -
+ } diff --git a/webapp/src/components/DAGFlow/DAGNode.stories.tsx b/webapp/src/components/DAGFlow/DAGNode.stories.tsx index 3b80408..aaed2e5 100644 --- a/webapp/src/components/DAGFlow/DAGNode.stories.tsx +++ b/webapp/src/components/DAGFlow/DAGNode.stories.tsx @@ -8,6 +8,7 @@ import * as dgconst from "components/DAGFlow/constants"; import ReactFlow, { Controls } from 'react-flow-renderer'; import { DAGNode } from "./DAGNode"; import { convertToFlowNode } from "./helpers"; +import { Page } from "components/Page"; export default { @@ -30,7 +31,7 @@ export const Colors: ComponentStory = args => { "type": "mynode", "position": { "x": 50 + dgconst.NODE_HEIGHT * dgconst.DISTANCE_FACTOR * i, "y": 50 + dgconst.NODE_HEIGHT * dgconst.DISTANCE_FACTOR * i } })); - return
+ return = args => { > -
+ } diff --git a/webapp/src/components/DAGFlow/index.stories.tsx b/webapp/src/components/DAGFlow/index.stories.tsx index 89ff2bc..0832e27 100644 --- a/webapp/src/components/DAGFlow/index.stories.tsx +++ b/webapp/src/components/DAGFlow/index.stories.tsx @@ -5,6 +5,7 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import { DAGAutomationFlow } from '.'; import { useState } from 'react'; import * as dgconst from "components/DAGFlow/constants"; +import { Page } from "components/Page"; export default { @@ -22,7 +23,7 @@ const Template: ComponentStory = args => { sequence: args.sequence, condition: args.condition, }) - return
+ return = args => { onSequenceUpdate={sequence => setState({ ...state, sequence })} onConditionUpdate={condition => setState({ ...state, condition })} /> -
+ } export const Simple = Template.bind({}) diff --git a/webapp/src/components/ErrorBoundary/index.stories.tsx b/webapp/src/components/ErrorBoundary/index.stories.tsx index 2bfc1db..cd4c72b 100644 --- a/webapp/src/components/ErrorBoundary/index.stories.tsx +++ b/webapp/src/components/ErrorBoundary/index.stories.tsx @@ -1,6 +1,7 @@ import React, { FC } from "react"; import { ComponentMeta, ComponentStory } from '@storybook/react'; import { ErrorBoundary } from "."; +import { Page } from "components/Page"; export default { @@ -15,20 +16,20 @@ export const ErrorThrown: ComponentStory = args => { const BadComponent: FC = () => { throw new Error("!!!") } - return
+ return -
+ } export const NoError: ComponentStory = args => { const GoodComponent: FC = () => { return All Good. } - return
+ return -
+ } \ No newline at end of file diff --git a/webapp/src/components/Icons/index.stories.tsx b/webapp/src/components/Icons/index.stories.tsx index 1816b44..96a1635 100644 --- a/webapp/src/components/Icons/index.stories.tsx +++ b/webapp/src/components/Icons/index.stories.tsx @@ -3,6 +3,7 @@ import { ComponentStory } from "@storybook/react"; import { IconBase } from "./base"; import { PencilIcon, CheckMarkIcon, TrashIcon, InfoIcon, ArrowIcon, AddIcon, ZoomIcon, GearIcon } from "."; import { ButtonIcon } from "./ButtonIcons"; +import { Page } from "components/Page"; export default { title: 'Icons', @@ -12,7 +13,7 @@ export default { export const IconList: ComponentStory = (args) => { - return
+ return @@ -20,7 +21,7 @@ export const IconList: ComponentStory = (args) => { -
+ } IconList.args = { size: 2, @@ -30,9 +31,9 @@ IconList.args = { export const ButtonIconExample: ComponentStory = (args) => { - return
+ return {ArrowIcon} -
+ } ButtonIconExample.args = { size: 2, diff --git a/webapp/src/components/Inputs/InputBoolean.css b/webapp/src/components/Inputs/InputBoolean.css deleted file mode 100644 index 2f86029..0000000 --- a/webapp/src/components/Inputs/InputBoolean.css +++ /dev/null @@ -1,24 +0,0 @@ -.input-boolean { - display: flex; - flex-direction: row; - justify-content: center; - align-items: center; - max-width: fit-content; - border: 1px solid var(--secondary-accent); - border-radius: 5px; - padding: 0.5em; - background-color: var(--secondary); -} - -.input-boolean.disabled:hover, .input-boolean.disabled:hover * { - cursor: not-allowed; -} - -.input-boolean:hover, .input-boolean:hover * { - cursor: pointer; - background-color: var(--secondary-opaque); -} - -.input-boolean * { - user-select: none; -} \ No newline at end of file diff --git a/webapp/src/components/Inputs/InputBoolean.stories.tsx b/webapp/src/components/Inputs/InputBoolean.stories.tsx index b38c8e9..f880043 100644 --- a/webapp/src/components/Inputs/InputBoolean.stories.tsx +++ b/webapp/src/components/Inputs/InputBoolean.stories.tsx @@ -1,4 +1,5 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { Page } from "components/Page"; import { useState } from "react"; import InputBoolean from "./InputBoolean"; @@ -12,12 +13,12 @@ export default { const Template: ComponentStory = args => { const [state, onChange] = useState(args.value) - return
+ return { args.onChange(v) onChange(v) }} /> -
+ } export const SimpleText = Template.bind({}) diff --git a/webapp/src/components/Inputs/InputBoolean.tsx b/webapp/src/components/Inputs/InputBoolean.tsx index 2de4fb9..85ab51c 100644 --- a/webapp/src/components/Inputs/InputBoolean.tsx +++ b/webapp/src/components/Inputs/InputBoolean.tsx @@ -1,4 +1,6 @@ -import "./InputBoolean.css"; +import Checkbox from "@mui/material/Checkbox"; +import FormGroup from '@mui/material/FormGroup'; +import FormControlLabel from '@mui/material/FormControlLabel'; export interface Props { label: string; @@ -12,8 +14,7 @@ export default function InputBoolean({ onChange, disabled = false, }: Props) { - return
onChange(!value)}> - { }} disabled={disabled} /> - -
+ return + onChange(!value)} />} label={label} /> + } diff --git a/webapp/src/components/Inputs/InputList.stories.tsx b/webapp/src/components/Inputs/InputList.stories.tsx index 0ec1bea..70a3fdd 100644 --- a/webapp/src/components/Inputs/InputList.stories.tsx +++ b/webapp/src/components/Inputs/InputList.stories.tsx @@ -1,4 +1,5 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { Page } from "components/Page"; import { useState, useEffect } from 'react'; import { InputList } from "./InputList"; @@ -18,9 +19,9 @@ const Template: ComponentStory = args => { setValue(args.current) } }, [args.current]) - return
+ return -
+ } export const SimpleText = Template.bind({}) diff --git a/webapp/src/components/Inputs/InputMultiSelect.stories.tsx b/webapp/src/components/Inputs/InputMultiSelect.stories.tsx index 2e370c4..16cb8e4 100644 --- a/webapp/src/components/Inputs/InputMultiSelect.stories.tsx +++ b/webapp/src/components/Inputs/InputMultiSelect.stories.tsx @@ -1,4 +1,5 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { Page } from "components/Page"; import { useEffect, useState } from "react"; import InputMultiSelect from "./InputMultiSelect"; @@ -18,12 +19,12 @@ const Template: ComponentStory = args => { setValue(args.selected); }, [args.selected]) - return
+ return { setValue(a); args.onChange(a); }} options={args.options} selected={value} /> -
+ } export const Simple = Template.bind({}) diff --git a/webapp/src/components/Inputs/InputNumber.stories.tsx b/webapp/src/components/Inputs/InputNumber.stories.tsx index 852b3ab..2923787 100644 --- a/webapp/src/components/Inputs/InputNumber.stories.tsx +++ b/webapp/src/components/Inputs/InputNumber.stories.tsx @@ -1,4 +1,5 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { Page } from "components/Page"; import { useState } from "react"; import InputNumber from "./InputNumber"; @@ -18,14 +19,14 @@ export default { export const NullStart: ComponentStory = args => { const [value, setValue] = useState(undefined) - return
+ return -
+ } export const SomeStuffAtStart: ComponentStory = args => { const [value, setValue] = useState(10) - return
+ return -
+ } diff --git a/webapp/src/components/Inputs/InputText.stories.tsx b/webapp/src/components/Inputs/InputText.stories.tsx index 3fa0209..da06e1e 100644 --- a/webapp/src/components/Inputs/InputText.stories.tsx +++ b/webapp/src/components/Inputs/InputText.stories.tsx @@ -1,4 +1,5 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { Page } from "components/Page"; import { useState } from "react"; import InputText from "./InputText"; @@ -13,9 +14,9 @@ export default { const Template: ComponentStory = args => { const [value, setValue] = useState('') - return
+ return -
+ } export const SimpleText = Template.bind({}) diff --git a/webapp/src/components/Inputs/InputText.tsx b/webapp/src/components/Inputs/InputText.tsx index 71fd947..505c56d 100644 --- a/webapp/src/components/Inputs/InputText.tsx +++ b/webapp/src/components/Inputs/InputText.tsx @@ -1,7 +1,6 @@ import { PropsWithChildren, useState } from "react"; import { useToolTip } from "tooltip/context"; -import InputWrapper from "./InputWrapper"; -import { useInputTextStyles } from "./styles"; +import TextField from '@mui/material/TextField'; export interface Props { textBoxFor?: string; @@ -20,40 +19,69 @@ export default function InputText({ additionalTooltipFilters = {}, children, }: PropsWithChildren) { - const { classes } = useInputTextStyles({}); const tooltip = useToolTip(); const [isFocused, setIsFocused] = useState(false) - return - { - if (e.key === 'Enter') { - onEnter(); - } - }} - onChange={e => { - e.preventDefault(); - onChange(e.target.value) - }} - onBlur={e => { - setIsFocused(false) - }} - onFocus={e => { - setIsFocused(true) - if (textBoxFor) { - tooltip.setFocus( - e.target.getBoundingClientRect(), - { - searchObject: textBoxFor, - searchText: value, - filterObjects: additionalTooltipFilters, - }, - onChange - ) - } - }} - /> + return { + if (e.key === 'Enter') { + onEnter(); + } + }} + onChange={e => { + e.preventDefault(); + onChange(e.target.value) + }} + onBlur={() => { + setIsFocused(false) + }} + onFocus={e => { + setIsFocused(true) + if (textBoxFor) { + tooltip.setFocus( + e.target.getBoundingClientRect(), + { + searchObject: textBoxFor, + searchText: value, + filterObjects: additionalTooltipFilters, + }, + onChange + ) + } + }} + > {children} - + + // return + // { + // if (e.key === 'Enter') { + // onEnter(); + // } + // }} + // onChange={e => { + // e.preventDefault(); + // onChange(e.target.value) + // }} + // onBlur={e => { + // setIsFocused(false) + // }} + // onFocus={e => { + // setIsFocused(true) + // if (textBoxFor) { + // tooltip.setFocus( + // e.target.getBoundingClientRect(), + // { + // searchObject: textBoxFor, + // searchText: value, + // filterObjects: additionalTooltipFilters, + // }, + // onChange + // ) + // } + // }} + // /> + // {children} + // } diff --git a/webapp/src/components/Inputs/InputTextArea.stories.tsx b/webapp/src/components/Inputs/InputTextArea.stories.tsx index 0ffc06f..1b8ebc0 100644 --- a/webapp/src/components/Inputs/InputTextArea.stories.tsx +++ b/webapp/src/components/Inputs/InputTextArea.stories.tsx @@ -1,4 +1,5 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { Page } from "components/Page"; import { useState } from "react"; import InputTextArea from "./InputTextArea"; @@ -13,9 +14,9 @@ export default { const Template: ComponentStory = args => { const [value, setValue] = useState('') - return
+ return -
+ } export const SimpleText = Template.bind({}) diff --git a/webapp/src/components/Inputs/InputTextBubble.stories.tsx b/webapp/src/components/Inputs/InputTextBubble.stories.tsx index d1b7f1f..4a82503 100644 --- a/webapp/src/components/Inputs/InputTextBubble.stories.tsx +++ b/webapp/src/components/Inputs/InputTextBubble.stories.tsx @@ -1,4 +1,5 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { Page } from "components/Page"; import { useState } from "react"; import InputTextBubble, { InputEntity } from "./InputTextBubble"; @@ -18,26 +19,26 @@ export default { export const ArrayText: ComponentStory = args => { const [value, setValue] = useState(['wow', 'lots of bubbles', 'itchen', 'bathroom']) - return
+ return
-
+ } export const JustText: ComponentStory = args => { const [value, setValue] = useState('hello') - return
+ return -
+ } export const EntityId: ComponentStory = args => { const [value, setValue] = useState(['sensor.bathroom']) - return
+ return -
+ } diff --git a/webapp/src/components/Inputs/InputTime.stories.tsx b/webapp/src/components/Inputs/InputTime.stories.tsx index e9f9d79..241e44a 100644 --- a/webapp/src/components/Inputs/InputTime.stories.tsx +++ b/webapp/src/components/Inputs/InputTime.stories.tsx @@ -1,4 +1,5 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { Page } from "components/Page"; import { useState } from "react"; import { AutomationTime } from "types/automations/common"; @@ -14,9 +15,9 @@ export default { const Template: ComponentStory = args => { const [value, setValue] = useState(undefined); - return
+ return -
+ } export const SimpleText = Template.bind({}) diff --git a/webapp/src/components/Inputs/InputYaml.stories.tsx b/webapp/src/components/Inputs/InputYaml.stories.tsx index 3a8e07c..7adb1dc 100644 --- a/webapp/src/components/Inputs/InputYaml.stories.tsx +++ b/webapp/src/components/Inputs/InputYaml.stories.tsx @@ -1,4 +1,5 @@ import { ComponentMeta, ComponentStory } from "@storybook/react"; +import { Page } from "components/Page"; import { useState } from "react"; import InputYaml from "./InputYaml"; @@ -15,9 +16,9 @@ const Template: ComponentStory = args => { const [value, setValue] = useState({ "test": "data" }) - return
+ return -
+ } export const SimpleText = Template.bind({}) diff --git a/webapp/src/components/MultiNodeEditors/index.stories.tsx b/webapp/src/components/MultiNodeEditors/index.stories.tsx index 1e5891f..df38aa1 100644 --- a/webapp/src/components/MultiNodeEditors/index.stories.tsx +++ b/webapp/src/components/MultiNodeEditors/index.stories.tsx @@ -3,6 +3,7 @@ import { ComponentMeta, ComponentStory } from '@storybook/react'; import { MultiNodeEditor } from "."; import { Button } from "components/Inputs/Button"; import { Modal } from "components/Modal"; +import { Page } from "components/Page"; export default { @@ -31,20 +32,20 @@ export default { export const Simple: ComponentStory = args => { const [state, setState] = useState(args.sequence); - return
+ return
{ args.onSave && args.onSave(s) setState(s) }} />
-
+ } export const InAModal: ComponentStory = props => { const [open, setOpen] = useState(false); const [state, setState] = useState(props.sequence); - return
+ return = props => { }} /> -
+ }; diff --git a/webapp/src/components/NodeEditor/index.stories.tsx b/webapp/src/components/NodeEditor/index.stories.tsx index 07c56b4..90f012c 100644 --- a/webapp/src/components/NodeEditor/index.stories.tsx +++ b/webapp/src/components/NodeEditor/index.stories.tsx @@ -6,6 +6,7 @@ import { AutomationCondition } from "types/automations/conditions"; import { Button } from "components/Inputs/Button"; import { useState } from 'react'; import { Modal } from "components/Modal"; +import { Page } from "components/Page"; export default { @@ -23,9 +24,9 @@ export default { const Base: ComponentStory = props => { - return
+ return -
+ }; export const Action = Base.bind({}) export const SingleOption = Action.bind({}) @@ -59,10 +60,10 @@ Condition.args = { export const InAModal: ComponentStory = props => { const [open, setOpen] = useState(false); - return
+ return setOpen(!open)} /> -
+ }; diff --git a/webapp/src/components/Page/index.css b/webapp/src/components/Page/index.css new file mode 100644 index 0000000..c208851 --- /dev/null +++ b/webapp/src/components/Page/index.css @@ -0,0 +1,18 @@ +.page { + /* dims */ + height: 100vh; + width: 100vw; + margin: 0; + padding: 0; + overflow: hidden; + max-width: 100vw; + max-height: 100vh; + + /* font */ + font-size: 16px; + font-family: Tahoma, Geneva, sans-serif; + /* color : var(--primary-accent); */ + + /* background */ + /* background-color: var(--primary); */ +} \ No newline at end of file diff --git a/webapp/src/components/Page/index.tsx b/webapp/src/components/Page/index.tsx new file mode 100644 index 0000000..11cc5ea --- /dev/null +++ b/webapp/src/components/Page/index.tsx @@ -0,0 +1,23 @@ +import "./index.css"; +import { FC } from 'react'; +import { createTheme, ThemeProvider } from '@mui/material/styles'; +import { VersionBox } from "components/VersionBox"; + +const theme = createTheme({ + palette: { + mode: 'dark' + }, +}); + + +export const Page: FC = ({ children }) => { + return +
+ + {children} +
+
+} \ No newline at end of file diff --git a/webapp/src/components/VersionBox/index.css b/webapp/src/components/VersionBox/index.css new file mode 100644 index 0000000..50f2c23 --- /dev/null +++ b/webapp/src/components/VersionBox/index.css @@ -0,0 +1,6 @@ +.version-box { + position: absolute; + bottom: 0; + right: 0; + font-size: 0.5em; +} \ No newline at end of file diff --git a/webapp/src/components/VersionBox/index.tsx b/webapp/src/components/VersionBox/index.tsx new file mode 100644 index 0000000..22b9950 --- /dev/null +++ b/webapp/src/components/VersionBox/index.tsx @@ -0,0 +1,10 @@ +import "./index.css"; +import { FC } from "react"; + +console.log(process.env) +export const VersionBox: FC = () => { + const version = process.env.REACT_APP_BUILD_VERSION ?? "n/a"; + return
+ version: {version} +
+} \ No newline at end of file diff --git a/webapp/src/routes/automation.tsx b/webapp/src/routes/automation.tsx index 1863ced..2e24938 100644 --- a/webapp/src/routes/automation.tsx +++ b/webapp/src/routes/automation.tsx @@ -1,6 +1,7 @@ import { ApiService } from 'apiService/core'; import { ConnectedAutomationList } from "components/AutomationList"; import { DEFAULT_DIMS } from "components/DAGFlow/constants"; +import { Page } from 'components/Page'; import { FC } from "react"; @@ -11,10 +12,10 @@ export const AutomationRoute: FC<{ api: ApiService }> = ({ }) => { - return
+ return -
+ } diff --git a/webapp/src/styles/page.css b/webapp/src/styles/page.css deleted file mode 100644 index ec3cf4c..0000000 --- a/webapp/src/styles/page.css +++ /dev/null @@ -1,18 +0,0 @@ -.page { - /* dims */ - height : 100vh; - width : 100vw; - margin : 0; - padding : 0; - overflow : hidden; - max-width : 100vw; - max-height: 100vh; - - /* font */ - font-size : 16px; - font-family: Tahoma, Geneva, sans-serif; - color : var(--primary-accent); - - /* background */ - background-color: var(--primary); -} diff --git a/webapp/src/styles/root.css b/webapp/src/styles/root.css index 1e90c02..64735d0 100644 --- a/webapp/src/styles/root.css +++ b/webapp/src/styles/root.css @@ -1,3 +1,6 @@ +@import url(https://fonts.googleapis.com/css?family=Roboto:300,400,500,700&display=swap); +@import url(https://fonts.googleapis.com/icon?family=Material+Icons); + :root { --primary: #111; --primary-light: #333; diff --git a/webapp/src/styles/theme.ts b/webapp/src/styles/theme.ts index bda5e69..0b854b0 100644 --- a/webapp/src/styles/theme.ts +++ b/webapp/src/styles/theme.ts @@ -1,5 +1,4 @@ import "styles/root.css"; -import "styles/page.css"; import { Classes } from "jss"; import { Context, createContext } from "react"