-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Move Leave button into a row of the Report Details page #41823
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
@@ -332,7 +354,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD | |||
/> | |||
</OfflineWithFeedback> | |||
)} | |||
{isGroupChat && <ChatDetailsQuickActionsBar report={report} />} | |||
<ChatDetailsQuickActionsBar report={report} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 isPrivateNotesFetchTriggered = report?.isLoadingPrivateNotes !== undefined; | ||
|
||
const isSelfDM = useMemo(() => ReportUtils.isSelfDM(report), [report]); | ||
|
||
const shouldShowReportDescription = isChatRoom && (canEditReportDescription || report.description !== ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should add shouldShowRightIcon: true to other item
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahhhh
I understand )
No problem
I'll update now
@ZhenjaHorbach Minor comment and please merge main again. Thanks |
src/pages/ReportDetailsPage.tsx
Outdated
@@ -196,10 +196,27 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD | |||
}); | |||
} | |||
|
|||
if ((isGroupChat || (isChatRoom && ReportUtils.canLeaveChat(report, policy ?? null))) && !isThread) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with you at this point && !isThread
if it is thread we should display leave row
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -332,7 +357,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD | |||
/> | |||
</OfflineWithFeedback> | |||
)} | |||
{isGroupChat && <ChatDetailsQuickActionsBar report={report} />} | |||
{!isGroupDMChat && <ChatDetailsQuickActionsBar report={report} />} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -196,10 +196,27 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD | |||
}); | |||
} | |||
|
|||
if ((isGroupChat || (isChatRoom && ReportUtils.canLeaveChat(report, policy ?? null))) && !isThread) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
style={styles.flex1} | ||
text={isPinned ? translate('common.unPin') : translate('common.pin')} | ||
text={translate('common.share')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check this PR here: #41972
Just want to make sure we aren't duplicating work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shawnborton thanks for noticing! It looks like this PR will conflict with #41972
cc @grgia
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the PR and made changes to use the new implementation for ActionBar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although we have TS issue in main
#42798
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just had one more small request. Rest of the code looks good, but don't think we need isHidden
@@ -19,6 +19,9 @@ type ThreeDotsMenuItem = { | |||
|
|||
/** A callback triggered when the item is selected */ | |||
onSelected: () => void; | |||
|
|||
/** Whether the item is hidden */ | |||
isHidden?: boolean; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just exclude it if it should be hidden? Then this can be removed.
src/libs/HeaderUtils.ts
Outdated
@@ -15,7 +18,19 @@ function getPinMenuItem(report: OnyxReport): ThreeDotsMenuItem { | |||
}; | |||
} | |||
|
|||
function getShareMenuItem(report: OnyxReport, participants: number[]): ThreeDotsMenuItem { | |||
const isGroupDMChat = ReportUtils.isDM(report) && participants.length > 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming from #43404:
@ZhenjaHorbach was there any reason for setting this value to true?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmmm
Actually good question
But I don't think it should be true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for confirmation
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 Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.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