diff --git a/src/Account/components/AccountActions.tsx b/src/Account/components/AccountActions.tsx
index 585f733c7..db076bb0a 100644
--- a/src/Account/components/AccountActions.tsx
+++ b/src/Account/components/AccountActions.tsx
@@ -67,6 +67,7 @@ function AccountActions(props: AccountActionsProps) {
disabled={accountData.balances.length === 0}
icon={}
onClick={props.onCreatePayment}
+ testnet={props.account.testnet}
type="primary"
>
{t("account.action.send")}
diff --git a/src/Account/components/AccountTitle.tsx b/src/Account/components/AccountTitle.tsx
index 31560f1d8..d7c2967a2 100644
--- a/src/Account/components/AccountTitle.tsx
+++ b/src/Account/components/AccountTitle.tsx
@@ -14,7 +14,7 @@ import { Account } from "~App/contexts/accounts"
import { useLiveAccountData } from "~Generic/hooks/stellar-subscriptions"
import { useIsMobile, useRouter } from "~Generic/hooks/userinterface"
import { containsThirdPartySigner, ThirdPartySecurityService } from "~Generic/lib/third-party-security"
-import { primaryBackgroundColor } from "~App/theme"
+import { testnetColor } from "~App/theme"
import { HorizontalLayout } from "~Layout/components/Box"
import MainTitle from "~Generic/components/MainTitle"
@@ -42,9 +42,9 @@ function TestnetBadge(props: { style?: React.CSSProperties }) {
display: "inline-flex",
alignItems: "center",
padding: "5px",
- background: "white",
+ background: testnetColor.main,
borderRadius: 3,
- color: primaryBackgroundColor,
+ color: "white",
fontSize: "50%",
fontWeight: "bold",
lineHeight: "100%",
diff --git a/src/AccountCreation/components/AccountCreationActions.tsx b/src/AccountCreation/components/AccountCreationActions.tsx
index a09575784..7ecad6d84 100644
--- a/src/AccountCreation/components/AccountCreationActions.tsx
+++ b/src/AccountCreation/components/AccountCreationActions.tsx
@@ -46,6 +46,7 @@ function AccountCreationActions(props: AccountCreationActionsProps) {
className={buttonClassName}
icon={}
onClick={props.onActionButtonClick}
+ testnet={props.testnet}
type="primary"
>
{t("create-account.action.create")}
@@ -57,6 +58,7 @@ function AccountCreationActions(props: AccountCreationActionsProps) {
className={buttonClassName}
icon={}
onClick={props.onActionButtonClick}
+ testnet={props.testnet}
type="primary"
>
{t("create-account.action.import")}
diff --git a/src/AccountSettings/components/AccountDeletionDialog.tsx b/src/AccountSettings/components/AccountDeletionDialog.tsx
index b4bf91aa9..fc77e2915 100644
--- a/src/AccountSettings/components/AccountDeletionDialog.tsx
+++ b/src/AccountSettings/components/AccountDeletionDialog.tsx
@@ -29,6 +29,7 @@ interface DeletionConfirmationDialogProps {
onClose: () => void
onConfirm: () => void
open: boolean
+ testnet?: boolean
}
const DeletionConfirmationDialog = React.memo(function DeletionConfirmationDialog(
@@ -41,7 +42,7 @@ const DeletionConfirmationDialog = React.memo(function DeletionConfirmationDialo
{t("account-settings.account-deletion.action.cancel")}
}
confirmButton={
-
+
{t("account-settings.account-deletion.action.confirm")}
}
@@ -220,6 +221,7 @@ function AccountDeletionDialog(props: AccountDeletionDialogProps) {
disabled={!selectedMergeAccount}
icon={}
onClick={requestConfirmation}
+ testnet={props.account.testnet}
type="primary"
>
{isTinyScreen
@@ -227,7 +229,13 @@ function AccountDeletionDialog(props: AccountDeletionDialogProps) {
: t("account-settings.account-deletion.action.merge.long")}
) : (
- } onClick={requestConfirmation} type="primary">
+ }
+ onClick={requestConfirmation}
+ testnet={props.account.testnet}
+ type="primary"
+ >
{t("account-settings.account-deletion.action.delete")}
)}
@@ -250,6 +258,7 @@ function AccountDeletionDialog(props: AccountDeletionDialogProps) {
onClose={cancelConfirmation}
onConfirm={onConfirm}
open={confirmationPending}
+ testnet={props.account.testnet}
/>
void
onToggleRemovePassword: () => void
+ testnet?: boolean
}
function Actions(props: ActionsProps) {
@@ -90,7 +91,7 @@ function Actions(props: ActionsProps) {
/>
)
) : null}
- } onClick={props.onSubmit} type="primary">
+ } onClick={props.onSubmit} testnet={props.testnet} type="primary">
{isSmallScreen
? props.removePassword
? t("account-settings.set-password.action.remove-password.long")
@@ -201,6 +202,7 @@ function ChangePasswordDialog(props: Props) {
onSubmit={removingPassword ? removePassword : changePassword}
onToggleRemovePassword={toggleRemovePassword}
removePassword={removingPassword}
+ testnet={props.account.testnet}
/>
}
diff --git a/src/AccountSettings/components/ExportKeyDialog.tsx b/src/AccountSettings/components/ExportKeyDialog.tsx
index d18c9e67a..bdf1ea4ac 100644
--- a/src/AccountSettings/components/ExportKeyDialog.tsx
+++ b/src/AccountSettings/components/ExportKeyDialog.tsx
@@ -22,6 +22,7 @@ interface PromptToRevealProps {
password: string
passwordError: Error | null
requiresPassword: boolean
+ testnet?: boolean
title: React.ReactNode
onReveal: (event: React.SyntheticEvent) => void
updatePassword: (event: React.ChangeEvent) => void
@@ -39,7 +40,7 @@ function PromptToReveal(props: PromptToRevealProps) {
top={props.title}
actions={
- } onClick={props.onReveal} type="primary">
+ } onClick={props.onReveal} testnet={props.testnet} type="primary">
{isSmallScreen
? t("account-settings.export-key.action.reveal.short")
: t("account-settings.export-key.action.reveal.long")}
@@ -80,6 +81,7 @@ function PromptToReveal(props: PromptToRevealProps) {
interface ShowSecretKeyProps {
export: string
onConfirm?: () => void
+ testnet?: boolean
title: React.ReactNode
variant: Props["variant"]
}
@@ -96,7 +98,7 @@ function ShowSecretKey(props: ShowSecretKeyProps) {
actions={
props.onConfirm ? (
-
+
{t("account-settings.export-key.action.confirm")}
@@ -204,13 +206,20 @@ function ExportKeyDialog(props: Props) {
)
return isRevealed && secretKey ? (
-
+
) : (
diff --git a/src/App/contexts/accounts.tsx b/src/App/contexts/accounts.tsx
index ee58df93b..e3bda781b 100644
--- a/src/App/contexts/accounts.tsx
+++ b/src/App/contexts/accounts.tsx
@@ -86,7 +86,12 @@ async function createAccountInstance(keyStore: KeyStoreAPI, keyID: string) {
}
async function createAccountInKeyStore(accounts: Account[], accountData: NewAccountData) {
- if (accounts.some(someAccount => someAccount.name.toLowerCase() === accountData.name.toLowerCase())) {
+ if (
+ accounts.some(
+ someAccount =>
+ someAccount.name.toLowerCase() === accountData.name.toLowerCase() && someAccount.testnet === accountData.testnet
+ )
+ ) {
throw CustomError("ExistingAccountError", "An account with that name does already exist.")
}
diff --git a/src/App/theme.ts b/src/App/theme.ts
index f503993d4..b4440539c 100644
--- a/src/App/theme.ts
+++ b/src/App/theme.ts
@@ -15,6 +15,12 @@ export const brandColor = {
light: "#72dbfe"
}
+export const testnetColor = {
+ dark: "#d3356b",
+ main: "#fe4081",
+ light: "#fd5a92"
+}
+
export const primaryBackground = "linear-gradient(to left bottom, #01B3F3, #0176DC)"
export const primaryBackgroundColor = "#0194E7"
@@ -89,6 +95,19 @@ const theme = createMuiTheme({
backgroundColor: "#02b2f2"
}
},
+ containedSecondary: {
+ backgroundColor: testnetColor.main,
+
+ "&$disabled": {
+ backgroundColor: testnetColor.main,
+ border: "none",
+ boxShadow: "none",
+ color: "rgba(255, 255, 255, 0.7)"
+ },
+ "&:hover": {
+ backgroundColor: testnetColor.light
+ }
+ },
textPrimary: {
color: brandColor.dark
},
diff --git a/src/Assets/components/AssetDetailsActions.tsx b/src/Assets/components/AssetDetailsActions.tsx
index b2c106d4e..404c7f2e1 100644
--- a/src/Assets/components/AssetDetailsActions.tsx
+++ b/src/Assets/components/AssetDetailsActions.tsx
@@ -84,7 +84,12 @@ function AssetDetailsActions(props: Props) {
} onClick={removeThisAsset} type="secondary">
{t("account.add-asset.action.remove")}
- } onClick={tradeThisAsset} type="primary">
+ }
+ onClick={tradeThisAsset}
+ testnet={props.account.testnet}
+ type="primary"
+ >
{t("account.add-asset.action.trade")}
>
diff --git a/src/Assets/components/CustomTrustline.tsx b/src/Assets/components/CustomTrustline.tsx
index 7a24cee90..2225ba454 100644
--- a/src/Assets/components/CustomTrustline.tsx
+++ b/src/Assets/components/CustomTrustline.tsx
@@ -75,6 +75,7 @@ function CustomTrustlineDialog(props: Props) {
icon={}
loading={props.txCreationPending}
onClick={addCustomAsset}
+ testnet={props.account.testnet}
type="primary"
>
{isWidthMax450
diff --git a/src/Assets/components/RemoveTrustline.tsx b/src/Assets/components/RemoveTrustline.tsx
index 80ba3e7dd..0dc72fb34 100644
--- a/src/Assets/components/RemoveTrustline.tsx
+++ b/src/Assets/components/RemoveTrustline.tsx
@@ -72,6 +72,7 @@ const RemoveTrustlineDialog = React.memo(function RemoveTrustlineDialog(props: P
icon={}
onClick={removeAsset}
style={{ maxWidth: "none" }}
+ testnet={props.account.testnet}
type="primary"
>
{t("account.remove-trustline.action.remove")}
diff --git a/src/Generic/components/DialogActions.tsx b/src/Generic/components/DialogActions.tsx
index 8d8d08c0d..c75e2186f 100644
--- a/src/Generic/components/DialogActions.tsx
+++ b/src/Generic/components/DialogActions.tsx
@@ -115,6 +115,7 @@ interface ActionButtonProps {
loading?: boolean
onClick?: (event: React.SyntheticEvent) => void
style?: React.CSSProperties
+ testnet?: boolean
variant?: ButtonProps["variant"]
type?: "primary" | "secondary" | "submit"
}
@@ -128,7 +129,7 @@ export function ActionButton(props: ActionButtonProps) {
return (
diff --git a/src/TransactionReview/components/ReviewForm.tsx b/src/TransactionReview/components/ReviewForm.tsx
index 6833b3c7e..58ed01942 100644
--- a/src/TransactionReview/components/ReviewForm.tsx
+++ b/src/TransactionReview/components/ReviewForm.tsx
@@ -168,6 +168,7 @@ function TxConfirmationForm(props: Props) {
form={formID}
loading={props.loading || loading}
onClick={showLoadingIndicator}
+ testnet={props.account.testnet}
type="submit"
>
{isOrderCancellation
diff --git a/src/TransferService/components/NoWithdrawableAssets.tsx b/src/TransferService/components/NoWithdrawableAssets.tsx
index d8141a9e1..1578ce4bd 100644
--- a/src/TransferService/components/NoWithdrawableAssets.tsx
+++ b/src/TransferService/components/NoWithdrawableAssets.tsx
@@ -24,6 +24,7 @@ function NoWithdrawableAssets(props: Props) {
router.history.push(routes.manageAccountAssets(props.account.id))}
+ testnet={props.account.testnet}
type="primary"
>
{t("transfer-service.no-withdrawable-assets.action.add-asset")}
diff --git a/src/TransferService/components/TransferDetailsForm.tsx b/src/TransferService/components/TransferDetailsForm.tsx
index e63093f2b..ef652aa4b 100644
--- a/src/TransferService/components/TransferDetailsForm.tsx
+++ b/src/TransferService/components/TransferDetailsForm.tsx
@@ -271,6 +271,7 @@ function TransferDetailsForm(props: TransferDetailsFormProps) {
form={formID}
loading={submissionState && submissionState.type === "pending"}
onClick={() => undefined}
+ testnet={account.testnet}
type="submit"
>
{t("transfer-service.transfer-details.action.proceed")}
diff --git a/src/TransferService/components/TransferInitial.tsx b/src/TransferService/components/TransferInitial.tsx
index 843cea3d6..00b8acbd0 100644
--- a/src/TransferService/components/TransferInitial.tsx
+++ b/src/TransferService/components/TransferInitial.tsx
@@ -208,6 +208,7 @@ function TransferInitial(props: TransferInitialProps) {
form={formID}
loading={submissionState.type === "pending"}
onClick={() => undefined}
+ testnet={account.testnet}
type="submit"
>
{t("transfer-service.initial.action.proceed")}
diff --git a/src/TransferService/components/TransferTransactionDetails.tsx b/src/TransferService/components/TransferTransactionDetails.tsx
index 47f63ebd0..0df387d66 100644
--- a/src/TransferService/components/TransferTransactionDetails.tsx
+++ b/src/TransferService/components/TransferTransactionDetails.tsx
@@ -173,6 +173,7 @@ function TransferTransactionDetails(props: TransferTransactionDetailsProps) {
icon={props.type === "deposit" ? null : }
loading={txPreparationState.type === "pending"}
onClick={() => undefined}
+ testnet={account.testnet}
type="submit"
>
{props.type === "deposit"