-
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
base: release/5.28.0
Are you sure you want to change the base?
Hide assets from views #1797
Changes from 10 commits
6ee9edd
deb3838
1103ed1
7b14b6e
733b24e
467b7e4
973a9a8
7134974
5ecd930
19e83ed
0512f6c
e0efa9f
365d79b
e82dd31
16f98b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -23,3 +23,4 @@ export const IS_HASH_SIGNING_ENABLED_ID = "isHashSigningEnabled"; | |||||
export const IS_NON_SSL_ENABLED_ID = "isNonSSLEnabled"; | ||||||
export const IS_BLOCKAID_ANNOUNCED_ID = "isBlockaidAnnounced"; | ||||||
export const IS_HIDE_DUST_ENABLED_ID = "isHideDustEnabled"; | ||||||
export const HIDDEN_ASSETS = "hiddenAsset"; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😄 thanks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done in 365d79b |
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> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
.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; | ||
|
||
&--short { | ||
flex-grow: 1; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does it make sense to have this one since it's not adding any actual change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh good call this came from a similar view but its not needed here. Removing. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done in 365d79b |
||
} | ||
|
||
&__button { | ||
a { | ||
color: var(--sds-clr-gray-12); | ||
} | ||
|
||
button { | ||
text-wrap: nowrap; | ||
} | ||
} | ||
} |
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