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

feat(reply): Integrate collaborators endpoint #484

Merged
merged 1 commit into from
May 15, 2020

Conversation

mxiao6
Copy link
Contributor

@mxiao6 mxiao6 commented May 11, 2020

  • Fix tests
  • More tests

@mxiao6 mxiao6 requested a review from a team as a code owner May 11, 2020 17:43
@mxiao6 mxiao6 marked this pull request as draft May 11, 2020 18:05
src/components/Popups/ReplyField/MentionItem.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/PopupList.scss Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/PopupList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/PopupList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/PopupList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@jstoffan jstoffan left a 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.

src/components/Popups/ReplyField/PopupList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/PopupList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/PopupList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/MentionItem.tsx Outdated Show resolved Hide resolved
@mxiao6 mxiao6 force-pushed the collab-mentions-2 branch from c34f654 to 71fd902 Compare May 12, 2020 17:46
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/MentionItem.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ItemList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ItemList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
@mxiao6 mxiao6 force-pushed the collab-mentions-2 branch 2 times, most recently from adce7c8 to 228ae85 Compare May 13, 2020 06:38
@mxiao6 mxiao6 marked this pull request as ready for review May 13, 2020 17:33
src/components/Popups/ReplyField/DefaultItemRow.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ItemList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ItemList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ItemList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ItemList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ItemList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/MentionItem.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/MentionItem.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/DefaultItemRow.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/PopupList.tsx Outdated Show resolved Hide resolved
);
const PopupList = ({ items, reference, options, ...rest }: Props): JSX.Element => {
return (
<PopupBase className="ba-PopupList" options={{ ...defaultOptions, ...options }} reference={reference}>
Copy link
Collaborator

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.

Copy link
Collaborator

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?

Copy link
Contributor Author

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.

@mxiao6 mxiao6 force-pushed the collab-mentions-2 branch from 6c0ef80 to eb20b7f Compare May 14, 2020 01:25
src/components/Popups/ReplyField/ItemRow.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/PopupList.tsx Outdated Show resolved Hide resolved
activeItemIndex?: number;
itemRowAs?: JSX.Element;
items: Record<string, unknown>[];
onSelect: (index: number, event: React.SyntheticEvent) => void;
Copy link
Contributor

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?

Copy link
Contributor Author

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.

src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
editorState: prevEditorState,
popupReference: null,
};
}

componentDidMount(): void {
this.focusEditor();
// restore PopupList if it was active
this.updatePopupReference();
Copy link
Contributor

Choose a reason for hiding this comment

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

When would this occur?

Copy link
Contributor Author

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

Copy link
Contributor Author

@mxiao6 mxiao6 May 14, 2020

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.

src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
@mxiao6 mxiao6 force-pushed the collab-mentions-2 branch from 6a0caf6 to 11bf610 Compare May 14, 2020 21:15
src/components/Popups/ReplyField/ItemList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ItemList.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ItemList.tsx Outdated Show resolved Hide resolved
);
const PopupList = ({ items, reference, options, ...rest }: Props): JSX.Element => {
return (
<PopupBase className="ba-PopupList" options={{ ...defaultOptions, ...options }} reference={reference}>
Copy link
Collaborator

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?

src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.tsx Outdated Show resolved Hide resolved
@@ -0,0 +1,24 @@
import { CompositeDecorator, ContentBlock, ContentState, EditorState } from 'draft-js';
Copy link
Collaborator

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.

Copy link
Contributor Author

@mxiao6 mxiao6 May 15, 2020

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.

@jstoffan jstoffan self-requested a review May 14, 2020 22:33
<PopupBase className="ba-PopupList" options={{ ...defaultOptions, ...options }} reference={reference}>
{isEmpty(items) ? (
<div className="ba-PopupList-prompt">
<FormattedMessage {...messages.popupListPrompt} />
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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/ItemList/ItemRow.scss Outdated Show resolved Hide resolved
src/components/ItemList/ItemRow.scss Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/PopupList.scss Outdated Show resolved Hide resolved
src/components/Popups/ReplyField/ReplyField.scss Outdated Show resolved Hide resolved
@mxiao6 mxiao6 force-pushed the collab-mentions-2 branch from 904e751 to 0c40590 Compare May 15, 2020 20:58
@mxiao6 mxiao6 requested a review from jstoffan May 15, 2020 20:59
@@ -1,12 +1,19 @@
import * as React from 'react';
import React from 'react';
import isEmpty from 'lodash/isEmpty';
Copy link
Collaborator

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?

@mergify mergify bot merged commit 619e7be into box:master May 15, 2020
@mxiao6 mxiao6 deleted the collab-mentions-2 branch August 13, 2020 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants