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

Add ReportActionItemThread and Thread Replies UI #18274

Merged
merged 33 commits into from
May 12, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
982c97b
Add new button for replying in threads
stitesExpensify Apr 27, 2023
e09ee8b
Add size prop
stitesExpensify Apr 27, 2023
1d40aa0
Add imageSize method
stitesExpensify Apr 28, 2023
4b919fd
change all sizes based on prop
stitesExpensify Apr 28, 2023
55aa13b
Add threads component
stitesExpensify Apr 28, 2023
8162704
Create new component to display threads in reportActions
stitesExpensify Apr 28, 2023
e7b3b9f
Add method for creating/opening threads
stitesExpensify May 1, 2023
4db53da
Pass the child reportactionID through the context menu
stitesExpensify May 1, 2023
8b31d03
Update API call to properly create optimistic thread report and repor…
stitesExpensify May 1, 2023
7761696
go back instead of always home
stitesExpensify May 1, 2023
bae93b4
Remove changes to navigation
stitesExpensify May 3, 2023
3b73583
Remove new openChildReport method
stitesExpensify May 3, 2023
10fe957
Extract more code to other PRs
stitesExpensify May 4, 2023
7780871
Merge branch 'main' into stites-threadUI
grgia May 4, 2023
a05a95a
Clean up thread styles, use Multiple Avatars
grgia May 4, 2023
0de7775
Undo changes to RoomHeaderAvatars that are already accomplished by Mu…
grgia May 4, 2023
9afd2f2
Add translations
grgia May 4, 2023
c75840a
Temporarily reference reportAction
grgia May 8, 2023
cd52ecc
Clean up, icon helper function
grgia May 10, 2023
b54a6b0
Allow to be pressed
grgia May 10, 2023
0f336e4
Merge branch 'main' into stites-threadUI
grgia May 10, 2023
00c1532
fix delimiter
grgia May 10, 2023
20bc93d
undo, my testing data was wrong
grgia May 10, 2023
35492e2
Clean up
grgia May 11, 2023
f69af26
Remove unused param docs
grgia May 11, 2023
1168c38
Merge branch 'main' of github.com:Expensify/App into stites-threadUI
stitesExpensify May 11, 2023
3104e3e
Add beta check
stitesExpensify May 11, 2023
f97c600
Add betas to proptypes
stitesExpensify May 11, 2023
779fa63
Rename to getIconsForParticipants and fix param type
grgia May 12, 2023
628de21
Merge branch 'main' into stites-threadUI
grgia May 12, 2023
087862e
Make text not selectable
grgia May 12, 2023
67d6171
Merge branch 'main' into stites-threadUI
grgia May 12, 2023
30f5eba
Don't show on thread preview (first chat in thread)
grgia May 12, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1274,4 +1274,8 @@ export default {
chatUserDisplayNames: 'Chat user display names',
scrollToNewestMessages: 'Scroll to newest messages',
},
threads: {
lastReplyAt: 'Last Reply at',
replies: 'Replies',
},
};
4 changes: 4 additions & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -1735,4 +1735,8 @@ export default {
chatUserDisplayNames: 'Nombres de los usuarios del chat',
scrollToNewestMessages: 'Desplázate a los mensajes más recientes',
},
threads: {
lastReplyAt: 'Última respuesta a las',
replies: 'Respuestas',
},
};
1 change: 1 addition & 0 deletions src/libs/actions/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ function addComment(reportID, text) {
* @param {String} reportID
* @param {Array} participantList The list of users that are included in a new chat, not including the user creating it
* @param {Object} newReportObject The optimistic report object created when making a new chat, saved as optimistic data
* @param {String} parentReportActionID The report action that a thread was created off of (only passed for threads)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks like we got rid of this param

*/
function openReport(reportID, participantList = [], newReportObject = {}) {
const optimisticReportData = {
Expand Down
4 changes: 4 additions & 0 deletions src/pages/home/report/ReportActionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import ReportActionItemMessage from './ReportActionItemMessage';
import UnreadActionIndicator from '../../../components/UnreadActionIndicator';
import ReportActionItemMessageEdit from './ReportActionItemMessageEdit';
import ReportActionItemCreated from './ReportActionItemCreated';
import ReportActionItemThread from './ReportActionItemThread';
import compose from '../../../libs/compose';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../../components/withWindowDimensions';
import ControlSelection from '../../../libs/ControlSelection';
Expand Down Expand Up @@ -163,6 +164,7 @@ class ReportActionItem extends Component {
this.checkIfContextMenuActive,
ReportUtils.isArchivedRoom(this.props.report),
ReportUtils.chatIncludesChronos(this.props.report),
this.props.action.childReportID,
grgia marked this conversation as resolved.
Show resolved Hide resolved
);
}

Expand Down Expand Up @@ -244,6 +246,7 @@ class ReportActionItem extends Component {
toggleReaction={this.toggleReaction}
/>
)}
<ReportActionItemThread numberOfReplies={7} mostRecentReply={'1:03pm'} icons={ReportUtils.getIcons(this.props.report, this.props.personalDetails)} />
Copy link
Contributor

Choose a reason for hiding this comment

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

@chiragsalian how are we handling the conditional rendering of this. Would we just check if this.props.action.childReportID exists?

Copy link
Contributor

Choose a reason for hiding this comment

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

ReportUtils.js isThread?

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed 1:1, yes just checking this.props.action.childReportID should suffice to render this item.

</>
);
}
Expand Down Expand Up @@ -354,6 +357,7 @@ class ReportActionItem extends Component {
}
draftMessage={this.props.draftMessage}
isChronosReport={ReportUtils.chatIncludesChronos(this.props.report)}
childReportActionID={this.props.action.childReportActionID}
grgia marked this conversation as resolved.
Show resolved Hide resolved
/>
</View>
)}
Expand Down
59 changes: 59 additions & 0 deletions src/pages/home/report/ReportActionItemThread.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import React from 'react';
import {View, Pressable, Text} from 'react-native';
import PropTypes from 'prop-types';
import _ from 'underscore';
import lodashGet from 'lodash/get';
import styles from '../../../styles/styles';
import ReportActionItemFragment from './ReportActionItemFragment';
import reportActionPropTypes from './reportActionPropTypes';
import * as Report from '../../../libs/actions/Report';
import withLocalize, {withLocalizePropTypes} from '../../../components/withLocalize';
import CONST from "../../../CONST";
import avatarPropTypes from "../../../components/avatarPropTypes";
import themeColors from "../../../styles/themes/default";
import MultipleAvatars from '../../../components/MultipleAvatars';

const propTypes = {
// childReportID: PropTypes.number.isRequired,

grgia marked this conversation as resolved.
Show resolved Hide resolved
icons: PropTypes.arrayOf(avatarPropTypes).isRequired,

numberOfReplies: PropTypes.number.isRequired,

mostRecentReply: PropTypes.string.isRequired,

childReportID: PropTypes.string.isRequired,

/** localization props */
...withLocalizePropTypes,
};

const ReportActionItemThread = props => (
<View style={[styles.chatItemMessage]}>
<Pressable
grgia marked this conversation as resolved.
Show resolved Hide resolved
onPress={() => {
// Report.OpenChildReport(props.childReportID)
return '';
}}
>
<View style={[styles.flexRow, styles.alignItemsCenter, styles.mt2]}>
grgia marked this conversation as resolved.
Show resolved Hide resolved
<MultipleAvatars
grgia marked this conversation as resolved.
Show resolved Hide resolved
size={CONST.AVATAR_SIZE.SMALLER}
icons={props.icons}
shouldStackHorizontally
grgia marked this conversation as resolved.
Show resolved Hide resolved
avatarTooltips={_.map(props.icons, icon => icon.name)}
/>
<View style={[styles.flexRow, styles.lhPercent, styles.alignItemsEnd]}>
<Text style={[styles.link, styles.ml2, styles.h4]}>{`${props.numberOfReplies} ${props.translate('threads.replies')}`}</Text>
<Text style={[styles.ml2, styles.textMicroSupporting]}>{`${props.translate('threads.lastReplyAt')} ${props.mostRecentReply}`}</Text>
</View>
</View>

</Pressable>
</View>
);

ReportActionItemThread.propTypes = propTypes;
ReportActionItemThread.displayName = 'ReportActionItemThread';

export default withLocalize(ReportActionItemThread);
4 changes: 4 additions & 0 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,10 @@ const styles = {
lineHeight: 16,
},

lhPercent: {
grgia marked this conversation as resolved.
Show resolved Hide resolved
lineHeight: '140%',
},

formHelp: {
color: themeColors.textSupporting,
fontSize: variables.fontSizeLabel,
Expand Down