Skip to content

Commit e916190

Browse files
[DDW-694] Implement the Tokens screen (#2671)
* [DDW-694] Initial file structure * [DDW-694] Improve file structure * [DDW-694] CHANGELOG * [DDW-694] Search init * [DDW-694] Fix Assets search * [DDW-694] Fix Assets dropdown search * [DDW-694] Tokens list - progress * [DDW-694] Storybook stories * [DDW-694] Storybook stories * [DDW-694] Tokens List Header - init * [DDW-694] Tokens List Header - progress * [DDW-694] Tokens List Header - progress * [DDW-694] Tokens List Header - progress * [DDW-694] Remove controls for the MVP scope * [DDW-694] Remove controls for the MVP scope * [DDW-694] Favorite - init * [DDW-694] Favorites localstorage * [DDW-694] Styling adjustments * [DDW-694] Styling adjustments * [DDW-694] Styling adjustments * [DDW-694] Favorites working * [DDW-694] Only recent tokens * [DDW-694] Toggle favorite animation * [DDW-694] Show Zero Tokens - init * [DDW-694] Move animation to the specific component using it * [DDW-694] Move animation to the specific component using it * [DDW-694] View all tokens button * [DDW-694] Translation manager * [DDW-694] Sorting - init * [DDW-694] Wallet Tokens sorting * [DDW-694] Fix memoized token dependency * [DDW-694] Fix memoized token dependency * [DDW-694] Move sort fn into utils * [DDW-694] Adjust column title position * [DDW-694] Sorting and animation tweaks * [DDW-694] JP translation * [DDW-694] Preparing for translation * [DDW-694] JP translation and adjustments * [DDW-694] Adjustments * [DDW-694] Adjustments * [DDW-694] Adjustments * [DDW-694] Add mistakenly removed flow to Routes * [DDW-694] Remove unused type * [DDW-694] Fix variables naming * [DDW-694] Fix variables naming * [DDW-694] Styling adjustment * [DDW-694] Add hooks to Func Component functions * [DDW-694] Wallet Summary tokens adjustments and fns docs * [DDW-694] Fix toggle sort direction * [DDW-694] Restoring state for the Tokens tab * [DDW-694] Fix search not working * [DDW-694] Styling adjustments * [DDW-694] Disable send when token has zero balance * [DDW-694] No Tokens scenario in the Tokens tab * [DDW-694] No Tokens scenario in the Tokens tab - fix typo * [DDW-694] Remove zero tokens from the scope * [DDW-694] Sort qtd with formatted amount * [DDW-694] Fix CHANGELOG * [DDW-694] Proper flow typing * [DDW-694] useMemo in main content functions Co-authored-by: Nikola Glumac <[email protected]>
1 parent a05ee8d commit e916190

File tree

69 files changed

+2375
-965
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+2375
-965
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## vNext
44

5+
### Features
6+
7+
- Implemented the wallet Tokens dedicated screen ([PR 2671](https://github.com/input-output-hk/daedalus/pull/2671))
8+
59
### Fixes
610

711
- Fixed wallet settings screen - no space at the bottom when scrolled down ([PR 2686](https://github.com/input-output-hk/daedalus/pull/2686))

source/common/config/electron-store.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ export const STORAGE_KEYS: {
2929
STAKING_INFO_WAS_OPEN: 'ALONZO-INFO-WAS-OPEN',
3030
TERMS_OF_USE_ACCEPTANCE: 'TERMS-OF-USE-ACCEPTANCE',
3131
THEME: 'THEME',
32+
TOKEN_FAVORITES: 'TOKEN-FAVORITES',
3233
USER_DATE_FORMAT_ENGLISH: 'USER-DATE-FORMAT-ENGLISH',
3334
USER_DATE_FORMAT_JAPANESE: 'USER-DATE-FORMAT-JAPANESE',
3435
USER_LOCALE: 'USER-LOCALE',

source/common/types/electron-store.types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export type StorageKey =
1919
| 'SMASH-SERVER'
2020
| 'TERMS-OF-USE-ACCEPTANCE'
2121
| 'THEME'
22+
| 'TOKEN-FAVORITES'
2223
| 'USER-DATE-FORMAT-ENGLISH'
2324
| 'USER-DATE-FORMAT-JAPANESE'
2425
| 'USER-LOCALE'

source/renderer/app/Routes.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import WalletSummaryPage from './containers/wallet/WalletSummaryPage';
3030
import WalletSendPage from './containers/wallet/WalletSendPage';
3131
import WalletReceivePage from './containers/wallet/WalletReceivePage';
3232
import WalletTransactionsPage from './containers/wallet/WalletTransactionsPage';
33+
import WalletTokensPage from './containers/wallet/WalletTokensPage';
3334
import WalletSettingsPage from './containers/wallet/WalletSettingsPage';
3435
import WalletUtxoPage from './containers/wallet/WalletUtxoPage';
3536
import VotingRegistrationPage from './containers/voting/VotingRegistrationPage';
@@ -64,15 +65,16 @@ export const Routes = withRouter(() => (
6465
path={ROUTES.WALLETS.SUMMARY}
6566
component={WalletSummaryPage}
6667
/>
67-
<Route
68-
path={ROUTES.WALLETS.TRANSACTIONS}
69-
component={WalletTransactionsPage}
70-
/>
7168
<Route path={ROUTES.WALLETS.SEND} component={WalletSendPage} />
7269
<Route
7370
path={ROUTES.WALLETS.RECEIVE}
7471
component={WalletReceivePage}
7572
/>
73+
<Route path={ROUTES.WALLETS.TOKENS} component={WalletTokensPage} />
74+
<Route
75+
path={ROUTES.WALLETS.TRANSACTIONS}
76+
component={WalletTransactionsPage}
77+
/>
7678
<Route
7779
path={ROUTES.WALLETS.SETTINGS}
7880
component={WalletSettingsPage}

source/renderer/app/actions/assets-actions.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,14 @@ export default class AssetsActions {
1111
decimals: number,
1212
}> = new Action();
1313
onAssetSettingsCancel: Action<any> = new Action();
14+
onOpenAssetSend: Action<{ uniqueId: string }> = new Action();
15+
onCopyAssetParam: Action<{ param: string, fullValue: string }> = new Action();
16+
onToggleFavorite: Action<{
17+
uniqueId: string,
18+
isFavorite: boolean,
19+
}> = new Action();
20+
copyAssetParamNotification: Action<{
21+
param: string,
22+
shortValue: string,
23+
}> = new Action();
1424
}

source/renderer/app/actions/wallets-actions.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export default class WalletsActions {
8282
copyWalletPublicKey: Action<{ publicKey: string }> = new Action();
8383
copyICOPublicKey: Action<{ publicKey: string }> = new Action();
8484
copyAddress: Action<{ address: string }> = new Action();
85-
copyAssetItem: Action<{ assetItem: string, value: string }> = new Action();
8685
updateCertificateStep: Action<any> = new Action();
8786
closeCertificateGeneration: Action<any> = new Action();
8887
closeRewardsCsvGeneration: Action<any> = new Action();

source/renderer/app/api/assets/types.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ export type AssetToken = {
7777

7878
export type AssetMetadata = {
7979
name: string,
80-
ticker: string,
8180
description: string,
81+
ticker?: string,
8282
decimals?: number, // [0 .. 255]
8383
url?: string,
8484
logo?: string,

source/renderer/app/api/utils/localStorage.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,31 @@ export default class LocalStorageApi {
327327
unsetAppUpdateCompleted = (): Promise<void> =>
328328
LocalStorageApi.unset(keys.APP_UPDATE_COMPLETED);
329329

330+
getWalletTokenFavorites = (): Promise<{ [key: string]: boolean }> =>
331+
LocalStorageApi.get(keys.TOKEN_FAVORITES, {});
332+
333+
toggleWalletTokenFavorite = async (
334+
uniqueId: string,
335+
isFavorite: boolean
336+
): Promise<boolean> => {
337+
const favorites = await this.getWalletTokenFavorites();
338+
const newFavorites = {
339+
...favorites,
340+
[uniqueId]: isFavorite,
341+
};
342+
await LocalStorageApi.set(keys.TOKEN_FAVORITES, newFavorites);
343+
return !isFavorite;
344+
};
345+
346+
unsetWalletTokenFavorite = async (uniqueId: string): Promise<void> => {
347+
const favorites = await this.getWalletTokenFavorites();
348+
delete favorites[uniqueId];
349+
await LocalStorageApi.set(keys.TOKEN_FAVORITES, favorites);
350+
};
351+
352+
unsetWalletTokenFavorites = async (): Promise<void> =>
353+
LocalStorageApi.unset(keys.TOKEN_FAVORITES);
354+
330355
getAssetsLocalData = (): Promise<AssetLocalData> =>
331356
LocalStorageApi.get(keys.ASSET_DATA, []);
332357

Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)