-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Update header subtitle styles for thread (child) reports #23621
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6356815
Make only roomTitle blue
grgia 3a7f3d1
Merge branch 'main' into georgia-headerHoverLinkStyle
grgia efe1132
remove parentNavigationPropTypes
grgia 99296ec
remove hasParentNavigationSubtitle, add pressable styles, boolean check
grgia 9ff6383
prettier
grgia 82a2ef1
update jsDocs
grgia ca26b36
only pass parentReportID
grgia b361d2b
Merge branch 'main' into georgia-headerHoverLinkStyle
grgia 0ffabc8
remove default to empty string for parentReportID
grgia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import React from 'react'; | ||
| import PropTypes from 'prop-types'; | ||
| import styles from '../styles/styles'; | ||
| import CONST from '../CONST'; | ||
| import Text from './Text'; | ||
| import PressableWithoutFeedback from './Pressable/PressableWithoutFeedback'; | ||
| import Navigation from '../libs/Navigation/Navigation'; | ||
| import ROUTES from '../ROUTES'; | ||
| import useLocalize from '../hooks/useLocalize'; | ||
|
|
||
| const propTypes = { | ||
| parentNavigationSubtitleData: PropTypes.shape({ | ||
| // Title of root report room | ||
| rootReportName: PropTypes.string, | ||
|
|
||
| // Name of workspace, if any | ||
| workspaceName: PropTypes.string, | ||
| }).isRequired, | ||
|
|
||
| /** parent Report ID */ | ||
| parentReportID: PropTypes.string, | ||
|
|
||
| /** PressableWithoutFeedack additional styles */ | ||
| // eslint-disable-next-line react/forbid-prop-types | ||
| pressableStyles: PropTypes.arrayOf(PropTypes.object), | ||
| }; | ||
|
|
||
| const defaultProps = { | ||
| parentReportID: '', | ||
| pressableStyles: [], | ||
| }; | ||
|
|
||
| function ParentNavigationSubtitle(props) { | ||
| const {workspaceName, rootReportName} = props.parentNavigationSubtitleData; | ||
|
|
||
| const {translate} = useLocalize(); | ||
|
|
||
| return ( | ||
| <PressableWithoutFeedback | ||
| onPress={() => { | ||
| Navigation.navigate(ROUTES.getReportRoute(props.parentReportID)); | ||
| }} | ||
| accessibilityLabel={translate('threads.parentNavigationSummary', {rootReportName, workspaceName})} | ||
| accessibilityRole={CONST.ACCESSIBILITY_ROLE.LINK} | ||
| style={[...props.pressableStyles]} | ||
| > | ||
| <Text | ||
| style={[styles.optionAlternateText]} | ||
| numberOfLines={1} | ||
| > | ||
| <Text style={[styles.optionAlternateText, styles.textLabelSupporting]}>{`${translate('threads.from')} `}</Text> | ||
| <Text style={[styles.optionAlternateText, styles.textLabelSupporting, styles.link]}>{rootReportName}</Text> | ||
| {Boolean(workspaceName) && <Text style={[styles.optionAlternateText, styles.textLabelSupporting]}>{` ${translate('threads.in')} ${workspaceName}`}</Text>} | ||
| </Text> | ||
| </PressableWithoutFeedback> | ||
| ); | ||
| } | ||
|
|
||
| ParentNavigationSubtitle.defaultProps = defaultProps; | ||
| ParentNavigationSubtitle.propTypes = propTypes; | ||
| ParentNavigationSubtitle.displayName = 'ParentNavigationSubtitle'; | ||
| export default ParentNavigationSubtitle; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1400,19 +1400,19 @@ function getChatRoomSubtitle(report) { | |
| /** | ||
| * Gets the parent navigation subtitle for the report | ||
| * @param {Object} report | ||
| * @returns {String} | ||
| * @returns {Object} | ||
| */ | ||
| function getParentNavigationSubtitle(report) { | ||
| if (isThread(report)) { | ||
| const parentReport = lodashGet(allReports, [`${ONYXKEYS.COLLECTION.REPORT}${report.parentReportID}`]); | ||
| const {rootReportName, workspaceName} = getRootReportAndWorkspaceName(parentReport); | ||
| if (_.isEmpty(rootReportName)) { | ||
| return ''; | ||
| return {}; | ||
| } | ||
|
|
||
| return Localize.translateLocal('threads.parentNavigationSummary', {rootReportName, workspaceName}); | ||
| return {rootReportName, workspaceName}; | ||
| } | ||
| return ''; | ||
| return {}; | ||
|
Member
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. Update the JSDoc that this returns an object and not a string |
||
| } | ||
|
|
||
| /** | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 need to set color here too for the ellipses as it caused issue #52381