Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeesun Kim authored and Jeesun Kim committed Apr 12, 2024
1 parent 8f444d9 commit 1a60e18
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 22 deletions.
12 changes: 5 additions & 7 deletions src/app/(sidebar)/transaction/sign/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ export default function SignTransaction() {
const [tx, setTx] = useState<FeeBumpTransaction | Transaction | undefined>(
undefined,
);
const [isTxImported, setIsTxImported] = useState<boolean | undefined>(
undefined,
);
const [isTxImported, setIsTxImported] = useState<boolean>(false);

const onChange = (value: string) => {
setTxErrMsg("");
Expand All @@ -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);
}
Expand All @@ -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 (
<>
<Card>
Expand Down Expand Up @@ -194,7 +192,7 @@ export default function SignTransaction() {
{isTxImported ? "Transaction Overview" : "Sign Transaction"}
</Text>
</div>
{isTxValid && tx ? renderOverviewView() : rendeDefaultView()}
{isTxValid && tx ? renderOverviewView() : rendeImportView()}
</div>
);
}
4 changes: 2 additions & 2 deletions src/components/FormElements/TextPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const TextPicker = ({
label,
value,
error,
readOnly,
onChange,
readOnly,
...props
}: TextPickerProps) => (
<Input
Expand All @@ -31,8 +31,8 @@ export const TextPicker = ({
labelSuffix={labelSuffix}
value={value}
error={error}
readOnly={readOnly}
onChange={onChange}
readOnly={readOnly}
{...props}
/>
);
6 changes: 3 additions & 3 deletions src/components/FormElements/XdrPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface XdrPickerProps extends Omit<TextareaProps, "fieldSize"> {
placeholder?: string;
error?: string | undefined;
note?: string | React.ReactNode;
readOnly?: boolean;
onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
readOnly?: boolean;
}

export const XdrPicker = ({
Expand All @@ -22,8 +22,8 @@ export const XdrPicker = ({
value,
error,
note,
readOnly,
onChange,
readOnly,
...props
}: XdrPickerProps) => (
<Textarea
Expand All @@ -36,8 +36,8 @@ export const XdrPicker = ({
error={error}
rows={5}
note={note}
readOnly={readOnly}
onChange={onChange}
readOnly={readOnly}
{...props}
/>
);
10 changes: 0 additions & 10 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,6 @@ export type AssetObject = {
value: AssetObjectValue;
};

// =============================================================================
// Sign Transaction
// =============================================================================

export type SignTxPageComponent = {
[key: string]: any;
id: string;
name: string;
};

// =============================================================================
// Component
// =============================================================================
Expand Down

0 comments on commit 1a60e18

Please sign in to comment.