fixed up styling for autos
This commit is contained in:
1 parent
634f3e9219
commit
c256400518
9 files changed
+104
-107
No files matched your search
@@ -1,10 +1,69 @@
|
||||
.automation-editor--info-icon {
|
||||
.automation-editor {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.automation-editor--flow-wrapper {
|
||||
flex: 1;
|
||||
padding: 0 0.5em 0 0.5em;
|
||||
max-height: 100%;
|
||||
max-width: 100%;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.5em;
|
||||
}
|
||||
|
||||
.automation-editor--flow-wrapper--toolbar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.automation-editor--flow-wrapper.unchanged>.automation-editor--flow-wrapper--toolbar {
|
||||
height: 0;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.automation-editor--flow-wrapper.changed>.automation-editor--flow-wrapper--toolbar * {
|
||||
border-color: var(--change);
|
||||
color: var(--change)
|
||||
}
|
||||
|
||||
|
||||
.automation-editor--flow-wrapper--toolbar--save-btn {
|
||||
display: flex;
|
||||
gap: 0.5em;
|
||||
align-items: center;
|
||||
padding: 0.25em;
|
||||
}
|
||||
|
||||
.automation-editor--flow-wrapper.changed>.automation-editor--flow-wrapper--flow {
|
||||
border-color: var(--change);
|
||||
}
|
||||
|
||||
.automation-editor--flow-wrapper--flow {
|
||||
flex: 1;
|
||||
border: 1px solid var(--secondary-accent);
|
||||
margin: 0 0 0.5em 0;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.automation-editor--info-box {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.automation-editor--info-box--icon {
|
||||
position: absolute;
|
||||
right: 1.5em;
|
||||
right: 0em;
|
||||
bottom: 0.5em;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.automation-editor--info-box.hide>.automation-editor--info-icon {
|
||||
.automation-editor--info-box.hide>.automation-editor--info-box--icon {
|
||||
transform: rotate(180deg);
|
||||
z-index: 2;
|
||||
}
|
||||
@@ -36,6 +36,9 @@ const Template: ComponentStory<typeof AutomationEditor> = args => {
|
||||
</div>
|
||||
}
|
||||
|
||||
export const Loading = Template.bind({});
|
||||
|
||||
|
||||
export const Simple = Template.bind({})
|
||||
Simple.args = {
|
||||
...Simple.args,
|
||||
|
||||
@@ -12,7 +12,7 @@ import { DAGAutomationFlow } from "components/DAGFlow";
|
||||
import { DAGAutomationFlowDims } from "components/DAGFlow/types";
|
||||
|
||||
interface Props {
|
||||
automation: AutomationData;
|
||||
automation?: AutomationData;
|
||||
dims: DAGAutomationFlowDims;
|
||||
onUpdate: (auto: AutomationData) => void;
|
||||
}
|
||||
@@ -30,22 +30,15 @@ export const AutomationEditor: FC<Props> = ({
|
||||
save,
|
||||
} = useAutomatioEditorState(propsAutos, propsOnUpdate);
|
||||
|
||||
const { ratioWbh } = useWindowSize();
|
||||
const [closeInfo, setCloseInfo] = useState(false);
|
||||
const { classes } = useEditorStyles({
|
||||
closeInfo,
|
||||
horizontalMode: ratioWbh < 0.75,
|
||||
autoChanged: state.status,
|
||||
});
|
||||
|
||||
|
||||
// render
|
||||
if (state.status === 'loading') {
|
||||
return <div className={classes.root}>
|
||||
return <div className="automation-editor loading">
|
||||
Loading...
|
||||
</div>
|
||||
}
|
||||
return <div className={classes.root}>
|
||||
return <div className="automation-editor">
|
||||
<AutoInfoBox
|
||||
className={closeInfo ? "hide" : "show"}
|
||||
metadata={state.data.metadata}
|
||||
@@ -53,17 +46,16 @@ export const AutomationEditor: FC<Props> = ({
|
||||
onUpdate={updateMetadata}
|
||||
>
|
||||
<ButtonIcon
|
||||
className={`${classes.infoIcon} automation-editor--info-icon`}
|
||||
className="automation-editor--info-box--icon"
|
||||
onClick={() => setCloseInfo(!closeInfo)}
|
||||
title={closeInfo ? "Show Metadata" : "Hide Metadata"}
|
||||
>{ArrowIcon}</ButtonIcon>
|
||||
</AutoInfoBox>
|
||||
|
||||
<div className={classes.wrapper}>
|
||||
<div className={classes.toolbar}>
|
||||
<span></span>
|
||||
<div className={["automation-editor--flow-wrapper", state.status].join(" ")}>
|
||||
<div className="automation-editor--flow-wrapper--toolbar">
|
||||
<Button
|
||||
className={classes.saveBtn}
|
||||
className={"automation-editor--flow-wrapper--toolbar--save-btn"}
|
||||
onClick={save}
|
||||
disabled={state.status !== 'changed'}
|
||||
>
|
||||
@@ -71,6 +63,7 @@ export const AutomationEditor: FC<Props> = ({
|
||||
</Button>
|
||||
</div>
|
||||
<DAGAutomationFlow
|
||||
className="automation-editor--flow-wrapper--flow"
|
||||
sequence={state.data.sequence}
|
||||
trigger={state.data.trigger}
|
||||
onSequenceUpdate={updateSequence}
|
||||
|
||||
@@ -12,7 +12,7 @@ export type EditorState = {
|
||||
export type EditorStatus = EditorState['status'];
|
||||
|
||||
export const useAutomatioEditorState = (
|
||||
automation: AutomationData,
|
||||
automation: AutomationData | undefined,
|
||||
onSave: (a: AutomationData) => void,
|
||||
) => {
|
||||
const [state, update] = useState<EditorState>({
|
||||
@@ -30,10 +30,12 @@ export const useAutomatioEditorState = (
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
update({
|
||||
status: 'unchanged',
|
||||
data: genEditorData(automation),
|
||||
})
|
||||
if (automation) {
|
||||
update({
|
||||
status: 'unchanged',
|
||||
data: genEditorData(automation),
|
||||
})
|
||||
}
|
||||
}, [automation]);
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
import { createAppUseStyles } from "styles/theme";
|
||||
|
||||
|
||||
export const useEditorStyles = createAppUseStyles<{
|
||||
closeInfo: boolean;
|
||||
horizontalMode: boolean;
|
||||
autoChanged: string;
|
||||
}>(theme => ({
|
||||
wrapper: {
|
||||
display: 'flex',
|
||||
flexDirection: 'column',
|
||||
alignItems: "flex-end",
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
overflow: 'hidden',
|
||||
},
|
||||
root: ({ horizontalMode }) => ({
|
||||
height: '100%',
|
||||
width: '100%',
|
||||
color: theme.primaryAccent,
|
||||
display: 'flex',
|
||||
flexDirection: horizontalMode ? 'column' : 'row',
|
||||
}),
|
||||
dag: {
|
||||
borderWidth: 1,
|
||||
borderStyle: 'solid',
|
||||
borderColor: theme.secondaryAccent,
|
||||
width: '100%',
|
||||
},
|
||||
infoIcon: ({ horizontalMode }) => ({
|
||||
bottom: horizontalMode ? '90%' : 10
|
||||
}),
|
||||
zoom: {
|
||||
backgroundColor: theme.secondary,
|
||||
color: theme.secondaryAccent,
|
||||
textAlign: 'center',
|
||||
maxWidth: "3em",
|
||||
},
|
||||
zoomImg: {
|
||||
|
||||
},
|
||||
toolbar: ({ autoChanged }) => ({
|
||||
width: "100%",
|
||||
height: autoChanged === 'changed' ? 'initial' : 0,
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
justifyContent: 'space-between',
|
||||
alignItems: "center",
|
||||
padding: "0.5em",
|
||||
borderBottom: autoChanged === 'changed' ? '1px solid var(--change)' : undefined,
|
||||
borderLeft: autoChanged === 'changed' ? '1px solid var(--change)' : undefined,
|
||||
}),
|
||||
saveBtn: ({ autoChanged }) => ({
|
||||
display: "flex",
|
||||
opacity: autoChanged === "changed" ? 1 : 0,
|
||||
height: autoChanged === "changed" ? undefined : 0,
|
||||
fontSize: autoChanged === "changed" ? undefined : 0,
|
||||
gap: '0.5em',
|
||||
maxHeight: '1em',
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
borderColor: "var(--change) !important",
|
||||
color: "var(--change) !important",
|
||||
paddingTop: '1em !important',
|
||||
paddingBottom: '1em !important',
|
||||
}),
|
||||
}))
|
||||
Reference in new issue
Block a user