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 InputList from "components/Inputs/InputList";
import InputText from "components/Inputs/InputText"; import InputText from "components/Inputs/InputText";
import InputTextArea from "components/Inputs/InputTextArea"; import InputTextArea from "components/Inputs/InputTextArea";
import { FC } from "react";
interface Props { interface Props {
className: string; className: string;
metadata: AutomationMetadata; metadata: AutomationMetadata;
onUpdate: (m: AutomationMetadata) => void; onUpdate: (m: AutomationMetadata) => void;
} }
export function AutoInfoBox({ export const AutoInfoBox: FC<Props> = ({
metadata, metadata,
onUpdate, onUpdate,
className, className,
}: Props) { children,
}) => {
// aliases // aliases
const onUpdateMetadata = <K extends keyof AutomationMetadata>(k: K) => (update: AutomationMetadata[K]) => onUpdate({ const onUpdateMetadata = <K extends keyof AutomationMetadata>(k: K) => (update: AutomationMetadata[K]) => onUpdate({
@@ -36,5 +38,6 @@ export function AutoInfoBox({
'restart' 'restart'
]} ]}
/> />
{children}
</div> </div>
} }
@@ -1,6 +1,8 @@
import { DAGBoardElmDims } from "components/DAGSvgs/DAGBoard"; import { DAGBoardElmDims } from "components/DAGSvgs/DAGBoard";
import { InfoIcon } from "components/Icons";
import { Button } from "components/Inputs/Button";
import { SequenceNodes } from "components/SequenceNodes"; import { SequenceNodes } from "components/SequenceNodes";
import { FC } from "react"; import { FC, useState } from "react";
import { AutomationData, AutomationSequenceNode } from "types/automations"; import { AutomationData, AutomationSequenceNode } from "types/automations";
import useWindowSize from "utils/useWindowSize"; import useWindowSize from "utils/useWindowSize";
import { AutoInfoBox } from "./AutoInfoBox"; import { AutoInfoBox } from "./AutoInfoBox";
@@ -19,7 +21,11 @@ export const AutomationEditor: FC<Props> = ({
}) => { }) => {
// state // state
const { ratioWbh } = useWindowSize(); const { ratioWbh } = useWindowSize();
const { classes } = useEditorStyles({}); const [closeInfo, setCloseInfo] = useState(false);
const { classes } = useEditorStyles({
closeInfo,
horizontalMode: ratioWbh < 0.75
});
// alias // alias
const updateSequence = (sequence: AutomationSequenceNode[]) => onUpdate({ const updateSequence = (sequence: AutomationSequenceNode[]) => onUpdate({
@@ -28,14 +34,18 @@ export const AutomationEditor: FC<Props> = ({
}); });
// render // render
return <div className={classes.root} style={{ return <div className={classes.root}>
flexDirection: ratioWbh >= 0.75 ? 'row' : 'column'
}}>
<AutoInfoBox <AutoInfoBox
className={classes.infoBox} className={classes.infoBox}
metadata={automation.metadata} metadata={automation.metadata}
onUpdate={metadata => onUpdate({ ...automation, metadata })} onUpdate={metadata => onUpdate({ ...automation, metadata })}
/> />
<InfoIcon
className={classes.infoIcon}
onClick={() => setCloseInfo(!closeInfo)}
title={closeInfo ? "Show Metadata" : "Hide Metadata"}
/>
<SequenceNodes <SequenceNodes
zoomLevel={1.5} zoomLevel={1.5}
startPoint={[0.5, 0.5]} startPoint={[0.5, 0.5]}
@@ -1,26 +1,45 @@
import { createAppUseStyles } from "styles/theme"; import { createAppUseStyles } from "styles/theme";
export const useEditorStyles = createAppUseStyles(theme => ({ export const useEditorStyles = createAppUseStyles<{
root: { closeInfo: boolean;
horizontalMode: boolean;
}>(theme => ({
root: ({horizontalMode}) => ({
height: '100%', height: '100%',
width: '100%', width: '100%',
color: theme.primaryAccent, color: theme.primaryAccent,
display: 'flex', display: 'flex',
flexDirection: 'row', flexDirection: horizontalMode ? 'column' : 'row',
}, }),
dag: { dag: {
borderWidth: 1, borderWidth: 1,
borderStyle: 'solid', borderStyle: 'solid',
borderColor: theme.secondaryAccent, borderColor: theme.secondaryAccent,
width: '100%', width: '100%',
}, },
infoBox: { infoBox: ({closeInfo}) => ({
width: closeInfo ? 0 : 'auto',
paddingLeft: '10px', paddingLeft: '10px',
paddingRight: '10px', paddingRight: '10px',
display: 'flex', display: closeInfo ? 'none' : 'flex',
flexDirection: 'column', flexDirection: 'column',
justifyContent: 'flex-start', justifyContent: 'flex-start',
overflow: 'auto', 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)" transform: "rotate(90deg)"
} }
}), }),
icon: { icon: {},
transition: "200ms ease-out"
},
deleteBtn, deleteBtn,
children: ({hasChildren}) => ({ children: ({hasChildren}) => ({
flex: 1, flex: 1,
-1
View File
@@ -66,7 +66,6 @@ export const useNodeStyles = createAppUseStyles<{
height: '15px', height: '15px',
width: '15px', width: '15px',
cursor: 'pointer', cursor: 'pointer',
transition: "500ms east-out",
} }
return { return {
root: { root: {
-2
View File
@@ -53,7 +53,6 @@ export const useInputWrapperStyles = createAppUseStyles<{
left: labelSize === 'normal' ? '0.75em' : '1em', left: labelSize === 'normal' ? '0.75em' : '1em',
top: labelSize === 'normal' ? '0.5em' : '0.25em', top: labelSize === 'normal' ? '0.5em' : '0.25em',
fontWeight: 'bold', fontWeight: 'bold',
transition: 'all 200ms',
color: theme.primaryAccent, color: theme.primaryAccent,
}) })
} }
@@ -177,7 +176,6 @@ export const useInputBubblesStyles = createAppUseStyles<{}>(theme => ({
backgroundColor: theme.secondary, backgroundColor: theme.secondary,
color: theme.secondaryAccent, color: theme.secondaryAccent,
padding: "3px 7px", padding: "3px 7px",
transition: "200ms ease-out",
"&:hover": { "&:hover": {
borderRadius: 100, borderRadius: 100,
backgroundColor: Color(theme.primary).set('rgb.g', 150).alpha(0.35).hex(), backgroundColor: Color(theme.primary).set('rgb.g', 150).alpha(0.35).hex(),
+31 -29
View File
@@ -1,45 +1,47 @@
:root { :root {
--primary: #111111; --primary : #111111;
--secondary: #1c1c1c; --secondary : #1c1c1c;
--primaryAccent: #bbbbbb; --primaryAccent : #bbbbbb;
--secondaryAccent: #929191; --secondaryAccent: #929191;
touch-action: pan-x pan-y; touch-action : pan-x pan-y;
height: 100%; height : 100%;
} }
html, html,
body, body,
#root { #root {
margin: 0 !important; margin : 0 !important;
padding: 0 !important; padding : 0 !important;
height: 100vh; height : 100vh;
width: 100vw; width : 100vw;
overflow: hidden !important; overflow : hidden !important;
font-family: Tahoma, Geneva, sans-serif; font-family : Tahoma, Geneva, sans-serif;
display: flex !important; display : flex !important;
align-items: center; align-items : center;
justify-items: center; justify-items: center;
} }
/* width */ /* width */
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 10px; width: 10px;
} }
/* Track */ /* Track */
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background: var(--secondary); background: var(--secondary);
} }
/* Handle */ /* Handle */
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background: var(--secondary-accent); background: var(--secondary-accent);
} }
/* Handle on hover */ /* Handle on hover */
::-webkit-scrollbar-thumb:hover { ::-webkit-scrollbar-thumb:hover {
background: var(--primary-accent); background: var(--primary-accent);
} }
* {
transition: all 200ms ease-out;
}