initial work with mui
This commit is contained in:
1 parent
f8233dd6ab
commit
44c4ac12dd
35 files changed
+216
-145
No files matched your search
@@ -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 && \
|
||||
|
||||
@@ -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<typeof AutoInfoBox> = args => {
|
||||
const [[metadata, tags], setState] = useState([args.metadata, args.tags])
|
||||
return (
|
||||
<div className="page">
|
||||
<Page>
|
||||
<AutoInfoBox
|
||||
className=""
|
||||
metadata={metadata}
|
||||
@@ -22,7 +23,7 @@ export const NoTags: ComponentStory<typeof AutoInfoBox> = args => {
|
||||
setState([m, t])
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Page>
|
||||
)
|
||||
}
|
||||
NoTags.args = {
|
||||
|
||||
@@ -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<typeof AutomationEditor> = args => {
|
||||
const [state, setState] = useState(args.automation)
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<AutomationEditor
|
||||
{...args}
|
||||
automation={state}
|
||||
@@ -24,7 +25,7 @@ const Template: ComponentStory<typeof AutomationEditor> = args => {
|
||||
window.setTimeout(() => setState(s), 3000)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const Loading = Template.bind({});
|
||||
|
||||
@@ -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<typeof AutomationList> = args => {
|
||||
const [autos, setAutos] = useState(args.automations)
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<AutomationList {...args} automations={autos}
|
||||
onAdd={a => {
|
||||
args.onAdd(a);
|
||||
@@ -39,7 +40,7 @@ const Template: ComponentStory<typeof AutomationList> = args => {
|
||||
]);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const EmptyStart = Template.bind({})
|
||||
|
||||
@@ -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<typeof AutomationListBox> = args => {
|
||||
const [selected, setSelected] = useState(args.selected)
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<AutomationListBox {...args} automations={args.automations} selected={selected} onSelectAutomation={(i) => {
|
||||
setSelected(i)
|
||||
args.onSelectAutomation(i)
|
||||
}} />
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const EmptyStart = Template.bind({})
|
||||
|
||||
@@ -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<any> = args => {
|
||||
const api = useMockApiService(args.initialAutomations);
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<ConnectedAutomationList
|
||||
{...args}
|
||||
api={api}
|
||||
/>
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const EmptyStart = Template.bind({})
|
||||
|
||||
@@ -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<typeof ConditionEditor> = args => {
|
||||
]
|
||||
})
|
||||
return (
|
||||
<div className="page">
|
||||
<Page>
|
||||
<ConditionEditor
|
||||
onUpdate={setState}
|
||||
onDelete={() => { }}
|
||||
condition={state}
|
||||
/>
|
||||
</div>
|
||||
</Page>
|
||||
)
|
||||
}
|
||||
@@ -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<typeof ConditionEditor> = ({ condition, ...args }) => {
|
||||
|
||||
const [data, setData] = useState(condition);
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<ConditionEditor {...args}
|
||||
condition={data}
|
||||
onUpdate={data => {
|
||||
setData(data)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const TemplateViewer = Template.bind({})
|
||||
|
||||
@@ -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<typeof DAGErrorNode> = args => {
|
||||
"y": 50 + dgconst.NODE_HEIGHT * dgconst.DISTANCE_FACTOR * i
|
||||
}
|
||||
}));
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<ReactFlow
|
||||
defaultNodes={nodes}
|
||||
nodeTypes={{
|
||||
@@ -42,5 +43,5 @@ export const Examples: ComponentStory<typeof DAGErrorNode> = args => {
|
||||
>
|
||||
<Controls />
|
||||
</ReactFlow>
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
@@ -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<typeof DAGNode> = args => {
|
||||
"type": "mynode",
|
||||
"position": { "x": 50 + dgconst.NODE_HEIGHT * dgconst.DISTANCE_FACTOR * i, "y": 50 + dgconst.NODE_HEIGHT * dgconst.DISTANCE_FACTOR * i }
|
||||
}));
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<ReactFlow
|
||||
defaultNodes={nodes}
|
||||
nodeTypes={{
|
||||
@@ -43,5 +44,5 @@ export const Colors: ComponentStory<typeof DAGNode> = args => {
|
||||
>
|
||||
<Controls />
|
||||
</ReactFlow>
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
@@ -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<typeof DAGAutomationFlow> = args => {
|
||||
sequence: args.sequence,
|
||||
condition: args.condition,
|
||||
})
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<DAGAutomationFlow
|
||||
{...args}
|
||||
{...state}
|
||||
@@ -32,7 +33,7 @@ const Template: ComponentStory<typeof DAGAutomationFlow> = args => {
|
||||
onSequenceUpdate={sequence => setState({ ...state, sequence })}
|
||||
onConditionUpdate={condition => setState({ ...state, condition })}
|
||||
/>
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const Simple = Template.bind({})
|
||||
|
||||
@@ -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<typeof ErrorBoundary> = args => {
|
||||
const BadComponent: FC = () => {
|
||||
throw new Error("!!!")
|
||||
}
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<ErrorBoundary>
|
||||
<BadComponent />
|
||||
</ErrorBoundary>
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const NoError: ComponentStory<typeof ErrorBoundary> = args => {
|
||||
const GoodComponent: FC = () => {
|
||||
return <span>All Good.</span>
|
||||
}
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<ErrorBoundary>
|
||||
<GoodComponent />
|
||||
</ErrorBoundary>
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
@@ -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<typeof IconBase> = (args) => {
|
||||
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<PencilIcon {...args} />
|
||||
<CheckMarkIcon {...args} />
|
||||
<AddIcon {...args} />
|
||||
@@ -20,7 +21,7 @@ export const IconList: ComponentStory<typeof IconBase> = (args) => {
|
||||
<InfoIcon {...args} />
|
||||
<ZoomIcon {...args} />
|
||||
<GearIcon {...args} />
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
IconList.args = {
|
||||
size: 2,
|
||||
@@ -30,9 +31,9 @@ IconList.args = {
|
||||
|
||||
export const ButtonIconExample: ComponentStory<typeof IconBase> = (args) => {
|
||||
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<ButtonIcon {...args}>{ArrowIcon}</ButtonIcon>
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
ButtonIconExample.args = {
|
||||
size: 2,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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<typeof InputBoolean> = args => {
|
||||
const [state, onChange] = useState(args.value)
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<InputBoolean {...args} value={state} onChange={v => {
|
||||
args.onChange(v)
|
||||
onChange(v)
|
||||
}} />
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const SimpleText = Template.bind({})
|
||||
|
||||
@@ -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 <div className={["input-boolean", disabled ? 'disabled' : ''].join(' ')} onClick={() => onChange(!value)}>
|
||||
<input type="checkbox" checked={value} onChange={() => { }} disabled={disabled} />
|
||||
<label>{label}</label>
|
||||
</div>
|
||||
return <FormGroup>
|
||||
<FormControlLabel disabled={disabled} control={<Checkbox checked={value} onChange={() => onChange(!value)} />} label={label} />
|
||||
</FormGroup>
|
||||
}
|
||||
@@ -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<typeof InputList> = args => {
|
||||
setValue(args.current)
|
||||
}
|
||||
}, [args.current])
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<InputList {...args} current={value} onChange={setValue} />
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const SimpleText = Template.bind({})
|
||||
|
||||
@@ -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<typeof InputMultiSelect> = args => {
|
||||
setValue(args.selected);
|
||||
}, [args.selected])
|
||||
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<InputMultiSelect {...args} onChange={a => {
|
||||
setValue(a);
|
||||
args.onChange(a);
|
||||
}} options={args.options} selected={value} />
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const Simple = Template.bind({})
|
||||
|
||||
@@ -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<typeof InputNumber> = args => {
|
||||
|
||||
const [value, setValue] = useState<number | undefined>(undefined)
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<InputNumber {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
export const SomeStuffAtStart: ComponentStory<typeof InputNumber> = args => {
|
||||
|
||||
const [value, setValue] = useState<number | undefined>(10)
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<InputNumber {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
@@ -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<typeof InputText> = args => {
|
||||
|
||||
const [value, setValue] = useState('')
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<InputText {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const SimpleText = Template.bind({})
|
||||
|
||||
@@ -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<Props>) {
|
||||
const { classes } = useInputTextStyles({});
|
||||
const tooltip = useToolTip();
|
||||
const [isFocused, setIsFocused] = useState(false)
|
||||
return <InputWrapper label={label} labelSize={(value === '') && !isFocused ? 'normal' : 'small'}>
|
||||
<input
|
||||
className={classes.input}
|
||||
value={value}
|
||||
onKeyDown={e => {
|
||||
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 <TextField inputMode="text" variant="filled" focused={isFocused} label={label} value={value}
|
||||
onKeyDown={e => {
|
||||
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}
|
||||
</InputWrapper>
|
||||
</TextField>
|
||||
// return <InputWrapper label={label} labelSize={(value === '') && !isFocused ? 'normal' : 'small'}>
|
||||
// <input
|
||||
// className={classes.input}
|
||||
// value={value}
|
||||
// onKeyDown={e => {
|
||||
// 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}
|
||||
// </InputWrapper>
|
||||
}
|
||||
@@ -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<typeof InputTextArea> = args => {
|
||||
|
||||
const [value, setValue] = useState('')
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<InputTextArea {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const SimpleText = Template.bind({})
|
||||
|
||||
@@ -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<typeof InputTextBubble> = args => {
|
||||
|
||||
const [value, setValue] = useState<string | string[]>(['wow', 'lots of bubbles', 'itchen', 'bathroom'])
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<div style={{ maxWidth: '200px', overflow: 'hidden' }}>
|
||||
<InputTextBubble {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const JustText: ComponentStory<typeof InputTextBubble> = args => {
|
||||
|
||||
const [value, setValue] = useState<string | string[]>('hello')
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<InputTextBubble {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
|
||||
export const EntityId: ComponentStory<typeof InputTextBubble> = args => {
|
||||
|
||||
const [value, setValue] = useState<string | string[]>(['sensor.bathroom'])
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<InputEntity value={value} onChange={setValue} />
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
@@ -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<typeof InputTime> = args => {
|
||||
|
||||
const [value, setValue] = useState<AutomationTime | undefined>(undefined);
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<InputTime {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const SimpleText = Template.bind({})
|
||||
|
||||
@@ -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<typeof InputYaml> = args => {
|
||||
const [value, setValue] = useState({
|
||||
"test": "data"
|
||||
})
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<InputYaml {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
|
||||
export const SimpleText = Template.bind({})
|
||||
|
||||
@@ -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<typeof MultiNodeEditor> = args => {
|
||||
const [state, setState] = useState(args.sequence);
|
||||
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<div className="center column" style={{ paddingTop: "1em" }}>
|
||||
<MultiNodeEditor {...args} sequence={state} onSave={s => {
|
||||
args.onSave && args.onSave(s)
|
||||
setState(s)
|
||||
}} />
|
||||
</div>
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
export const InAModal: ComponentStory<typeof MultiNodeEditor> = props => {
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
const [state, setState] = useState(props.sequence);
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<Button onClick={() => setOpen(!open)}>Open Editor</Button>
|
||||
<Modal open={open}>
|
||||
<MultiNodeEditor
|
||||
@@ -57,7 +58,7 @@ export const InAModal: ComponentStory<typeof MultiNodeEditor> = props => {
|
||||
}}
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
</Page>
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -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<typeof NodeEditor> = props => {
|
||||
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<NodeEditor {...props} />
|
||||
</div>
|
||||
</Page>
|
||||
};
|
||||
export const Action = Base.bind({})
|
||||
export const SingleOption = Action.bind({})
|
||||
@@ -59,10 +60,10 @@ Condition.args = {
|
||||
export const InAModal: ComponentStory<typeof NodeEditor> = props => {
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
return <div className="page">
|
||||
return <Page>
|
||||
<Button onClick={() => setOpen(!open)}>Open Editor</Button>
|
||||
<Modal open={open}>
|
||||
<NodeEditor {...props} onClose={() => setOpen(!open)} />
|
||||
</Modal>
|
||||
</div>
|
||||
</Page>
|
||||
};
|
||||
@@ -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); */
|
||||
}
|
||||
@@ -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 <ThemeProvider theme={theme}>
|
||||
<main className="page" style={{
|
||||
color: theme.palette.text.primary,
|
||||
background: theme.palette.background.default,
|
||||
}}>
|
||||
<VersionBox />
|
||||
{children}
|
||||
</main>
|
||||
</ThemeProvider>
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
.version-box {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
font-size: 0.5em;
|
||||
}
|
||||
@@ -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 <div className="version-box">
|
||||
version: {version}
|
||||
</div>
|
||||
}
|
||||
@@ -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 <div className="page">
|
||||
return <Page>
|
||||
<ConnectedAutomationList
|
||||
dims={DEFAULT_DIMS}
|
||||
api={api}
|
||||
/>
|
||||
</div>
|
||||
</Page>
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import "styles/root.css";
|
||||
import "styles/page.css";
|
||||
|
||||
import { Classes } from "jss";
|
||||
import { Context, createContext } from "react"
|
||||
|
||||
Reference in new issue
Block a user