-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
186 additions
and
46 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
flow-editor/src/visual-node-editor/AddMainPinModal/AddMainPinModal.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.-add-main-pin-modal { | ||
color: pink; | ||
} |
81 changes: 81 additions & 0 deletions
81
flow-editor/src/visual-node-editor/AddMainPinModal/AddMainPinModal.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { | ||
Button, | ||
Callout, | ||
Classes, | ||
Dialog, | ||
FormGroup, | ||
Intent, | ||
} from "@blueprintjs/core"; | ||
import { InfoSign } from "@blueprintjs/icons"; | ||
import { PinType } from "@flyde/core"; | ||
import classNames from "classnames"; | ||
import React, { useCallback, useMemo } from "react"; | ||
|
||
export interface AddMainPinModalProps { | ||
type: PinType; | ||
onAdd: (type: PinType, name: string) => void; | ||
onClose: () => void; | ||
} | ||
|
||
export const AddMainPinModal: React.FC<AddMainPinModalProps> = ({ | ||
type, | ||
onAdd, | ||
onClose, | ||
}) => { | ||
const [name, setName] = React.useState(""); | ||
|
||
const _onAdd = useCallback(() => { | ||
onAdd(type, name); | ||
}, [name, onAdd, type]); | ||
|
||
const explanation = useMemo(() => { | ||
const suffix = ( | ||
<> | ||
Learn how to connect this flow with your casebase{" "} | ||
<a href="https://www.flyde.dev/docs/integrate-flows">here</a> | ||
</> | ||
); | ||
switch (type) { | ||
case "input": { | ||
return ( | ||
<Callout intent="primary" icon={<InfoSign />}> | ||
Main inputs are Flyde's way of receiving external data. | ||
<div>{suffix}</div> | ||
</Callout> | ||
); | ||
} | ||
case "output": { | ||
<Callout intent="primary" icon={<InfoSign />}> | ||
Main outputs are Flyde's way of emitting values externally. | ||
<div>{suffix}</div> | ||
</Callout>; | ||
} | ||
} | ||
}, [type]); | ||
|
||
return ( | ||
<Dialog isOpen={true} onClose={onClose} className="add-main-pin-modal"> | ||
<main className={classNames(Classes.DIALOG_BODY)} tabIndex={0}> | ||
<FormGroup> | ||
<label className={Classes.LABEL}>New main {type} name:</label> | ||
<input | ||
className={Classes.INPUT} | ||
type="text" | ||
placeholder="Enter name" | ||
value={name} | ||
onChange={(e) => setName(e.target.value)} | ||
/> | ||
</FormGroup> | ||
{explanation} | ||
</main> | ||
<div className={Classes.DIALOG_FOOTER}> | ||
<div className={Classes.DIALOG_FOOTER_ACTIONS}> | ||
<Button onClick={onClose}>Close</Button> | ||
<Button onClick={_onAdd} intent={Intent.PRIMARY}> | ||
Add | ||
</Button> | ||
</div> | ||
</div> | ||
</Dialog> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./AddMainPinModal"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
gap: 6px; | ||
font-size: 10px; | ||
z-index: 1; | ||
user-select: none; | ||
|
||
button { | ||
font-size: 10px; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters