-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat(reply): Integrate collaborators endpoint #484
Conversation
mxiao6
commented
May 11, 2020
•
edited
Loading
edited
- Fix tests
- More tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strongly suggest breaking things up with less tight coupling between components.
adce7c8
to
228ae85
Compare
); | ||
const PopupList = ({ items, reference, options, ...rest }: Props): JSX.Element => { | ||
return ( | ||
<PopupBase className="ba-PopupList" options={{ ...defaultOptions, ...options }} reference={reference}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will probably cause the popper to be re-rendered constantly due to the object reference changing per-render.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the finding here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the finding here?
I feel I eventually need to pass in options in the future. But since it's not used in this pr, I will remove it.
src/components/Popups/ReplyField/__tests__/MentionItem-test.tsx
Outdated
Show resolved
Hide resolved
activeItemIndex?: number; | ||
itemRowAs?: JSX.Element; | ||
items: Record<string, unknown>[]; | ||
onSelect: (index: number, event: React.SyntheticEvent) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the event
used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the
event
used anywhere?
not now, but I think we should provide this info to the parent and parent can choose to use it or not.
editorState: prevEditorState, | ||
popupReference: null, | ||
}; | ||
} | ||
|
||
componentDidMount(): void { | ||
this.focusEditor(); | ||
// restore PopupList if it was active | ||
this.updatePopupReference(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would this occur?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When would this occur?
zoom in/out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it also has popper position problem when you zoom in/out. I'll remove this line in this pr and address popper issue in an another pr.
); | ||
const PopupList = ({ items, reference, options, ...rest }: Props): JSX.Element => { | ||
return ( | ||
<PopupBase className="ba-PopupList" options={{ ...defaultOptions, ...options }} reference={reference}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the finding here?
@@ -0,0 +1,24 @@ | |||
import { CompositeDecorator, ContentBlock, ContentState, EditorState } from 'draft-js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file probably move to a more common location, like src/components
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file probably move to a more common location, like
src/components
.
But it's only used in the ReplyField
. Also MentionItem
has to move to src/components
with it, which may be confusing to people. It makes more sense to me to put it under its only consumer folder.
<PopupBase className="ba-PopupList" options={{ ...defaultOptions, ...options }} reference={reference}> | ||
{isEmpty(items) ? ( | ||
<div className="ba-PopupList-prompt"> | ||
<FormattedMessage {...messages.popupListPrompt} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a separate message for when a user has typed in a filter query but there are no results?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a separate message for when a user has typed in a filter query but there are no results?
Waiting for designer's response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rohit said that is ok
src/components/Popups/ReplyField/__tests__/MentionItem-test.tsx
Outdated
Show resolved
Hide resolved
@@ -1,12 +1,19 @@ | |||
import * as React from 'react'; | |||
import React from 'react'; | |||
import isEmpty from 'lodash/isEmpty'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is a new import. Is it needed or can we do !items.length
?