Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
070dc7c871 | ||
|
|
3d70f04e60 | ||
|
|
cf29d9d61c | ||
|
|
2245fd556b | ||
|
|
f50f22190e |
No files matched your search
+3
-2
@@ -1,4 +1,5 @@
|
|||||||
# Changelog -- v0.1.5
|
# Changelog -- v0.1.6
|
||||||
|
|
||||||
|
- Improved mobile mode
|
||||||
- Fixed up arrow styles due to typos
|
- Fixed up arrow styles due to typos
|
||||||
- Added selection color
|
- Added selection color
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
name: Shortumation
|
name: Shortumation
|
||||||
version: 0.1.5
|
version: 0.1.6
|
||||||
slug: shortumation
|
slug: shortumation
|
||||||
image: asosnovsky/shortumation-{arch}
|
image: asosnovsky/shortumation-{arch}
|
||||||
url: "https://github.com/asosnovsky/Shortumation"
|
url: "https://github.com/asosnovsky/Shortumation"
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { useAPIService } from './core';
|
|||||||
import { useMockAPI } from "./mock";
|
import { useMockAPI } from "./mock";
|
||||||
|
|
||||||
const locationPrefixWeb = window.location.pathname.match(/(.+)\/web/i);
|
const locationPrefixWeb = window.location.pathname.match(/(.+)\/web/i);
|
||||||
console.log(process.env)
|
|
||||||
|
|
||||||
export const useConnectedApiService = () => useAPIService(
|
export const useConnectedApiService = () => useAPIService(
|
||||||
makeAutomationAPI(makeRemoteAPI(
|
makeAutomationAPI(makeRemoteAPI(
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/* none-hidden */
|
||||||
|
.automation-list--root.mobile {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.automation-list--root.mobile>.automation-list--list {
|
||||||
|
max-width: 100vw;
|
||||||
|
min-height: 100vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
.automation-list--root.mobile .automation-editor {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.automation-list--root.mobile .automation-list--list-hide {
|
||||||
|
transform: rotate(90deg);
|
||||||
|
left: 1.25em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.automation-list--root.mobile .automation-editor--info-box {
|
||||||
|
min-width: 100vw;
|
||||||
|
min-height: calc(100vh - 5em);
|
||||||
|
max-width: 100vw;
|
||||||
|
max-height: calc(100vh - 5em);
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.automation-list--root.mobile .automation-editor--info-box-inner {
|
||||||
|
margin-top: 2.5em;
|
||||||
|
padding-left: 0.5em;
|
||||||
|
padding-right: 0.5em;
|
||||||
|
margin-bottom: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.automation-list--root.mobile .automation-editor--info-box--icon {
|
||||||
|
left: 1.25em;
|
||||||
|
bottom: 0em;
|
||||||
|
background-color: var(--primary);
|
||||||
|
transform: rotate(90deg);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* list hide */
|
||||||
|
.automation-list--root.mobile .automation-list--list.hide {
|
||||||
|
width: 100vw;
|
||||||
|
min-height: 0;
|
||||||
|
max-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.automation-list--root.mobile .automation-list--list.hide .automation-list--list-hide {
|
||||||
|
transform: rotate(270deg);
|
||||||
|
position: fixed;
|
||||||
|
top: 0.75em;
|
||||||
|
z-index: 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* info box hide */
|
||||||
|
.automation-list--root.mobile .automation-editor--info-box.hide {
|
||||||
|
width: 100vw;
|
||||||
|
min-height: 0;
|
||||||
|
max-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.automation-list--root.mobile .automation-editor--info-box.hide .automation-editor--info-box--icon {
|
||||||
|
transform: rotate(270deg);
|
||||||
|
position: fixed;
|
||||||
|
top: 0.75em;
|
||||||
|
background-color: var(--green-opaque);
|
||||||
|
z-index: 30;
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import "./index.css";
|
import "./index.css";
|
||||||
|
import "./index.mobile.css";
|
||||||
import { AutomationEditor } from "components/AutomationEditor";
|
import { AutomationEditor } from "components/AutomationEditor";
|
||||||
import { FC, useState } from "react";
|
import { FC, useState } from "react";
|
||||||
import { AutomationData } from "types/automations";
|
import { AutomationData } from "types/automations";
|
||||||
@@ -8,6 +9,7 @@ import { ButtonIcon } from "components/Icons/ButtonIcons";
|
|||||||
import { ApiService } from "apiService/core";
|
import { ApiService } from "apiService/core";
|
||||||
import { AutomationListBox } from "./AutomationListBox";
|
import { AutomationListBox } from "./AutomationListBox";
|
||||||
import { DAGAutomationFlowDims } from 'components/DAGFlow/types';
|
import { DAGAutomationFlowDims } from 'components/DAGFlow/types';
|
||||||
|
import useWindowSize from "utils/useWindowSize";
|
||||||
|
|
||||||
|
|
||||||
interface AutomationListParams {
|
interface AutomationListParams {
|
||||||
@@ -29,19 +31,24 @@ export const AutomationList: FC<AutomationListParams> = ({
|
|||||||
// state
|
// state
|
||||||
const [hideList, setHideList] = useState(false);
|
const [hideList, setHideList] = useState(false);
|
||||||
const [current, setCurrent] = useState(0);
|
const [current, setCurrent] = useState(0);
|
||||||
|
const { isMobile } = useWindowSize();
|
||||||
// alias
|
// alias
|
||||||
const currentAuto = automations.length > 0 ? automations[current] : null;
|
const currentAuto = automations.length > 0 ? automations[current] : null;
|
||||||
const automationListListCls = "automation-list--list" + (hideList ? " hide" : " show")
|
|
||||||
// render
|
// render
|
||||||
return <div className="automation-list--root">
|
return <div className={["automation-list--root", isMobile ? 'mobile' : ''].join(' ')}>
|
||||||
<div className={automationListListCls}>
|
<div className={["automation-list--list", hideList ? "hide" : "show"].join(' ')}>
|
||||||
<AutomationListBox
|
<AutomationListBox
|
||||||
automations={automations}
|
automations={automations}
|
||||||
onAdd={() => {
|
onAdd={() => {
|
||||||
onAdd(defaultAutomation(`shortu-${automations.length}`));
|
onAdd(defaultAutomation(`shortu-${automations.length}`));
|
||||||
setCurrent(automations.length)
|
setCurrent(automations.length)
|
||||||
}}
|
}}
|
||||||
onSelectAutomation={setCurrent}
|
onSelectAutomation={i => {
|
||||||
|
setCurrent(i);
|
||||||
|
if (isMobile) {
|
||||||
|
setHideList(true)
|
||||||
|
}
|
||||||
|
}}
|
||||||
selected={current}
|
selected={current}
|
||||||
onRemove={onRemove}
|
onRemove={onRemove}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -46,9 +46,7 @@ export const DAGNode: FC<{ data: DAGNodeProps }> = ({
|
|||||||
{label}
|
{label}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div className={classes.rightEdge} onClick={() => {
|
<div className={classes.rightEdge} onClick={onEditClick}>
|
||||||
console.log('editing me', label, onEditClick, onEditClick())
|
|
||||||
}}>
|
|
||||||
<button className={classes.buttonEdit}>
|
<button className={classes.buttonEdit}>
|
||||||
<PencilIcon size={1.1} color={theme.green} />
|
<PencilIcon size={1.1} color={theme.green} />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ const Template: ComponentStory<typeof DAGAutomationFlow> = args => {
|
|||||||
{...args}
|
{...args}
|
||||||
{...state}
|
{...state}
|
||||||
onTriggerUpdate={trigger => {
|
onTriggerUpdate={trigger => {
|
||||||
console.log({ trigger })
|
|
||||||
setState({ ...state, trigger })
|
setState({ ...state, trigger })
|
||||||
}}
|
}}
|
||||||
onSequenceUpdate={sequence => setState({ ...state, sequence })}
|
onSequenceUpdate={sequence => setState({ ...state, sequence })}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { FC, useState } from "react";
|
import { FC, useState } from "react";
|
||||||
|
|
||||||
import ReactFlow, { MiniMap, Controls } from 'react-flow-renderer';
|
import ReactFlow, { Controls } from 'react-flow-renderer';
|
||||||
import { AutomationSequenceNode } from "types/automations";
|
import { AutomationSequenceNode } from "types/automations";
|
||||||
import { AutomationTrigger } from 'types/automations/triggers';
|
import { AutomationTrigger } from 'types/automations/triggers';
|
||||||
import { triggerToFlow } from "./triggerConvertor";
|
import { triggerToFlow } from "./triggerConvertor";
|
||||||
@@ -127,7 +127,6 @@ export const DAGAutomationFlow: FC<Props> = ({
|
|||||||
nodesDraggable={false}
|
nodesDraggable={false}
|
||||||
{...flowData}
|
{...flowData}
|
||||||
>
|
>
|
||||||
<MiniMap />
|
|
||||||
<Controls />
|
<Controls />
|
||||||
</ReactFlow>
|
</ReactFlow>
|
||||||
</>;
|
</>;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ const mockSequenceUpdater = (defaultState: AutomationSequenceNode[] = []) => {
|
|||||||
state,
|
state,
|
||||||
s => {
|
s => {
|
||||||
state = s
|
state = s
|
||||||
console.log(state, s)
|
|
||||||
},
|
},
|
||||||
ms => modalStates.push(ms)
|
ms => modalStates.push(ms)
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ export const InputList: FC<Props<any>> = ({
|
|||||||
{...selattr} value={current}
|
{...selattr} value={current}
|
||||||
onChange={e => {
|
onChange={e => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
console.log(e.currentTarget.id)
|
|
||||||
console.log(e.currentTarget.value)
|
|
||||||
console.log(e.currentTarget.innerHTML)
|
|
||||||
if (e.currentTarget.id === 'invalid') {
|
if (e.currentTarget.id === 'invalid') {
|
||||||
onChange(options[0])
|
onChange(options[0])
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ export default function InputYaml<T>({
|
|||||||
});
|
});
|
||||||
const setText = (t: string) => {
|
const setText = (t: string) => {
|
||||||
try {
|
try {
|
||||||
console.log(yaml.dump(yaml.load(t)));
|
|
||||||
setState({ text: t, error: undefined })
|
setState({ text: t, error: undefined })
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
setState({ text: t, error: "! Invalid Yaml !" })
|
setState({ text: t, error: "! Invalid Yaml !" })
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ export const InAModal: ComponentStory<typeof MultiNodeEditor> = props => {
|
|||||||
|
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const [state, setState] = useState(props.sequence);
|
const [state, setState] = useState(props.sequence);
|
||||||
console.log({ state })
|
|
||||||
return <div className="page">
|
return <div className="page">
|
||||||
<Button onClick={() => setOpen(!open)}>Open Editor</Button>
|
<Button onClick={() => setOpen(!open)}>Open Editor</Button>
|
||||||
<Modal open={open}>
|
<Modal open={open}>
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ export const useMultiNodeEditorState = (props: MultiNodeEditorProps) => {
|
|||||||
internalNodeModified,
|
internalNodeModified,
|
||||||
} = state;
|
} = state;
|
||||||
const setState = (a: MultiNodeEditorInternalState) => {
|
const setState = (a: MultiNodeEditorInternalState) => {
|
||||||
console.log('setting state', a)
|
|
||||||
_setState(a)
|
_setState(a)
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
import { FC } from "react";
|
||||||
|
import useWindowSize from "utils/useWindowSize";
|
||||||
|
|
||||||
|
|
||||||
|
export const SizeModal: FC = () => {
|
||||||
|
const size = useWindowSize();
|
||||||
|
|
||||||
|
return <span style={{
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
left: 0,
|
||||||
|
background: 'white',
|
||||||
|
zIndex: 10,
|
||||||
|
}}>{size.width}/{size.height}={size.ratioWbh} ({size.isMobile ? 'm' : 'd'})</span>
|
||||||
|
}
|
||||||
@@ -3,7 +3,6 @@ import { AutomationTrigger } from 'types/automations/triggers';
|
|||||||
|
|
||||||
|
|
||||||
export const getNodeType = (node: AutomationNode): AutomationNodeTypes => {
|
export const getNodeType = (node: AutomationNode): AutomationNodeTypes => {
|
||||||
console.log({ node })
|
|
||||||
if ('condition' in node) {
|
if ('condition' in node) {
|
||||||
return 'condition'
|
return 'condition'
|
||||||
} else if ('platform' in node) {
|
} else if ('platform' in node) {
|
||||||
|
|||||||
@@ -5,27 +5,24 @@ interface Size {
|
|||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
ratioWbh: number;
|
ratioWbh: number;
|
||||||
|
isMobile: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hook
|
// Hook
|
||||||
export default function useWindowSize(): Size {
|
export default function useWindowSize(mobileRatioInd: number = 0.8): Size {
|
||||||
|
|
||||||
// Initialize state with undefined width/height so server and client renders match
|
// Initialize state with undefined width/height so server and client renders match
|
||||||
// Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/
|
// Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/
|
||||||
const [windowSize, setWindowSize] = useState<Size>({
|
const [windowSize, setWindowSize] = useState<Size>(makeUpdate(window, mobileRatioInd));
|
||||||
width: window.innerWidth,
|
|
||||||
height: window.innerHeight,
|
// alias
|
||||||
ratioWbh: window.innerWidth / window.innerHeight,
|
|
||||||
});
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Handler to call on window resize
|
// Handler to call on window resize
|
||||||
function handleResize() {
|
function handleResize() {
|
||||||
// Set window width/height to state
|
// Set window width/height to state
|
||||||
setWindowSize({
|
setWindowSize(makeUpdate(window, mobileRatioInd));
|
||||||
width: window.innerWidth,
|
|
||||||
height: window.innerHeight,
|
|
||||||
ratioWbh: window.innerWidth / window.innerHeight,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add event listener
|
// Add event listener
|
||||||
@@ -39,4 +36,11 @@ export default function useWindowSize(): Size {
|
|||||||
}, []); // Empty array ensures that effect is only run on mount
|
}, []); // Empty array ensures that effect is only run on mount
|
||||||
|
|
||||||
return windowSize;
|
return windowSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const makeUpdate = (w: Window, mobileRatioInd: number): Size => ({
|
||||||
|
width: w.innerWidth,
|
||||||
|
height: w.innerHeight,
|
||||||
|
ratioWbh: w.innerWidth / w.innerHeight,
|
||||||
|
isMobile: w.innerWidth / w.innerHeight <= mobileRatioInd,
|
||||||
|
})
|
||||||
Reference in new issue
Block a user