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

[Details Revamp] Update ReportDetailsPage for Rooms, Groups, Money Reports and Policy Expenses #43251

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
0a3db00
add leave action
cdOut May 15, 2024
cadf231
fix prettier
cdOut May 15, 2024
c299eb7
add proper room name display
cdOut May 16, 2024
b7ca1fc
fix lint and prettier errors
cdOut May 16, 2024
085b70b
remove workspace and room name sections from ReportSettingsPage
cdOut May 21, 2024
7db4c6f
fix prettier and remove unused imports
cdOut May 21, 2024
0586484
remove share code from menu items
cdOut May 21, 2024
4d07c2f
fix translation and margin for workspace name subtext
cdOut May 21, 2024
bf66978
add different name header logic for expenses and chat rooms
cdOut May 23, 2024
8d84b86
fix prettier
cdOut May 23, 2024
40689f4
correct leave button conditions
cdOut May 24, 2024
cecf745
correct PromotedActionsBar display conditions
cdOut May 24, 2024
81f0a27
fix prettier
cdOut May 24, 2024
82fd38d
Merge branch 'main' into @cdOut/report-details-for-rooms-groups
cdOut Jun 5, 2024
ad8816e
remove old leave button implementation and add PromotedActionsBar sty…
cdOut Jun 6, 2024
6f2fc17
clear up handling of promoted actions and container styling
cdOut Jun 7, 2024
97d3505
fix prettier
cdOut Jun 7, 2024
c8efb58
Merge branch 'main' into @cdOut/report-details-for-rooms-groups
cdOut Jun 7, 2024
c5de572
add spanish translations
cdOut Jun 7, 2024
fb293e4
add join action
cdOut Jun 10, 2024
cac6508
fix prettier
cdOut Jun 10, 2024
804fa40
Merge branch 'main' into @cdOut/report-details-for-rooms-groups
cdOut Jun 10, 2024
c866545
add function pattern to translation
cdOut Jun 10, 2024
b2236ea
correct spanish translation implementation
cdOut Jun 10, 2024
b93734c
add delete button into ReportDetailsPage
cdOut Jun 12, 2024
75e540e
fix prettier
cdOut Jun 12, 2024
526b98c
Merge branch 'main' into @cdOut/report-details-for-rooms-groups
cdOut Jun 12, 2024
d967042
add condition check for parentReportID
cdOut Jun 12, 2024
dc758a4
fix delete buttom check and response
cdOut Jun 13, 2024
8d5c916
add checks for displaying the Settings menu item
cdOut Jun 13, 2024
6542115
fix prettier
cdOut Jun 13, 2024
56bc7d6
Merge branch 'main' into @cdOut/report-details-for-rooms-groups
cdOut Jun 13, 2024
0aefe89
fix typecheck errors
cdOut Jun 13, 2024
88cd65c
reimplement hold functionality for PromotedActionsBar
cdOut Jun 13, 2024
4d88c81
fix prettier
cdOut Jun 13, 2024
c817ff9
Merge branch 'main' into @cdOut/report-details-for-rooms-groups
cdOut Jun 13, 2024
5113a09
Merge branch 'main' into @cdOut/report-details-for-rooms-groups
cdOut Jun 13, 2024
86e736a
fix lint and prettier
cdOut Jun 13, 2024
94d9dee
remove unused actions
cdOut Jun 13, 2024
ad793cb
remove redundant early return
cdOut Jun 14, 2024
386f9ec
Merge branch 'main' into @cdOut/report-details-for-rooms-groups
cdOut Jun 14, 2024
52d11f1
Merge branch 'main' into @cdOut/report-details-for-rooms-groups
cdOut Jun 17, 2024
08e0241
update ReportUtils and RoomPageName
cdOut Jun 17, 2024
d5ee0ff
feat: use requestParentReportAction
kosmydel Jun 17, 2024
d09a1d7
fix: displaying delete button
kosmydel Jun 17, 2024
6ddbdad
fix: displaying delete expense for single transactions
kosmydel Jun 17, 2024
29de89d
add comments
kosmydel Jun 17, 2024
2bc1b63
fix name section display issues
cdOut Jun 17, 2024
61a30ad
feat: add markAsIncomplete
kosmydel Jun 18, 2024
1ca7302
refactor hold promoted action conditions
cdOut Jun 18, 2024
6ffeaf5
fix PromotedActionsBar prettier
cdOut Jun 18, 2024
b03400a
Merge branch 'main' into @cdOut/report-details-for-rooms-groups
cdOut Jun 18, 2024
03b21c2
draft: deleting tasks
kosmydel Jun 18, 2024
8a2d031
fix lint errors
cdOut Jun 18, 2024
a497141
fix pressable name section subtitle for policy admins
cdOut Jun 18, 2024
ff4eae3
fix import issues and prettier
cdOut Jun 18, 2024
ce52cd7
fix: caseID
kosmydel Jun 18, 2024
1f3b3f8
fix
kosmydel Jun 18, 2024
8570f34
more clenup
kosmydel Jun 18, 2024
e1d97f1
fix deleting
kosmydel Jun 18, 2024
10bccf6
correct room avatar size and remove expense padding
cdOut Jun 18, 2024
33b0f69
Merge branch 'main' into @cdOut/report-details-for-rooms-groups
cdOut Jun 18, 2024
950f503
fix getGroupChatName attribute params
cdOut Jun 18, 2024
57fe023
remove unused styles
cdOut Jun 18, 2024
2279d4e
correct conditionals for displaying hold action
cdOut Jun 19, 2024
17729c7
Merge branch 'main' into @cdOut/report-details-for-rooms-groups
cdOut Jun 19, 2024
5fb443a
remove navigation on subtitle press and fix disappearance on native
cdOut Jun 19, 2024
9c88ab8
correct conditionals for displaying the join PromotedAction
cdOut Jun 19, 2024
dda1669
add deps for PromotedActions useMemo
cdOut Jun 19, 2024
5985107
add conditional for Hold PromotedAction display
cdOut Jun 19, 2024
efd9904
add modal dismissal after pressing the Mark as incomplete button
cdOut Jun 19, 2024
9dee32e
move PromotedActions keys into CONST
cdOut Jun 21, 2024
368b7b3
Merge branch 'main' into @cdOut/report-details-for-rooms-groups
cdOut Jun 21, 2024
34b36f0
replace deprecated use of action.originalMessage with ReportActionUti…
cdOut Jun 21, 2024
8786ba8
fix prettier
cdOut Jun 21, 2024
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
10 changes: 10 additions & 0 deletions src/CONST.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2126,6 +2126,8 @@ const CONST = {
SETTINGS: 'settings',
LEAVE_ROOM: 'leaveRoom',
PRIVATE_NOTES: 'privateNotes',
DELETE: 'delete',
MARK_AS_INCOMPLETE: 'markAsIncomplete',
},
EDIT_REQUEST_FIELD: {
AMOUNT: 'amount',
Expand Down Expand Up @@ -3735,6 +3737,14 @@ const CONST = {
REPORT: 'REPORT',
},

PROMOTED_ACTIONS: {
PIN: 'pin',
SHARE: 'share',
JOIN: 'join',
MESSAGE: 'message',
HOLD: 'hold',
},

THUMBNAIL_IMAGE: {
SMALL_SCREEN: {
SIZE: 250,
Expand Down
39 changes: 31 additions & 8 deletions src/components/PromotedActionsBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import * as HeaderUtils from '@libs/HeaderUtils';
import * as Localize from '@libs/Localize';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportUtils from '@libs/ReportUtils';
import * as ReportActions from '@userActions/Report';
import * as Session from '@userActions/Session';
import CONST from '@src/CONST';
import type {ReportAction} from '@src/types/onyx';
import type OnyxReport from '@src/types/onyx/Report';
import Button from './Button';
import type {ThreeDotsMenuItem} from './HeaderWithBackButton/types';
Expand All @@ -15,21 +20,34 @@ type PromotedAction = {
key: string;
} & ThreeDotsMenuItem;

type PromotedActionsType = Record<'pin' | 'share', (report: OnyxReport) => PromotedAction> & {
type BasePromotedActions = typeof CONST.PROMOTED_ACTIONS.PIN | typeof CONST.PROMOTED_ACTIONS.SHARE | typeof CONST.PROMOTED_ACTIONS.JOIN;

type PromotedActionsType = Record<BasePromotedActions, (report: OnyxReport) => PromotedAction> & {
message: (params: {accountID?: number; login?: string}) => PromotedAction;
} & {
hold: (params: {isTextHold: boolean; reportAction: ReportAction | undefined}) => PromotedAction;
};

const PromotedActions = {
pin: (report) => ({
key: 'pin',
key: CONST.PROMOTED_ACTIONS.PIN,
...HeaderUtils.getPinMenuItem(report),
}),
share: (report) => ({
key: 'share',
key: CONST.PROMOTED_ACTIONS.SHARE,
...HeaderUtils.getShareMenuItem(report),
}),
join: (report) => ({
key: CONST.PROMOTED_ACTIONS.JOIN,
icon: Expensicons.ChatBubbles,
text: Localize.translateLocal('common.join'),
onSelected: Session.checkIfActionIsAllowed(() => {
Navigation.dismissModal();
ReportActions.joinRoom(report);
}),
}),
message: ({accountID, login}) => ({
key: 'message',
key: CONST.PROMOTED_ACTIONS.MESSAGE,
icon: Expensicons.CommentBubbles,
text: Localize.translateLocal('common.message'),
onSelected: () => {
Expand All @@ -43,6 +61,15 @@ const PromotedActions = {
}
},
}),
hold: ({isTextHold, reportAction}) => ({
key: CONST.PROMOTED_ACTIONS.HOLD,
icon: Expensicons.Stopwatch,
text: Localize.translateLocal(`iou.${isTextHold ? 'hold' : 'unhold'}`),
onSelected: () => {
Navigation.dismissModal();
ReportUtils.changeMoneyRequestHoldStatus(reportAction);
},
}),
} satisfies PromotedActionsType;

type PromotedActionsBarProps = {
Expand All @@ -61,10 +88,6 @@ function PromotedActionsBar({promotedActions, containerStyle}: PromotedActionsBa
return null;
}

if (promotedActions.length === 0) {
return null;
}

return (
<View style={[styles.flexRow, styles.ph5, styles.mb5, styles.gap2, styles.mw100, styles.w100, styles.justifyContentCenter, containerStyle]}>
{promotedActions.map(({key, onSelected, ...props}) => (
Expand Down
4 changes: 2 additions & 2 deletions src/components/RoomHeaderAvatars.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ function RoomHeaderAvatars({icons, reportID}: RoomHeaderAvatarsProps) {
>
<Avatar
source={icons[0].source}
imageStyles={styles.avatarLarge}
size={CONST.AVATAR_SIZE.LARGE}
imageStyles={styles.avatarXLarge}
size={CONST.AVATAR_SIZE.XLARGE}
name={icons[0].name}
avatarID={icons[0].id}
type={icons[0].type}
Expand Down
4 changes: 4 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ export default {
waitingOnEnabledWallet: ({submitterDisplayName}: WaitingOnBankAccountParams) => `started settling up. Payment is on hold until ${submitterDisplayName} enables their wallet.`,
enableWallet: 'Enable Wallet',
hold: 'Hold',
unhold: 'Unhold',
holdExpense: 'Hold expense',
unholdExpense: 'Unhold expense',
heldExpense: 'held this expense',
Expand Down Expand Up @@ -1305,6 +1306,9 @@ export default {
},
},
},
reportDetailsPage: {
inWorkspace: ({policyName}) => `in ${policyName}`,
},
reportDescriptionPage: {
roomDescription: 'Room description',
roomDescriptionOptional: 'Room description (optional)',
Expand Down
4 changes: 4 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,7 @@ export default {
payOnly: 'Solo pagar',
approveOnly: 'Solo aprobar',
hold: 'Bloqueada',
unhold: 'Desbloqueada',
holdEducationalTitle: 'Este gasto está',
whatIsHoldTitle: '¿Qué es Bloquear?',
whatIsHoldExplain: 'Bloquear es nuestra forma de agilizar la colaboración financiera. ¡"Rechazar" es tan duro!',
Expand Down Expand Up @@ -1305,6 +1306,9 @@ export default {
},
},
},
reportDetailsPage: {
inWorkspace: ({policyName}) => `en ${policyName}`,
},
reportDescriptionPage: {
roomDescription: 'Descripción de la sala de chat',
roomDescriptionOptional: 'Descripción de la sala de chat (opcional)',
Expand Down
19 changes: 13 additions & 6 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6143,22 +6143,29 @@ function getAllWorkspaceReports(policyID: string): Array<OnyxEntry<Report>> {
/**
* @param policy - the workspace the report is on, null if the user isn't a member of the workspace
*/
function shouldDisableRename(report: OnyxEntry<Report>, policy: OnyxEntry<Policy>): boolean {
if (isDefaultRoom(report) || isArchivedRoom(report) || isThread(report) || isMoneyRequestReport(report) || isPolicyExpenseChat(report)) {
function shouldDisableRename(report: OnyxEntry<Report>): boolean {
if (
isDefaultRoom(report) ||
isArchivedRoom(report) ||
isPublicRoom(report) ||
isThread(report) ||
isMoneyRequest(report) ||
isMoneyRequestReport(report) ||
isPolicyExpenseChat(report) ||
isInvoiceRoom(report) ||
isInvoiceReport(report)
) {
return true;
}

if (isGroupChat(report)) {
return false;
}

// if the linked workspace is null, that means the person isn't a member of the workspace the report is in
// which means this has to be a public room we want to disable renaming for
if (!policy) {
if (isDeprecatedGroupDM(report) || isTaskReport(report)) {
return true;
}

// If there is a linked workspace, that means the user is a member of the workspace the report is in and is allowed to rename.
return false;
}

Expand Down
Loading
Loading