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

fix: ChatInput Formatter Tool UI for small screens #693

Merged
merged 36 commits into from
Jan 30, 2025

Conversation

abirc8010
Copy link
Contributor

@abirc8010 abirc8010 commented Dec 17, 2024

Brief Title

Moved formatters, video and file attachment to popover menu for small screens

Acceptance Criteria fulfillment

  • Implemented a media query (@media(max-width: 400px)) to render the VideoMessageRecorder inside the popover.
  • Wrapped the formatters (bold, italic, strike, code, multiline) inside the popover when screen width is below 400px.
  • Adjusted the chatToolMap logic to move the file upload into the popover for smaller screens.

Video/Screenshots

Screencast.from.2025-01-15.02-39-34.webm

Note: The PR will be ready for live testing at https://rocketchat.github.io/EmbeddedChat/pulls/pr-693 after approval. Contributors are requested to replace <pr_number> with the actual PR number.

@devanshkansagra
Copy link
Contributor

devanshkansagra commented Dec 18, 2024

Hey @abirc8010 it looks very good, but a suggestion you just put only formatters in that 3 dot menu. it would be better for user to find audio, video, and file upload buttons if they are displayed and visible on chatformatting toolbar. also you can see in layout editor, the formatters are not adjustable, and audio video and file upload are adjustable. the code I shared to you in that merged pr is based on this feature

@abirc8010
Copy link
Contributor Author

@devanshkansagra I have considered moving the video and files to 3-dot menu so that clicking the audio message does not cause other icons (video, file) to be shifted outside the toolbar.

Screencast.from.2024-12-18.11-16-22.webm

image

@devanshkansagra
Copy link
Contributor

then it might be difficult to edit layout of embeddedchat using layout_editor, or else do one thing, try to remove the margins from sides(left and right) of chat input box on small screen keeping only formatters in 3 dots. just for visualization how it would look, whether it will look consistent or not?

@abirc8010
Copy link
Contributor Author

Screencast.from.2024-12-19.00-36-52.webm

@devanshkansagra @Spiral-Memory will it be ok to make the message box occupy the entire width ?

@Spiral-Memory
Copy link
Collaborator

Hi @abirc8010 and @devanshkansagra ,

Let’s make it configurable. In mobile mode, let the user (the one setting up EC) decide what they want to keep visible and which options should go into the three-dot menu, similar to how this is configurable in the theme object.

@devanshkansagra , maybe you can connect with @abirc8010 to guide him on this or collaborate together on it.

@devanshkansagra
Copy link
Contributor

Sure

@abirc8010
Copy link
Contributor Author

Hey @devanshkansagra @Spiral-Memory
Would this kind of behaviour be better ?
I am keeping the emoji fixed , and by default the formatters will be inside the popOver menu , user can shuffle the ordering , I am keeping 5 items inside the menu and 3 items outside to maintain consistency.
One can drag out an item from the popOver menu to outside.
Functionality is achieved using dnd-kit as in layout_editor

Screencast.from.2024-12-24.14-18-10.webm

@devanshkansagra
Copy link
Contributor

devanshkansagra commented Dec 25, 2024

Hey @abirc8010, this thing we already have in layout_editor check #607 where we can customize the ui of embeddedchat. so can you tell me why did you implemented here?

@devanshkansagra
Copy link
Contributor

also I don't think we needed this modification of drag and drop here because we don't want that non-admin users should modify the ui otherwise every user will able modify the position of the buttons where they want to and each time the ui of that fomratting toolbar will be changed so it will be difficult for other users to handle new modification each time

@abirc8010
Copy link
Contributor Author

Let’s make it configurable. In mobile mode, let the user (the one setting up EC) decide what they want to keep visible and which options should go into the three-dot menu, similar to how this is configurable in the theme object.

Hey @devanshkansagra after reading this , I thought we need to implement it the same way as it's done in the layout editor. Could you please clarify the intended behavior?

@devanshkansagra
Copy link
Contributor

devanshkansagra commented Dec 25, 2024

Ohh my bad I didn't read that comment, I was bit busy a bit since few days and without reading that entire comment I texted sure 😅

@abirc8010
Copy link
Contributor Author

A problem here till now is that the user's preferences are not stored, so every time the user reloads or visits again, the toolbars revert to their default state.

@devanshkansagra
Copy link
Contributor

It is because default layout is set by layout editor and you are modifying in the environment hence it does not modify the layout editor theme obj so if the page gets refreshed it will reset the changes

@Spiral-Memory
Copy link
Collaborator

Hi @abirc8010 ,
I think there’s some confusion here. This is not about user preferences. Instead, it’s about a developer embedding EmbeddedChat into their website. Based on the developer's choice, the layout will be determined.

It’s important to understand that EmbeddedChat is not a standalone chatting app. It’s presented inside Storybook for development purposes only. Its primary purpose is to be embedded into any website, offering the power of Rocket.Chat and the customizability provided by the external developer configuring it.

While setting it up, the developer can define the theme object accordingly.

@Spiral-Memory
Copy link
Collaborator

Spiral-Memory commented Dec 25, 2024

You may look into this repo to understand the purpose of EmbeddedChat : https://github.com/Spiral-Memory/rc-app-demo-page

https://spiral-memory.github.io/rc-app-demo-page/

@abirc8010
Copy link
Contributor Author

Hey @Spiral-Memory @devanshkansagra I have made the message box configurable

eg:

optionConfig = {
   surfaceItems: ['emoji', 'formatter', 'audio', 'video', 'file'],
   formatters: ['bold', 'italic', 'strike', 'multiline'],
   smallScreenSurfaceItems: [ 'file', 'code', 'popoverItems', 'italic', 'video'],
   popOverItems: ['audio', 'bold', 'emoji', 'strike'],
 }

for large screen we have:

image

for smaller screen we have:

image

@devanshkansagra
Copy link
Contributor

devanshkansagra commented Dec 28, 2024

Hey @abirc8010, Can you share the working video regarding this or @Spiral-Memory can you please approve this pr to test?

@abirc8010
Copy link
Contributor Author

@devanshkansagra Here is the working video. You mainly need to pass two additional configurations: smallScreenSurfaceItems to define the arrangement of toolbars on small screens, and popOverItems to specify the arrangement of items in the popover menu.

If these configurations are not provided, the default behavior will place emoji, audio, video, and file options outside the popover menu, while formatters will remain inside it.

working.webm

Copy link
Collaborator

@Spiral-Memory Spiral-Memory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving to test

@abirc8010
Copy link
Contributor Author

abirc8010 commented Jan 1, 2025

Hey @Spiral-Memory I can see a 'link' option is added for the chatInputToolbar , should I consider moving it inside the popover menu or keep it outside by default ?
I am keeping it inside the popover by default, if any changes are needed , I will modify it

@Spiral-Memory
Copy link
Collaborator

image
Feels too big compared to the last one

Also, i am facing a slow behaviour, not sure why ?

Also, just before the login completes, You will see message #undefined -> Not sure, which PR introduced this

Can you please these please

@abirc8010
Copy link
Contributor Author

Feels too big compared to the last one

@Spiral-Memory I made it occupy the full screen so that while recording audio other icons do not get shifted out of boundary

image

@abirc8010
Copy link
Contributor Author

Also, i am facing a slow behaviour, not sure why ?

I am not quite sure about this as this seems to be fine from my end.

@Spiral-Memory
Copy link
Collaborator

Can we please keep the space same as before

You can occupy full width, after a breakpoint if needed, but that too, keep the font size consistent as before

@abirc8010 abirc8010 marked this pull request as draft January 27, 2025 18:02
@abirc8010 abirc8010 marked this pull request as ready for review January 27, 2025 19:36
@abirc8010
Copy link
Contributor Author

Hey @Spiral-Memory I made the input box occupy full width only for smaller screens

@Spiral-Memory
Copy link
Collaborator

Spiral-Memory commented Jan 30, 2025

Hi @abirc8010
Can we please also keep the font size same as before for "Message #general"

@abirc8010
Copy link
Contributor Author

Hey @Spiral-Memory I made the modification.

@Spiral-Memory Spiral-Memory merged commit b501f76 into RocketChat:develop Jan 30, 2025
2 of 3 checks passed
@Spiral-Memory Spiral-Memory added enhancement New feature or request and removed testing labels Jan 30, 2025
github-actions bot added a commit that referenced this pull request Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants