adjusted scrollbar for dag in all possible modes
removed pages
This commit is contained in:
1 parent
3f74c10cbf
commit
28fbdf1698
26 files changed
+92
-155
No files matched your search
@@ -1,6 +1,5 @@
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { useState } from "react";
|
||||
import { usePageTheme } from "styles/page";
|
||||
import { AutoInfoBox } from "./AutoInfoBox";
|
||||
|
||||
export default {
|
||||
@@ -11,10 +10,9 @@ export default {
|
||||
|
||||
|
||||
export const Basic: ComponentStory<typeof AutoInfoBox> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
const [state, setState] = useState(args.metadata)
|
||||
return (
|
||||
<div className={classes.page}>
|
||||
<div className="page">
|
||||
<AutoInfoBox
|
||||
className=""
|
||||
metadata={state}
|
||||
|
||||
@@ -3,7 +3,6 @@ import { ComponentMeta, ComponentStory } from '@storybook/react';
|
||||
import { AutomationEditor } from './index';
|
||||
import { NODE_HEIGHT, NODE_WIDTH, DISTANCE_FACTOR, ADD_HEIGHT, ADD_WIDTH, CIRCLE_SIZE } from '../DAGSvgs/constants';
|
||||
import { useState } from 'react';
|
||||
import { usePageTheme } from "styles/page";
|
||||
|
||||
|
||||
export default {
|
||||
@@ -24,8 +23,7 @@ export default {
|
||||
|
||||
const Template: ComponentStory<typeof AutomationEditor> = args => {
|
||||
const [state, setState] = useState(args.automation)
|
||||
const { classes } = usePageTheme({});
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<AutomationEditor
|
||||
{...args}
|
||||
automation={state}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { useState } from "react";
|
||||
import { usePageTheme } from "styles/page";
|
||||
import { AutomationList } from ".";
|
||||
import { NODE_HEIGHT, NODE_WIDTH, ADD_HEIGHT, ADD_WIDTH, CIRCLE_SIZE, DISTANCE_FACTOR } from 'components/DAGSvgs/constants';
|
||||
import { createMockAuto } from "utils/mocks";
|
||||
@@ -23,9 +22,8 @@ export default {
|
||||
|
||||
|
||||
const Template: ComponentStory<typeof AutomationList> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
const [autos, setAutos] = useState(args.automations)
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<AutomationList {...args} automations={autos}
|
||||
onAdd={a => {
|
||||
args.onAdd(a);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { usePageTheme } from "styles/page";
|
||||
import { ConnectedAutmationList } from ".";
|
||||
import { NODE_HEIGHT, NODE_WIDTH, ADD_HEIGHT, ADD_WIDTH, CIRCLE_SIZE, DISTANCE_FACTOR } from 'components/DAGSvgs/constants';
|
||||
import { createMockAuto } from "utils/mocks";
|
||||
@@ -24,9 +23,8 @@ export default {
|
||||
|
||||
|
||||
const Template: ComponentStory<any> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
const api = useMockApiService(args.initialAutomations);
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<ConnectedAutmationList
|
||||
{...args}
|
||||
api={api}
|
||||
|
||||
@@ -7,7 +7,6 @@ import { DAGBoardElmDims } from 'components/DAGSvgs/DAGBoard';
|
||||
import { defaultAutomation } from '../../utils/defaults';
|
||||
import { ArrowIcon, TrashIcon } from "components/Icons";
|
||||
import { ButtonIcon } from "components/Icons/ButtonIcons";
|
||||
import { useSearchParams } from "react-router-dom";
|
||||
import { ApiService } from "apiService/core";
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
}
|
||||
|
||||
.automation-list--viewer {
|
||||
flex: 6;
|
||||
/* flex: 6; */
|
||||
min-width: 100%;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
/* list children: on hide */
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { useState } from "react";
|
||||
import { usePageTheme } from "styles/page";
|
||||
import { ConditionEditor } from ".";
|
||||
import { AutomationCondition } from 'types/automations/conditions';
|
||||
|
||||
@@ -12,7 +11,6 @@ export default {
|
||||
|
||||
|
||||
export const Basic: ComponentStory<typeof ConditionEditor> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
const [state, setState] = useState<AutomationCondition>({
|
||||
"$smType": "condition",
|
||||
"condition": "or",
|
||||
@@ -58,7 +56,7 @@ export const Basic: ComponentStory<typeof ConditionEditor> = args => {
|
||||
}
|
||||
})
|
||||
return (
|
||||
<div className={classes.page}>
|
||||
<div className="page">
|
||||
<ConditionEditor
|
||||
onUpdate={setState}
|
||||
onDelete={() => { }}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { useState } from "react";
|
||||
import { AutomationCondition } from "types/automations/conditions";
|
||||
import { usePageTheme } from "styles/page";
|
||||
|
||||
import { ConditionEditor } from ".";
|
||||
|
||||
export default {
|
||||
@@ -12,9 +12,9 @@ export default {
|
||||
|
||||
|
||||
const Template: ComponentStory<typeof ConditionEditor> = ({ condition, ...args }) => {
|
||||
const { classes } = usePageTheme({});
|
||||
|
||||
const [data, setData] = useState(condition);
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<ConditionEditor {...args}
|
||||
condition={data}
|
||||
onUpdate={data => {
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
.board-btn {
|
||||
position: absolute;
|
||||
}
|
||||
.board-btn:hover {
|
||||
background: #5e44444f;
|
||||
cursor: pointer;
|
||||
}
|
||||
.board-btn.right {
|
||||
right: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
width: 5%;
|
||||
}
|
||||
.board-btn.left {
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 100%;
|
||||
width: 5%;
|
||||
}
|
||||
.board-btn.top {
|
||||
left: 0;
|
||||
top: 0;
|
||||
height: 5%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.board-btn.bottom {
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
height: 5%;
|
||||
width: 100%;
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import "./Board.css";
|
||||
import { FC } from 'react';
|
||||
import useWindowSize from "utils/useWindowSize";
|
||||
import { useBoardStyles } from "./styles";
|
||||
@@ -29,12 +28,10 @@ export const SVGBoard: FC<{
|
||||
);
|
||||
const { classes, theme } = useBoardStyles({
|
||||
boardHeight: Math.max(nodeHeight, graphHeight) * zoomLevel,
|
||||
boardWidth: Math.max(5 * nodeWidth, graphWidth) * zoomLevel,
|
||||
boardWidth: Math.max(4 * nodeWidth, graphWidth) * zoomLevel,
|
||||
});
|
||||
|
||||
|
||||
// render
|
||||
return <div className={classes.dag}>
|
||||
return <div className={classes.dag} >
|
||||
<svg
|
||||
className={classes.svg}
|
||||
viewBox={[0, 0, graphWidth, graphHeight].join(" ")}
|
||||
|
||||
@@ -3,7 +3,6 @@ import { ComponentMeta, ComponentStory } from '@storybook/react';
|
||||
import { DAGBoard, DAGElement, DAGNodeElm } from "./DAGBoard";
|
||||
import { NODE_HEIGHT, NODE_WIDTH, ADD_HEIGHT, ADD_WIDTH, DISTANCE_FACTOR, CIRCLE_SIZE } from './constants';
|
||||
import { AutomationAction } from 'types/automations/actions';
|
||||
import { arrayToIter } from "utils/iter";
|
||||
|
||||
|
||||
export default {
|
||||
@@ -51,7 +50,12 @@ function* makeDummyData(pts: Array<any>, extras: DAGElement[]): Generator<DAGEle
|
||||
}
|
||||
|
||||
|
||||
export const Simple: ComponentStory<typeof DAGBoard> = args => <DAGBoard {...args} />
|
||||
export const Simple: ComponentStory<typeof DAGBoard> = args => {
|
||||
|
||||
return <div className="page">
|
||||
<DAGBoard {...args} />
|
||||
</div>
|
||||
}
|
||||
Simple.args = {
|
||||
...Simple.args,
|
||||
elements: makeDummyData(
|
||||
@@ -94,7 +98,12 @@ Simple.args = {
|
||||
}
|
||||
|
||||
|
||||
export const Complex: ComponentStory<typeof DAGBoard> = args => <DAGBoard {...args} />
|
||||
export const Complex: ComponentStory<typeof DAGBoard> = args => {
|
||||
|
||||
return <div className="page">
|
||||
<DAGBoard {...args} />
|
||||
</div>
|
||||
}
|
||||
Complex.args = {
|
||||
...Complex.args,
|
||||
elements: makeDummyData(
|
||||
|
||||
@@ -194,7 +194,7 @@ export const DAGBoard: FC<Props & { zoomLevel: number }> = props => {
|
||||
];
|
||||
return <SVGBoard
|
||||
graphHeight={y1 - y0}
|
||||
minGraphWidth={Math.max(x1 - x0, props.settings.nodeWidth * 15)}
|
||||
minGraphWidth={Math.max(x1 - x0, props.settings.nodeWidth * 8)}
|
||||
nodeHeight={props.settings.nodeHeight}
|
||||
nodeWidth={props.settings.nodeWidth}
|
||||
zoomLevel={props.zoomLevel}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ComponentStory } from "@storybook/react";
|
||||
import { usePageTheme } from "styles/page";
|
||||
|
||||
import { IconBase } from "./base";
|
||||
import { PencilIcon, CheckMarkIcon, TrashIcon, InfoIcon, ArrowIcon } from ".";
|
||||
import { AddIcon } from './index';
|
||||
@@ -12,8 +12,8 @@ export default {
|
||||
|
||||
|
||||
export const IconList: ComponentStory<typeof IconBase> = (args) => {
|
||||
const { classes } = usePageTheme({});
|
||||
return <div className={classes.page}>
|
||||
|
||||
return <div className="page">
|
||||
<PencilIcon {...args} />
|
||||
<CheckMarkIcon {...args} />
|
||||
<AddIcon {...args} />
|
||||
@@ -28,8 +28,8 @@ IconList.args = {
|
||||
|
||||
|
||||
export const ButtonIconExample: ComponentStory<typeof IconBase> = (args) => {
|
||||
const { classes } = usePageTheme({});
|
||||
return <div className={classes.page}>
|
||||
|
||||
return <div className="page">
|
||||
<ButtonIcon {...args}>{ArrowIcon}</ButtonIcon>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { useState } from "react";
|
||||
import { usePageTheme } from "styles/page";
|
||||
|
||||
import InputList from "./InputList";
|
||||
|
||||
export default {
|
||||
@@ -11,9 +11,9 @@ export default {
|
||||
|
||||
|
||||
const Template: ComponentStory<typeof InputList> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
|
||||
const [value, setValue] = useState('')
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<InputList {...args} current={value} onChange={setValue} />
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { useState } from "react";
|
||||
import { usePageTheme } from "styles/page";
|
||||
|
||||
import InputNumber from "./InputNumber";
|
||||
|
||||
export default {
|
||||
@@ -16,16 +16,16 @@ export default {
|
||||
|
||||
|
||||
export const NullStart: ComponentStory<typeof InputNumber> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
|
||||
const [value, setValue] = useState<number | undefined>(undefined)
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<InputNumber {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
}
|
||||
export const SomeStuffAtStart: ComponentStory<typeof InputNumber> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
|
||||
const [value, setValue] = useState<number | undefined>(10)
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<InputNumber {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { useState } from "react";
|
||||
import { usePageTheme } from "styles/page";
|
||||
|
||||
import InputText from "./InputText";
|
||||
|
||||
export default {
|
||||
@@ -11,9 +11,9 @@ export default {
|
||||
|
||||
|
||||
const Template: ComponentStory<typeof InputText> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
|
||||
const [value, setValue] = useState('')
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<InputText {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { useState } from "react";
|
||||
import { usePageTheme } from "styles/page";
|
||||
|
||||
import InputTextArea from "./InputTextArea";
|
||||
|
||||
export default {
|
||||
@@ -11,9 +11,9 @@ export default {
|
||||
|
||||
|
||||
const Template: ComponentStory<typeof InputTextArea> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
|
||||
const [value, setValue] = useState('')
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<InputTextArea {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { useState } from "react";
|
||||
import { usePageTheme } from "styles/page";
|
||||
|
||||
import InputTextBubble, { InputEntity } from "./InputTextBubble";
|
||||
|
||||
export default {
|
||||
@@ -16,9 +16,9 @@ export default {
|
||||
|
||||
|
||||
export const ArrayText: ComponentStory<typeof InputTextBubble> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
|
||||
const [value, setValue] = useState<string | string[]>(['wow', 'lots of bubbles', 'itchen', 'bathroom'])
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<div style={{ maxWidth: '200px', overflow: 'hidden' }}>
|
||||
<InputTextBubble {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
@@ -26,18 +26,18 @@ export const ArrayText: ComponentStory<typeof InputTextBubble> = args => {
|
||||
}
|
||||
|
||||
export const JustText: ComponentStory<typeof InputTextBubble> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
|
||||
const [value, setValue] = useState<string | string[]>('hello')
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<InputTextBubble {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
export const EntityId: ComponentStory<typeof InputTextBubble> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
|
||||
const [value, setValue] = useState<string | string[]>(['sensor.bathroom'])
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<InputEntity value={value} onChange={setValue} />
|
||||
</div>
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ComponentMeta, ComponentStory } from "@storybook/react";
|
||||
import { useState } from "react";
|
||||
import { usePageTheme } from "styles/page";
|
||||
|
||||
import InputYaml from "./InputYaml";
|
||||
|
||||
export default {
|
||||
@@ -11,11 +11,11 @@ export default {
|
||||
|
||||
|
||||
const Template: ComponentStory<typeof InputYaml> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
|
||||
const [value, setValue] = useState({
|
||||
"test": "data"
|
||||
})
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<InputYaml {...args} value={value} onChange={setValue} />
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React, { useState } from "react";
|
||||
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
||||
import { MultiNodeEditor } from ".";
|
||||
import { usePageTheme } from 'styles/page';
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import { Modal } from "components/Modal";
|
||||
|
||||
@@ -35,16 +34,16 @@ export default {
|
||||
} as ComponentMeta<typeof MultiNodeEditor>
|
||||
|
||||
export const Simple: ComponentStory<typeof MultiNodeEditor> = args => {
|
||||
const { classes } = usePageTheme({});
|
||||
return <div className={classes.page}>
|
||||
|
||||
return <div className="page">
|
||||
<MultiNodeEditor {...args} />
|
||||
</div>
|
||||
}
|
||||
export const InAModal: ComponentStory<typeof MultiNodeEditor> = props => {
|
||||
const { classes } = usePageTheme({});
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
const [state, setState] = useState(props.sequence);
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<Button onClick={() => setOpen(!open)}>Open Editor</Button>
|
||||
<Modal open={open}>
|
||||
<MultiNodeEditor
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from "react";
|
||||
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
||||
import { NodeEditor } from ".";
|
||||
import { usePageTheme } from "styles/page";
|
||||
|
||||
import { AutomationCondition } from "types/automations/conditions";
|
||||
import { Button } from "components/Inputs/Button";
|
||||
import { useState } from 'react';
|
||||
@@ -26,8 +26,8 @@ export default {
|
||||
} as ComponentMeta<typeof NodeEditor>
|
||||
|
||||
const Base: ComponentStory<typeof NodeEditor> = props => {
|
||||
const { classes } = usePageTheme({});
|
||||
return <div className={classes.page}>
|
||||
|
||||
return <div className="page">
|
||||
<NodeEditor {...props} />
|
||||
</div>
|
||||
};
|
||||
@@ -70,9 +70,9 @@ Condition.args = {
|
||||
|
||||
|
||||
export const InAModal: ComponentStory<typeof NodeEditor> = props => {
|
||||
const { classes } = usePageTheme({});
|
||||
|
||||
const [open, setOpen] = useState(false);
|
||||
return <div className={classes.page}>
|
||||
return <div className="page">
|
||||
<Button onClick={() => setOpen(!open)}>Open Editor</Button>
|
||||
<Modal open={open}>
|
||||
<NodeEditor {...props} onClose={() => setOpen(!open)} />
|
||||
|
||||
Reference in new issue
Block a user