From 1a60e186446270530a8d5c6b830b0daa5882f85b Mon Sep 17 00:00:00 2001 From: Jeesun Kim Date: Fri, 12 Apr 2024 11:03:40 -0700 Subject: [PATCH] clean up --- src/app/(sidebar)/transaction/sign/page.tsx | 12 +++++------- src/components/FormElements/TextPicker.tsx | 4 ++-- src/components/FormElements/XdrPicker.tsx | 6 +++--- src/types/types.ts | 10 ---------- 4 files changed, 10 insertions(+), 22 deletions(-) diff --git a/src/app/(sidebar)/transaction/sign/page.tsx b/src/app/(sidebar)/transaction/sign/page.tsx index b68ed329..24430306 100644 --- a/src/app/(sidebar)/transaction/sign/page.tsx +++ b/src/app/(sidebar)/transaction/sign/page.tsx @@ -27,9 +27,7 @@ export default function SignTransaction() { const [tx, setTx] = useState( undefined, ); - const [isTxImported, setIsTxImported] = useState( - undefined, - ); + const [isTxImported, setIsTxImported] = useState(false); const onChange = (value: string) => { setTxErrMsg(""); @@ -42,7 +40,7 @@ export default function SignTransaction() { if (validatedXDR.result === "success") { setIsTxValid(true); setTxSuccessMsg(validatedXDR.message); - } else if (validatedXDR.result === "error") { + } else { setIsTxValid(false); setTxErrMsg(validatedXDR.message); } @@ -56,11 +54,11 @@ export default function SignTransaction() { setTx(transaction); } catch (e) { setIsTxImported(false); - setTxErrMsg("Unable to parse input XDR into Transaction Envelope"); + setTxErrMsg("Unable to import a transaction envelope"); } }; - const rendeDefaultView = () => { + const rendeImportView = () => { return ( <> @@ -194,7 +192,7 @@ export default function SignTransaction() { {isTxImported ? "Transaction Overview" : "Sign Transaction"} - {isTxValid && tx ? renderOverviewView() : rendeDefaultView()} + {isTxValid && tx ? renderOverviewView() : rendeImportView()} ); } diff --git a/src/components/FormElements/TextPicker.tsx b/src/components/FormElements/TextPicker.tsx index d0033fbc..7e90cba9 100644 --- a/src/components/FormElements/TextPicker.tsx +++ b/src/components/FormElements/TextPicker.tsx @@ -20,8 +20,8 @@ export const TextPicker = ({ label, value, error, - readOnly, onChange, + readOnly, ...props }: TextPickerProps) => ( ); diff --git a/src/components/FormElements/XdrPicker.tsx b/src/components/FormElements/XdrPicker.tsx index 6de52a4a..da06dd4c 100644 --- a/src/components/FormElements/XdrPicker.tsx +++ b/src/components/FormElements/XdrPicker.tsx @@ -10,8 +10,8 @@ interface XdrPickerProps extends Omit { placeholder?: string; error?: string | undefined; note?: string | React.ReactNode; - readOnly?: boolean; onChange?: (e: React.ChangeEvent) => void; + readOnly?: boolean; } export const XdrPicker = ({ @@ -22,8 +22,8 @@ export const XdrPicker = ({ value, error, note, - readOnly, onChange, + readOnly, ...props }: XdrPickerProps) => (