-
Notifications
You must be signed in to change notification settings - Fork 26
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
Hide assets from views #1797
Open
aristidesstaffieri
wants to merge
15
commits into
release/5.28.0
Choose a base branch
from
feature/hide-tokens-2
base: release/5.28.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Hide assets from views #1797
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
6ee9edd
adds background settings key and methods for hidden assets, adds exte…
aristidesstaffieri deb3838
adds ducks for gettung hidden assets, adds button to navigate to hidd…
aristidesstaffieri 1103ed1
adds asset visibility toggle in asset rows
aristidesstaffieri 7b14b6e
adds isAssetVisible helper, tweaks background handling of hidden assets
aristidesstaffieri 733b24e
updates toggle asset classes
aristidesstaffieri 467b7e4
refactor getAccountBalances to allow filtering of hidden assets
aristidesstaffieri 973a9a8
wip: reset account balance after managing assets
aristidesstaffieri 7134974
adds test for hiding a token
aristidesstaffieri 5ecd930
adds useFetchDomains helper
aristidesstaffieri 19e83ed
mocks getHiddenAssets in existing tests
aristidesstaffieri 0512f6c
switches to composite key for asset key in hidden asset map
aristidesstaffieri e0efa9f
updates e2e tests for new Manage Assets header
aristidesstaffieri 365d79b
uses pxToRem helper in place of raw rem values, tweaks hidden assets …
aristidesstaffieri e82dd31
Merge branch 'release/5.28.0' into feature/hide-tokens-2
aristidesstaffieri 16f98b5
Merge branch 'release/5.28.0' into feature/hide-tokens-2
aristidesstaffieri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
extension/src/popup/components/manageAssets/AssetVisibility/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React, { useEffect, useRef } from "react"; | ||
import { useHistory } from "react-router-dom"; | ||
import { useDispatch, useSelector } from "react-redux"; | ||
import { useTranslation } from "react-i18next"; | ||
import { Loader } from "@stellar/design-system"; | ||
|
||
import { View } from "popup/basics/layout/View"; | ||
import { SubviewHeader } from "popup/components/SubviewHeader"; | ||
import { | ||
getAccountBalances, | ||
resetSubmission, | ||
} from "popup/ducks/transactionSubmission"; | ||
import { | ||
settingsNetworkDetailsSelector, | ||
settingsSorobanSupportedSelector, | ||
} from "popup/ducks/settings"; | ||
import { publicKeySelector } from "popup/ducks/accountServices"; | ||
import { useFetchDomains } from "popup/helpers/useFetchDomains"; | ||
import { ToggleAssetRows } from "../ToggleAssetRows"; | ||
|
||
import "./styles.scss"; | ||
|
||
export const AssetVisibility = () => { | ||
const { t } = useTranslation(); | ||
const history = useHistory(); | ||
const isSorobanSuported = useSelector(settingsSorobanSupportedSelector); | ||
const networkDetails = useSelector(settingsNetworkDetailsSelector); | ||
const dispatch = useDispatch(); | ||
const publicKey = useSelector(publicKeySelector); | ||
|
||
const ManageAssetRowsWrapperRef = useRef<HTMLDivElement>(null); | ||
|
||
const { assets, isManagingAssets } = useFetchDomains(); | ||
|
||
useEffect(() => { | ||
dispatch( | ||
getAccountBalances({ | ||
publicKey, | ||
networkDetails, | ||
showHidden: true, | ||
}), | ||
); | ||
return () => { | ||
dispatch(resetSubmission()); | ||
}; | ||
}, [publicKey, dispatch, networkDetails]); | ||
|
||
const goBack = () => { | ||
dispatch(resetSubmission()); | ||
history.goBack(); | ||
}; | ||
|
||
return ( | ||
<View> | ||
<SubviewHeader customBackAction={goBack} title={t("Toggle Assets")} /> | ||
<View.Content hasNoTopPadding> | ||
{assets.isLoading ? ( | ||
<div className="ToggleAsset__loader"> | ||
<Loader size="2rem" /> | ||
</div> | ||
) : ( | ||
<div className="ToggleAsset__wrapper"> | ||
<div | ||
className={`ToggleAsset__assets${ | ||
isManagingAssets && isSorobanSuported ? "--short" : "" | ||
}`} | ||
ref={ManageAssetRowsWrapperRef} | ||
> | ||
<ToggleAssetRows assetRows={assets.assetRows} /> | ||
</div> | ||
</div> | ||
)} | ||
</View.Content> | ||
</View> | ||
); | ||
}; |
50 changes: 50 additions & 0 deletions
50
extension/src/popup/components/manageAssets/AssetVisibility/styles.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
.ToggleAsset { | ||
&__close-btn { | ||
color: var(--sds-clr-gray-10); | ||
} | ||
|
||
&__hide-btn { | ||
background-color: transparent; | ||
border: none; | ||
padding: 0; | ||
align-items: center; | ||
cursor: pointer; | ||
display: flex; | ||
width: var(--back--button-dimension); | ||
height: var(--back--button-dimension); | ||
color: var(--sds-clr-gray-10); | ||
} | ||
|
||
&__loader { | ||
height: 100%; | ||
width: 100%; | ||
z-index: calc(var(--back--button-z-index) + 1); | ||
position: absolute; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
top: 0; | ||
left: 0; | ||
} | ||
|
||
&__wrapper { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
} | ||
|
||
&__assets { | ||
flex-grow: 1; | ||
} | ||
|
||
&__button { | ||
a { | ||
color: var(--sds-clr-gray-12); | ||
} | ||
|
||
button { | ||
text-wrap: nowrap; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll run into an issue here when a G address is the issuer for multiple assets.
Here's an example of an issuer on Mainnet who issues multiple assets under one address: GBX23RCWKV7DA23J2MA2OFMTRV3XZHHKOTHBQF6AKOEP7AGQUIZZXLMG
I think you might just want to use
{assetCode}:{assetIssuer}
as your key hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@piyalbasu very good point thank you, will update to use the composite key.
Can an issuer have two assets that use the same ticker?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done in 0512f6c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, that's a good question about multiple assets using the same ticket. Off the top of my head, I'm not 100% sure. We may need to test it out and see if the network lets us do it