Compare commits

...

3 Commits

Author SHA1 Message Date
Valtteri Karesto
a2a6596cc5 Prevent pasting decimals 2022-06-22 12:16:36 +03:00
Valtteri Karesto
37208ce97e fixes #201 2022-06-22 12:03:43 +03:00
Valtteri Karesto
bf4042926d Merge pull request #218 from XRPLF/feat/ui-fixes
Fixes #213 and fixes #200
2022-06-22 11:41:31 +03:00
2 changed files with 37 additions and 10 deletions

View File

@@ -512,6 +512,7 @@ const ImportAccountDialog = () => {
<Input
name="secret"
type="password"
autoComplete="new-password"
value={value}
onChange={(e) => setValue(e.target.value)}
/>

View File

@@ -38,22 +38,22 @@ export const TxUI: FC<UIProps> = ({
txFields,
} = txState;
const transactionsOptions = transactionsData.map(tx => ({
const transactionsOptions = transactionsData.map((tx) => ({
value: tx.TransactionType,
label: tx.TransactionType,
}));
const accountOptions: SelectOption[] = accounts.map(acc => ({
const accountOptions: SelectOption[] = accounts.map((acc) => ({
label: acc.name,
value: acc.address,
}));
const destAccountOptions: SelectOption[] = accounts
.map(acc => ({
.map((acc) => ({
label: acc.name,
value: acc.address,
}))
.filter(acc => acc.value !== selectedAccount?.value);
.filter((acc) => acc.value !== selectedAccount?.value);
const [feeLoading, setFeeLoading] = useState(false);
@@ -108,15 +108,15 @@ export const TxUI: FC<UIProps> = ({
const specialFields = ["TransactionType", "Account", "Destination"];
const otherFields = Object.keys(txFields).filter(
k => !specialFields.includes(k)
(k) => !specialFields.includes(k)
) as [keyof TxFields];
const switchToJson = () =>
setState({ editorSavedValue: null, viewType: "json" });
useEffect(() => {
const defaultOption = transactionsOptions.find(
tt => tt.value === "Payment"
(tt) => tt.value === "Payment"
);
if (defaultOption) {
handleChangeTxType(defaultOption);
@@ -204,7 +204,7 @@ export const TxUI: FC<UIProps> = ({
/>
</Flex>
)}
{otherFields.map(field => {
{otherFields.map((field) => {
let _value = txFields[field];
let value: string | undefined;
@@ -253,13 +253,39 @@ export const TxUI: FC<UIProps> = ({
/>
) : (
<Input
type={isFee ? "number" : "text"}
value={value}
onChange={e => {
handleSetField(field, e.target.value);
onChange={(e) => {
if (isFee) {
const val = e.target.value
.replaceAll(".", "")
.replaceAll(",", "");
handleSetField(field, val);
} else {
handleSetField(field, e.target.value);
}
}}
onKeyPress={
isFee
? (e) => {
if (e.key === "." || e.key === ",") {
e.preventDefault();
}
}
: undefined
}
css={{
width: "70%",
flex: "inherit",
"-moz-appearance": "textfield",
"&::-webkit-outer-spin-button": {
"-webkit-appearance": "none",
margin: 0,
},
"&::-webkit-inner-spin-button ": {
"-webkit-appearance": "none",
margin: 0,
},
}}
/>
)}