-
Notifications
You must be signed in to change notification settings - Fork 148
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
feat: hide asset list unsupported tokens in accordion, closes #16 #5344
Conversation
6e2ccc6
to
5befee1
Compare
@fabric-8 curious how we want to handle left and right padding here on hover? Or better no hover background effect? |
5befee1
to
d6484fa
Compare
@markmhendrickson fixed paddings, needed some css hack to do it |
@@ -8,6 +8,14 @@ export const keyframes: CssKeyframes = { | |||
from: { opacity: 1, transform: 'translateY(0)' }, | |||
to: { opacity: 0, transform: 'translateY(4px)' }, | |||
}, | |||
slideDown: { |
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 do have a slideUpAndFade
and slideDownAndFade
being used in other UI components (dropdown, select, and tooltip) ...wondering about naming here bc specific to this feature with the maxHeight
?
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.
hm, how do you think better to name? 🤔
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.
Not necessary to change, but thought maybe just adding the maxHeight
to the ones we already have might work? Not critical to address.
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.
changing maxHeight there will break animation, dropdown's menu height will go from 0 to the actual height, I believe we don't expect it there
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.
Looks good @alter-eggo, just some naming suggestions.
d6484fa
to
3fe305d
Compare
Amazing to see this coming to life already! Realizing that the way it's set up in the design doesn't match the current implementation because the token list items are built differently (They don't have any padding inside and all the padding is given via the outer container). In design we're using token list item "future versions" which have a built-in padding that would align with a button like used here. The hack you used is nifty, however given the current situation and the container getting really close to the left/right boundaries I'd also propose to not use a full background hover effect but instead do something simpler and just rely on a change of text color on hover (action-primary-hover) without changing the background, similar to what we do for the account switcher. Apologies this is on me, should have checked how the current token list items are constructed instead of relying on the future-to-be-design-ones and made that suggestion from the start. |
export function useFilteredStacksFungibleTokenList({ | ||
address, | ||
filter = 'all', | ||
}: useFilteredStacksFungibleTokenListArgs) { | ||
const stacksFtAssetBalances = useStacksFungibleTokenAssetBalancesWithMetadata(address); | ||
const { data: swapAssets = [] } = useAlexSwappableAssets(); | ||
|
||
return useMemo(() => { | ||
if (filter === 'supported') { | ||
return stacksFtAssetBalances.filter(assetBalance => | ||
swapAssets.some(swapAsset => | ||
swapAsset.principal.includes(assetBalance.asset.contractAddress) | ||
) | ||
); | ||
} | ||
|
||
if (filter === 'unsupported') { | ||
return stacksFtAssetBalances.filter( | ||
assetBalance => | ||
!swapAssets.some(swapAsset => | ||
swapAsset.principal.includes(assetBalance.asset.contractAddress) | ||
) | ||
); | ||
} | ||
|
||
return stacksFtAssetBalances; | ||
}, [stacksFtAssetBalances, swapAssets, filter]); | ||
} |
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.
Can we break apart the filtering from the hook that binds it to the state?
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.
separated it
left: '-2%', | ||
right: '-2%', |
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.
Should we use negative spacing units, rather than percentage here?
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.
I wonder also if we can reuse any styles from <Pressable />
, which does the same thing?
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.
removed it, due to @fabric-8 comment above
3fe305d
to
a3a1236
Compare
/** | ||
* @see https://github.com/leather-wallet/issues/issues/16 | ||
*/ | ||
type StacksFtTokensFilter = 'all' | 'supported' | 'unsupported'; |
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.
Think this is a smart API choice 👍🏼
a3a1236
to
bb66cb7
Compare
@@ -108,6 +109,9 @@ export function AssetsList() { | |||
)} | |||
</BitcoinNativeSegwitAccountLoader> | |||
|
|||
<CurrentStacksAccountLoader fallback={<AddStacksLedgerKeysItem />}> |
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.
@alter-eggo - can you please check this as it's causing a double display of the Connect Stacks
button on Ledger if you only have a BTC account:
thanks @pete-watters |
Nice work, @alter-eggo 💪 Does the UI remember the user's preference in terms of hiding or showing? E.g. if the user shows the tokens and refreshes, are they still shown or hidden again? If the UI doesn't remember, let's create a separate issue to track that as an enhancement. |
@markmhendrickson always hidden, will you create a task? |
I've created it here. |
This pr puts unsupported list of tokens in accordion, also adds Accordion ui component
Screen.Recording.2024-05-03.at.17.56.08.mov