Conversation
WIP suggestion styles broke a whole lot of things cleanup logs
Generated by 🚫 dangerJS |
|
@mxstbr if you wouldn't mind taking a quick glance at this when you get a minute I'd love some (very) early feed back. Some high level questions / notes: I've stubbed out the search temporarily so that I can develop this locally without the algolia keys. I'm using the draft-js mentions plugin here and it seems to have functionality that would replace the existing mentions decorators. I've found that the two don't play very well together, so so far I've just used the out of the box functionality from the draft-js plugin for decorating mentions in both the editor (just the chat input so far) as well as the redraft rendered messages. Is that an ok approach? Obviously there will be ramifications (the ones I could think of I've itemized above). I was not planning on implementing this functionality in mobile for this PR. Would this feature existing in the web client but not the mobile apps just yet be tolerable? I do intend, however, to make sure that the existing mobile functionality stays intact! This PR will make some slight changes to the way mentions are communicated between the web app and the api. More specifically, those mentions are now being created as an actual To support older mentions for this change, would you advise maintaining support for both formats in code, or a db migration to update older mentions? Still early, but let me know of any other concerns should you be able to spot them! Thanks |
mxstbr
left a comment
There was a problem hiding this comment.
Thanks so much for kicking this off! Got a couple of minor code nitpicks inline, don't worry too much about those just yet though.
Overall the approach to just use the draft-js-mentions-plugin makes sense. There's just a couple UX things I immediately noticed:
- No loading indicator while searching (this should be an easy fix with the plugin)
- Having to confirm a mention. I can't type
Hey @mxstbr what's up?and expect it to mention @mxstbr—it won't be counted as a mention if I don't wait for the search to complete and then click it, which is annoying. I'd much rather it automatically links/mentions whatever I type (like it does now), but also gives me suggestions if I'm not sure how to spell a certain name. (not sure this can be fixed while using the plugin?)
Any clue how to change that second behavior?
| @@ -0,0 +1,34 @@ | |||
| import { withStateHandlers, compose, withProps } from 'recompose'; | |||
There was a problem hiding this comment.
nit: let's import these specifically, i.e.
import withStateHandlers from 'recompose/withStateHandlers';
import compose from 'recompose/compose';
// etc.| @@ -0,0 +1,34 @@ | |||
| import { withStateHandlers, compose, withProps } from 'recompose'; | |||
| import searchUsers from 'shared/graphql/queries/search/searchUsers'; | |||
| import { flatMap, map } from 'lodash'; | |||
There was a problem hiding this comment.
nit: let's get rid of this lodash usage since we don't use it anywhere on the client and don't really need it here either:
data.search ? data.search.searchResultsConnection.edges.map(({ node }) => node) : [];| import { QuotedMessage as QuotedMessageComponent } from '../message/view'; | ||
| import type { Dispatch } from 'redux'; | ||
| import withUserSearch from './hoc/withUserSearch'; | ||
| import { consolidateStreamedStyles } from 'styled-components'; |
Yeah that's kinda a bummer. It does not appear to be supported by the plugin. @mxstbr Should this PR be able to move forward without that? If not, I suppose we can file an issue over at https://github.com/draft-js-plugins/draft-js-plugins and see what they think! To me it looks like a solution hacked outside of the plugin might be tough. 😞 Will look into it a bit further though. |
Wow, that's surprising and really too bad. I agree with Max that the resulting experience should allow people to type usernames without having to go through any sort of dropdown and selection flow and we figure out how to tag them as mentions properly. FWIW I'd be totally fine removing all mentions highlighting in the chat input itself. I know it's helpful to have it share a lot of the same formatting code as the thread composer, but if the chat input didn't highlight usernames and we only parse those mentions in the rendered sent message, that could work too? |
|
Yeah surprising enough that it feels like I'm missing something. Will keep digging. Would forking this plugin be a tolerable option for you? |
|
Yeah totally fine with forking it! |
|
@mxstbr code is still a mess but I've made some modifications to override the behavior in regards to:
I think it's working as you envisioned now? |
|
yikes.. Don't waste time looking at this yet :). found a couple annoying bugs! |
|
@dan-weaver no worries, lmk when it's ready for review! |
|
When we have moved our chat input to plaintext (#4472) we also finally implemented this without having to hack around any DraftJS stuff! Thanks so much for your work on this @dan-weaver, really appreciate the contribution even though we did not end up merging it. This made building the current mention suggestions much easier! 🙏 🙏 🙏 |
Status
Deploy after merge (delete what needn't be deployed)
TODO: Not sure yet
Release notes for users (delete if codebase-only change)
Related issues (delete if you don't know of any)
Closes #2649
Current UI:
Chat Input:

thread message:
