advanced icon

This commit is contained in:
anovazzi1 2023-04-13 00:47:55 -03:00
commit ba271ff85f
2 changed files with 30 additions and 25 deletions

View file

@ -1,4 +1,4 @@
import { TrashIcon } from "@heroicons/react/24/outline"; import { Cog6ToothIcon, TrashIcon } from "@heroicons/react/24/outline";
import { import {
classNames, classNames,
nodeColors, nodeColors,
@ -23,7 +23,7 @@ export default function GenericNode({
const { setErrorData } = useContext(alertContext); const { setErrorData } = useContext(alertContext);
const showError = useRef(true); const showError = useRef(true);
const { types, deleteNode } = useContext(typesContext); const { types, deleteNode } = useContext(typesContext);
const {openPopUp} = useContext(PopUpContext) const { openPopUp } = useContext(PopUpContext);
const Icon = nodeIcons[types[data.type]]; const Icon = nodeIcons[types[data.type]];
if (!Icon) { if (!Icon) {
if (showError.current) { if (showError.current) {
@ -54,17 +54,32 @@ export default function GenericNode({
/> />
<div className="truncate">{data.type}</div> <div className="truncate">{data.type}</div>
</div> </div>
<button <div className="flex gap-3">
onClick={() => { <button
deleteNode(data.id); onClick={(event) => {
}} event.preventDefault();
> openPopUp(<NodeModal data={data} />);
<TrashIcon className="w-6 h-6 hover:text-red-500 dark:text-gray-500 dark:hover:text-red-500"></TrashIcon> }}
</button> >
<Cog6ToothIcon
className={classNames(
Object.keys(data.node.template).length < 1 ? "hidden" : "",
"w-6 h-6 dark:text-gray-500 hover:animate-spin"
)}
></Cog6ToothIcon>
</button>
<button
onClick={() => {
deleteNode(data.id);
}}
>
<TrashIcon className="w-6 h-6 hover:text-red-500 dark:text-gray-500 dark:hover:text-red-500"></TrashIcon>
</button>
</div>
</div> </div>
<div className="w-full h-full py-5"> <div className="w-full h-full py-5">
<div className="w-full text-gray-500 px-5 text-sm"> <div className="w-full text-gray-500 px-5 pb-3 text-sm">
{data.node.description} {data.node.description}
</div> </div>
@ -73,7 +88,7 @@ export default function GenericNode({
.filter((t) => t.charAt(0) !== "_") .filter((t) => t.charAt(0) !== "_")
.map((t: string, idx) => ( .map((t: string, idx) => (
<div key={idx}> <div key={idx}>
{idx === 0 ? ( {/* {idx === 0 ? (
<div <div
className={classNames( className={classNames(
"px-5 py-2 mt-2 dark:text-white text-center", "px-5 py-2 mt-2 dark:text-white text-center",
@ -89,7 +104,7 @@ export default function GenericNode({
</div> </div>
) : ( ) : (
<></> <></>
)} )} */}
{data.node.template[t].show ? ( {data.node.template[t].show ? (
<ParameterComponent <ParameterComponent
data={data} data={data}
@ -127,20 +142,10 @@ export default function GenericNode({
)} )}
> >
{" "} {" "}
<button
onClick={(event) => {
event.preventDefault();
openPopUp(<NodeModal data={data}/>)
}}
className="hover:text-blue-500"
>
{" "}
show advanced{" "}
</button>
</div> </div>
<div className="px-5 py-2 mt-2 dark:text-white text-center"> {/* <div className="px-5 py-2 mt-2 dark:text-white text-center">
Output Output
</div> </div> */}
<ParameterComponent <ParameterComponent
data={data} data={data}
color={nodeColors[types[data.type]] ?? nodeColors.unknown} color={nodeColors[types[data.type]] ?? nodeColors.unknown}

View file

@ -127,7 +127,7 @@ export default function NodeModal({ data }: { data: NodeDataType }) {
setModalOpen(false); setModalOpen(false);
}} }}
> >
Finish editing Done
</button> </button>
</div> </div>
</div> </div>