adjusting dims for info box
This commit is contained in:
1 parent
ccca0edb65
commit
12d086a5c0
6 files changed
+81
-68
No files matched your search
@@ -19,24 +19,20 @@ export default function AutoInfoBox({
|
||||
})
|
||||
|
||||
// render
|
||||
return <g className="automation-dag-title">
|
||||
<foreignObject x={0} y={0} height={125} width={100}>
|
||||
<div>
|
||||
<InputText label="ID" value={metadata.id} onChange={onUpdateMetadata('id')} />
|
||||
<InputText label="Name" value={metadata.alias} onChange={onUpdateMetadata('alias')} />
|
||||
<InputTextArea label="Description" value={metadata.description} onChange={onUpdateMetadata('description')} />
|
||||
<InputList
|
||||
label="Mode"
|
||||
current={metadata.mode}
|
||||
onChange={onUpdateMetadata('mode')}
|
||||
options={[
|
||||
'parallel',
|
||||
'single',
|
||||
'queued',
|
||||
'restart'
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</foreignObject>
|
||||
</g>
|
||||
return <div className="automation-editor-info-box">
|
||||
<InputText label="ID" value={metadata.id} onChange={onUpdateMetadata('id')} />
|
||||
<InputText label="Name" value={metadata.alias} onChange={onUpdateMetadata('alias')} />
|
||||
<InputTextArea label="Description" value={metadata.description} onChange={onUpdateMetadata('description')} />
|
||||
<InputList
|
||||
label="Mode"
|
||||
current={metadata.mode}
|
||||
onChange={onUpdateMetadata('mode')}
|
||||
options={[
|
||||
'parallel',
|
||||
'single',
|
||||
'queued',
|
||||
'restart'
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AutomationData } from "~/automations/types";
|
||||
import useWindowSize from "~/utils/useWindowSize";
|
||||
import AutoInfoBox from "./AutoInfoBox";
|
||||
|
||||
interface Props {
|
||||
@@ -10,32 +11,38 @@ export default function AutomationEditor({
|
||||
onUpdate,
|
||||
}: Props) {
|
||||
|
||||
const graphWidth = 300;
|
||||
const graphHeight = 300;
|
||||
const {ratioWbh} = useWindowSize();
|
||||
|
||||
return <div className="automation-dag" >
|
||||
<svg
|
||||
viewBox={[0,0,graphWidth, graphHeight].join(" ")}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<defs>
|
||||
<marker id="arrow" viewBox="0 0 10 10" refX="10" refY="5"
|
||||
markerWidth="6" markerHeight="6"
|
||||
orient="auto-start-reverse">
|
||||
<path d="M 0 0 L 10 5 L 0 10 z" />
|
||||
</marker>
|
||||
</defs>
|
||||
const graphHeight = 300;
|
||||
const graphWidth = Math.round(graphHeight * ratioWbh);
|
||||
console.log({ratioWbh, graphHeight, graphWidth})
|
||||
return <div className="automation-editor" style={{
|
||||
flexDirection: ratioWbh >= 0.75 ? 'row' : 'column'
|
||||
}}>
|
||||
<AutoInfoBox
|
||||
metadata={automation.metadata}
|
||||
onUpdate={metadata => onUpdate({...automation, metadata})}
|
||||
/>
|
||||
{/* <rect x="1" y="1" height={GRAPH_HEIGHT-1} width={GRAPH_WIDTH} stroke="white" fill="none"/> */}
|
||||
{/* <g className="automation-dag-edges">
|
||||
|
||||
</g>
|
||||
<g className="automation-dag-nodes">
|
||||
|
||||
</g> */}
|
||||
</svg>
|
||||
<div className="automation-editor-dag">
|
||||
<svg
|
||||
viewBox={[0,0,graphWidth, graphHeight].join(" ")}
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<defs>
|
||||
<marker id="arrow" viewBox="0 0 10 10" refX="10" refY="5"
|
||||
markerWidth="6" markerHeight="6"
|
||||
orient="auto-start-reverse">
|
||||
<path d="M 0 0 L 10 5 L 0 10 z" />
|
||||
</marker>
|
||||
</defs>
|
||||
{/* <rect x="1" y="1" height={GRAPH_HEIGHT-1} width={GRAPH_WIDTH} stroke="white" fill="none"/> */}
|
||||
{/* <g className="automation-dag-edges">
|
||||
|
||||
</g>
|
||||
<g className="automation-dag-nodes">
|
||||
|
||||
</g> */}
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -103,7 +103,7 @@ textarea {
|
||||
@extend button;
|
||||
cursor: text;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
width: 98%;
|
||||
height: 100%;
|
||||
}
|
||||
span.checkbox {
|
||||
|
||||
@@ -1,34 +1,44 @@
|
||||
.automation-dag {
|
||||
.automation-editor {
|
||||
height: 99%;
|
||||
width: 99%;
|
||||
border: 1px solid $secondary-accent;
|
||||
font-size: 0.5em;
|
||||
color: $primary-accent;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
svg {
|
||||
height: 100%;
|
||||
&-dag {
|
||||
border: 1px solid $secondary-accent;
|
||||
width: 100%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
svg {
|
||||
height: 99%;
|
||||
width: 99%;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&-title {
|
||||
.input-wrapper {
|
||||
max-height: 100%;
|
||||
max-width: 100%;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
&-info-box {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: flex-start;
|
||||
overflow: auto;
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
}
|
||||
input,
|
||||
textarea,
|
||||
div {
|
||||
font-size: 1em;
|
||||
resize: none;
|
||||
}
|
||||
}
|
||||
// .input-wrapper {
|
||||
// max-height: 100%;
|
||||
// max-width: 100%;
|
||||
// height: 100%;
|
||||
// width: 100%;
|
||||
|
||||
// * {
|
||||
// margin: 0;
|
||||
// }
|
||||
// input,
|
||||
// textarea,
|
||||
// div {
|
||||
// font-size: 1em;
|
||||
// resize: none;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
.edge {
|
||||
stroke: $secondary-accent;
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
input {
|
||||
padding-top: 0.65em;
|
||||
}
|
||||
textarea {
|
||||
max-width: 94%;
|
||||
}
|
||||
// .input-view {
|
||||
// @extend input;
|
||||
// cursor: default;
|
||||
|
||||
@@ -4,6 +4,7 @@ import { useState, useEffect } from "react";
|
||||
interface Size {
|
||||
width: number;
|
||||
height: number;
|
||||
ratioWbh: number;
|
||||
}
|
||||
|
||||
// Hook
|
||||
@@ -13,6 +14,7 @@ export default function useWindowSize(): Size {
|
||||
const [windowSize, setWindowSize] = useState<Size>({
|
||||
width: window.innerWidth,
|
||||
height: window.innerHeight,
|
||||
ratioWbh: window.innerWidth / window.innerHeight,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -22,6 +24,7 @@ export default function useWindowSize(): Size {
|
||||
setWindowSize({
|
||||
width: window.innerWidth,
|
||||
height: window.innerHeight,
|
||||
ratioWbh: window.innerWidth / window.innerHeight,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user