From c6005b777cba697cf910fbe143157d0a7d3878ec Mon Sep 17 00:00:00 2001 From: "solis.sergioariel@gmail.com" <42455008+SergioAriel@users.noreply.github.com> Date: Tue, 27 Jun 2023 19:09:03 -0300 Subject: [PATCH 1/9] fix struct enum --- .../NewEditor/section/EditInstruction/index.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/components/NewEditor/section/EditInstruction/index.tsx b/ui/components/NewEditor/section/EditInstruction/index.tsx index b2dcd6a..74deee2 100644 --- a/ui/components/NewEditor/section/EditInstruction/index.tsx +++ b/ui/components/NewEditor/section/EditInstruction/index.tsx @@ -254,16 +254,16 @@ const EditInstructions: FC = ({ editingItem, instruction }) => { editProperty={editProperty} addProperty={addProperty} elements={IDL?.[instruction]?.[editingItem]?.type?.variants} - objConfig={[{ name: "name" }, { name: "type", options: type_args }, { name: "index", options: "boolean" }]} - /> - } + objConfig={[{ name: "name" }]} + /> + } { kind === "struct" && } From fcac335faba4eae39524d42366d316eaec383eb4 Mon Sep 17 00:00:00 2001 From: "solis.sergioariel@gmail.com" <42455008+SergioAriel@users.noreply.github.com> Date: Wed, 28 Jun 2023 13:23:46 -0300 Subject: [PATCH 2/9] delete cards, fix overflow --- ui/components/ClassicEditor/Editor/index.tsx | 38 ++++++++- ui/components/ClassicEditor/card/index.tsx | 7 +- ui/components/ClassicEditor/section/index.tsx | 83 ++++++++++--------- ui/components/NewEditor/card/index.tsx | 6 +- ui/components/NewEditor/section/index.tsx | 2 +- ui/pages/index.tsx | 22 ++--- 6 files changed, 101 insertions(+), 57 deletions(-) diff --git a/ui/components/ClassicEditor/Editor/index.tsx b/ui/components/ClassicEditor/Editor/index.tsx index 0fbdacf..74be886 100644 --- a/ui/components/ClassicEditor/Editor/index.tsx +++ b/ui/components/ClassicEditor/Editor/index.tsx @@ -20,38 +20,74 @@ const ClassicEditor: FC = ({ exportData }) => { item: IDL.instructions, setItem: (newItem: any) => { setIDL({ ...IDL, instructions: [...IDL.instructions, newItem] }) }, initExpanded: true, + deleteItem: (index: any) => { + const del = IDL.instructions.toSpliced(index, 1) + setIDL({ + ...IDL, + instructions: del + }) + } }, { name: "Accounts", item: IDL.accounts, setItem: (newItem: any) => { setIDL({ ...IDL, accounts: [...IDL.accounts, newItem] }) }, initExpanded: false, + deleteItem: (index: any) => { + const del = IDL.accounts.toSpliced(index, 1) + setIDL({ + ...IDL, + accounts: del + }) + } }, { name: "Types", item: IDL.types, setItem: (newItem: any) => { setIDL({ ...IDL, types: [...IDL.types, newItem] }) }, initExpanded: false, + deleteItem: (index: any) => { + const del = IDL.types.toSpliced(index, 1) + setIDL({ + ...IDL, + types: del + }) + } }, { name: "Events", item: IDL.events, setItem: (newItem: any) => { setIDL({ ...IDL, events: [...IDL.events, newItem] }) }, initExpanded: false, + deleteItem: (index: any) => { + const del = IDL.events.toSpliced(index, 1) + setIDL({ + ...IDL, + events: del + }) + } }, { name: "Errors", item: IDL.errors, setItem: (newItem: any) => { setIDL({ ...IDL, errors: [...IDL.errors, newItem] }) }, initExpanded: false, + deleteItem: (index: any) => { + const del = IDL.errors.toSpliced(index, 1) + setIDL({ + ...IDL, + errors: del + }) + } }, - ].map(({ item, setItem, name, initExpanded }) => ( + ].map(({ item, setItem, name, initExpanded, deleteItem }) => (
))} - {isModalOpen && ( -
- setNewIntructionName(e.target.value)} - className="p-5 mb-5 text-center bg-black rounded-md ring-2 ring-green-400 text-white" - /> -
- - + { + isModalOpen && ( +
+ setNewIntructionName(e.target.value)} + className="p-5 mb-5 text-center bg-black rounded-md ring-2 ring-green-400 text-white" + /> +
+ + +
-
- )} + ) + }
); }; diff --git a/ui/components/NewEditor/card/index.tsx b/ui/components/NewEditor/card/index.tsx index 8246c72..97ffcd3 100644 --- a/ui/components/NewEditor/card/index.tsx +++ b/ui/components/NewEditor/card/index.tsx @@ -1,10 +1,10 @@ import { FC, useEffect, useRef, useState } from "react"; -import { TrashIcon, CheckIcon } from "@heroicons/react/24/solid" +import { TrashIcon } from "@heroicons/react/24/solid" import { useIDL } from "@/context/IDL"; -export const Card: FC = ({ name, onClick, filter, instruction, index }) => { +export const Card: FC = ({ name, onClick, deleteItem, instruction, index }) => { const { IDL, setIDL } = useIDL() const [showOptions, setShowOptions] = useState(false) const [newName, setNewName] = useState(name) @@ -49,7 +49,7 @@ export const Card: FC = ({ name, onClick, filter, instruction, index }) => showOptions &&
diff --git a/ui/components/NewEditor/section/index.tsx b/ui/components/NewEditor/section/index.tsx index f4da2c5..54304cb 100644 --- a/ui/components/NewEditor/section/index.tsx +++ b/ui/components/NewEditor/section/index.tsx @@ -57,7 +57,7 @@ export const Section: FC = ({ instruction }) => { name={name} instruction={instruction} index={index} - filter={() => { + deleteItem={() => { const del = IDL[instruction].toSpliced(index, 1) setIDL({ ...IDL, diff --git a/ui/pages/index.tsx b/ui/pages/index.tsx index a307eaf..212f1e7 100644 --- a/ui/pages/index.tsx +++ b/ui/pages/index.tsx @@ -152,12 +152,12 @@ export default function Home() {
{/* Your Company */} + height={25} + width={25} + className="h-8 w-auto" + src="https://tailwindui.com/img/logos/mark.svg?color=indigo&shade=600" + alt="Your Company" + /> */}