-
Notifications
You must be signed in to change notification settings - Fork 145
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
fix: allow virtuoso to resize dynamically, ref #5242 #5289
Conversation
94d01c6
to
ab6dd7b
Compare
@@ -34,12 +37,16 @@ export const ChooseAccount = memo(() => { | |||
{url && <RequesterFlag requester={url.toString()} />} | |||
<LogomarkIcon width="248px" height="58px" /> | |||
<Stack gap="space.04"> | |||
<styled.h1 textStyle="heading.05">Choose an account to connect</styled.h1> | |||
<styled.h1 textStyle="heading.05"> |
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.
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 believe we prob need some more explanation of what's going on for users?
something like 'you are connected with ledger in bitcoin mode only, please connect stacks account as well to use this feature' or smth like that
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.
@mica000 @markmhendrickson @fabric-8 :
Do you have any input on what copy to use on this screen?
Right now :
- AS A USER signed in with ledger
- AND only have BTC connected
- WHEN you try and sign in to a site e.g. Gamma
- THEN you see an empty screen below the leather logo like this
I've just made a small change so that in these cases we say No connected accounts found
instead of Choose an account to connect
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.
Following up here a bit late:
Ideally the user should be able to connect their wallet to any site with a Ledger account, regardless of whether they've connected with Ledger for BTC or STX.
It seems that our legacy endpoint for connecting (used by Gamma and others) is not behaving this way. However, because it's legacy (and deprecated), we don't need to update it per se.
I also assume that our newer endpoint (getAddresses
) does behave this way, though I haven't tested per se. And as we implement this endpoint for mobile, we should retain this agnostic behavior, allowing users to connect regardless of Ledger connectivity by token.
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.
Thanks for following up anyway 👍
a8698eb
to
6e6765d
Compare
const heightOffset = headerHeight + footerHeight; | ||
const height = vhToPixels(virtualHeight) - heightOffset; | ||
|
||
const onResize = () => { |
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 tried to be more precise and update to the exact height we wanted on re-size but it was buggy.
Instead, here I force a re-render on re-size by changing the key
. This means the wrapper height can adjust properly according to the parents vh
} | ||
|
||
function vhToPixels(vh: string) { | ||
const numericHeight = +vh.replace('vh', ''); |
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.
This is converting vh
to pixels so that it's a numeric value and we can compute the height of the wrapper, taking into account offsets needed for headers + footers
return (numericHeight * window.innerHeight) / 100; | ||
} | ||
|
||
export function VirtuosoWrapper({ children, hasFooter, isPopup }: VirtuosoWrapper) { |
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 should improve this more by:
- accepting the height as a prop
- using tokens for footer / header height
- I couldn't get them working using
token('size
- When importing and using
token.size.X.value
it was giving type errors
- I couldn't get them working using
I can improve this further but I think this needs to get released sooner
> | ||
{children} | ||
</Box> | ||
{wrapChildren ? ( |
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.
All other dialogs have this Box
to help them size dynamically but ones containing Virtuoso
lists now bypass that.
onClose={onGoBack} | ||
wrapChildren={false} | ||
> | ||
<VirtuosoWrapper> |
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.
Virtuoso
height is now set to 100%
and the actual height is controlled by a wrapping container
const { decodedAuthRequest } = useOnboardingState(); | ||
|
||
const { isShowingSwitchAccount, setIsShowingSwitchAccount } = |
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 was investigating why we were re-rendering SwitchAccount
and I found this mistake.
We were rendering it both inside of the main <Container
and also inside of AccountCard
.
Now it stays at Container
level only and OutletContext
is used to show / hide it.
It needs to stay at that level so the settings menu can also trigger it
@@ -17,8 +17,8 @@ export function MessagePreviewBox({ message, hash }: MessageBoxProps) { | |||
py="space.05" | |||
overflowX="auto" | |||
> | |||
{message.split(/\r?\n/).map(line => ( | |||
<styled.span key={line} textStyle="label.01"> | |||
{message.split(/\r?\n/).map((line, index) => ( |
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.
This was throwing a duplicate keys error
isShowing={isShowingSwitchAccount} | ||
onClose={() => setIsShowingSwitchAccount(false)} | ||
/> | ||
{isShowingSwitchAccount && ( |
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.
There was a mistake here in that <SwitchAccountDialog
shouldn't be in the DOM unless showing
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.
nice catch! I believe problem with requests not being cancelled on close in SwitchAccountDialog
is here
@@ -0,0 +1,23 @@ | |||
import { useEffect, useState } from 'react'; |
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.
Re-adding this which I naively removed as I thought we didn't need it, however it's important as it alters the breakpoint on re-size
6e6765d
to
6f242c3
Compare
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.
great work 💪
isShowing={isShowingSwitchAccount} | ||
onClose={() => setIsShowingSwitchAccount(false)} | ||
/> | ||
{isShowingSwitchAccount && ( |
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.
nice catch! I believe problem with requests not being cancelled on close in SwitchAccountDialog
is here
@@ -34,12 +37,16 @@ export const ChooseAccount = memo(() => { | |||
{url && <RequesterFlag requester={url.toString()} />} | |||
<LogomarkIcon width="248px" height="58px" /> | |||
<Stack gap="space.04"> | |||
<styled.h1 textStyle="heading.05">Choose an account to connect</styled.h1> | |||
<styled.h1 textStyle="heading.05"> |
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 believe we prob need some more explanation of what's going on for users?
something like 'you are connected with ledger in bitcoin mode only, please connect stacks account as well to use this feature' or smth like that
This PR ensures that account lists grow appropriately and that users with many accounts can access all of them.
#5242