From 3cfb8151eb08fffee53cbb2534a7229a78fc4b7c Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Thu, 16 Dec 2021 17:19:59 -0500 Subject: [PATCH] show hide metadata dim --- .../AutomationEditor/AutoInfoBox.tsx | 7 ++- .../src/components/AutomationEditor/index.tsx | 20 +++++-- .../src/components/AutomationEditor/styles.ts | 33 +++++++--- .../src/components/ConditionEditor/style.ts | 4 +- webapp/src/components/DAGSvgs/styles.ts | 1 - webapp/src/components/Inputs/styles.ts | 2 - webapp/src/styles/root.css | 60 ++++++++++--------- 7 files changed, 78 insertions(+), 49 deletions(-) diff --git a/webapp/src/components/AutomationEditor/AutoInfoBox.tsx b/webapp/src/components/AutomationEditor/AutoInfoBox.tsx index 1521be8..7ea1826 100644 --- a/webapp/src/components/AutomationEditor/AutoInfoBox.tsx +++ b/webapp/src/components/AutomationEditor/AutoInfoBox.tsx @@ -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 = ({ metadata, onUpdate, className, -}: Props) { + children, +}) => { // aliases const onUpdateMetadata = (k: K) => (update: AutomationMetadata[K]) => onUpdate({ @@ -36,5 +38,6 @@ export function AutoInfoBox({ 'restart' ]} /> + {children} } diff --git a/webapp/src/components/AutomationEditor/index.tsx b/webapp/src/components/AutomationEditor/index.tsx index f3bc29d..73dd7bc 100644 --- a/webapp/src/components/AutomationEditor/index.tsx +++ b/webapp/src/components/AutomationEditor/index.tsx @@ -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 = ({ }) => { // 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 = ({ }); // render - return
= 0.75 ? 'row' : 'column' - }}> + return
onUpdate({ ...automation, metadata })} /> + setCloseInfo(!closeInfo)} + title={closeInfo ? "Show Metadata" : "Hide Metadata"} + /> + ({ - 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', + } + }) })) diff --git a/webapp/src/components/ConditionEditor/style.ts b/webapp/src/components/ConditionEditor/style.ts index 9ba960d..b8397f2 100644 --- a/webapp/src/components/ConditionEditor/style.ts +++ b/webapp/src/components/ConditionEditor/style.ts @@ -86,9 +86,7 @@ export const useStyles = createAppUseStyles<{ transform: "rotate(90deg)" } }), - icon: { - transition: "200ms ease-out" - }, + icon: {}, deleteBtn, children: ({hasChildren}) => ({ flex: 1, diff --git a/webapp/src/components/DAGSvgs/styles.ts b/webapp/src/components/DAGSvgs/styles.ts index 917b154..eb050f1 100644 --- a/webapp/src/components/DAGSvgs/styles.ts +++ b/webapp/src/components/DAGSvgs/styles.ts @@ -66,7 +66,6 @@ export const useNodeStyles = createAppUseStyles<{ height: '15px', width: '15px', cursor: 'pointer', - transition: "500ms east-out", } return { root: { diff --git a/webapp/src/components/Inputs/styles.ts b/webapp/src/components/Inputs/styles.ts index 419e00f..441b7c4 100644 --- a/webapp/src/components/Inputs/styles.ts +++ b/webapp/src/components/Inputs/styles.ts @@ -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(), diff --git a/webapp/src/styles/root.css b/webapp/src/styles/root.css index b1fbe28..e5992ac 100644 --- a/webapp/src/styles/root.css +++ b/webapp/src/styles/root.css @@ -1,45 +1,47 @@ - :root { - --primary: #111111; - --secondary: #1c1c1c; - --primaryAccent: #bbbbbb; + --primary : #111111; + --secondary : #1c1c1c; + --primaryAccent : #bbbbbb; --secondaryAccent: #929191; - touch-action: pan-x pan-y; - height: 100%; + touch-action : pan-x pan-y; + height : 100%; } html, body, #root { - margin: 0 !important; - padding: 0 !important; - height: 100vh; - width: 100vw; - overflow: hidden !important; - font-family: Tahoma, Geneva, sans-serif; - display: flex !important; - align-items: center; - justify-items: center; + margin : 0 !important; + padding : 0 !important; + height : 100vh; + width : 100vw; + overflow : hidden !important; + font-family : Tahoma, Geneva, sans-serif; + display : flex !important; + align-items : center; + justify-items: center; } /* width */ ::-webkit-scrollbar { width: 10px; - } - - /* Track */ - ::-webkit-scrollbar-track { +} + +/* Track */ +::-webkit-scrollbar-track { background: var(--secondary); - } - - /* Handle */ - ::-webkit-scrollbar-thumb { +} + +/* Handle */ +::-webkit-scrollbar-thumb { background: var(--secondary-accent); - } - - /* Handle on hover */ - ::-webkit-scrollbar-thumb:hover { +} + +/* Handle on hover */ +::-webkit-scrollbar-thumb:hover { background: var(--primary-accent); - } - +} + +* { + transition: all 200ms ease-out; +}