From b1e7f332647037978451165d601059bd5555c101 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Tue, 19 Sep 2023 14:16:44 +0800 Subject: [PATCH 01/13] move call buttons and pin button to overflow menu --- src/pages/home/HeaderView.js | 57 +++++++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 10 deletions(-) diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index 477d063c1747..a33c7b86796e 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -14,7 +14,6 @@ import SubscriptAvatar from '../../components/SubscriptAvatar'; import DisplayNames from '../../components/DisplayNames'; import * as OptionsListUtils from '../../libs/OptionsListUtils'; import participantPropTypes from '../../components/participantPropTypes'; -import VideoChatButtonAndMenu from '../../components/VideoChatButtonAndMenu'; import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; import CONST from '../../CONST'; import * as ReportUtils from '../../libs/ReportUtils'; @@ -27,10 +26,14 @@ import ThreeDotsMenu from '../../components/ThreeDotsMenu'; import * as Task from '../../libs/actions/Task'; import reportActionPropTypes from './report/reportActionPropTypes'; import PressableWithoutFeedback from '../../components/Pressable/PressableWithoutFeedback'; -import PinButton from '../../components/PinButton'; import TaskHeaderActionButton from '../../components/TaskHeaderActionButton'; import * as ReportActionsUtils from '../../libs/ReportActionsUtils'; import ParentNavigationSubtitle from '../../components/ParentNavigationSubtitle'; +import ZoomIcon from '../../../assets/images/zoom-icon.svg'; +import GoogleMeetIcon from '../../../assets/images/google-meet.svg'; +import * as Link from '../../libs/actions/Link'; +import * as Report from '../../libs/actions/Report'; +import * as Session from '../../libs/actions/Session'; const propTypes = { /** Toggles the navigationMenu open and closed */ @@ -99,7 +102,6 @@ function HeaderView(props) { // We hide the button when we are chatting with an automated Expensify account since it's not possible to contact // these users via alternative means. It is possible to request a call with Concierge so we leave the option for them. - const shouldShowCallButton = (isConcierge && guideCalendarLink) || (!isAutomatedExpensifyAccount && !isTaskReport); const threeDotMenuItems = []; if (isTaskReport && !isCanceledTaskReport) { const canModifyTask = Task.canModifyTask(props.report, props.session.accountID); @@ -129,6 +131,48 @@ function HeaderView(props) { }); } } + + if (!props.report.isPinned) { + threeDotMenuItems.push({ + icon: Expensicons.Pin, + iconFill: themeColors.icon, + text: props.translate('common.pin'), + onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned)), + }); + } else { + threeDotMenuItems.push({ + icon: Expensicons.Pin, + iconFill: themeColors.heading, + text: props.translate('common.unPin'), + onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned)), + }); + } + + if (isConcierge && guideCalendarLink) { + threeDotMenuItems.push({ + icon: Expensicons.Phone, + text: props.translate('videoChatButtonAndMenu.tooltip'), + onSelected: () => { + Link.openExternalLink(props.guideCalendarLink); + }, + }); + } else if ((isConcierge && guideCalendarLink) || (!isAutomatedExpensifyAccount && !isTaskReport)) { + threeDotMenuItems.push({ + icon: ZoomIcon, + text: props.translate('videoChatButtonAndMenu.zoom'), + onSelected: () => { + Link.openExternalLink(CONST.NEW_ZOOM_MEETING_URL); + }, + }); + threeDotMenuItems.push({ + icon: GoogleMeetIcon, + text: props.translate('videoChatButtonAndMenu.googleMeet'), + onSelected: () => { + Link.openExternalLink(CONST.NEW_GOOGLE_MEET_MEETING_URL); + }, + }); + } + const shouldShowThreeDotsButton = !!threeDotMenuItems.length; const shouldShowSubscript = ReportUtils.shouldReportShowSubscript(props.report); @@ -219,13 +263,6 @@ function HeaderView(props) { {isTaskReport && !props.isSmallScreenWidth && ReportUtils.isOpenTaskReport(props.report) && } - {shouldShowCallButton && ( - - )} - {shouldShowThreeDotsButton && ( Date: Wed, 20 Sep 2023 16:21:36 +0800 Subject: [PATCH 02/13] add and leave thread buttons --- src/languages/en.ts | 3 +++ src/languages/es.ts | 3 +++ src/pages/home/HeaderView.js | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/src/languages/en.ts b/src/languages/en.ts index 3a1e689e356a..c1cdadcfc3c1 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -139,7 +139,9 @@ export default { download: 'Download', downloading: 'Downloading', pin: 'Pin', + pinConversation: 'Pin conversation', unPin: 'Unpin', + unPinConversation: 'Unpin conversation', back: 'Back', saveAndContinue: 'Save & continue', settings: 'Settings', @@ -206,6 +208,7 @@ export default { debitCard: 'Debit card', bankAccount: 'Bank account', join: 'Join', + joinThread: 'Join thread', decline: 'Decline', transferBalance: 'Transfer balance', cantFindAddress: "Can't find your address? ", diff --git a/src/languages/es.ts b/src/languages/es.ts index 036c5fc0d266..aa12a470d232 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -129,7 +129,9 @@ export default { download: 'Descargar', downloading: 'Descargando', pin: 'Fijar', + pinConversation: 'NEED TO TRANSLATE', unPin: 'Desfijar', + unPinConversation: 'NEED TO TRANSLATE', back: 'Volver', saveAndContinue: 'Guardar y continuar', settings: 'Configuración', @@ -196,6 +198,7 @@ export default { debitCard: 'Tarjeta de débito', bankAccount: 'Cuenta bancaria', join: 'Unirse', + joinThread: 'NEED TO TRANSLATE', decline: 'Rechazar', transferBalance: 'Transferencia de saldo', cantFindAddress: '¿No encuentras tu dirección? ', diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index a33c7b86796e..311b7c184c04 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -132,6 +132,24 @@ function HeaderView(props) { } } + if (isChatThread) { + if (props.report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { + threeDotMenuItems.push({ + icon: Expensicons.Exit, + iconFill: themeColors.icon, + text: props.translate('common.leaveThread'), + onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned)), + }); + } else { + threeDotMenuItems.push({ + icon: Expensicons.ChatBubble, + iconFill: themeColors.icon, + text: props.translate('common.joinThread'), + onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned)), + }); + } + } + if (!props.report.isPinned) { threeDotMenuItems.push({ icon: Expensicons.Pin, From 0f942c54f9616750b2eca6ee9257caae93e6f3ef Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Thu, 21 Sep 2023 12:08:41 +0800 Subject: [PATCH 03/13] join and leave functionality for threads --- src/libs/actions/Report.js | 27 +++++++++++++++++++++++++++ src/pages/ReportDetailsPage.js | 2 +- src/pages/home/HeaderView.js | 4 ++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 2a34c839a94e..0cdec7b7ad3f 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1205,6 +1205,32 @@ function saveReportActionDraftNumberOfLines(reportID, reportActionID, numberOfLi Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_DRAFT_COMMENT_NUMBER_OF_LINES}${reportID}_${reportActionID}`, numberOfLines); } +/** + * @param {String} reportID + * @param {String} previousValue + * @param {String} newValue + */ +function updateNotificationPreference(reportID, previousValue, newValue) { + if (previousValue === newValue) { + return; + } + const optimisticData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, + value: {notificationPreference: newValue}, + }, + ]; + const failureData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, + value: {notificationPreference: previousValue}, + }, + ]; + API.write('UpdateReportNotificationPreference', {reportID, notificationPreference: newValue}, {optimisticData, failureData}); +} + /** * @param {String} reportID * @param {String} previousValue @@ -2066,6 +2092,7 @@ export { updateWelcomeMessage, updateWriteCapabilityAndNavigate, updateNotificationPreferenceAndNavigate, + updateNotificationPreference, subscribeToReportTypingEvents, unsubscribeFromReportChannel, saveReportComment, diff --git a/src/pages/ReportDetailsPage.js b/src/pages/ReportDetailsPage.js index 3a9e0f5c2eb8..16f2f462c5ec 100644 --- a/src/pages/ReportDetailsPage.js +++ b/src/pages/ReportDetailsPage.js @@ -124,7 +124,7 @@ function ReportDetailsPage(props) { }); } - if (isUserCreatedPolicyRoom || canLeaveRoom || isThread) { + if (isUserCreatedPolicyRoom || canLeaveRoom) { items.push({ key: CONST.REPORT_DETAILS_MENU_ITEM.LEAVE_ROOM, translationKey: isThread ? 'common.leaveThread' : 'common.leaveRoom', diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index 311b7c184c04..95af3dab00b7 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -138,14 +138,14 @@ function HeaderView(props) { icon: Expensicons.Exit, iconFill: themeColors.icon, text: props.translate('common.leaveThread'), - onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned)), + onSelected: () => Report.leaveRoom(props.report.reportID), }); } else { threeDotMenuItems.push({ icon: Expensicons.ChatBubble, iconFill: themeColors.icon, text: props.translate('common.joinThread'), - onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned)), + onSelected: () => Report.updateNotificationPreference(props.report.reportID, props.report.notificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS), }); } } From d38dd073d904038a752d157d411d555c0076814a Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Thu, 21 Sep 2023 12:22:47 +0800 Subject: [PATCH 04/13] icon fill and new zoom/google meet icons --- assets/images/google-meet.svg | 15 ++++---- assets/images/zoom-icon.svg | 8 +++- src/components/PopoverMenu/index.js | 1 + src/pages/home/HeaderView.js | 60 ++++++++++++++++------------- 4 files changed, 48 insertions(+), 36 deletions(-) diff --git a/assets/images/google-meet.svg b/assets/images/google-meet.svg index 138a11859321..980cd102f67a 100644 --- a/assets/images/google-meet.svg +++ b/assets/images/google-meet.svg @@ -1,8 +1,7 @@ - \ No newline at end of file + + + + + diff --git a/assets/images/zoom-icon.svg b/assets/images/zoom-icon.svg index 6c6ed03cb2f3..24d019654795 100644 --- a/assets/images/zoom-icon.svg +++ b/assets/images/zoom-icon.svg @@ -1 +1,7 @@ - \ No newline at end of file + + + + + diff --git a/src/components/PopoverMenu/index.js b/src/components/PopoverMenu/index.js index 5fabf73547ea..4cdc7a5a4f47 100644 --- a/src/components/PopoverMenu/index.js +++ b/src/components/PopoverMenu/index.js @@ -98,6 +98,7 @@ function PopoverMenu(props) { icon={item.icon} iconWidth={item.iconWidth} iconHeight={item.iconHeight} + iconFill={item.iconFill} title={item.text} description={item.description} onPress={() => selectItem(menuIndex)} diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index 95af3dab00b7..365572078118 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -1,39 +1,39 @@ -import _ from 'underscore'; -import React from 'react'; -import {View} from 'react-native'; -import PropTypes from 'prop-types'; import lodashGet from 'lodash/get'; -import {withOnyx} from 'react-native-onyx'; -import styles from '../../styles/styles'; +import PropTypes from 'prop-types'; +import React from 'react'; +import { View } from 'react-native'; +import { withOnyx } from 'react-native-onyx'; +import _ from 'underscore'; +import GoogleMeetIcon from '../../../assets/images/google-meet.svg'; +import ZoomIcon from '../../../assets/images/zoom-icon.svg'; +import CONST from '../../CONST'; +import ONYXKEYS from '../../ONYXKEYS'; +import DisplayNames from '../../components/DisplayNames'; import Icon from '../../components/Icon'; import * as Expensicons from '../../components/Icon/Expensicons'; -import compose from '../../libs/compose'; -import withWindowDimensions, {windowDimensionsPropTypes} from '../../components/withWindowDimensions'; import MultipleAvatars from '../../components/MultipleAvatars'; +import ParentNavigationSubtitle from '../../components/ParentNavigationSubtitle'; +import PressableWithoutFeedback from '../../components/Pressable/PressableWithoutFeedback'; import SubscriptAvatar from '../../components/SubscriptAvatar'; -import DisplayNames from '../../components/DisplayNames'; -import * as OptionsListUtils from '../../libs/OptionsListUtils'; -import participantPropTypes from '../../components/participantPropTypes'; -import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; -import CONST from '../../CONST'; -import * as ReportUtils from '../../libs/ReportUtils'; +import TaskHeaderActionButton from '../../components/TaskHeaderActionButton'; import Text from '../../components/Text'; -import Tooltip from '../../components/Tooltip'; -import themeColors from '../../styles/themes/default'; -import reportPropTypes from '../reportPropTypes'; -import ONYXKEYS from '../../ONYXKEYS'; import ThreeDotsMenu from '../../components/ThreeDotsMenu'; -import * as Task from '../../libs/actions/Task'; -import reportActionPropTypes from './report/reportActionPropTypes'; -import PressableWithoutFeedback from '../../components/Pressable/PressableWithoutFeedback'; -import TaskHeaderActionButton from '../../components/TaskHeaderActionButton'; +import Tooltip from '../../components/Tooltip'; +import participantPropTypes from '../../components/participantPropTypes'; +import withLocalize, { withLocalizePropTypes } from '../../components/withLocalize'; +import withWindowDimensions, { windowDimensionsPropTypes } from '../../components/withWindowDimensions'; +import * as OptionsListUtils from '../../libs/OptionsListUtils'; import * as ReportActionsUtils from '../../libs/ReportActionsUtils'; -import ParentNavigationSubtitle from '../../components/ParentNavigationSubtitle'; -import ZoomIcon from '../../../assets/images/zoom-icon.svg'; -import GoogleMeetIcon from '../../../assets/images/google-meet.svg'; +import * as ReportUtils from '../../libs/ReportUtils'; import * as Link from '../../libs/actions/Link'; import * as Report from '../../libs/actions/Report'; import * as Session from '../../libs/actions/Session'; +import * as Task from '../../libs/actions/Task'; +import compose from '../../libs/compose'; +import styles from '../../styles/styles'; +import themeColors from '../../styles/themes/default'; +import reportPropTypes from '../reportPropTypes'; +import reportActionPropTypes from './report/reportActionPropTypes'; const propTypes = { /** Toggles the navigationMenu open and closed */ @@ -108,6 +108,7 @@ function HeaderView(props) { if (ReportUtils.isOpenTaskReport(props.report) && canModifyTask) { threeDotMenuItems.push({ icon: Expensicons.Checkmark, + iconFill: themeColors.icon, text: props.translate('task.markAsDone'), onSelected: () => Task.completeTask(props.report, title), }); @@ -117,6 +118,7 @@ function HeaderView(props) { if (ReportUtils.isCompletedTaskReport(props.report) && canModifyTask) { threeDotMenuItems.push({ icon: Expensicons.Checkmark, + iconFill: themeColors.icon, text: props.translate('task.markAsIncomplete'), onSelected: () => Task.reopenTask(props.report, title), }); @@ -126,6 +128,7 @@ function HeaderView(props) { if (props.report.stateNum !== CONST.REPORT.STATE_NUM.SUBMITTED && props.report.statusNum !== CONST.REPORT.STATUS.CLOSED && canModifyTask) { threeDotMenuItems.push({ icon: Expensicons.Trashcan, + iconFill: themeColors.icon, text: props.translate('common.cancel'), onSelected: () => Task.cancelTask(props.report.reportID, props.report.reportName, props.report.stateNum, props.report.statusNum), }); @@ -154,14 +157,14 @@ function HeaderView(props) { threeDotMenuItems.push({ icon: Expensicons.Pin, iconFill: themeColors.icon, - text: props.translate('common.pin'), + text: props.translate('common.pinConversation'), onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned)), }); } else { threeDotMenuItems.push({ icon: Expensicons.Pin, iconFill: themeColors.heading, - text: props.translate('common.unPin'), + text: props.translate('common.unPinConversation'), onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned)), }); } @@ -169,6 +172,7 @@ function HeaderView(props) { if (isConcierge && guideCalendarLink) { threeDotMenuItems.push({ icon: Expensicons.Phone, + iconFill: themeColors.icon, text: props.translate('videoChatButtonAndMenu.tooltip'), onSelected: () => { Link.openExternalLink(props.guideCalendarLink); @@ -177,6 +181,7 @@ function HeaderView(props) { } else if ((isConcierge && guideCalendarLink) || (!isAutomatedExpensifyAccount && !isTaskReport)) { threeDotMenuItems.push({ icon: ZoomIcon, + iconFill: themeColors.icon, text: props.translate('videoChatButtonAndMenu.zoom'), onSelected: () => { Link.openExternalLink(CONST.NEW_ZOOM_MEETING_URL); @@ -184,6 +189,7 @@ function HeaderView(props) { }); threeDotMenuItems.push({ icon: GoogleMeetIcon, + iconFill: themeColors.icon, text: props.translate('videoChatButtonAndMenu.googleMeet'), onSelected: () => { Link.openExternalLink(CONST.NEW_GOOGLE_MEET_MEETING_URL); From f50eb7cb091a5ee483dbab57e4c96b5967cabbec Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Thu, 21 Sep 2023 12:25:48 +0800 Subject: [PATCH 05/13] wrong color for unpin icon --- src/pages/home/HeaderView.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index 365572078118..e197391d2149 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -1,8 +1,8 @@ import lodashGet from 'lodash/get'; import PropTypes from 'prop-types'; import React from 'react'; -import { View } from 'react-native'; -import { withOnyx } from 'react-native-onyx'; +import {View} from 'react-native'; +import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import GoogleMeetIcon from '../../../assets/images/google-meet.svg'; import ZoomIcon from '../../../assets/images/zoom-icon.svg'; @@ -20,8 +20,8 @@ import Text from '../../components/Text'; import ThreeDotsMenu from '../../components/ThreeDotsMenu'; import Tooltip from '../../components/Tooltip'; import participantPropTypes from '../../components/participantPropTypes'; -import withLocalize, { withLocalizePropTypes } from '../../components/withLocalize'; -import withWindowDimensions, { windowDimensionsPropTypes } from '../../components/withWindowDimensions'; +import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; +import withWindowDimensions, {windowDimensionsPropTypes} from '../../components/withWindowDimensions'; import * as OptionsListUtils from '../../libs/OptionsListUtils'; import * as ReportActionsUtils from '../../libs/ReportActionsUtils'; import * as ReportUtils from '../../libs/ReportUtils'; @@ -163,7 +163,7 @@ function HeaderView(props) { } else { threeDotMenuItems.push({ icon: Expensicons.Pin, - iconFill: themeColors.heading, + iconFill: themeColors.icon, text: props.translate('common.unPinConversation'), onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned)), }); From 5efd054551b69413eec52c56d18e9a26bf81e4fd Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Fri, 22 Sep 2023 16:32:15 +0800 Subject: [PATCH 06/13] refactor to use same method for notification preference --- src/libs/actions/Report.js | 34 ++++--------------- src/pages/home/HeaderView.js | 2 +- .../FloatingActionButtonAndPopover.js | 2 +- .../Report/NotificationPreferencePage.js | 2 +- 4 files changed, 9 insertions(+), 31 deletions(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 0cdec7b7ad3f..5a95555bac78 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -1209,9 +1209,13 @@ function saveReportActionDraftNumberOfLines(reportID, reportActionID, numberOfLi * @param {String} reportID * @param {String} previousValue * @param {String} newValue + * @param {boolean} navigate */ -function updateNotificationPreference(reportID, previousValue, newValue) { +function updateNotificationPreference(reportID, previousValue, newValue, navigate) { if (previousValue === newValue) { + if (navigate) { + Navigation.goBack(ROUTES.getReportSettingsRoute(reportID)); + } return; } const optimisticData = [ @@ -1229,34 +1233,9 @@ function updateNotificationPreference(reportID, previousValue, newValue) { }, ]; API.write('UpdateReportNotificationPreference', {reportID, notificationPreference: newValue}, {optimisticData, failureData}); -} - -/** - * @param {String} reportID - * @param {String} previousValue - * @param {String} newValue - */ -function updateNotificationPreferenceAndNavigate(reportID, previousValue, newValue) { - if (previousValue === newValue) { + if (navigate) { Navigation.goBack(ROUTES.getReportSettingsRoute(reportID)); - return; } - const optimisticData = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, - value: {notificationPreference: newValue}, - }, - ]; - const failureData = [ - { - onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, - value: {notificationPreference: previousValue}, - }, - ]; - API.write('UpdateReportNotificationPreference', {reportID, notificationPreference: newValue}, {optimisticData, failureData}); - Navigation.goBack(ROUTES.getReportSettingsRoute(reportID)); } /** @@ -2091,7 +2070,6 @@ export { reconnect, updateWelcomeMessage, updateWriteCapabilityAndNavigate, - updateNotificationPreferenceAndNavigate, updateNotificationPreference, subscribeToReportTypingEvents, unsubscribeFromReportChannel, diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index e197391d2149..05957a87462a 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -148,7 +148,7 @@ function HeaderView(props) { icon: Expensicons.ChatBubble, iconFill: themeColors.icon, text: props.translate('common.joinThread'), - onSelected: () => Report.updateNotificationPreference(props.report.reportID, props.report.notificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS), + onSelected: () => Report.updateNotificationPreference(props.report.reportID, props.report.notificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false), }); } } diff --git a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js index 26cd4b180109..3831af719e46 100644 --- a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js +++ b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js @@ -119,7 +119,7 @@ function FloatingActionButtonAndPopover(props) { * - Pressing the floating action button to open the CreateMenu modal * - Selecting an item on CreateMenu or closing it by clicking outside of the modal component */ - const hideCreateMenu = useCallback( + const hideCreateMernu = useCallback( () => { if (!isCreateMenuActive) { return; diff --git a/src/pages/settings/Report/NotificationPreferencePage.js b/src/pages/settings/Report/NotificationPreferencePage.js index 17bd77a235ce..4d0fa3f48f0f 100644 --- a/src/pages/settings/Report/NotificationPreferencePage.js +++ b/src/pages/settings/Report/NotificationPreferencePage.js @@ -51,7 +51,7 @@ function NotificationPreferencePage(props) { /> Report.updateNotificationPreferenceAndNavigate(props.report.reportID, props.report.notificationPreference, option.value)} + onSelectRow={(option) => Report.updateNotificationPreference(props.report.reportID, props.report.notificationPreference, option.value, true)} hideSectionHeaders optionHoveredStyle={{ ...styles.hoveredComponentBG, From 4b4fb23dc3115fa36c8987a8c10f36b64857a53f Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Fri, 22 Sep 2023 16:35:22 +0800 Subject: [PATCH 07/13] revert accidental letter change --- .../sidebar/SidebarScreen/FloatingActionButtonAndPopover.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js index 3831af719e46..26cd4b180109 100644 --- a/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js +++ b/src/pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover.js @@ -119,7 +119,7 @@ function FloatingActionButtonAndPopover(props) { * - Pressing the floating action button to open the CreateMenu modal * - Selecting an item on CreateMenu or closing it by clicking outside of the modal component */ - const hideCreateMernu = useCallback( + const hideCreateMenu = useCallback( () => { if (!isCreateMenuActive) { return; From a3dffb3ca432e01c03255bc0072980fe9f1caf33 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Mon, 25 Sep 2023 14:42:31 +0800 Subject: [PATCH 08/13] add chat bubbles --- assets/images/chatbubbles.svg | 12 ++++++++++++ src/components/Icon/Expensicons.js | 2 ++ src/pages/home/HeaderView.js | 16 ++++++++-------- 3 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 assets/images/chatbubbles.svg diff --git a/assets/images/chatbubbles.svg b/assets/images/chatbubbles.svg new file mode 100644 index 000000000000..6194c43e631e --- /dev/null +++ b/assets/images/chatbubbles.svg @@ -0,0 +1,12 @@ + + + + + + diff --git a/src/components/Icon/Expensicons.js b/src/components/Icon/Expensicons.js index a0c8b72d755a..810bbc86b5dc 100644 --- a/src/components/Icon/Expensicons.js +++ b/src/components/Icon/Expensicons.js @@ -19,6 +19,7 @@ import Camera from '../../../assets/images/camera.svg'; import Car from '../../../assets/images/car.svg'; import Cash from '../../../assets/images/cash.svg'; import ChatBubble from '../../../assets/images/chatbubble.svg'; +import ChatBubbles from '../../../assets/images/chatbubbles.svg'; import Checkmark from '../../../assets/images/checkmark.svg'; import Chair from '../../../assets/images/chair.svg'; import Close from '../../../assets/images/close.svg'; @@ -147,6 +148,7 @@ export { Car, Cash, ChatBubble, + ChatBubbles, Checkmark, Chair, Close, diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index 05957a87462a..91293036f3e2 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -136,19 +136,19 @@ function HeaderView(props) { } if (isChatThread) { - if (props.report.notificationPreference !== CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { + if (props.report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { threeDotMenuItems.push({ - icon: Expensicons.Exit, + icon: Expensicons.ChatBubbles, iconFill: themeColors.icon, - text: props.translate('common.leaveThread'), - onSelected: () => Report.leaveRoom(props.report.reportID), + text: props.translate('common.joinThread'), + onSelected: () => Report.updateNotificationPreference(props.report.reportID, props.report.notificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false), }); - } else { + } else if (props.report.notificationPreference.length) { threeDotMenuItems.push({ - icon: Expensicons.ChatBubble, + icon: Expensicons.ChatBubbles, iconFill: themeColors.icon, - text: props.translate('common.joinThread'), - onSelected: () => Report.updateNotificationPreference(props.report.reportID, props.report.notificationPreference, CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, false), + text: props.translate('common.leaveThread'), + onSelected: () => Report.leaveRoom(props.report.reportID), }); } } From 0f5d5026fed6578d7e47dbc7bf976ad09db3904f Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Tue, 26 Sep 2023 11:00:40 +0800 Subject: [PATCH 09/13] set default notification preference of new child report to hidden --- src/libs/actions/Report.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Report.js b/src/libs/actions/Report.js index 8a7868507897..fab882f5b682 100644 --- a/src/libs/actions/Report.js +++ b/src/libs/actions/Report.js @@ -669,7 +669,7 @@ function navigateToAndOpenChildReport(childReportID = '0', parentReportAction = '', undefined, undefined, - CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS, + CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, parentReportAction.reportActionID, parentReportID, ); From e67845c39fd688cb48b08739f23653f17087d08a Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Tue, 26 Sep 2023 13:03:49 +0800 Subject: [PATCH 10/13] hide join/leave when thread has no comments --- src/libs/ReportUtils.js | 5 ----- src/pages/home/HeaderView.js | 4 +++- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 9b42a0925680..b8082447984e 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -2928,11 +2928,6 @@ function shouldReportBeInOptionList(report, currentReportId, isInGSDMode, betas, const isEmptyChat = !report.lastMessageText && !report.lastMessageTranslationKey && !lastVisibleMessage.lastMessageText && !lastVisibleMessage.lastMessageTranslationKey; const canHideReport = shouldHideReport(report, currentReportId); - // Hide only chat threads that haven't been commented on (other threads are actionable) - if (isChatThread(report) && canHideReport && isEmptyChat) { - return false; - } - // Include reports if they are pinned if (report.isPinned) { return true; diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index 91293036f3e2..deb17789be1c 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -99,6 +99,8 @@ function HeaderView(props) { const guideCalendarLink = lodashGet(props.account, 'guideCalendarLink'); const parentReportAction = ReportActionsUtils.getParentReportAction(props.report); const isCanceledTaskReport = ReportUtils.isCanceledTaskReport(props.report, parentReportAction); + const lastVisibleMessage = ReportActionsUtils.getLastVisibleMessage(props.report.reportID); + const isEmptyChat = !props.report.lastMessageText && !props.report.lastMessageTranslationKey && !lastVisibleMessage.lastMessageText && !lastVisibleMessage.lastMessageTranslationKey; // We hide the button when we are chatting with an automated Expensify account since it's not possible to contact // these users via alternative means. It is possible to request a call with Concierge so we leave the option for them. @@ -135,7 +137,7 @@ function HeaderView(props) { } } - if (isChatThread) { + if (isChatThread && !isEmptyChat) { if (props.report.notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN) { threeDotMenuItems.push({ icon: Expensicons.ChatBubbles, From 91421210ea64d7141485ad3bd5849e14aadab3db Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Tue, 26 Sep 2023 13:17:07 +0800 Subject: [PATCH 11/13] remove uneeded if check --- src/pages/home/HeaderView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index deb17789be1c..45f88e2a6f0d 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -180,7 +180,7 @@ function HeaderView(props) { Link.openExternalLink(props.guideCalendarLink); }, }); - } else if ((isConcierge && guideCalendarLink) || (!isAutomatedExpensifyAccount && !isTaskReport)) { + } else if (!isAutomatedExpensifyAccount && !isTaskReport) { threeDotMenuItems.push({ icon: ZoomIcon, iconFill: themeColors.icon, From f4949677738e126fc2c454f6c961ce92573057a6 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Tue, 26 Sep 2023 13:29:42 +0800 Subject: [PATCH 12/13] change text --- src/languages/en.ts | 2 -- src/languages/es.ts | 4 +--- src/pages/home/HeaderView.js | 4 ++-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/languages/en.ts b/src/languages/en.ts index 971eb29af6f3..f55667785275 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -141,9 +141,7 @@ export default { download: 'Download', downloading: 'Downloading', pin: 'Pin', - pinConversation: 'Pin conversation', unPin: 'Unpin', - unPinConversation: 'Unpin conversation', back: 'Back', saveAndContinue: 'Save & continue', settings: 'Settings', diff --git a/src/languages/es.ts b/src/languages/es.ts index 277f35cbee10..ef23ab87552e 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -131,9 +131,7 @@ export default { download: 'Descargar', downloading: 'Descargando', pin: 'Fijar', - pinConversation: 'NEED TO TRANSLATE', unPin: 'Desfijar', - unPinConversation: 'NEED TO TRANSLATE', back: 'Volver', saveAndContinue: 'Guardar y continuar', settings: 'Configuración', @@ -200,7 +198,7 @@ export default { debitCard: 'Tarjeta de débito', bankAccount: 'Cuenta bancaria', join: 'Unirse', - joinThread: 'NEED TO TRANSLATE', + joinThread: 'Unirse al hilo', decline: 'Rechazar', transferBalance: 'Transferencia de saldo', cantFindAddress: '¿No encuentras tu dirección? ', diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index 45f88e2a6f0d..4443d274248f 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -159,14 +159,14 @@ function HeaderView(props) { threeDotMenuItems.push({ icon: Expensicons.Pin, iconFill: themeColors.icon, - text: props.translate('common.pinConversation'), + text: props.translate('common.pin'), onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned)), }); } else { threeDotMenuItems.push({ icon: Expensicons.Pin, iconFill: themeColors.icon, - text: props.translate('common.unPinConversation'), + text: props.translate('common.unPin'), onSelected: Session.checkIfActionIsAllowed(() => Report.togglePinnedState(props.report.reportID, props.report.isPinned)), }); } From 51a4a32128954b9aeff3a965e30ddb30cfbffd84 Mon Sep 17 00:00:00 2001 From: Srikar Parsi Date: Thu, 28 Sep 2023 12:59:21 +0800 Subject: [PATCH 13/13] fix merge conflicts --- src/pages/home/HeaderView.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/pages/home/HeaderView.js b/src/pages/home/HeaderView.js index fff38d10467b..f6adaf051e1c 100644 --- a/src/pages/home/HeaderView.js +++ b/src/pages/home/HeaderView.js @@ -33,15 +33,6 @@ import compose from '../../libs/compose'; import styles from '../../styles/styles'; import themeColors from '../../styles/themes/default'; import reportPropTypes from '../reportPropTypes'; -import reportActionPropTypes from './report/reportActionPropTypes'; -import ONYXKEYS from '../../ONYXKEYS'; -import ThreeDotsMenu from '../../components/ThreeDotsMenu'; -import * as Task from '../../libs/actions/Task'; -import PressableWithoutFeedback from '../../components/Pressable/PressableWithoutFeedback'; -import PinButton from '../../components/PinButton'; -import TaskHeaderActionButton from '../../components/TaskHeaderActionButton'; -import * as ReportActionsUtils from '../../libs/ReportActionsUtils'; -import ParentNavigationSubtitle from '../../components/ParentNavigationSubtitle'; const propTypes = { /** Toggles the navigationMenu open and closed */