Open kevinaboos opened 4 months ago
PR #90 added support for handling when a user clicks on a matrix.to
link or a user tag. But it doesn't change anything about how those links are displayed (they're still displayed as regular HTML links instead of the desired "User Pill" widget).
Currently, when a message includes a tagged username, it is displayed just like a regular link. Instead, we should display it using a special visual element that is embedded into the message's HTML content (this isn't relevant for plaintext messages).
Element displays user tags as shown below, and calls them "User Pills" because the displayed element is pill-shaped:
Discord displays them like so:
Implementation
Makepad's HTML widget supports displaying custom widgets as inline HTML components, so it should be straightforward to create a new widget (e.g.,
UserTag
) and include that as a possible template for any HTML URL that is amatrix.to
link to a specific user. User tag links look like this:The Robrix-specific HTML widget instance is defined here: https://github.com/project-robius/robrix/blob/61f49943b3bb89161dfca26c8cfaec98705f1f42/src/shared/html_or_plaintext.rs#L34-L36
We will likely need to completely replace Makepad's default
HtmlLink
widget with a custom widget that supports displaying either a regular HTML link or a specialUserTag
. Once that widget is implemented, we'll need to override the default handling for thea
HTML tag (a link), which is specified here in the code: https://github.com/project-robius/robrix/blob/61f49943b3bb89161dfca26c8cfaec98705f1f42/src/shared/html_or_plaintext.rs#L61A
UserTag
should contain anAvatar
and aLabel
with the user's displayable name.Upon being clicked, aThis was implemented in #90.UserTag
should open theUserProfileSlidingPane
, which anAvatar
already supports as of #78.