Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui-ux): translations for convert screen #4028

Merged
merged 7 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions mobile-app/app/api/transaction/dfi_converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { ConvertDirection } from "@screens/enum";
export async function dfiConversionSigner(
account: WhaleWalletAccount,
amount: BigNumber,
mode: ConvertDirection
mode: ConvertDirection,
): Promise<CTransactionSegWit> {
const script = await account.getScript();
const builder = account.withTransactionBuilder();
Expand All @@ -31,7 +31,7 @@ export async function dfiConversionSigner(
},
],
},
script
script,
);
} else {
signed = await builder.account.accountToUtxos(
Expand All @@ -45,7 +45,7 @@ export async function dfiConversionSigner(
],
mintingOutputsStart: 2, // 0: DfTx, 1: change, 2: minted utxos (mandated by jellyfish-tx)
},
script
script,
);
}
return new CTransactionSegWit(signed);
Expand All @@ -56,7 +56,7 @@ export function dfiConversionCrafter(
convertDirection: ConvertDirection,
onBroadcast: () => any,
onConfirmation: () => void,
submitButtonLabel?: string
submitButtonLabel?: string,
): DfTxSigner {
if (
![
Expand All @@ -81,7 +81,7 @@ export function dfiConversionCrafter(
amount: amount.toFixed(8),
symbolA,
symbolB,
}
},
),
drawerMessages: {
preparing: translate("screens/OceanInterface", "Preparing to convert…"),
Expand All @@ -92,7 +92,7 @@ export function dfiConversionCrafter(
symbolA: symbolA,
symbolB: symbolB,
amount: amount.toFixed(8),
}
},
),
complete: translate(
"screens/OceanInterface",
Expand All @@ -101,7 +101,7 @@ export function dfiConversionCrafter(
symbolA,
symbolB,
amount: amount.toFixed(8),
}
},
),
},
onBroadcast,
Expand Down
16 changes: 8 additions & 8 deletions mobile-app/app/api/transaction/transfer_domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export async function transferDomainSigner(
sourceTokenId: string,
targetTokenId: string,
amount: BigNumber,
convertDirection: ConvertDirection
convertDirection: ConvertDirection,
): Promise<CTransactionSegWit> {
const dvmScript = await account.getScript();
const evmScript = await account.getEvmScript();
Expand Down Expand Up @@ -64,7 +64,7 @@ export async function transferDomainSigner(
},
],
},
dvmScript
dvmScript,
);

return new CTransactionSegWit(signed);
Expand All @@ -77,11 +77,11 @@ export function transferDomainCrafter(
targetToken: TransferDomainToken,
onBroadcast: () => any,
onConfirmation: () => void,
submitButtonLabel?: string
submitButtonLabel?: string,
): DfTxSigner {
if (
![ConvertDirection.evmToDvm, ConvertDirection.dvmToEvm].includes(
convertDirection
convertDirection,
)
) {
throw new Error("Unexpected transfer domain");
Expand All @@ -99,7 +99,7 @@ export function transferDomainCrafter(
sourceToken.tokenId,
targetToken.tokenId,
amount,
convertDirection
convertDirection,
),
title: translate(
"screens/ConvertConfirmScreen",
Expand All @@ -108,7 +108,7 @@ export function transferDomainCrafter(
amount: amount.toFixed(8),
symbolA,
symbolB,
}
},
),
drawerMessages: {
preparing: translate("screens/OceanInterface", "Preparing to convert…"),
Expand All @@ -119,7 +119,7 @@ export function transferDomainCrafter(
symbolA: symbolA,
symbolB: symbolB,
amount: amount.toFixed(8),
}
},
),
complete: translate(
"screens/OceanInterface",
Expand All @@ -128,7 +128,7 @@ export function transferDomainCrafter(
symbolA: symbolA,
symbolB: symbolB,
amount: amount.toFixed(8),
}
},
),
},
onBroadcast,
Expand Down
10 changes: 5 additions & 5 deletions mobile-app/app/components/DomainSwitch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function DomainSwitch({ testID }: { testID: string }): JSX.Element {

const toggleDomain = async () => {
await setDomain(
domain === DomainType.DVM ? DomainType.EVM : DomainType.DVM
domain === DomainType.DVM ? DomainType.EVM : DomainType.DVM,
);
};
return (
Expand All @@ -30,7 +30,7 @@ export function DomainSwitch({ testID }: { testID: string }): JSX.Element {
{domain === DomainType.DVM && (
<View
style={tailwind(
"flex-1 flex-row justify-center rounded-full items-center p-0 absolute left-0"
"flex-1 flex-row justify-center rounded-full items-center p-0 absolute left-0",
)}
>
<View
Expand Down Expand Up @@ -58,7 +58,7 @@ export function DomainSwitch({ testID }: { testID: string }): JSX.Element {
{domain === DomainType.EVM && (
<View
style={tailwind(
"flex-1 rounded-full flex-row justify-center items-center absolute right-0"
"flex-1 rounded-full flex-row justify-center items-center absolute right-0",
)}
>
<LinearGradient
Expand All @@ -70,15 +70,15 @@ export function DomainSwitch({ testID }: { testID: string }): JSX.Element {
<View style={tailwind("rounded-full p-1 flex-row items-center")}>
<View
style={tailwind(
"flex items-center justify-center rounded-full w-5 h-5"
"flex items-center justify-center rounded-full w-5 h-5",
)}
>
<EvmDFIIcon width={20} height={20} />
</View>

<Text
style={tailwind(
"text-mono-light-v2-00 text-xs ml-1 w-9 font-normal-v2"
"text-mono-light-v2-00 text-xs ml-1 w-9 font-normal-v2",
)}
testID={`${testID}_EVM`}
>
Expand Down
2 changes: 1 addition & 1 deletion mobile-app/app/components/WalletAddressRow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ describe("Wallet Address Row", () => {
const rendered = render(
<Provider store={store}>
<WalletAddressRow />
</Provider>
</Provider>,
);
expect(rendered.toJSON()).toMatchSnapshot();
});
Expand Down
2 changes: 1 addition & 1 deletion mobile-app/app/contexts/DomainContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function useDomainContext(): Domain {
}

export function DomainProvider(
props: DomainContextI & PropsWithChildren<any>
props: DomainContextI & PropsWithChildren<any>,
): JSX.Element | null {
const { api } = props;
const { domain } = useDomain({ api });
Expand Down
4 changes: 2 additions & 2 deletions mobile-app/app/hooks/useAddressBook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export function useAddressBook(): {
} {
const { network } = useNetworkContext();
const userPreferences = useSelector(
(state: RootState) => state.userPreferences
(state: RootState) => state.userPreferences,
);
const dispatch = useAppDispatch();
const clearAddressBook = (): void => {
Expand All @@ -24,7 +24,7 @@ export function useAddressBook(): {
...userPreferences,
addressBook: emptyAddressBook,
},
})
}),
);
});
};
Expand Down
2 changes: 1 addition & 1 deletion mobile-app/app/hooks/useAddressLabel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { selectAllLabeledWalletAddress } from "@store/userPreferences";

export function useAddressLabel(address: string): string | null {
const addresses = useSelector((state: RootState) =>
selectAllLabeledWalletAddress(state.userPreferences)
selectAllLabeledWalletAddress(state.userPreferences),
);
let label = null;
if (addresses?.[address] != null) {
Expand Down
16 changes: 8 additions & 8 deletions mobile-app/app/hooks/wallet/Conversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ export function useConversion(props: useConversionProps): ConversionResult {
const [isConversionRequired, setIsConversionRequired] = useState(false);
const [conversionAmount, setConversionAmount] = useState(new BigNumber("0"));
const DFIUnified = useSelector((state: RootState) =>
unifiedDFISelector(state.wallet)
unifiedDFISelector(state.wallet),
);
const DFIToken = useSelector((state: RootState) =>
DFITokenSelector(state.wallet)
DFITokenSelector(state.wallet),
);
const DFIUtxo = useSelector((state: RootState) =>
DFIUtxoSelector(state.wallet)
DFIUtxoSelector(state.wallet),
);
const unifiedAmount = new BigNumber(DFIUnified.amount);
const reservedDFI = 0.1;
Expand All @@ -61,7 +61,7 @@ export function useConversion(props: useConversionProps): ConversionResult {
setConversionAmount(
amount
.minus(type === "utxo" ? DFIUtxo.amount : DFIToken.amount)
.plus(type === "utxo" ? reservedDFI : 0)
.plus(type === "utxo" ? reservedDFI : 0),
);
setIsConversionRequired(true);
} else {
Expand All @@ -80,7 +80,7 @@ export function queueConvertTransaction(
dispatch: Dispatch<any>,
onBroadcast: () => void,
logger: NativeLoggingProps,
onConfirmation: () => void = () => {}
onConfirmation: () => void = () => {},
): void {
try {
dispatch(
Expand All @@ -90,9 +90,9 @@ export function queueConvertTransaction(
mode,
onBroadcast,
onConfirmation,
"CONVERTING"
)
)
"CONVERTING",
),
),
);
} catch (e) {
logger.error(e);
Expand Down
2 changes: 1 addition & 1 deletion mobile-app/app/screens/AppNavigator/BottomTabNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export function BottomTabNavigator(): JSX.Element {
{ "bg-mono-light-v2-00 border-mono-light-v2-100": isLight },
{ "bg-mono-dark-v2-00 border-mono-dark-v2-100": !isLight },
{ "pt-1 pb-4 h-24": Platform.OS === "ios" },
{ hidden: domain !== DomainType.DVM }
{ hidden: domain !== DomainType.DVM },
),
tabBarActiveTintColor: getColor("brand-v2-500"),
tabBarInactiveTintColor: isLight
Expand Down
Loading