-
Notifications
You must be signed in to change notification settings - Fork 501
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: add hover and clusters to peers map #1444
feat: add hover and clusters to peers map #1444
Conversation
This is awesome! My thoughts on your questions but @hacdias and @lidel should weigh in too 😊
|
I love this and I agree with @jessicaschilling about scrolling. |
@rafaelramalho19 I really like the idea of map popover! May be a bit more useful if popover for a standalone peer includes its full multiaddr (ok to keep the shortened PeerID).. and maybe latency too? In other words, instead of " FYSA multiaddr prefix is already displayed on hover at connection column, if you want to reuse the data source. Answering questions: (1) Should we change the map scale or add buttons to zoom? Adding zoom would not fully solve the problem, because no matter how much you zoom, you will always end up with situation when there is more than one person from a big city, and they all are assigned the same coordinate on the map (geoip resolution we use is limited to the "city" level). I don't think we should add zoom in this PR (it could be something for the future / separate PR). Instead, we should make the map smarter if there is more than one peer in specific area (eg. within the size of the dot itself). Loose idea: merge those dots into a single (bigger?) one and show a popover with a peer count for the area. Could still have a list of merged peers below the count. This would make it easy to hover mouse on parts of the USA, see how many of my peers are from NYC, Tokio. Right now it gets messy when there are many peers (some people tweak settings and run webui with 5000 peers or more!), no way to tell how much bigger US is than EU, especially when viewport is small (could be 10x more peers, but both look the same): As for (2) and (3): I think those are great improvements for UX, but should be implemented together: if one works, user will expect it working the other way around. (I suspect it may be easier to implement without zoom controls, as there is no need to account for edge cases when zoomed in and hovering something outside of map viewport) ps. long PR descriptions with visuals like the one you made here are great, they ensure everyone is on the same page, keep doing it! ❤️ |
Good suggestion @lidel, I will merge the dots into a bigger one and share the result here. I'm actually having problems with paning and zooming with d3 + our react setup, so your suggestion actually helps me a lot 😄 |
+1 to everything @lidel said. Thanks both for thinking through this in such detail 😊 |
Following up on the bi-weekly call to add a reference to the NY Times coronavirus map illustrating relative size of dots with numbers attached to them. This is overkill for our case, but could be useful inspiration: https://www.nytimes.com/interactive/2020/us/coronavirus-us-cases.html |
New update:
@jessicaschilling @hacdias @lidel what you think of this approach? |
This is so cool 😊 A few cosmetic suggestions, assuming @lidel @hacdias are OK with this approach:
Thanks! |
|
||
const unique = new Set(allCoord.map(JSON.stringify)) | ||
return Array.from(unique).map(JSON.parse) | ||
return peers.reduce((previous, { peerId, coordinates }) => { |
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.
Note to self: Missing tests once UI and UX is reviewed
Thanks for the suggestions Jessica, Relative to the last point, I didn't sort the elements in the hover with the same logic as in the table because that added an extra layer of overhead and complexion. Now, about the other points you referred, could you please revise them?
|
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 really, really like it @rafaelramalho19! 👌 😍
Took it for a spin and found some small bugs. Also, wrote some thoughts how we can optimize clustering logic for regular users who will have under 300 peers (see below).
UI bugs / nits
-
Contents of the hover box will look better if we sort them by multiaddr
(those are just strings, just sort them in lexicographical order, that is all) -
For some reason I get horizontal scrollbar in Firefox, may be related to the other issue (3):
-
I believe we have a regression in responsiveness – when I resize window the map does not scale, it starts overlaping the menu:
Those were some issues I found at the start of the development, so I was thinking about opening a new merge request after this one to fix them. But since you already referred it, I'll put it in this MR 😄 |
Co-Authored-By: Marcin Rataj <lidel@lidel.org>
…o19/ipfs-webui into feat/add-hover-to-peers-map
Thanks for the suggestions @lidel, here's how it looks so far:
I would love to work again on this later and improve responsiveness (mobile needs a lot of love in the map) |
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! Made another pass:
-
Some peers have no latency info, in those cases we should either hide
(ms)
or show(???ms)
:
-
For some time I had this weird bug where menu randomly stopped working. Finally figured it out – svg is getting over the menu, hijacking clicks in Firefox. Perhaps tweaking z-index will be enough to fix this?
-
Smaller suggestions below
src/peers/WorldMap/WorldMap.js
Outdated
<div className='relative flex justify-end pt2 pb4'> | ||
<div className='f6 p2 no-select flex items-center'> | ||
<span className='f6 charcoal-muted pr3'>{t('index')}: </span> | ||
<i className='mapDotExplanation mr1' style={{ width: getDotsSize(1) * 2, height: getDotsSize(1) * 2, backgroundColor: getDotsColor(1) }}></i>1-10 {t('peers')} | ||
<i className='mapDotExplanation ml3 mr1' style={{ width: getDotsSize(50) * 2, height: getDotsSize(50) * 2, backgroundColor: getDotsColor(50) }}></i> 10-100 {t('peers')} | ||
<i className='mapDotExplanation ml3 mr1' style={{ width: getDotsSize(110) * 2, height: getDotsSize(110) * 2, backgroundColor: getDotsColor(110) }}></i>100+ {t('peers')} |
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 the review @lidel! The flag actually has empty space in MacOS, so that's why I never saw that happen 😢 I was able to fix the scrollbar issue, but I needed to get a bit creative and actually get the popover to align down instead of up. If you see this as a UX problem (CC @jessicaschilling), I'll try a more overhead solution (passing the popover as a portal element, and setting the top and left according to the body/html position, while calculating the size of the svg and subtracting offsets) Nice suggestion on the Status component, didn't see it 👍 |
I don't think the popover facing down is a big problem. If there are a ton of peers in Patagonia, it might overlap with the top of the main peer table, but that feels like a bit of an edge case for this release. |
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.
On the UX/UI side, I love it and I approve it. I didn't check the whole code though. But, the parts I checked, looked good for me.
@rafaelramalho19 mind resolving the conflict? (rebase is also fine) |
@hugomrdias @alanshaw does any of you have bandwidth to take a look at React-specific parts and give @rafaelramalho19 some feedback? |
…t/add-hover-to-peers-map
@lidel Everything's ready for merge now, just waiting on your final approval 🎉 |
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.
Fantastic contribution @rafaelramalho19, let's ship it!
Notes
I wasn't sure what information to place in the popover, so I just used the country and id for now. If you find any more relevant information I should place, please say so 🙏
I couldn't find a way to properly make a reducer work with
createAsyncResourceBundle
, the documentation seemed a bit lacking and I had some really hard time trying to figure out what happened. After reading through the source code I found out thatcreateAsyncResourceBundle
actually creates a reducer function to handle all the async mechanism mutations, so I extended it. You can see this in src/bundles/peers.js#13If someone could help me find a better way, I would be very much appreciated 😄
Added some transitions to smoothen the interaction with several popovers, as you can see here:
Questions
I believe that most of the times the peers will be too close to each other (at least on the map scale) and hovering through them can be weird/glitchy. Should we change the map scale or add buttons to zoom?
Should we scroll the list to the hoverable peer when it's out of view?
Should we show the popover when we also hover an element from the list?
PS: Sorry for the long merge request description 😅