Skip to content
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 link previews beneath a message containing a link #81

Open
kevinaboos opened this issue Jul 15, 2024 · 0 comments
Open

Display link previews beneath a message containing a link #81

kevinaboos opened this issue Jul 15, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request help wanted Looking for help from anyone!

Comments

@kevinaboos
Copy link
Member

kevinaboos commented Jul 15, 2024

Most chat/messaging services display a preview of a link (or multiple links) included in a message, which makes it easier to quickly find, understand, and click links. We want to add this feature to Robrix too.

Implementation Approach

As of PR #76, this is now possible because we properly linkify plaintext URLs. This means that links will always be easily discoverable because they'll exist in a canonical HTML link format: <a href=...>Link</a>.

For the Makepad DSL components, we can add an optional LinkPreview view that can be added into the Message view, most likely by included it after the message subview here in the DSL code:

message = <HtmlOrPlaintext> { }

By default, this view would be marked as visible: false, and would only be set to visible: true if a link was found in the message text (which thanks to linkification from PR #76, should be easy to detect).

The LinkPreview view itself should consist of two subviews: an image thumbnail of the linked website, and a text summary of the linked website. The text preview should include the title, an optional subtitle, and a 2-3 line preview of the website text body.
This LinkPreview view should also be clickable (set cursor: Hand and handle click/tap events), and open the linked URL upon click, just like if the user had clicked the actual HTML URL.

The Rust crate called link-preview should be able to help us retrieve and generate the metadata from the link.

Examples

Here's what Discord shows:

image

Here's an example of an Element link preview:

image

Signal messenger shows the preview above the message, but I think showing it below the message makes more sense and is more standard

image
@kevinaboos kevinaboos added enhancement New feature or request help wanted Looking for help from anyone! labels Jul 15, 2024
@kevinaboos kevinaboos moved this to Ready in Robrix Aug 19, 2024
@kevinaboos kevinaboos moved this to Ready in Robrix Sep 18, 2024
@fmzbl fmzbl self-assigned this Nov 5, 2024
@kevinaboos kevinaboos moved this from Ready to In progress in Robrix Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Looking for help from anyone!
Projects
Status: In progress
Development

No branches or pull requests

2 participants