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

Implement Task Detailed View Redesign #20841

Merged
merged 105 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
affa78c
component skeleton, render component in ReportActionList, show GBR on…
jasperhuangg Jun 15, 2023
20db293
remove gbr logic
jasperhuangg Jun 16, 2023
c86cccf
rename TaskUtils => Task, allow ReportActionItem to respond to report…
jasperhuangg Jun 16, 2023
2a512f1
add and use TaskHeaderActionButton
jasperhuangg Jun 16, 2023
7a6c051
fix translations
jasperhuangg Jun 16, 2023
9f29276
remove unused
jasperhuangg Jun 16, 2023
11e24e3
remove unused
jasperhuangg Jun 16, 2023
de48e8a
merge main
jasperhuangg Jun 16, 2023
0542182
merge main
jasperhuangg Jun 16, 2023
5df849e
style
jasperhuangg Jun 16, 2023
ba7027f
remove unused
jasperhuangg Jun 16, 2023
a86e4b8
remove unused
jasperhuangg Jun 16, 2023
e47e33e
add created by and assignee to task view
jasperhuangg Jun 16, 2023
69b505f
fix task preview assignee selection
jasperhuangg Jun 16, 2023
16df838
get correct avatar for each user
jasperhuangg Jun 16, 2023
e291f00
description vertically centers if empty
jasperhuangg Jun 16, 2023
7adfb7d
Merge branch 'main' of github.com:Expensify/App into jasper-taskRedesign
jasperhuangg Jun 16, 2023
8e82218
lint
jasperhuangg Jun 16, 2023
f6dcbc7
fix ellipses
jasperhuangg Jun 16, 2023
83f3fc7
move title input to its own component
jasperhuangg Jun 16, 2023
3fb0cb2
remove unused props
jasperhuangg Jun 16, 2023
e296acc
whitespace
jasperhuangg Jun 16, 2023
4c53e3d
style
jasperhuangg Jun 16, 2023
9e7a13c
move styles into styles.js
jasperhuangg Jun 16, 2023
5c44d67
fix header button spacing on small screens
jasperhuangg Jun 16, 2023
7b53db0
remove unused import
jasperhuangg Jun 16, 2023
f5be337
remove unused
jasperhuangg Jun 16, 2023
b062f20
fix title menu item spacing
jasperhuangg Jun 17, 2023
476c4a5
fix title menu item spacing
jasperhuangg Jun 17, 2023
207d153
fix title menu item spacing
jasperhuangg Jun 17, 2023
895582e
fix title menu item spacing
jasperhuangg Jun 17, 2023
86106e4
merge main
jasperhuangg Jun 19, 2023
43d0c6d
merge main
jasperhuangg Jun 21, 2023
9299adb
style
jasperhuangg Jun 21, 2023
a94c829
Fix styling of task view (spacing)
jasperhuangg Jun 22, 2023
0ca36c0
fix task action styling on small screens
jasperhuangg Jun 23, 2023
f542875
fix title page display on android
jasperhuangg Jun 23, 2023
f110eab
fix checkbox height
jasperhuangg Jun 23, 2023
84115cd
fix display for multiline titles
jasperhuangg Jun 23, 2023
b88f11c
address design review
jasperhuangg Jun 23, 2023
53d07a2
remove unused
jasperhuangg Jun 23, 2023
e142642
remove unused
jasperhuangg Jun 23, 2023
c0efa17
merge main
jasperhuangg Jun 23, 2023
2f1d3a0
use shouldShowHorizontalRule
jasperhuangg Jun 23, 2023
adff1a1
push missing changes
jasperhuangg Jun 27, 2023
9863595
style
jasperhuangg Jun 27, 2023
2776407
remove unused param
jasperhuangg Jun 27, 2023
de7106e
add/use styles.backgroundBG
jasperhuangg Jun 27, 2023
de58d5e
move maskAsDone and markAsIncomplete translations to task
jasperhuangg Jun 27, 2023
0eb8f72
move newassigneeerror to task
jasperhuangg Jun 27, 2023
17bb9fa
resolve merge conflicts
jasperhuangg Jun 27, 2023
c7de5ec
fix workspace menu item avatar display
jasperhuangg Jun 27, 2023
983ecc2
fix warning
jasperhuangg Jun 27, 2023
fd8af36
resolve conflicts with main
jasperhuangg Jun 29, 2023
3844b8a
resolve conflicts
jasperhuangg Jun 30, 2023
15a8fc6
ensure horizontal rule refreshes correctly
jasperhuangg Jun 30, 2023
05ec710
fix case with empty assignee
jasperhuangg Jun 30, 2023
b2c030f
style
jasperhuangg Jun 30, 2023
df00196
fix translations
jasperhuangg Jun 30, 2023
377ccde
remove unused style
jasperhuangg Jun 30, 2023
cab230f
use utility function
jasperhuangg Jun 30, 2023
63e5c6f
add accessibility label
jasperhuangg Jun 30, 2023
db2b90a
merge main
jasperhuangg Jul 5, 2023
ef26b0e
fix merge conflicts
jasperhuangg Jul 5, 2023
1f78014
fix task header background color
jasperhuangg Jul 5, 2023
03dcd2b
allow description to occupy multiple lines
jasperhuangg Jul 5, 2023
6a91367
fix inverted elements on ios
jasperhuangg Jul 5, 2023
f85dda2
Update src/styles/styles.js
jasperhuangg Jul 5, 2023
b7be525
Merge branch 'main' of github.com:Expensify/App into jasper-taskRedesign
jasperhuangg Jul 5, 2023
3e9dd3b
Merge branch 'jasper-taskRedesign' of github.com:Expensify/App into j…
jasperhuangg Jul 5, 2023
9c045b2
fix warnings
jasperhuangg Jul 5, 2023
79cdc72
fix background color for task headers
jasperhuangg Jul 5, 2023
4e7356f
fix review comments
jasperhuangg Jul 5, 2023
e1b21e5
typo
jasperhuangg Jul 5, 2023
a032cb6
Update src/components/TaskHeaderActionButton.js
jasperhuangg Jul 5, 2023
bb83d22
fix merge conflicts
jasperhuangg Jul 5, 2023
fd12785
import const
jasperhuangg Jul 5, 2023
a21beac
add missing border bottom styles to task headergis
jasperhuangg Jul 5, 2023
3896e42
remove unused
jasperhuangg Jul 5, 2023
e3e838f
fix duplicated border bottom styles, fix display bug with incorrect b…
jasperhuangg Jul 5, 2023
4db3cf0
remove unused
jasperhuangg Jul 5, 2023
cbecf45
remove unused
jasperhuangg Jul 5, 2023
9713f9c
disable picking assignee via header for closed tasks
jasperhuangg Jul 5, 2023
aca68bd
disable checkbox for canceled tasks
jasperhuangg Jul 6, 2023
629f6a2
style
jasperhuangg Jul 6, 2023
c2a3ca3
fix merge conflicts
jasperhuangg Jul 6, 2023
87744a1
fix merge conflicts
jasperhuangg Jul 6, 2023
3be5ff2
remove unused
jasperhuangg Jul 6, 2023
fb21771
fix crash from merge
jasperhuangg Jul 6, 2023
8c51b2b
fix merge conflicts with main
jasperhuangg Jul 6, 2023
c91e789
disable title menu for canceled tasks
jasperhuangg Jul 6, 2023
4c6e442
disable title menu for canceled tasks
jasperhuangg Jul 6, 2023
3626cab
disable title menu for canceled tasks
jasperhuangg Jul 6, 2023
5d5296e
linter
jasperhuangg Jul 6, 2023
decf60a
fix conflicts
jasperhuangg Jul 6, 2023
58f3eeb
fix conflicts
jasperhuangg Jul 6, 2023
e7a85ae
disable hovered/pressed styles for task title menu item for completed…
jasperhuangg Jul 7, 2023
02da6af
apply disabled styles to title text for completed task
jasperhuangg Jul 7, 2023
ee378e5
pass cancelledTaskReportActionID
jasperhuangg Jul 7, 2023
c5e01bc
Update Task.js
jasperhuangg Jul 7, 2023
7e86ef2
merge main
jasperhuangg Jul 7, 2023
c0aca39
don't grey out menu items when canceled/closed
jasperhuangg Jul 7, 2023
3f6945b
fix merge conflicts
jasperhuangg Jul 7, 2023
e2d7eca
prettier
jasperhuangg Jul 7, 2023
3645840
resolve conflicts with main
jasperhuangg Jul 7, 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
2 changes: 1 addition & 1 deletion src/components/LHNOptionsList/OptionRowLHN.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function OptionRowLHN(props) {
!hasBrickError &&
(optionItem.isUnreadWithMention ||
(optionItem.hasOutstandingIOU && !optionItem.isIOUReportOwner) ||
(optionItem.isTaskReport && optionItem.isTaskAssignee && !optionItem.isTaskCompleted));
(optionItem.isTaskReport && optionItem.isTaskAssignee && !optionItem.isCompletedTaskReport));
thienlnam marked this conversation as resolved.
Show resolved Hide resolved

/**
* Show the ReportActionContextMenu modal popover.
Expand Down
112 changes: 67 additions & 45 deletions src/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import Badge from './Badge';
import CONST from '../CONST';
import menuItemPropTypes from './menuItemPropTypes';
import SelectCircle from './SelectCircle';
import Checkbox from './Checkbox';
import colors from '../styles/colors';
import MultipleAvatars from './MultipleAvatars';
import * as defaultWorkspaceAvatars from './Icon/WorkspaceDefaultAvatars';
Expand All @@ -33,6 +34,8 @@ const defaultProps = {
badgeText: undefined,
shouldShowRightIcon: false,
shouldShowSelectedState: false,
shouldUseSquareSelectedState: false,
shouldShowSelectedStateBeforeTitle: false,
shouldShowBasicTitle: false,
shouldShowDescriptionOnTop: false,
shouldShowHeaderTitle: false,
Expand Down Expand Up @@ -67,6 +70,7 @@ const defaultProps = {
hoverAndPressStyle: [],
furtherDetails: '',
furtherDetailsIcon: undefined,
onPressSelection: () => {},
};

function MenuItem(props) {
Expand Down Expand Up @@ -97,6 +101,19 @@ function MenuItem(props) {

const fallbackAvatarSize = props.viewMode === CONST.OPTION_MODE.COMPACT ? CONST.AVATAR_SIZE.SMALL : CONST.AVATAR_SIZE.DEFAULT;

const selectedState = props.shouldUseSquareSelectedState ? (
<Checkbox
onPress={() => props.onPressSelection()}
isChecked={props.isSelected}
style={props.shouldShowSelectedStateBeforeTitle && styles.mr3}
/>
) : (
<SelectCircle
isChecked={props.isSelected}
style={props.shouldShowSelectedStateBeforeTitle && styles.mr3}
/>
);
thienlnam marked this conversation as resolved.
Show resolved Hide resolved

return (
<PressableWithSecondaryInteraction
onPress={Session.checkIfActionIsAllowed((e) => {
Expand Down Expand Up @@ -146,7 +163,7 @@ function MenuItem(props) {
/>
)}
{Boolean(props.icon) && !_.isArray(props.icon) && (
<View style={[styles.popoverMenuIcon, ...props.iconStyles]}>
<View style={[styles.popoverMenuIcon, ...props.iconStyles, StyleUtils.getAvatarWidthStyle(props.avatarSize || CONST.AVATAR_SIZE.DEFAULT)]}>
{props.iconType === CONST.ICON_TYPE_ICON && (
<Icon
src={props.icon}
Expand All @@ -170,67 +187,72 @@ function MenuItem(props) {
)}
{props.iconType === CONST.ICON_TYPE_AVATAR && (
<Avatar
imageStyles={[styles.avatarNormal, styles.alignSelfCenter]}
imageStyles={[styles.alignSelfCenter]}
source={props.icon}
fallbackIcon={props.fallbackIcon}
size={props.avatarSize || CONST.AVATAR_SIZE.DEFAULT}
/>
)}
</View>
)}
<View style={[styles.justifyContentCenter, styles.menuItemTextContainer, styles.flex1]}>
{Boolean(props.description) && props.shouldShowDescriptionOnTop && (
<Text
style={descriptionTextStyle}
numberOfLines={2}
>
{props.description}
</Text>
)}
<View style={[styles.flexRow, styles.alignItemsCenter]}>
{Boolean(props.title) && (
<View style={[styles.flexRow, styles.alignItemsCenter]}>
{props.shouldShowSelectedState && props.shouldShowSelectedStateBeforeTitle && selectedState}
<View style={[styles.justifyContentCenter, styles.menuItemTextContainer, styles.flex1]}>
{Boolean(props.description) && props.shouldShowDescriptionOnTop && (
<Text
style={descriptionTextStyle}
numberOfLines={2}
>
{props.description}
</Text>
)}
<View style={[styles.flexRow, styles.alignItemsCenter]}>
{Boolean(props.title) && (
<Text
style={titleTextStyle}
numberOfLines={1}
>
{convertToLTR(props.title)}
</Text>
)}
{Boolean(props.shouldShowTitleIcon) && (
<View style={[styles.ml2]}>
<Icon
src={props.titleIcon}
fill={themeColors.iconSuccessFill}
/>
</View>
)}
</View>
{Boolean(props.description) && !props.shouldShowDescriptionOnTop && (
<Text
style={titleTextStyle}
numberOfLines={1}
style={descriptionTextStyle}
numberOfLines={2}
>
{convertToLTR(props.title)}
{props.description}
</Text>
)}
{Boolean(props.shouldShowTitleIcon) && (
<View style={[styles.ml2]}>
{Boolean(props.furtherDetails) && (
<View style={[styles.flexRow, styles.mt2, styles.alignItemsCenter]}>
<Icon
src={props.titleIcon}
fill={themeColors.iconSuccessFill}
src={props.furtherDetailsIcon}
height={variables.iconSizeNormal}
width={variables.iconSizeNormal}
inline
/>
<Text
style={[styles.furtherDetailsText, styles.ph2, styles.pt1]}
numberOfLines={2}
>
{props.furtherDetails}
</Text>
</View>
)}
</View>
{Boolean(props.description) && !props.shouldShowDescriptionOnTop && (
<Text
style={descriptionTextStyle}
numberOfLines={2}
>
{props.description}
</Text>
)}
{Boolean(props.furtherDetails) && (
<View style={[styles.flexRow, styles.mt2, styles.alignItemsCenter]}>
<Icon
src={props.furtherDetailsIcon}
height={variables.iconSizeNormal}
width={variables.iconSizeNormal}
inline
/>
<Text
style={[styles.furtherDetailsText, styles.ph2, styles.pt1]}
numberOfLines={2}
>
{props.furtherDetails}
</Text>
</View>
)}
</View>
</View>
</View>

<View style={[styles.flexRow, styles.menuItemTextContainer, styles.pointerEventsNone]}>
{Boolean(props.badgeText) && (
<Badge
Expand Down Expand Up @@ -272,7 +294,7 @@ function MenuItem(props) {
/>
</View>
)}
{props.shouldShowSelectedState && <SelectCircle isChecked={props.isSelected} />}
{props.shouldShowSelectedState && !props.shouldShowSelectedStateBeforeTitle && selectedState}
</View>
</>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/TaskAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function TaskAction(props) {
messageLinkText = props.translate('task.messages.reopened');
break;
default:
messageLinkText = props.translate('newTaskPage.task');
messageLinkText = props.translate('task.task');
}

return (
Expand Down
9 changes: 5 additions & 4 deletions src/components/ReportActionItem/TaskPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ 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';
import * as Task from '../../libs/actions/Task';
import * as ReportUtils from '../../libs/ReportUtils';
import RenderHTML from '../RenderHTML';

const propTypes = {
Expand Down Expand Up @@ -70,12 +71,12 @@ function TaskPreview(props) {
style={[styles.mr2]}
containerStyle={[styles.taskCheckbox]}
isChecked={isTaskCompleted}
disabled={TaskUtils.isTaskCanceled(props.taskReport)}
disabled={ReportUtils.isCanceledTaskReport(props.taskReport)}
onPress={() => {
if (isTaskCompleted) {
TaskUtils.reopenTask(props.taskReportID, taskTitle);
Task.reopenTask(props.taskReportID, taskTitle);
} else {
TaskUtils.completeTask(props.taskReportID, taskTitle);
Task.completeTask(props.taskReportID, taskTitle);
}
}}
/>
Expand Down
76 changes: 76 additions & 0 deletions src/components/ReportActionItem/TaskView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import React, {useEffect} from 'react';
import {View} from 'react-native';
import reportPropTypes from '../../pages/reportPropTypes';
import withLocalize, {withLocalizePropTypes} from '../withLocalize';
import withWindowDimensions from '../withWindowDimensions';
import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsPropTypes} from '../withCurrentUserPersonalDetails';
import compose from '../../libs/compose';
import Navigation from '../../libs/Navigation/Navigation';
import ROUTES from '../../ROUTES';
import MenuItemWithTopDescription from '../MenuItemWithTopDescription';
import MenuItem from '../MenuItem';
import styles from '../../styles/styles';
import * as ReportUtils from '../../libs/ReportUtils';
import * as PersonalDetailsUtils from '../../libs/PersonalDetailsUtils';
import * as UserUtils from '../../libs/UserUtils';
import * as Task from '../../libs/actions/Task';
import CONST from '../../CONST';

const propTypes = {
/** The report currently being looked at */
report: reportPropTypes.isRequired,

...withLocalizePropTypes,

...withCurrentUserPersonalDetailsPropTypes,
};

function TaskView(props) {
useEffect(() => {
Task.setTaskReport({...props.report, isExistingTaskReport: true});
}, [props.report]);

const taskTitle = props.report.reportName;
const isCompleted = ReportUtils.isCompletedTaskReport(props.report);

return (
<View style={[styles.borderBottom]}>
<MenuItemWithTopDescription
description={props.translate('task.title')}
title={taskTitle}
onPress={() => Navigation.navigate(ROUTES.getTaskReportTitleRoute(props.report.reportID))}
shouldShowRightIcon
shouldShowSelectedState
shouldShowSelectedStateBeforeTitle
shouldUseSquareSelectedState
titleStyle={styles.newKansasLarge}
isSelected={isCompleted}
onPressSelection={() => (isCompleted ? Task.reopenTask(props.report.reportID, taskTitle) : Task.completeTask(props.report.reportID, taskTitle))}
/>
<MenuItemWithTopDescription
description={props.translate('task.description')}
title={props.report.description}
onPress={() => Navigation.navigate(ROUTES.getTaskReportDescriptionRoute(props.report.reportID))}
shouldShowRightIcon
/>
<MenuItem
label={props.translate('task.assignee')}
title={ReportUtils.getDisplayNameForParticipant(props.report.managerID)}
icon={UserUtils.getAvatar(
jasperhuangg marked this conversation as resolved.
Show resolved Hide resolved
PersonalDetailsUtils.getPersonalDetailsByIDs([props.report.managerID], props.currentUserPersonalDetails.accountID)[0].avatar,
props.report.managerID,
)}
iconType={CONST.ICON_TYPE_AVATAR}
avatarSize={CONST.AVATAR_SIZE.SMALL}
titleStyle={styles.textStrong}
onPress={() => Navigation.navigate(ROUTES.getTaskReportAssigneeRoute(props.report.reportID))}
shouldShowRightIcon
/>
</View>
);
}

TaskView.propTypes = propTypes;
TaskView.displayName = 'TaskView';

export default compose(withWindowDimensions, withLocalize, withCurrentUserPersonalDetails)(TaskView);
Loading