Move Leave button into a row of the Report Details page#41823
Conversation
|
@DylanDylann Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
@DylanDylann This condition we used before The only thing |
|
In the current changes I use the condition for |
|
@ZhenjaHorbach We will apply ChatDetailsQuickActionsBar for all reports but we will not display pin/unpin option in all reports. Let's keep the options as before. This is discussed here |
I was just writing a comment about this ) In fact, it's a little confusing this discrepancy between the header and details page And during this comment we want use pin everywhere where we can do it |
|
@DylanDylann
And if I understand you correctly, you mean to show the pin button only for |
|
@ZhenjaHorbach Let's wait for the final decision from the design team before moving forward with the PR. Thanks |
I just fixed the conflicts) |
src/pages/ReportDetailsPage.tsx
Outdated
| </OfflineWithFeedback> | ||
| )} | ||
| {isGroupChat && <ChatDetailsQuickActionsBar report={report} />} | ||
| <ChatDetailsQuickActionsBar report={report} /> |
There was a problem hiding this comment.
@ZhenjaHorbach From my viewpoint, we should update like this
| <ChatDetailsQuickActionsBar report={report} /> | |
| {!isGroupDMChat && <ChatDetailsQuickActionsBar report={report} />} |
To make sure the logic to display the share button is same like before
There was a problem hiding this comment.
I will update this line
If something happens, I'll revert the last commit
If we decide to use it everywhere
src/pages/ReportDetailsPage.tsx
Outdated
|
|
||
| const isSelfDM = useMemo(() => ReportUtils.isSelfDM(report), [report]); | ||
|
|
||
| const shouldShowReportDescription = isChatRoom && (canEditReportDescription || report.description !== ''); |
There was a problem hiding this comment.
Revert the position of this variable to keep the change is clean
src/pages/ReportDetailsPage.tsx
Outdated
| translationKey: 'common.leave', | ||
| icon: Expensicons.Exit, | ||
| isAnonymousAction: true, | ||
| shouldShowRightIcon: false, |
There was a problem hiding this comment.
Should add shouldShowRightIcon: true to other item
There was a problem hiding this comment.
Sorry
I probably didn't fully understand you
But we only have one place where we don't need an icon
For other cases I have added a condition here
There was a problem hiding this comment.
yeah, the current change work well, but I think add shouldShowRightIcon: true to other item will be clearer
There was a problem hiding this comment.
Ahhhh
I understand )
No problem
I'll update now
|
@ZhenjaHorbach Minor comment and please merge main again. Thanks |
src/pages/ReportDetailsPage.tsx
Outdated
| }); | ||
| } | ||
|
|
||
| if ((isGroupChat || (isChatRoom && ReportUtils.canLeaveChat(report, policy ?? null))) && !isThread) { |
There was a problem hiding this comment.
Agree with you at this point && !isThread if it is thread we should display leave row
There was a problem hiding this comment.
Agree, but sort of out of scope for the original ticket maybe. I believe there is a separate project to make this change.
|
@ZhenjaHorbach please check TS error |
This is normal ) I will update the branch when a fix will be in main |
|
@DylanDylann |
src/pages/ReportDetailsPage.tsx
Outdated
| </OfflineWithFeedback> | ||
| )} | ||
| {isGroupChat && <ChatDetailsQuickActionsBar report={report} />} | ||
| {!isGroupDMChat && <ChatDetailsQuickActionsBar report={report} />} |
There was a problem hiding this comment.
We can pin a Group DM chat, but not share it. They are getting deprecated soon. But, I think this is more or less incorrect logic and we should be able to remove the !isGroupDMChat.
src/pages/ReportDetailsPage.tsx
Outdated
| }); | ||
| } | ||
|
|
||
| if ((isGroupChat || (isChatRoom && ReportUtils.canLeaveChat(report, policy ?? null))) && !isThread) { |
There was a problem hiding this comment.
Agree, but sort of out of scope for the original ticket maybe. I believe there is a separate project to make this change.
|
@ZhenjaHorbach found one thing if you can fix it - otherwise, looks great. Thanks for your patience both @DylanDylann and @ZhenjaHorbach as we had temporarily halted merging of PRs, but now resumed. 🙇 |
I updated the branch and fixed comments |
| icon={Expensicons.QrCode} | ||
| style={styles.flex1} | ||
| text={isPinned ? translate('common.unPin') : translate('common.pin')} | ||
| text={translate('common.share')} |
There was a problem hiding this comment.
well, we need to add back the if (!isGroupDMChat) to this part now... I thought that was clear from my last comment sorry if not.
There was a problem hiding this comment.
Oh, sorry
Perhaps I misunderstood
But I fixed it
And I updated the styles for one button inside ActionsBar following this comment
There was a problem hiding this comment.
Would you mind posting a screen shot of this change? I want to make sure it's what @shawnborton expects. Thanks!
There was a problem hiding this comment.
I think we're working on a component for this that has all of that baked in. @grgia does that sound right?
There was a problem hiding this comment.
Check this PR here: #41972
Just want to make sure we aren't duplicating work.
There was a problem hiding this comment.
@shawnborton thanks for noticing! It looks like this PR will conflict with #41972
cc @grgia
There was a problem hiding this comment.
Thanks for the heads up @shawnborton
I think we're good here though. We just need to fix some conflicts now @ZhenjaHorbach. I've instructed @cdOut to pause the next PR they mentioned since we don't really need it.
@grgia might want to do a quick scan to make sure there aren't any other improvements with open issues that snuck into that design doc, but don't think there are a ton. They should all be in the #vip-split project and categorized by Group Chats.
There was a problem hiding this comment.
I updated the PR and made changes to use the new implementation for ActionBar
There was a problem hiding this comment.
Although we have TS issue in main
#42798
marcaaron
left a comment
There was a problem hiding this comment.
Just had one more small request. Rest of the code looks good, but don't think we need isHidden
| onSelected: () => void; | ||
|
|
||
| /** Whether the item is hidden */ | ||
| isHidden?: boolean; |
There was a problem hiding this comment.
Why do we have an isHidden prop vs. just not including it in the items passed to the component?
There was a problem hiding this comment.
Actually good idea
Thanks for the review
Done )
| {promotedActions.map(({key, onSelected, ...props}) => { | ||
| if (props.isHidden) { | ||
| return null; | ||
| } |
There was a problem hiding this comment.
Let's just exclude it if it should be hidden? Then this can be removed.
src/libs/HeaderUtils.ts
Outdated
| } | ||
|
|
||
| function getShareMenuItem(report: OnyxReport, participants: number[]): ThreeDotsMenuItem { | ||
| const isGroupDMChat = ReportUtils.isDM(report) && participants.length > 1; |
There was a problem hiding this comment.
Check for isGroupDMChat when we are deciding whether to add the share menu item or not. Then delete this method as it is only used in one place.
| shouldShowLeaveButton | ||
| /> | ||
| )} | ||
| <PromotedActionsBar promotedActions={[PromotedActions.pin(report), ...(isGroupDMChat ? [] : [PromotedActions.share(report)])]} /> |
There was a problem hiding this comment.
NAB but I think it is slightly over engineered to have "pin" and "share" functions that return an object. No need for all these different methods IMO. Just use the objects.
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.4.79-11 🚀
|
| key: CONST.REPORT_DETAILS_MENU_ITEM.LEAVE_ROOM, | ||
| translationKey: 'common.leave', | ||
| icon: Expensicons.Exit, | ||
| isAnonymousAction: true, |
There was a problem hiding this comment.
Coming from #43404:
@ZhenjaHorbach was there any reason for setting this value to true?
There was a problem hiding this comment.
Hmmm
Actually good question
But I don't think it should be true


Details
Move the "Share" row into the ChatDetailsQuickActionsBar
Move the "Leave" button out of this component and into it's own row here.
Fixed Issues
$ #40256
PROPOSAL: #40256 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
android_w5JoDfzq.mp4
Android: mWeb Chrome
android_w5JoDfzq.mp4
iOS: Native
ios_C82AYGGZ.mp4
iOS: mWeb Safari
ios-web_D4Z5n1mS.mp4
MacOS: Chrome / Safari
web_YDYEn9BO.mp4
MacOS: Desktop
desktop_7RFrq62O.mp4