Page MenuHomePhabricator

[web] Added ChatInputTextArea component
ClosedPublic

Authored by kuba on May 16 2023, 1:24 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Mar 28, 9:26 PM
Unknown Object (File)
Thu, Mar 28, 9:26 PM
Unknown Object (File)
Thu, Mar 28, 9:26 PM
Unknown Object (File)
Thu, Mar 28, 9:26 PM
Unknown Object (File)
Thu, Mar 28, 9:26 PM
Unknown Object (File)
Thu, Mar 28, 9:26 PM
Unknown Object (File)
Thu, Mar 28, 9:26 PM
Unknown Object (File)
Thu, Mar 28, 9:26 PM
Subscribers

Details

Summary

This components handles resizing of textarea, when amount of lines in text changes. It also provides Escape and Enter operations. It will be used later for the editing GUI.

Test Plan

Used component, checked if the height is adjusted correctly, checked if key operations work.

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Removed accidentally added styles

web/chat/chat-input-text-area.react.js
14 ↗(On Diff #26488)

Why do we need both BaseProps and Props? They appear to be identical

18 ↗(On Diff #26488)

In general, we tend to use function components when making a new component. Class components do have some advantages – in particular, the fact that callbacks don't always need to be recomputed.

Can you explain a bit more why you chose to use a class component here?

107 ↗(On Diff #26488)

Why don't you just pass ChatInputTextArea in here? What's the point of ConnectedChatInputBar? (Also ConnectedChatInputBar appears to be misnamed)

web/chat/chat-input-text-area.react.js
18 ↗(On Diff #26488)

I used it because it is used in most of the places. If the function component is preferred, I am going to change it to it.

107 ↗(On Diff #26488)

Right, there is no point in that.

kuba marked an inline comment as done.

Change to function component

michal added inline comments.
web/chat/chat-input-text-area.react.js
53–56 ↗(On Diff #26540)

Is this supposed to happen only at the first render? If yes, I feel like leaving the dependency array empty and silencing the eslint error makes it more explicit.

This revision is now accepted and ready to land.May 16 2023, 11:01 AM
web/chat/chat-input-text-area.react.js
53 ↗(On Diff #26638)

Not a big deal, but we usually do React.useEffect for this

kuba marked an inline comment as done.

Address review

Fix updating height after text changes

Fix - couldn't close edit modal