-
Notifications
You must be signed in to change notification settings - Fork 3.9k
seprate subtitle from title #77914
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
Closed
Closed
seprate subtitle from title #77914
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
b00d21f
seprate subtitle from title
Nodebrute 1ea5ae2
fix lint
Nodebrute f151d22
fix subtitle in 2 lines
Nodebrute f57edd0
fix lint errors
Nodebrute f8283c8
remove unused variables
Nodebrute a2684a5
Merge branch 'main' into sepratetitle
Nodebrute afc0c4b
fix lint error
Nodebrute af97ac4
fix font size of subtitle
Nodebrute 27b87ea
fix lint
Nodebrute 7c16bd1
Merge branch 'main' into sepratetitle
Nodebrute af674c7
undo subtitle line change
Nodebrute 94ec79b
Merge branch 'main' into sepratetitle
Nodebrute c3bb82b
Merge branch 'main' into sepratetitle
Nodebrute fd783be
add description styles
Nodebrute de1e48a
Merge branch 'main' into sepratetitle
Nodebrute 6261b1e
fix lint
Nodebrute 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 | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,15 +5,13 @@ import type {OnyxEntry} from 'react-native-onyx'; | |||||||
| import type {ValueOf} from 'type-fest'; | ||||||||
| import AvatarWithImagePicker from '@components/AvatarWithImagePicker'; | ||||||||
| import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; | ||||||||
| import DisplayNames from '@components/DisplayNames'; | ||||||||
| import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||||||||
| import MentionReportContext from '@components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/MentionReportContext'; | ||||||||
| import MenuItem from '@components/MenuItem'; | ||||||||
| import MenuItemWithTopDescription from '@components/MenuItemWithTopDescription'; | ||||||||
| import {ModalActions} from '@components/Modal/Global/ModalContext'; | ||||||||
| import OfflineWithFeedback from '@components/OfflineWithFeedback'; | ||||||||
| import ParentNavigationSubtitle from '@components/ParentNavigationSubtitle'; | ||||||||
| import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeedback'; | ||||||||
| import type {PromotedAction} from '@components/PromotedActionsBar'; | ||||||||
| import PromotedActionsBar, {PromotedActions} from '@components/PromotedActionsBar'; | ||||||||
| import ReportActionAvatars from '@components/ReportActionAvatars'; | ||||||||
|
|
@@ -40,13 +38,13 @@ import usePreferredPolicy from '@hooks/usePreferredPolicy'; | |||||||
| import useReportAttributes from '@hooks/useReportAttributes'; | ||||||||
| import useReportIsArchived from '@hooks/useReportIsArchived'; | ||||||||
| import useResponsiveLayout from '@hooks/useResponsiveLayout'; | ||||||||
| import useTheme from '@hooks/useTheme'; | ||||||||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||||||||
| import getBase62ReportID from '@libs/getBase62ReportID'; | ||||||||
| import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID'; | ||||||||
| import Navigation, {navigationRef} from '@libs/Navigation/Navigation'; | ||||||||
| import type {PlatformStackScreenProps} from '@libs/Navigation/PlatformStackNavigation/types'; | ||||||||
| import type {ReportDetailsNavigatorParamList, RightModalNavigatorParamList} from '@libs/Navigation/types'; | ||||||||
| import {getPersonalDetailsForAccountIDs} from '@libs/OptionsListUtils'; | ||||||||
| import Parser from '@libs/Parser'; | ||||||||
| import Permissions from '@libs/Permissions'; | ||||||||
| import {isPaidGroupPolicy, isPolicyAdmin as isPolicyAdminUtil, isPolicyEmployee as isPolicyEmployeeUtil, shouldShowPolicy} from '@libs/PolicyUtils'; | ||||||||
|
|
@@ -62,7 +60,6 @@ import { | |||||||
| createDraftTransactionAndNavigateToParticipantSelector, | ||||||||
| getAvailableReportFields, | ||||||||
| getChatRoomSubtitle, | ||||||||
| getDisplayNamesWithTooltips, | ||||||||
| getIcons, | ||||||||
| getOriginalReportID, | ||||||||
| getParentNavigationSubtitle, | ||||||||
|
|
@@ -104,10 +101,10 @@ import { | |||||||
| navigateBackOnDeleteTransaction, | ||||||||
| navigateToPrivateNotes, | ||||||||
| shouldDisableRename as shouldDisableRenameUtil, | ||||||||
| shouldUseFullTitleToDisplay, | ||||||||
| } from '@libs/ReportUtils'; | ||||||||
| import StringUtils from '@libs/StringUtils'; | ||||||||
| import {isDemoTransaction} from '@libs/TransactionUtils'; | ||||||||
| import variables from '@styles/variables'; | ||||||||
| import {deleteTrackExpense, getNavigationUrlAfterTrackExpenseDelete, getNavigationUrlOnMoneyRequestDelete} from '@userActions/IOU'; | ||||||||
| import { | ||||||||
| clearAvatarErrors, | ||||||||
|
|
@@ -156,9 +153,10 @@ const CASES = { | |||||||
| type CaseID = ValueOf<typeof CASES>; | ||||||||
|
|
||||||||
| function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetailsPageProps) { | ||||||||
| const {translate, localeCompare, formatPhoneNumber} = useLocalize(); | ||||||||
| const {translate, formatPhoneNumber} = useLocalize(); | ||||||||
| const {isOffline} = useNetwork(); | ||||||||
| const {isRestrictedToPreferredPolicy, preferredPolicyID} = usePreferredPolicy(); | ||||||||
| const theme = useTheme(); | ||||||||
| const activePolicy = useActivePolicy(); | ||||||||
| const styles = useThemeStyles(); | ||||||||
| const expensifyIcons = useMemoizedLazyExpensifyIcons(['Users', 'Gear', 'Send', 'Folder', 'UserPlus', 'Pencil', 'Checkmark', 'Building', 'Exit', 'Bug', 'Camera', 'Trashcan']); | ||||||||
|
|
@@ -197,7 +195,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail | |||||||
| const isPolicyAdmin = useMemo(() => isPolicyAdminUtil(policy), [policy]); | ||||||||
| const isPolicyEmployee = useMemo(() => isPolicyEmployeeUtil(report?.policyID, policy), [report?.policyID, policy]); | ||||||||
| const isPolicyExpenseChat = useMemo(() => isPolicyExpenseChatUtil(report), [report]); | ||||||||
| const shouldUseFullTitle = useMemo(() => shouldUseFullTitleToDisplay(report), [report]); | ||||||||
|
|
||||||||
| const isChatRoom = useMemo(() => isChatRoomUtil(report), [report]); | ||||||||
| const isUserCreatedPolicyRoom = useMemo(() => isUserCreatedPolicyRoomUtil(report), [report]); | ||||||||
| const isDefaultRoom = useMemo(() => isDefaultRoomUtil(report), [report]); | ||||||||
|
|
@@ -225,6 +223,7 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail | |||||||
| const parentNavigationSubtitleData = getParentNavigationSubtitle(report, isParentReportArchived); | ||||||||
| const base62ReportID = getBase62ReportID(Number(report.reportID)); | ||||||||
| const ancestors = useAncestors(report); | ||||||||
| const parentNavigationSubtitleTextStyle = useMemo(() => ({fontSize: variables.fontSizeNormal, color: theme.heading}), [theme.heading]); | ||||||||
| // eslint-disable-next-line react-hooks/exhaustive-deps -- policy is a dependency because `getChatRoomSubtitle` calls `getPolicyName` which in turn retrieves the value from the `policy` value stored in Onyx | ||||||||
| const chatRoomSubtitle = useMemo(() => { | ||||||||
| const subtitle = getChatRoomSubtitle(report, false, isReportArchived); | ||||||||
|
|
@@ -630,26 +629,11 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail | |||||||
| userBillingGraceEndPeriodCollection, | ||||||||
| ]); | ||||||||
|
|
||||||||
| const displayNamesWithTooltips = useMemo(() => { | ||||||||
| const hasMultipleParticipants = participants.length > 1; | ||||||||
| return getDisplayNamesWithTooltips(getPersonalDetailsForAccountIDs(participants, personalDetails), hasMultipleParticipants, localeCompare, formatPhoneNumber); | ||||||||
| }, [participants, personalDetails, localeCompare, formatPhoneNumber]); | ||||||||
|
|
||||||||
| const icons = useMemo( | ||||||||
| () => getIcons(report, formatPhoneNumber, personalDetails, null, '', -1, policy, undefined, isReportArchived), | ||||||||
| [report, formatPhoneNumber, personalDetails, policy, isReportArchived], | ||||||||
| ); | ||||||||
|
|
||||||||
| const chatRoomSubtitleText = chatRoomSubtitle ? ( | ||||||||
| <DisplayNames | ||||||||
| fullTitle={chatRoomSubtitle} | ||||||||
| tooltipEnabled | ||||||||
| numberOfLines={1} | ||||||||
| textStyles={[styles.sidebarLinkText, styles.textLabelSupporting, styles.pre, styles.mt1, styles.textAlignCenter]} | ||||||||
| shouldUseFullTitle | ||||||||
| /> | ||||||||
| ) : null; | ||||||||
|
|
||||||||
| const renderedAvatar = useMemo(() => { | ||||||||
| if (isChatRoom && !isThread) { | ||||||||
| return ( | ||||||||
|
|
@@ -737,61 +721,36 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail | |||||||
| }, [canJoin, report, backTo, currentUserPersonalDetails.accountID]); | ||||||||
|
|
||||||||
| const nameSectionExpenseIOU = ( | ||||||||
| <View style={[styles.reportDetailsRoomInfo, styles.mw100]}> | ||||||||
| {shouldDisableRename && ( | ||||||||
| <> | ||||||||
| <View style={[styles.alignSelfCenter, styles.w100, styles.mt1]}> | ||||||||
| <DisplayNames | ||||||||
| fullTitle={reportName} | ||||||||
| displayNamesWithTooltips={displayNamesWithTooltips} | ||||||||
| shouldParseFullTitle={!isGroupChat} | ||||||||
| tooltipEnabled | ||||||||
| numberOfLines={isChatRoom && !isChatThread ? 0 : 1} | ||||||||
| textStyles={[styles.textHeadline, styles.textAlignCenter, isChatRoom && !isChatThread ? undefined : styles.pre]} | ||||||||
| shouldUseFullTitle={shouldUseFullTitle} | ||||||||
| /> | ||||||||
| </View> | ||||||||
| {isPolicyAdmin ? ( | ||||||||
| <PressableWithoutFeedback | ||||||||
| style={[styles.w100]} | ||||||||
| disabled={policy?.pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE} | ||||||||
| role={CONST.ROLE.BUTTON} | ||||||||
| accessibilityLabel={chatRoomSubtitle} | ||||||||
| accessible | ||||||||
| sentryLabel={CONST.SENTRY_LABEL.REPORT_DETAILS.WORKSPACE_LINK} | ||||||||
| onPress={() => { | ||||||||
| let policyID = report?.policyID; | ||||||||
|
|
||||||||
| if (!policyID) { | ||||||||
| policyID = ''; | ||||||||
| } | ||||||||
|
|
||||||||
| Navigation.navigate(ROUTES.WORKSPACE_INITIAL.getRoute(policyID)); | ||||||||
| }} | ||||||||
| > | ||||||||
| {chatRoomSubtitleText} | ||||||||
| </PressableWithoutFeedback> | ||||||||
| ) : ( | ||||||||
| chatRoomSubtitleText | ||||||||
| )} | ||||||||
| </> | ||||||||
| )} | ||||||||
| <> | ||||||||
| <MenuItemWithTopDescription | ||||||||
| shouldShowRightIcon={false} | ||||||||
| interactive={false} | ||||||||
| title={reportName} | ||||||||
| titleStyle={styles.newKansasLarge} | ||||||||
| shouldCheckActionAllowedOnPress={false} | ||||||||
| description={translate('common.title')} | ||||||||
| /> | ||||||||
| {!isEmptyObject(parentNavigationSubtitleData) && (isMoneyRequestReport || isInvoiceReport || isMoneyRequest || isTaskReport) && ( | ||||||||
| <View style={[styles.w100, styles.mt1, styles.alignItemsCenter]}> | ||||||||
| <View style={styles.mw100}> | ||||||||
| <MenuItemWithTopDescription | ||||||||
| shouldShowRightIcon={false} | ||||||||
| interactive={false} | ||||||||
| titleComponent={ | ||||||||
| <ParentNavigationSubtitle | ||||||||
| parentNavigationSubtitleData={parentNavigationSubtitleData} | ||||||||
| reportID={report?.reportID} | ||||||||
| parentReportID={report?.parentReportID} | ||||||||
| parentReportActionID={report?.parentReportActionID} | ||||||||
| pressableStyles={[styles.mt1, styles.mw100]} | ||||||||
| textStyles={[styles.textAlignCenter]} | ||||||||
| subtitleNumberOfLines={2} | ||||||||
| shouldShowFrom={false} | ||||||||
| textStyles={parentNavigationSubtitleTextStyle} | ||||||||
| /> | ||||||||
| </View> | ||||||||
| </View> | ||||||||
| } | ||||||||
| description={translate('threads.from')} | ||||||||
| descriptionTextStyle={[styles.mutedNormalTextLabel, styles.mb1]} | ||||||||
| shouldCheckActionAllowedOnPress={false} | ||||||||
| /> | ||||||||
| )} | ||||||||
| </View> | ||||||||
| </> | ||||||||
| ); | ||||||||
|
|
||||||||
| const nameSectionGroupWorkspace = ( | ||||||||
|
|
@@ -839,6 +798,8 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail | |||||||
| parentReportActionID={report?.parentReportActionID} | ||||||||
| pressableStyles={[styles.mt1, styles.mw100]} | ||||||||
| subtitleNumberOfLines={2} | ||||||||
| shouldShowFrom={false} | ||||||||
| textStyles={parentNavigationSubtitleTextStyle} | ||||||||
| /> | ||||||||
| ); | ||||||||
|
|
||||||||
|
|
@@ -867,7 +828,13 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail | |||||||
|
|
||||||||
| Navigation.navigate(ROUTES.EDIT_REPORT_FIELD_REQUEST.getRoute(report.reportID, policyID, CONST.REPORT_FIELD_TITLE_FIELD_ID, backTo)); | ||||||||
| }} | ||||||||
| furtherDetailsComponent={nameSectionFurtherDetailsContent} | ||||||||
| /> | ||||||||
| <MenuItemWithTopDescription | ||||||||
| shouldShowRightIcon={false} | ||||||||
| interactive={false} | ||||||||
| titleComponent={nameSectionFurtherDetailsContent} | ||||||||
| description={translate('common.from')} | ||||||||
|
Contributor
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.
Suggested change
Contributor
Author
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. Done 👍 |
||||||||
| descriptionTextStyle={[styles.mutedNormalTextLabel, styles.mb1]} | ||||||||
| /> | ||||||||
| </View> | ||||||||
| </OfflineWithFeedback> | ||||||||
|
|
@@ -1026,11 +993,9 @@ function ReportDetailsPage({policy, report, route, reportMetadata}: ReportDetail | |||||||
| onBackButtonPress={() => Navigation.goBack(backTo)} | ||||||||
| /> | ||||||||
| <ScrollView contentContainerStyle={[styles.flexGrow1]}> | ||||||||
| <View style={[styles.reportDetailsTitleContainer, styles.pb0]}> | ||||||||
| {renderedAvatar} | ||||||||
| {isExpenseReport && !shouldShowEditableTitleField && nameSectionExpenseIOU} | ||||||||
| </View> | ||||||||
| {isExpenseReport && shouldShowEditableTitleField && nameSectionTitleField} | ||||||||
| <View style={[styles.reportDetailsTitleContainer, styles.pb0]}>{renderedAvatar}</View> | ||||||||
| {isExpenseReport && (!shouldShowEditableTitleField || !titleField) && nameSectionExpenseIOU} | ||||||||
| {isExpenseReport && shouldShowEditableTitleField && titleField && nameSectionTitleField} | ||||||||
|
|
||||||||
| {!isExpenseReport && nameSectionGroupWorkspace} | ||||||||
|
|
||||||||
|
|
||||||||
Oops, something went wrong.
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
descriptionTextStyleto make it consistent with other description labels.