From b48c214e742c5fbe565da4fae0add9f5fddeafcf Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Thu, 11 May 2023 15:25:54 -0700 Subject: [PATCH 01/37] Add TASKCOMPLETED constant --- src/CONST.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CONST.js b/src/CONST.js index 614ec00917c3..e8f793df6f5e 100755 --- a/src/CONST.js +++ b/src/CONST.js @@ -409,6 +409,7 @@ const CONST = { IOU: 'IOU', RENAMED: 'RENAMED', CHRONOSOOOLIST: 'CHRONOSOOOLIST', + TASKCOMPLETED: 'TASKCOMPLETED', POLICYCHANGELOG: { ADD_APPROVER_RULE: 'POLICYCHANGELOG_ADD_APPROVER_RULE', ADD_CATEGORY: 'POLICYCHANGELOG_ADD_CATEGORY', From 15e000155abf7ea2557b860a3a6d46cc007b7098 Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Thu, 11 May 2023 15:26:12 -0700 Subject: [PATCH 02/37] Add new method for task actions --- src/libs/ReportUtils.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 18a479675110..ef5d4293ab53 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1063,6 +1063,19 @@ function buildOptimisticTaskCommentReportAction(taskReportID, taskTitle, taskAss return reportAction; } +function buildOptimisticTaskReportAction(taskReportID, text, actionName) { + const reportAction = buildOptimisticAddCommentReportAction(text); + reportAction.reportAction.message[0].taskReportID = taskReportID; + reportAction.reportAction.actionName = actionName; + + // These parameters are not saved on the reportAction, but are used to display the task in the UI + // Added when we fetch the reportActions on a report + reportAction.reportAction.originalMessage = { + html: reportAction.reportAction.message[0].html, + taskReportID: reportAction.reportAction.message[0].taskReportID, + }; +} + /** * Builds an optimistic IOU report with a randomly generated reportID * @@ -1964,6 +1977,7 @@ export { buildOptimisticIOUReportAction, buildOptimisticAddCommentReportAction, buildOptimisticTaskCommentReportAction, + buildOptimisticTaskReportAction, shouldReportBeInOptionList, getChatByParticipants, getChatByParticipantsAndPolicy, From ae1562a3d10c7e0413af43147276a255602b2774 Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Thu, 11 May 2023 15:26:19 -0700 Subject: [PATCH 03/37] Create completeTask command --- src/libs/actions/Task.js | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index d55d6b910c83..d1d0af7215c0 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -8,6 +8,7 @@ import * as Report from './Report'; import Navigation from '../Navigation/Navigation'; import ROUTES from '../../ROUTES'; import DateUtils from '../DateUtils'; +import CONST from '../../CONST'; /** * Clears out the task info from the store @@ -151,6 +152,46 @@ function createTaskAndNavigate(currentUserEmail, parentReportID, title, descript Navigation.navigate(ROUTES.getReportRoute(optimisticTaskReport.reportID)); } +function completeTask(taskReportID, parentReportID) { + // TODO: Update the text to be the task title + const completedTaskReportAction = ReportUtils.buildOptimisticTaskReportAction(taskReportID, 'Completed task: ', CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED); + + const optimisticData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${taskReportID}`, + value: { + stateNum: CONST.REPORT.STATE_NUM.SUBMITTED, + statusNum: CONST.REPORT.STATUS.APPROVED, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, + value: {[completedTaskReportAction.reportAction.reportActionID]: completedTaskReportAction.reportAction}, + }, + ]; + + const successData = []; + const failureData = [ + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT}${taskReportID}`, + value: { + stateNum: CONST.REPORT.STATE_NUM.OPEN, + statusNum: CONST.REPORT.STATUS.PENDING, + }, + }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, + value: {[completedTaskReportAction.reportAction.reportActionID]: {pendingAction: null}}, + }, + ]; + + API.write('CompleteTask', {taskReportID}, {optimisticData, successData, failureData}); +} + /** * Sets the title and description values for the task * @param {string} title From f815004e63ca6cf1866b4d86add611b7af1baacf Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Thu, 11 May 2023 16:07:04 -0700 Subject: [PATCH 04/37] Hook up functionality to complete task --- src/components/ReportActionItem/TaskPreview.js | 3 +++ src/libs/ReportUtils.js | 2 ++ src/libs/actions/Task.js | 13 ++++++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/components/ReportActionItem/TaskPreview.js b/src/components/ReportActionItem/TaskPreview.js index 19c8349571f3..9cf4dca7c888 100644 --- a/src/components/ReportActionItem/TaskPreview.js +++ b/src/components/ReportActionItem/TaskPreview.js @@ -16,6 +16,7 @@ import getButtonState from '../../libs/getButtonState'; import Navigation from '../../libs/Navigation/Navigation'; import ROUTES from '../../ROUTES'; import reportActionPropTypes from '../../pages/home/report/reportActionPropTypes'; +import * as TaskUtils from '../../libs/actions/Task'; const propTypes = { /** The ID of the associated taskReport */ @@ -56,6 +57,7 @@ const TaskPreview = (props) => { (props.taskReport.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && props.taskReport.statusNum === CONST.REPORT.STATUS.APPROVED) || (props.action.childStateNum === CONST.REPORT.STATE_NUM.CLOSED && props.action.childStatusNum === CONST.REPORT.STATUS.APPROVED); const taskTitle = props.action.taskTitle || props.taskReport.reportName; + const parentReportID = props.taskReport.parentReportID; return ( { isChecked={isTaskCompleted} onPress={() => { // Being implemented in https://github.com/Expensify/App/issues/16858 + TaskUtils.completeTask(props.taskReportID, parentReportID); }} /> {taskTitle} diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index ef5d4293ab53..86e39c06a51c 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1074,6 +1074,8 @@ function buildOptimisticTaskReportAction(taskReportID, text, actionName) { html: reportAction.reportAction.message[0].html, taskReportID: reportAction.reportAction.message[0].taskReportID, }; + + return reportAction; } /** diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index d1d0af7215c0..b2aa95701356 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -188,8 +188,15 @@ function completeTask(taskReportID, parentReportID) { value: {[completedTaskReportAction.reportAction.reportActionID]: {pendingAction: null}}, }, ]; - - API.write('CompleteTask', {taskReportID}, {optimisticData, successData, failureData}); + console.log('completeTask', taskReportID, parentReportID, optimisticData, successData, failureData); + API.write( + 'CompleteTask', + { + taskReportID, + completedTaskReportActionID: completedTaskReportAction.reportAction.reportActionID, + }, + {optimisticData, successData, failureData}, + ); } /** @@ -274,4 +281,4 @@ function clearOutTaskInfoAndNavigate(reportID) { Navigation.navigate(ROUTES.NEW_TASK_DETAILS); } -export {createTaskAndNavigate, setTitleValue, setDescriptionValue, setDetailsValue, setAssigneeValue, setShareDestinationValue, clearOutTaskInfo, clearOutTaskInfoAndNavigate}; +export {createTaskAndNavigate, completeTask, setTitleValue, setDescriptionValue, setDetailsValue, setAssigneeValue, setShareDestinationValue, clearOutTaskInfo, clearOutTaskInfoAndNavigate}; From c75c4208fefbea2d8cdc23bbeeda9a8dc7969ed7 Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Thu, 11 May 2023 16:07:29 -0700 Subject: [PATCH 05/37] Update TaskPreview.js --- src/components/ReportActionItem/TaskPreview.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/ReportActionItem/TaskPreview.js b/src/components/ReportActionItem/TaskPreview.js index 9cf4dca7c888..a4cc32aaf421 100644 --- a/src/components/ReportActionItem/TaskPreview.js +++ b/src/components/ReportActionItem/TaskPreview.js @@ -70,7 +70,6 @@ const TaskPreview = (props) => { containerStyle={[styles.taskCheckbox]} isChecked={isTaskCompleted} onPress={() => { - // Being implemented in https://github.com/Expensify/App/issues/16858 TaskUtils.completeTask(props.taskReportID, parentReportID); }} /> From d125fe44e9675c73f4f0acb1218b5db4dab59cbc Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Thu, 11 May 2023 16:36:47 -0700 Subject: [PATCH 06/37] add grabbing the parentReportID --- src/components/ReportActionItem/TaskPreview.js | 4 ++-- src/libs/ReportUtils.js | 3 ++- src/libs/actions/Task.js | 10 ++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/components/ReportActionItem/TaskPreview.js b/src/components/ReportActionItem/TaskPreview.js index a4cc32aaf421..cbfe17e231e1 100644 --- a/src/components/ReportActionItem/TaskPreview.js +++ b/src/components/ReportActionItem/TaskPreview.js @@ -57,7 +57,7 @@ const TaskPreview = (props) => { (props.taskReport.stateNum === CONST.REPORT.STATE_NUM.SUBMITTED && props.taskReport.statusNum === CONST.REPORT.STATUS.APPROVED) || (props.action.childStateNum === CONST.REPORT.STATE_NUM.CLOSED && props.action.childStatusNum === CONST.REPORT.STATUS.APPROVED); const taskTitle = props.action.taskTitle || props.taskReport.reportName; - const parentReportID = props.taskReport.parentReportID; + const parentReportID = props.action.parentReportID || props.taskReport.parentReportID; return ( { containerStyle={[styles.taskCheckbox]} isChecked={isTaskCompleted} onPress={() => { - TaskUtils.completeTask(props.taskReportID, parentReportID); + TaskUtils.completeTask(props.taskReportID, parentReportID, taskTitle); }} /> {taskTitle} diff --git a/src/libs/ReportUtils.js b/src/libs/ReportUtils.js index 86e39c06a51c..114db6edb3a3 100644 --- a/src/libs/ReportUtils.js +++ b/src/libs/ReportUtils.js @@ -1043,7 +1043,7 @@ function buildOptimisticAddCommentReportAction(text, file) { * @param {String} text - Text of the comment * @returns {Object} */ -function buildOptimisticTaskCommentReportAction(taskReportID, taskTitle, taskAssignee, text) { +function buildOptimisticTaskCommentReportAction(taskReportID, taskTitle, taskAssignee, text, parentReportID) { const reportAction = buildOptimisticAddCommentReportAction(text); reportAction.reportAction.message[0].taskReportID = taskReportID; @@ -1054,6 +1054,7 @@ function buildOptimisticTaskCommentReportAction(taskReportID, taskTitle, taskAss taskReportID: reportAction.reportAction.message[0].taskReportID, }; reportAction.reportAction.childReportID = taskReportID; + reportAction.reportAction.parentReportID = parentReportID; reportAction.reportAction.childType = CONST.REPORT.TYPE.TASK; reportAction.reportAction.taskTitle = taskTitle; reportAction.reportAction.taskAssignee = taskAssignee; diff --git a/src/libs/actions/Task.js b/src/libs/actions/Task.js index b2aa95701356..bca7590e88c1 100644 --- a/src/libs/actions/Task.js +++ b/src/libs/actions/Task.js @@ -39,12 +39,12 @@ function createTaskAndNavigate(currentUserEmail, parentReportID, title, descript const taskReportID = optimisticTaskReport.reportID; let optimisticAssigneeAddComment; if (assigneeChatReportID && assigneeChatReportID !== parentReportID) { - optimisticAssigneeAddComment = ReportUtils.buildOptimisticTaskCommentReportAction(taskReportID, title, assignee, `Assigned a task to you: ${title}`); + optimisticAssigneeAddComment = ReportUtils.buildOptimisticTaskCommentReportAction(taskReportID, title, assignee, `Assigned a task to you: ${title}`, parentReportID); } // Create the CreatedReportAction on the task const optimisticTaskCreatedAction = ReportUtils.buildOptimisticCreatedReportAction(optimisticTaskReport.reportID); - const optimisticAddCommentReport = ReportUtils.buildOptimisticTaskCommentReportAction(taskReportID, title, assignee, `Created a task: ${title}`); + const optimisticAddCommentReport = ReportUtils.buildOptimisticTaskCommentReportAction(taskReportID, title, assignee, `Created a task: ${title}`, parentReportID); const currentTime = DateUtils.getDBTime(); @@ -152,10 +152,8 @@ function createTaskAndNavigate(currentUserEmail, parentReportID, title, descript Navigation.navigate(ROUTES.getReportRoute(optimisticTaskReport.reportID)); } -function completeTask(taskReportID, parentReportID) { - // TODO: Update the text to be the task title - const completedTaskReportAction = ReportUtils.buildOptimisticTaskReportAction(taskReportID, 'Completed task: ', CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED); - +function completeTask(taskReportID, parentReportID, taskTitle) { + const completedTaskReportAction = ReportUtils.buildOptimisticTaskReportAction(taskReportID, `Completed task: ${taskTitle}`, CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED); const optimisticData = [ { onyxMethod: Onyx.METHOD.MERGE, From 92ddb6f9ff48067468ab276951ae2a4a7cb43369 Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Thu, 11 May 2023 16:46:33 -0700 Subject: [PATCH 07/37] add new taskAction component --- src/components/ReportActionItem/TaskAction.js | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/components/ReportActionItem/TaskAction.js diff --git a/src/components/ReportActionItem/TaskAction.js b/src/components/ReportActionItem/TaskAction.js new file mode 100644 index 000000000000..241f7f26b160 --- /dev/null +++ b/src/components/ReportActionItem/TaskAction.js @@ -0,0 +1,80 @@ +import React from 'react'; +import {View, Pressable} from 'react-native'; +import PropTypes from 'prop-types'; +import {withOnyx} from 'react-native-onyx'; +import Navigation from '../../libs/Navigation/Navigation'; +import withLocalize, {withLocalizePropTypes} from '../withLocalize'; +import ROUTES from '../../ROUTES'; +import compose from '../../libs/compose'; +import ONYXKEYS from '../../ONYXKEYS'; +import Text from '../Text'; +import styles from '../../styles/styles'; +import Icon from '../Icon'; +import * as Expensicons from '../Icon/Expensicons'; +import reportActionPropTypes from '../../pages/home/report/reportActionPropTypes'; +import * as StyleUtils from '../../styles/StyleUtils'; +import getButtonState from '../../libs/getButtonState'; + +const propTypes = { + /** The ID of the associated taskReport */ + taskReportID: PropTypes.string.isRequired, + + /** Whether the task preview is hovered so we can modify its style */ + isHovered: PropTypes.bool, + + /** The linked reportAction */ + action: PropTypes.shape(reportActionPropTypes).isRequired, + + /* Onyx Props */ + + taskReport: PropTypes.shape({ + /** Title of the task */ + reportName: PropTypes.string, + + /** Email address of the manager in this iou report */ + managerEmail: PropTypes.string, + + /** Email address of the creator of this iou report */ + ownerEmail: PropTypes.string, + }), + + ...withLocalizePropTypes, +}; + +const defaultProps = { + taskReport: {}, + isHovered: false, +}; +const TaskAction = (props) => { + const taskReportID = props.taskReportID; + const taskReportName = props.taskReport.reportName || ''; + console.log(props.action); + return ( + Navigation.navigate(ROUTES.getReportRoute(taskReportID))} + style={[styles.flexRow, styles.justifyContentBetween]} + > + + {'testeastadwa'} + {` ${taskReportName}`} + + + + ); +}; + +TaskAction.propTypes = propTypes; +TaskAction.defaultProps = defaultProps; +TaskAction.displayName = 'TaskAction'; + +export default compose( + withLocalize, + withOnyx({ + taskReport: { + key: ({taskReportID}) => `${ONYXKEYS.COLLECTION.REPORT}${taskReportID}`, + }, + }), +)(TaskAction); From 3ad9ffff37eb74b4338699cbabdf368f430d6859 Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Thu, 11 May 2023 16:46:43 -0700 Subject: [PATCH 08/37] render on demand --- src/pages/home/report/ReportActionItem.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index b2c86d55204e..80e168525257 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -47,6 +47,7 @@ import DisplayNames from '../../../components/DisplayNames'; import personalDetailsPropType from '../../personalDetailsPropType'; import ReportActionItemDraft from './ReportActionItemDraft'; import TaskPreview from '../../../components/ReportActionItem/TaskPreview'; +import TaskAction from '../../../components/ReportActionItem/TaskAction'; import * as ReportActionUtils from '../../../libs/ReportActionsUtils'; const propTypes = { @@ -200,6 +201,14 @@ class ReportActionItem extends Component { isHovered={hovered} /> ); + } else if (this.props.action.actionName === CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED) { + children = ( + + ); } else { const message = _.last(lodashGet(this.props.action, 'message', [{}])); const isAttachment = _.has(this.props.action, 'isAttachment') ? this.props.action.isAttachment : ReportUtils.isReportMessageAttachment(message); From 90a0df4deb56f5841a90ce017ea73ca641fe7b1b Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Thu, 11 May 2023 16:55:09 -0700 Subject: [PATCH 09/37] add copy for completed task --- src/languages/en.js | 5 +++++ src/languages/es.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/languages/en.js b/src/languages/en.js index b9f49302a43a..948a18ea3c26 100755 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -1183,6 +1183,11 @@ export default { pleaseEnterTaskAssignee: 'Please select an assignee', pleaseEnterTaskDestination: 'Please select a share destination', }, + task: { + messages: { + completed: 'Completed task', + }, + }, statementPage: { generatingPDF: "We're generating your PDF right now. Please come back later!", }, diff --git a/src/languages/es.js b/src/languages/es.js index 01878fafe5e2..991afc8c959b 100644 --- a/src/languages/es.js +++ b/src/languages/es.js @@ -1188,6 +1188,11 @@ export default { pleaseEnterTaskAssignee: 'Por favor, asigna una persona a esta tarea', pleaseEnterTaskDestination: 'Por favor, selecciona un destino de tarea', }, + task: { + messages: { + completed: 'Completed task', + }, + }, statementPage: { generatingPDF: 'Estamos generando tu PDF ahora mismo. ¡Por favor, vuelve más tarde!', }, From 50a2b4d084925fc6bfcb7c55ca3f72252eff5c78 Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Thu, 11 May 2023 16:55:23 -0700 Subject: [PATCH 10/37] update task action to pass in actionName --- src/components/ReportActionItem/TaskAction.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/ReportActionItem/TaskAction.js b/src/components/ReportActionItem/TaskAction.js index 241f7f26b160..74c0454d092d 100644 --- a/src/components/ReportActionItem/TaskAction.js +++ b/src/components/ReportActionItem/TaskAction.js @@ -14,6 +14,7 @@ import * as Expensicons from '../Icon/Expensicons'; import reportActionPropTypes from '../../pages/home/report/reportActionPropTypes'; import * as StyleUtils from '../../styles/StyleUtils'; import getButtonState from '../../libs/getButtonState'; +import CONST from '../../CONST'; const propTypes = { /** The ID of the associated taskReport */ @@ -22,8 +23,8 @@ const propTypes = { /** Whether the task preview is hovered so we can modify its style */ isHovered: PropTypes.bool, - /** The linked reportAction */ - action: PropTypes.shape(reportActionPropTypes).isRequired, + /** Name of the reportAction action */ + actionName: PropTypes.string.isRequired, /* Onyx Props */ @@ -48,14 +49,15 @@ const defaultProps = { const TaskAction = (props) => { const taskReportID = props.taskReportID; const taskReportName = props.taskReport.reportName || ''; - console.log(props.action); + + const messageLinkText = props.actionName === CONST.REPORT.ACTIONS.TYPE.TASKCOMPLETED ? props.translate('task.messages.completed') : props.translate('newTaskPage.task'); return ( Navigation.navigate(ROUTES.getReportRoute(taskReportID))} style={[styles.flexRow, styles.justifyContentBetween]} > - {'testeastadwa'} + {messageLinkText} {` ${taskReportName}`} Date: Thu, 11 May 2023 16:55:26 -0700 Subject: [PATCH 11/37] Update ReportActionItem.js --- src/pages/home/report/ReportActionItem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js index 80e168525257..d3ae125c7859 100644 --- a/src/pages/home/report/ReportActionItem.js +++ b/src/pages/home/report/ReportActionItem.js @@ -205,7 +205,7 @@ class ReportActionItem extends Component { children = ( ); From 5e623a01c627f2dcc43b66e2c29a91d49999b191 Mon Sep 17 00:00:00 2001 From: Jack Nam Date: Fri, 12 May 2023 21:08:02 -0700 Subject: [PATCH 12/37] Merge in IR Dan changes --- src/pages/home/TaskHeaderView.js | 72 ++++++++++++++++++++- src/pages/signin/SignInPageLayout/Footer.js | 7 +- 2 files changed, 74 insertions(+), 5 deletions(-) diff --git a/src/pages/home/TaskHeaderView.js b/src/pages/home/TaskHeaderView.js index 9f00fe5e4f9c..1d0f57703e4e 100644 --- a/src/pages/home/TaskHeaderView.js +++ b/src/pages/home/TaskHeaderView.js @@ -1,18 +1,80 @@ import React from 'react'; +import {View} from 'react-native'; +import {withOnyx} from 'react-native-onyx'; import lodashGet from 'lodash/get'; +import PropTypes from 'prop-types'; +import compose from '../../libs/compose'; +import styles from '../../styles/styles'; +import * as TaskUtils from '../../libs/actions/Task'; import reportPropTypes from '../reportPropTypes'; import MenuItemWithTopDescription from '../../components/MenuItemWithTopDescription'; import Navigation from '../../libs/Navigation/Navigation'; import ROUTES from '../../ROUTES'; +import ONYXKEYS from '../../ONYXKEYS'; +import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; +import Text from '../../components/Text'; +import Button from '../../components/Button'; +import Icon from '../../components/Icon'; +import * as Expensicons from '../../components/Icon/Expensicons'; +import themeColors from '../../styles/themes/default'; const propTypes = { /** The report currently being looked at */ report: reportPropTypes.isRequired, + + /** All of the personal details for everyone */ + personalDetails: PropTypes.objectOf( + PropTypes.shape({ + /** Display name of the person */ + displayName: PropTypes.string, + + /** Avatar URL of the person */ + avatar: PropTypes.string, + + /** Login of the person */ + login: PropTypes.string, + }), + ), + + ...withLocalizePropTypes, +}; + +const defaultProps = { + personalDetails: {}, }; function TaskHeaderView(props) { + console.log('TaskHeaderView', props.report); return ( <> + + {props.report.assignee ? ( + {props.personalDetails[props.report.assignee] ? props.personalDetails[props.report.assignee].displayName : ''} + ) : ( + Navigation.navigate(ROUTES.getTaskReportAssigneeRoute(props.report.reportID))} + /> + )} + {props.report.stateNum === 2 && props.report.statusNum === 3 ? ( + + + {props.translate('task.messages.completed')} + + ) : ( +