-
Notifications
You must be signed in to change notification settings - Fork 5
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
display network notices #94
Conversation
Deploying with Cloudflare Pages
|
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.
Was the yarn.lock change intentional?
type MinimalNetworkConfig = { | ||
rpcAddrs: string[]; | ||
chainName: string; | ||
notices?: NetworkNotice[]; |
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.
Do we want to have separate notices for PSM and Vaults?
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.
if we do I think that has to go somewhere else. this is config for the network. appropriate for things like pending upgrades.
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.
Makes sense
src/components/ChainConnection.tsx
Outdated
}); | ||
for (const message of activeNotices(config)) { | ||
toast.warn(message, { position: 'top-center' }); |
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.
Do we need to support multiple concurrent notices? It would be be cleaner functionally and aesthetically to reuse https://github.com/Agoric/dapp-psm/blob/main/src/components/AnnouncementBanner.tsx and put this logic in there. If there's multiple maybe we can rethink the design, because having a bunch of toasts pop up isn't ideal either. Not sure the priority of this though, if we have time to think it through 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.
Good question. I figured there might be one or two max. And I didn't want to risk having someone defined multiple messages and one not go out due to client implemenation. (We don't have any validation tools on the production side.)
I think AnnouncementBanner makes sense for announcements, which can be delivered one a time and dismissed. "Ok, I saw it, got it." Whereas "notice" is more aggressive like, "DO NOT FORGET
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.
The announcement banner is what we've used for notices such as chain upgrades in the past. For multiple concurrent notices, I'm thinking it's sufficiently uncommon that showing multiple banners, or multiple rows in the banner, would be fine in that case. I think it should also show when the dapp loads, before the user has to connect their wallet. By doing it that way, the PR won't reinvent any of our existing UX, just make it more convenient to update the notice.
@@ -0,0 +1,40 @@ | |||
import { expect, it, describe } from 'vitest'; |
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.
Yay tests
Yeah, called out in the PR description and separated with a commit. If you want it in a different PR lemme know. But I figure they're going to deploy together anyway. |
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.
Yeah, called out in the PR description and separated with a commit.
Ah okay thanks
0059b24
to
4ae6369
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.
LGTM. I opened the PR so I can't approve. I wish GH allowed transferring a PR.
I'm adding automerge so it'll land once you approve. Automerge can't be set until there's an approval. So just Approve and land at will.
Sam addressed his requested changes
Reads a
notices
list from https://main.agoric.net/network-config and displays them as toast to the user.Also has a
yarn upgrade
for deps hygiene.Test plan
Added this before the toast line to simulate data coming from network-config,