show hide metadata dim

This commit is contained in:
ari committed 2021-12-16 17:19:59 -05:00
1 parent 997c793c36
commit 3cfb8151eb
7 files changed
+78 -49

No files matched your search

@@ -2,17 +2,19 @@ import { AutomationMetadata } from "types/automations";
import InputList from "components/Inputs/InputList";
import InputText from "components/Inputs/InputText";
import InputTextArea from "components/Inputs/InputTextArea";
import { FC } from "react";
interface Props {
className: string;
metadata: AutomationMetadata;
onUpdate: (m: AutomationMetadata) => void;
}
export function AutoInfoBox({
export const AutoInfoBox: FC<Props> = ({
metadata,
onUpdate,
className,
}: Props) {
children,
}) => {
// aliases
const onUpdateMetadata = <K extends keyof AutomationMetadata>(k: K) => (update: AutomationMetadata[K]) => onUpdate({
@@ -36,5 +38,6 @@ export function AutoInfoBox({
'restart'
]}
/>
{children}
</div>
}
@@ -1,6 +1,8 @@
import { DAGBoardElmDims } from "components/DAGSvgs/DAGBoard";
import { InfoIcon } from "components/Icons";
import { Button } from "components/Inputs/Button";
import { SequenceNodes } from "components/SequenceNodes";
import { FC } from "react";
import { FC, useState } from "react";
import { AutomationData, AutomationSequenceNode } from "types/automations";
import useWindowSize from "utils/useWindowSize";
import { AutoInfoBox } from "./AutoInfoBox";
@@ -19,7 +21,11 @@ export const AutomationEditor: FC<Props> = ({
}) => {
// state
const { ratioWbh } = useWindowSize();
const { classes } = useEditorStyles({});
const [closeInfo, setCloseInfo] = useState(false);
const { classes } = useEditorStyles({
closeInfo,
horizontalMode: ratioWbh < 0.75
});
// alias
const updateSequence = (sequence: AutomationSequenceNode[]) => onUpdate({
@@ -28,14 +34,18 @@ export const AutomationEditor: FC<Props> = ({
});
// render
return <div className={classes.root} style={{
flexDirection: ratioWbh >= 0.75 ? 'row' : 'column'
}}>
return <div className={classes.root}>
<AutoInfoBox
className={classes.infoBox}
metadata={automation.metadata}
onUpdate={metadata => onUpdate({ ...automation, metadata })}
/>
<InfoIcon
className={classes.infoIcon}
onClick={() => setCloseInfo(!closeInfo)}
title={closeInfo ? "Show Metadata" : "Hide Metadata"}
/>
<SequenceNodes
zoomLevel={1.5}
startPoint={[0.5, 0.5]}
@@ -1,26 +1,45 @@
import { createAppUseStyles } from "styles/theme";
export const useEditorStyles = createAppUseStyles(theme => ({
root: {
export const useEditorStyles = createAppUseStyles<{
closeInfo: boolean;
horizontalMode: boolean;
}>(theme => ({
root: ({horizontalMode}) => ({
height: '100%',
width: '100%',
color: theme.primaryAccent,
display: 'flex',
flexDirection: 'row',
},
flexDirection: horizontalMode ? 'column' : 'row',
}),
dag: {
borderWidth: 1,
borderStyle: 'solid',
borderColor: theme.secondaryAccent,
width: '100%',
},
infoBox: {
infoBox: ({closeInfo}) => ({
width: closeInfo ? 0 : 'auto',
paddingLeft: '10px',
paddingRight: '10px',
display: 'flex',
display: closeInfo ? 'none' : 'flex',
flexDirection: 'column',
justifyContent: 'flex-start',
overflow: 'auto',
},
paddingTop: 5,
paddingBottom: 10,
position: 'relative',
}),
infoIcon: ({closeInfo, horizontalMode}) => ({
position: 'absolute',
top: horizontalMode ? '90%' : 10,
left: horizontalMode ? "3%" : closeInfo ? "2.5%" :"20%",
zIndex: 10,
background: theme.secondary,
"&:hover": {
background: theme.secondaryAccent,
borderRadius: 100,
cursor: 'pointer',
}
})
}))
@@ -86,9 +86,7 @@ export const useStyles = createAppUseStyles<{
transform: "rotate(90deg)"
}
}),
icon: {
transition: "200ms ease-out"
},
icon: {},
deleteBtn,
children: ({hasChildren}) => ({
flex: 1,
-1
View File
@@ -66,7 +66,6 @@ export const useNodeStyles = createAppUseStyles<{
height: '15px',
width: '15px',
cursor: 'pointer',
transition: "500ms east-out",
}
return {
root: {
-2
View File
@@ -53,7 +53,6 @@ export const useInputWrapperStyles = createAppUseStyles<{
left: labelSize === 'normal' ? '0.75em' : '1em',
top: labelSize === 'normal' ? '0.5em' : '0.25em',
fontWeight: 'bold',
transition: 'all 200ms',
color: theme.primaryAccent,
})
}
@@ -177,7 +176,6 @@ export const useInputBubblesStyles = createAppUseStyles<{}>(theme => ({
backgroundColor: theme.secondary,
color: theme.secondaryAccent,
padding: "3px 7px",
transition: "200ms ease-out",
"&:hover": {
borderRadius: 100,
backgroundColor: Color(theme.primary).set('rgb.g', 150).alpha(0.35).hex(),