-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Add workspace description #36058
Add workspace description #36058
Changes from all commits
15f1aee
841d2bf
8a0ca16
13e0c3e
8be9661
ed4b43d
2cd6b39
beb8f44
ea1d39f
50611e8
5cf38eb
19035b6
af8ccfe
0c19017
1dfce42
7cf5cc1
72d33df
9dd554f
6d320d8
1282d65
5acf332
534fe74
4fcc900
2f60134
283aefd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
type UpdateWorkspaceDescriptionParams = { | ||
policyID: string; | ||
description: string; | ||
}; | ||
|
||
export default UpdateWorkspaceDescriptionParams; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,9 @@ const propTypes = { | |
|
||
/** The URL for the policy avatar */ | ||
avatar: PropTypes.string, | ||
|
||
/** The id of the policy */ | ||
id: PropTypes.string, | ||
}), | ||
|
||
/** The reportID of the request */ | ||
|
@@ -111,7 +114,21 @@ function HeaderView(props) { | |
const isPolicyMember = useMemo(() => !_.isEmpty(props.policy), [props.policy]); | ||
const canLeaveRoom = ReportUtils.canLeaveRoom(props.report, isPolicyMember); | ||
const reportDescription = ReportUtils.getReportDescriptionText(props.report); | ||
const policyName = ReportUtils.getPolicyName(props.report); | ||
const policyName = ReportUtils.getPolicyName(props.report, true); | ||
const policyDescription = ReportUtils.getPolicyDescriptionText(props.policy); | ||
const isPersonalExpenseChat = isPolicyExpenseChat && ReportUtils.isCurrentUserSubmitter(props.report.reportID); | ||
const shouldShowSubtitle = () => { | ||
if (_.isEmpty(subtitle)) { | ||
return false; | ||
} | ||
if (isChatRoom) { | ||
return _.isEmpty(reportDescription); | ||
} | ||
if (isPolicyExpenseChat) { | ||
return _.isEmpty(policyDescription); | ||
} | ||
return true; | ||
}; | ||
|
||
// We hide the button when we are chatting with an automated Expensify account since it's not possible to contact | ||
// these users via alternative means. It is possible to request a call with Concierge so we leave the option for them. | ||
|
@@ -177,7 +194,7 @@ function HeaderView(props) { | |
); | ||
|
||
const renderAdditionalText = () => { | ||
if (_.isEmpty(policyName) || _.isEmpty(reportDescription) || !_.isEmpty(parentNavigationSubtitleData)) { | ||
if (shouldShowSubtitle() || isPersonalExpenseChat || _.isEmpty(policyName) || !_.isEmpty(parentNavigationSubtitleData)) { | ||
return null; | ||
} | ||
return ( | ||
|
@@ -280,15 +297,15 @@ function HeaderView(props) { | |
pressableStyles={[styles.alignSelfStart, styles.mw100]} | ||
/> | ||
)} | ||
{!_.isEmpty(subtitle) && _.isEmpty(reportDescription) && ( | ||
{shouldShowSubtitle() && ( | ||
<Text | ||
style={[styles.sidebarLinkText, styles.optionAlternateText, styles.textLabelSupporting]} | ||
numberOfLines={1} | ||
> | ||
{subtitle} | ||
</Text> | ||
)} | ||
{!_.isEmpty(reportDescription) && _.isEmpty(parentNavigationSubtitleData) && ( | ||
{isChatRoom && !_.isEmpty(reportDescription) && _.isEmpty(parentNavigationSubtitleData) && ( | ||
<PressableWithoutFeedback | ||
onPress={() => { | ||
if (ReportUtils.canEditReportDescription(props.report, props.policy)) { | ||
|
@@ -308,6 +325,26 @@ function HeaderView(props) { | |
</Text> | ||
</PressableWithoutFeedback> | ||
)} | ||
{isPolicyExpenseChat && !_.isEmpty(policyDescription) && _.isEmpty(parentNavigationSubtitleData) && ( | ||
<PressableWithoutFeedback | ||
onPress={() => { | ||
if (ReportUtils.canEditPolicyDescription(props.policy)) { | ||
Navigation.navigate(ROUTES.WORKSPACE_DESCRIPTION.getRoute(props.report.policyID)); | ||
return; | ||
} | ||
Navigation.navigate(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(props.reportID)); | ||
}} | ||
style={[styles.alignSelfStart, styles.mw100]} | ||
accessibilityLabel={translate('workspace.editor.descriptionInputLabel')} | ||
> | ||
<Text | ||
style={[styles.sidebarLinkText, styles.optionAlternateText, styles.textLabelSupporting]} | ||
numberOfLines={1} | ||
> | ||
{policyDescription} | ||
</Text> | ||
</PressableWithoutFeedback> | ||
)} | ||
</View> | ||
{brickRoadIndicator === CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR && ( | ||
<View style={[styles.alignItemsCenter, styles.justifyContentCenter]}> | ||
|
@@ -371,7 +408,6 @@ export default memo( | |
}, | ||
policy: { | ||
key: ({report}) => `${ONYXKEYS.COLLECTION.POLICY}${report ? report.policyID : '0'}`, | ||
selector: (policy) => _.pick(policy, ['name', 'avatar', 'pendingAction']), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you explain why we need to make this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jjcoffee We need to use many other properties on the policy object like |
||
}, | ||
personalDetails: { | ||
key: ONYXKEYS.PERSONAL_DETAILS_LIST, | ||
|
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.
This line created a regression. Issue here #36991