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>
|
||||
}
|
||||
Reference in new issue
Block a user