RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
40.17k stars 10.38k forks source link

Preview Title not showing up in preview component #32733

Open AmanNegi opened 2 months ago

AmanNegi commented 2 months ago

Description:

When we implement RC Slash Command, we can either use the previewer function or the executor function. The previewer function allows the return type as ISlashCommandPreview, which is essentially a list of preview items and a title(i18n).

The preview items, do render as expected however the i18nTitle doesn't render and doesn't show up anywhere.

Steps to reproduce:

  1. Generate a RC App.
  2. Implement ISlashCommand, and create a simple preview function that returns a valid ISlashCommandPreview item, with a title.
  3. Try the command on your local instance, and you'll notice no title shows up. (no items will show up as well, because we don't return any).

Alternatively, you could use the gist provided below, it's a basic implementation of ISlashCommand with a preview function that returns a list of text items and a title.

https://gist.github.com/AmanNegi/edea0ae7e7033493f5132d78ff01e29e

Expected behavior:

The i18nTitle should show up above the list of items, acting as an helping text/context for users to understand the command preview palette better.

Actual behavior:

Currently, it doesn't show the text provided anywhere. I've tried providing plain text as well as providing i18n text, by creating and utilizing the en.json file.

I know that, i18n is implemented correctly as it does work correctly in the ISlashCommand where we have to provide the i18nDescription.

Screenshot from 2024-07-03 11-33-46

Server Setup Information:

Client Setup Information

reetp commented 2 months ago

Thanks for reporting.

I'ñl ask someone to take a look.

hugocostadev commented 2 months ago

Indeed this title is not being used...

To add the title we need to add it here: https://github.com/RocketChat/Rocket.Chat/blob/ee43f2c57c87a6dda64b3250bfb3cc04caa8bda2/apps/meteor/client/views/room/providers/ComposerPopupProvider.tsx#L353

The same way it's being used in the slash commands previews here : https://github.com/RocketChat/Rocket.Chat/blob/ee43f2c57c87a6dda64b3250bfb3cc04caa8bda2/apps/meteor/client/views/room/providers/ComposerPopupProvider.tsx#L280

I'm going to send this to our design team, because we don't have a clear guideline on our Design system - Web & desktop (Community) – Figma