relaycc / receiver

Relay Receiver is a React library that makes it easy to add Web3 messaging to your website.
http://www.demo.relay.cc
MIT License
39 stars 2 forks source link

Show lens name instead of wallet address in conversation list when th… #119

Closed BrianS111 closed 1 year ago

BrianS111 commented 1 year ago

Closes https://github.com/relaycc/receiver/issues/114

BrianS111 commented 1 year ago

DEE4F06B-FC0B-4097-BBDB-0276265A0678_4_5005_c Before pic

BrianS111 commented 1 year ago

28724135-5EEC-4AB6-B454-B162A9AD325A

After

I have a strange feeling this PR wont get accepted.. Seems like a simple fix to make everything work. Let me know if I went in the right direction or if you'd like a different solution. The priority is ENS > Lens > Wallet address

BrianS111 commented 1 year ago
  • The peerAddressDisplay prop is a manual override for what gets displayed so it shouldn't be removed
  • The responsiveName and useEnsName hooks should be removed in favor of the useRelayId hook (We don't need to use all 3, we can just use the 1).
  • The logic for deciding what to show should be straightforward: "if we have an ENS name show that, if we have a Lens name, show that, otherwise show the address"

useRelayId doesn't truncate anything and all 3 forms (ens, lens, address) need to be truncated 3 different ways, so I'm assuming I'll import truncateName, truncateAddress and write a new function for truncate lens and use those along with useRelayId and everything should work that way along with what you mentioned above. Does that sound about right? @killthebuddh4

killthebuddh4 commented 1 year ago

useRelayId doesn't truncate anything and all 3 forms (ens, lens, address) need to be truncated 3 different ways, so I'm assuming I'll import truncateName, truncateAddress and write a new function for truncate lens and use those along with useRelayId and everything should work that way along with what you mentioned above. Does that sound about right? @killthebuddh4

Yep that sounds about right.

BrianS111 commented 1 year ago

The code has been updated @killthebuddh4 Let me know if this works. It seems to be everything we discussed. I slightly adjusted the ens function in the address.ts so when it's truncated there are 3 dots instead of 4.

The output is the same as the screenshot I posted above