Skip to content

Commit

Permalink
fix(ui): DTIS-450 removal crypto UI and deps (#259)
Browse files Browse the repository at this point in the history
* fix: remove pages, components, reducers, fixtures from Crypto

* fix: remove Crypto types

* fix: remove unused defaultCredentialsCardData

* fix: remove unnecessary ChooseAccountName component

* fix: remove unused toast state

* fix: remove seedPhraseType from GenerateSeedPhrase.tsx

* fix: remove passing route params from onboarding

* fix: unit test after clean up on generate seed

* fix: clean unused operationState fields

* fix: remove unused imports

* fix: remove crypto fields from redux in VerifySeedPhrase.test.tsx

* fix: remove unused validateMnemonic import in GenerateSeedPhrase.tsx

* fix: remove unnecessary stateRestore condition in GenerateSeedPhrase.tsx

* fix: remove unnecessary cryptoAccountsCache from GenerateSeedPhrase.test.tsx

* fix: remove unnecessary onboardingRoute dict and deps

* fix: crypto clean up in i18n

* fix: remove unused cryptoAccountsCache

* fix: remove unnecessary restore tests

* fix: remove unnecessary unit tests for Generate Seed Phrase screen from Crypto/Generate

* fix: remove comment

* fix: remove unused wallet toast messages in i18n

* fix: remove unused restoreCryptoAccount

* fix: remove unnecessary undefined value

* fix: using optional route in handleNavigation, Onboarding.tsx

* fix: put back route condition in handleNavigation

* fix: rename crypto placeholder to just crypto

* fix: crypto wallet messages for toast

* fix: remove unused toast message after verify seed phrase

* fix: remove defaultCryptoAccount from redux

* fix: remove newcryptoaccount from i18n

* fix: remove AlertVerify in GenerateSeedPhrase.tsx

* fix: refactor GenerateSeedPhrase.tsx

* fix: remove AlertExit from GenerateSeedPhrase.tsx

* fix: remove AlertExit and refactor
  • Loading branch information
jimcase authored Nov 21, 2023
1 parent f6476d7 commit 05a9a20
Show file tree
Hide file tree
Showing 63 changed files with 152 additions and 4,246 deletions.
90 changes: 0 additions & 90 deletions src/locales/en/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,6 @@
"continue": "Continue"
}
},
"newcryptoaccount": {
"title": "Generate your Seed Phrase",
"paragraph": {
"top": "It is critical that you securely store this secret recovery phrase, also referred to as a mnemonic, seed, or backup phrase. You will require this phrase in the event that you change mobile devices or need to regain access to your identity wallet profile.",
"bottom": "This phrase is essentially a representation of your Identity Wallet profile private key. This means that anyone with access to it can control your identity. We strongly recommend not using screenshots or storing this phrase without encryption."
},
"button": {
"continue": "Continue"
}
},
"restorecryptoaccount": {
"title": "Enter Seed Phrase",
"suggestions": "Suggestions",
"paragraph": {
"top": "Restore a crypto account based on an existing seed phrase.",
"bottom": ""
},
"button": {
"continue": "Verify Seed Phrase"
}
},
"segment": "{{length}} words",
"privacy": {
"overlay": {
Expand Down Expand Up @@ -153,12 +132,6 @@
"continue": "Continue"
}
},
"newcryptoaccount": {
"title": "Verify your Seed Phrase",
"button": {
"continue": "Verify your Seed Phrase"
}
},
"paragraph": {
"top": "Please select every word from your seed phrase in the correct order. If you select a word in the wrong order, select it again to move it back down to the list of available words."
},
Expand Down Expand Up @@ -589,75 +562,12 @@
]
}
},
"crypto": {
"tab": {
"create": "Add a crypto account",
"network": {
"mainnet": "Mainnet"
},
"slider": {
"title": {
"mainbalance": "Main balance",
"rewardbalance": "Reward balance"
}
},
"actionbuttons": {
"send": "Send",
"receive": "Receive",
"nfts": "NFTs",
"staking": "Staking"
},
"assetstransactions": {
"swipeupmessage": "Swipe up to see assets & transactions",
"assets": "Assets",
"nfts": "NFTs",
"metadata": "Metadata",
"transactions": "Transactions",
"searchtransactions": "Search transactions"
}
},
"mywalletsmodal": {
"title": "My wallets",
"empty": "No wallets available",
"create": "Add a crypto account"
},
"addcryptoaccountmodal": {
"title": "Add a new crypto account",
"reuse": "Use existing identity seed phrase",
"generate": "Generate a new seed phrase",
"restore": "Restore using an existing seed phrase"
},
"chooseaccountnamemodal": {
"title": "Wallet name",
"skip": "Skip",
"label": "Display name",
"placeholder": "My wallet",
"confirm": "Create wallet"
},
"renamewallet": {
"title": "Rename wallet",
"cancel": "Cancel",
"label": "Display name",
"placeholder": "Wallet name",
"confirm": "Confirm changes"
},
"receivemodal": {
"title": "Receive",
"derivationpath": "Derivation path",
"divider": "or",
"more": "More share options"
}
},
"shareqr": {
"divider": "or",
"more": "More share options"
},
"toast": {
"copiedtoclipboard": "Copied to clipboard",
"walletcreated": "Seed phrase verified",
"walletrenamed": "Account renamed successfully",
"walletrestored": "Seed phrase verified",
"walletdeleted": "Account deleted successfully",
"identitycreated": "New identity created successfully",
"identityupdated": "Identity successfully updated",
"identitydeleted": "Identity successfully deleted",
Expand Down
18 changes: 0 additions & 18 deletions src/routes/backRoute/backRoute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe("getBackRoute", () => {
time: 0,
},
currentOperation: "",
defaultCryptoAccount: "",
queueConnectionCredentialRequest: {
isProcessing: false,
queues: [],
Expand All @@ -51,11 +50,6 @@ describe("getBackRoute", () => {
},
identitiesCache: { identities: [], favourites: [] },
credsCache: { creds: [], favourites: [] },
cryptoAccountsCache: {
cryptoAccounts: [],
defaultCryptoAccount: "",
hideCryptoBalances: false,
},
connectionsCache: {
connections: [],
},
Expand Down Expand Up @@ -128,7 +122,6 @@ describe("getBackRoute", () => {
passwordIsSkipped: true,
},
currentOperation: "",
defaultCryptoAccount: "",
queueConnectionCredentialRequest: {
isProcessing: false,
queues: [],
Expand All @@ -142,11 +135,6 @@ describe("getBackRoute", () => {
},
identitiesCache: { identities: [], favourites: [] },
credsCache: { creds: [], favourites: [] },
cryptoAccountsCache: {
cryptoAccounts: [],
defaultCryptoAccount: "",
hideCryptoBalances: false,
},
connectionsCache: {
connections: [],
},
Expand Down Expand Up @@ -209,7 +197,6 @@ describe("getPreviousRoute", () => {
time: 0,
},
currentOperation: "",
defaultCryptoAccount: "",
queueConnectionCredentialRequest: {
isProcessing: false,
queues: [],
Expand All @@ -218,11 +205,6 @@ describe("getPreviousRoute", () => {
},
identitiesCache: { identities: [], favourites: [] },
credsCache: { creds: [], favourites: [] },
cryptoAccountsCache: {
cryptoAccounts: [],
defaultCryptoAccount: "",
hideCryptoBalances: false,
},
connectionsCache: {
connections: [],
},
Expand Down
11 changes: 0 additions & 11 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { DidCardDetails } from "../ui/pages/DidCardDetails";
import { CredCardDetails } from "../ui/pages/CredCardDetails";
import { ConnectionDetails } from "../ui/pages/ConnectionDetails";
import { AuthenticatedRouteProps } from "./routes.types";
import { onboardingRoute } from "../ui/constants/dictionary";

const AuthenticatedRoute: React.FC<AuthenticatedRouteProps> = (props) => {
const authentication = useAppSelector(getAuthentication);
Expand Down Expand Up @@ -89,16 +88,6 @@ const Routes = () => {
component={GenerateSeedPhrase}
nextPathname={nextPath.pathname}
/>
<AuthenticatedRoute
path={RoutePath.GENERATE_SEED_PHRASE + onboardingRoute.createRoute}
component={GenerateSeedPhrase}
nextPathname={nextPath.pathname}
/>
<AuthenticatedRoute
path={RoutePath.GENERATE_SEED_PHRASE + onboardingRoute.restoreRoute}
component={GenerateSeedPhrase}
nextPathname={nextPath.pathname}
/>
<AuthenticatedRoute
path={RoutePath.VERIFY_SEED_PHRASE}
exact
Expand Down
31 changes: 3 additions & 28 deletions src/routes/nextRoute/nextRoute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { RoutePath } from "../index";
import { setAuthentication } from "../../store/reducers/stateCache";
import { FIFTEEN_WORDS_BIT_LENGTH } from "../../constants/appConstants";
import { DataProps } from "./nextRoute.types";
import { onboardingRoute } from "../../ui/constants/dictionary";
import { TabsRoutePath } from "../paths";

describe("NextRoute", () => {
Expand All @@ -34,7 +33,6 @@ describe("NextRoute", () => {
passwordIsSkipped: true,
},
currentOperation: "",
defaultCryptoAccount: "",
queueConnectionCredentialRequest: {
isProcessing: false,
queues: [],
Expand All @@ -48,11 +46,6 @@ describe("NextRoute", () => {
},
identitiesCache: { identities: [], favourites: [] },
credsCache: { creds: [], favourites: [] },
cryptoAccountsCache: {
cryptoAccounts: [],
defaultCryptoAccount: "",
hideCryptoBalances: false,
},
connectionsCache: {
connections: [],
},
Expand Down Expand Up @@ -119,28 +112,16 @@ describe("NextRoute", () => {
});

test("should return correct route for /verifyseedphrase", () => {
let data = {
store: storeMock,
state: {
currentOperation: onboardingRoute.create,
},
};
let result = getNextVerifySeedPhraseRoute(data);

expect(result).toEqual({
pathname: RoutePath.CREATE_PASSWORD,
});

data = {
const data = {
store: storeMock,
state: {
currentOperation: "",
},
};
result = getNextVerifySeedPhraseRoute(data);
const result = getNextVerifySeedPhraseRoute(data);

expect(result).toEqual({
pathname: TabsRoutePath.CRYPTO,
pathname: RoutePath.CREATE_PASSWORD,
});
});
});
Expand All @@ -159,7 +140,6 @@ describe("getNextRoute", () => {
passwordIsSkipped: true,
},
currentOperation: "",
defaultCryptoAccount: "",
queueConnectionCredentialRequest: {
isProcessing: false,
queues: [],
Expand All @@ -173,11 +153,6 @@ describe("getNextRoute", () => {
},
identitiesCache: { identities: [], favourites: [] },
credsCache: { creds: [], favourites: [] },
cryptoAccountsCache: {
cryptoAccounts: [],
defaultCryptoAccount: "",
hideCryptoBalances: false,
},
connectionsCache: {
connections: [],
},
Expand Down
26 changes: 4 additions & 22 deletions src/routes/nextRoute/nextRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from "../../store/reducers/seedPhraseCache";
import { DataProps, StoreState } from "./nextRoute.types";
import { RoutePath, TabsRoutePath } from "../paths";
import { onboardingRoute, toastState } from "../../ui/constants/dictionary";
import { toastState } from "../../ui/constants/dictionary";

const getNextRootRoute = (store: StoreState) => {
const isInitialized = store.stateCache.initialized;
Expand All @@ -26,14 +26,7 @@ const getNextRootRoute = (store: StoreState) => {
} else if (routes.length === 1 && !isInitialized) {
path = RoutePath.ONBOARDING;
} else if (authentication.passcodeIsSet && authentication.seedPhraseIsSet) {
if (
store.stateCache.currentOperation ===
(onboardingRoute.create || onboardingRoute.restore)
) {
path = RoutePath.CREATE_PASSWORD;
} else {
path = RoutePath.TABS_MENU;
}
path = RoutePath.TABS_MENU;
} else {
if (initialRoute) {
path = RoutePath.ONBOARDING;
Expand All @@ -46,18 +39,11 @@ const getNextRootRoute = (store: StoreState) => {
};

const getNextOnboardingRoute = (data: DataProps) => {
const route = data?.state?.currentOperation;
let query = "";
if (route === onboardingRoute.create) {
query = onboardingRoute.createRoute;
} else if (route === onboardingRoute.restore) {
query = onboardingRoute.restoreRoute;
}
let path;
if (!data.store.stateCache.authentication.passcodeIsSet) {
path = RoutePath.SET_PASSCODE;
} else {
path = RoutePath.GENERATE_SEED_PHRASE + query;
path = RoutePath.GENERATE_SEED_PHRASE;
}

return { pathname: path };
Expand Down Expand Up @@ -113,11 +99,7 @@ const getNextGenerateSeedPhraseRoute = () => {
};

const getNextVerifySeedPhraseRoute = (data: DataProps) => {
const route = data?.state?.currentOperation;
const nextPath: string =
route === onboardingRoute.create
? RoutePath.CREATE_PASSWORD
: TabsRoutePath.CRYPTO;
const nextPath: string = RoutePath.CREATE_PASSWORD;

return { pathname: nextPath };
};
Expand Down
1 change: 0 additions & 1 deletion src/routes/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ enum TabsRoutePath {
CREDS = "/tabs/creds",
SCAN = "/tabs/scan",
CRYPTO = "/tabs/crypto",
CRYPTO_PLACEHOLDER = "/tabs/cryptoplaceholder",
CHAT = "/tabs/chat",
DID_DETAILS = "/tabs/dids/:id?",
CRED_DETAILS = "/tabs/creds/:id?",
Expand Down
2 changes: 0 additions & 2 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { seedPhraseCacheSlice } from "./reducers/seedPhraseCache";
import { stateCacheSlice } from "./reducers/stateCache";
import { identitiesCacheSlice } from "./reducers/identitiesCache";
import { credsCacheSlice } from "./reducers/credsCache";
import { cryptoAccountsCacheSlice } from "./reducers/cryptoAccountsCache";
import { connectionsCacheSlice } from "./reducers/connectionsCache";

const store = configureStore({
Expand All @@ -12,7 +11,6 @@ const store = configureStore({
seedPhraseCache: seedPhraseCacheSlice.reducer,
identitiesCache: identitiesCacheSlice.reducer,
credsCache: credsCacheSlice.reducer,
cryptoAccountsCache: cryptoAccountsCacheSlice.reducer,
connectionsCache: connectionsCacheSlice.reducer,
},
});
Expand Down
Loading

0 comments on commit 05a9a20

Please sign in to comment.