diff --git a/app/components/autocomplete_selector/index.tsx b/app/components/autocomplete_selector/index.tsx index 9412a3436..77cce1461 100644 --- a/app/components/autocomplete_selector/index.tsx +++ b/app/components/autocomplete_selector/index.tsx @@ -23,6 +23,7 @@ import {secureGetFromRecord} from '@utils/types'; import {displayUsername} from '@utils/user'; import type {WithDatabaseArgs} from '@typings/database/database'; +import type {AvailableScreens} from '@typings/screens/navigation'; type Selection = DialogOption | Channel | UserProfile | DialogOption[] | Channel[] | UserProfile[]; @@ -43,6 +44,7 @@ type AutoCompleteSelectorProps = { teammateNameDisplay: string; isMultiselect?: boolean; testID: string; + location: AvailableScreens; } const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => { @@ -131,8 +133,22 @@ function getTextAndValueFromSelectedItem(item: Selection, teammateNameDisplay: s } function AutoCompleteSelector({ - dataSource, disabled = false, errorText, getDynamicOptions, helpText, label, onSelected, optional = false, - options, placeholder, roundedBorders = true, selected, teammateNameDisplay, isMultiselect = false, testID, + dataSource, + disabled = false, + errorText, + getDynamicOptions, + helpText, + label, + onSelected, + optional = false, + options, + placeholder, + roundedBorders = true, + selected, + teammateNameDisplay, + isMultiselect = false, + testID, + location, }: AutoCompleteSelectorProps) { const intl = useIntl(); const theme = useTheme(); @@ -221,6 +237,7 @@ function AutoCompleteSelector({ disabled={disabled} helpText={helpText} errorText={errorText} + location={location} /> ); diff --git a/app/components/draft_scheduled_post/draft_scheduled_post.tsx b/app/components/draft_scheduled_post/draft_scheduled_post.tsx index 6a36a2989..a60fc8525 100644 --- a/app/components/draft_scheduled_post/draft_scheduled_post.tsx +++ b/app/components/draft_scheduled_post/draft_scheduled_post.tsx @@ -23,10 +23,11 @@ import type ChannelModel from '@typings/database/models/servers/channel'; import type DraftModel from '@typings/database/models/servers/draft'; import type ScheduledPostModel from '@typings/database/models/servers/scheduled_post'; import type UserModel from '@typings/database/models/servers/user'; +import type {AvailableScreens} from '@typings/screens/navigation'; type Props = { channel: ChannelModel; - location: string; + location: AvailableScreens; postReceiverUser?: UserModel; post: DraftModel | ScheduledPostModel; layoutWidth: number; diff --git a/app/components/draft_scheduled_post/draft_scheduled_post_container/draft_and_scheduled_post_message.tsx b/app/components/draft_scheduled_post/draft_scheduled_post_container/draft_and_scheduled_post_message.tsx index acdee7bca..a32a30cd0 100644 --- a/app/components/draft_scheduled_post/draft_scheduled_post_container/draft_and_scheduled_post_message.tsx +++ b/app/components/draft_scheduled_post/draft_scheduled_post_container/draft_and_scheduled_post_message.tsx @@ -16,11 +16,12 @@ import {typography} from '@utils/typography'; import type DraftModel from '@typings/database/models/servers/draft'; import type ScheduledPostModel from '@typings/database/models/servers/scheduled_post'; import type {UserMentionKey} from '@typings/global/markdown'; +import type {AvailableScreens} from '@typings/screens/navigation'; type Props = { post: DraftModel | ScheduledPostModel; layoutWidth: number; - location: string; + location: AvailableScreens; } const EMPTY_MENTION_KEYS: UserMentionKey[] = []; diff --git a/app/components/draft_scheduled_post/draft_scheduled_post_container/index.tsx b/app/components/draft_scheduled_post/draft_scheduled_post_container/index.tsx index 1934c436c..ded2c309b 100644 --- a/app/components/draft_scheduled_post/draft_scheduled_post_container/index.tsx +++ b/app/components/draft_scheduled_post/draft_scheduled_post_container/index.tsx @@ -12,10 +12,11 @@ import DraftAndScheduledPostMessage from './draft_and_scheduled_post_message'; import type DraftModel from '@typings/database/models/servers/draft'; import type ScheduledPostModel from '@typings/database/models/servers/scheduled_post'; +import type {AvailableScreens} from '@typings/screens/navigation'; type Props = { post: DraftModel | ScheduledPostModel; - location: string; + location: AvailableScreens; layoutWidth: number; } diff --git a/app/components/formatted_markdown_text/index.tsx b/app/components/formatted_markdown_text/index.tsx index 674f6d992..94b6eb946 100644 --- a/app/components/formatted_markdown_text/index.tsx +++ b/app/components/formatted_markdown_text/index.tsx @@ -14,6 +14,7 @@ import {logWarning} from '@utils/log'; import {getMarkdownBlockStyles, getMarkdownTextStyles} from '@utils/markdown'; import {concatStyles, changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; +import type {AvailableScreens} from '@typings/screens/navigation'; import type {PrimitiveType} from 'intl-messageformat'; type Props = { @@ -21,7 +22,7 @@ type Props = { channelId?: string; defaultMessage: string; id: string; - location: string; + location: AvailableScreens; onPostPress?: (e: GestureResponderEvent) => void; style?: StyleProp; values?: Record; diff --git a/app/components/markdown/at_mention/at_mention.tsx b/app/components/markdown/at_mention/at_mention.tsx index ce337d4c9..fec462ad7 100644 --- a/app/components/markdown/at_mention/at_mention.tsx +++ b/app/components/markdown/at_mention/at_mention.tsx @@ -5,28 +5,28 @@ import {useManagedConfig} from '@mattermost/react-native-emm'; import Clipboard from '@react-native-clipboard/clipboard'; import React, {useCallback, useEffect, useMemo} from 'react'; import {useIntl} from 'react-intl'; -import {type GestureResponderEvent, Keyboard, type StyleProp, StyleSheet, Text, type TextStyle, View} from 'react-native'; +import {type GestureResponderEvent, type StyleProp, StyleSheet, Text, type TextStyle, View} from 'react-native'; import {fetchUserOrGroupsByMentionsInBatch} from '@actions/remote/user'; import SlideUpPanelItem, {ITEM_HEIGHT} from '@components/slide_up_panel_item'; -import {Screens} from '@constants'; import {useServerUrl} from '@context/server'; import {useTheme} from '@context/theme'; import GroupModel from '@database/models/server/group'; import {useMemoMentionedGroup, useMemoMentionedUser} from '@hooks/markdown'; -import {bottomSheet, dismissBottomSheet, openAsBottomSheet} from '@screens/navigation'; +import {bottomSheet, dismissBottomSheet, openUserProfileModal} from '@screens/navigation'; import {bottomSheetSnapPoint} from '@utils/helpers'; import {displayUsername} from '@utils/user'; import type GroupMembershipModel from '@typings/database/models/servers/group_membership'; import type UserModelType from '@typings/database/models/servers/user'; +import type {AvailableScreens} from '@typings/screens/navigation'; type AtMentionProps = { channelId?: string; currentUserId: string; disableAtChannelMentionHighlight?: boolean; isSearchResult?: boolean; - location: string; + location: AvailableScreens; mentionKeys?: Array<{key: string }>; mentionName: string; mentionStyle: StyleProp; @@ -95,13 +95,11 @@ const AtMention = ({ return; } - const screen = Screens.USER_PROFILE; - const title = intl.formatMessage({id: 'mobile.routes.user_profile', defaultMessage: 'Profile'}); - const closeButtonId = 'close-user-profile'; - const props = {closeButtonId, location, userId: user.id, channelId}; - - Keyboard.dismiss(); - openAsBottomSheet({screen, title, theme, closeButtonId, props}); + openUserProfileModal(intl, theme, { + location, + userId: user.id, + channelId, + }); }; const handleLongPress = useCallback(() => { diff --git a/app/components/markdown/markdown.test.tsx b/app/components/markdown/markdown.test.tsx index 804a36916..db78336fa 100644 --- a/app/components/markdown/markdown.test.tsx +++ b/app/components/markdown/markdown.test.tsx @@ -19,7 +19,7 @@ describe('Markdown', () => { baseTextStyle: {}, enableInlineLatex: true, enableLatex: true, - location: 'somewhere?', + location: 'Channel', maxNodes: 2000, theme: Preferences.THEMES.denim, }; diff --git a/app/components/markdown/markdown.tsx b/app/components/markdown/markdown.tsx index e72a8a978..38f23a527 100644 --- a/app/components/markdown/markdown.tsx +++ b/app/components/markdown/markdown.tsx @@ -38,6 +38,7 @@ import type { MarkdownAtMentionRenderer, MarkdownBaseRenderer, MarkdownBlockStyles, MarkdownChannelMentionRenderer, MarkdownEmojiRenderer, MarkdownImageRenderer, MarkdownLatexRenderer, MarkdownTextStyles, SearchPattern, UserMentionKey, HighlightWithoutNotificationKey, } from '@typings/global/markdown'; +import type {AvailableScreens} from '@typings/screens/navigation'; type MarkdownProps = { autolinkedUrlSchemes?: string[]; @@ -65,7 +66,7 @@ type MarkdownProps = { isSearchResult?: boolean; layoutHeight?: number; layoutWidth?: number; - location: string; + location: AvailableScreens; maxNodes: number; mentionKeys?: UserMentionKey[]; minimumHashtagLength?: number; diff --git a/app/components/post_draft/archived/index.tsx b/app/components/post_draft/archived/index.tsx index 867e61e92..d11b9ceaf 100644 --- a/app/components/post_draft/archived/index.tsx +++ b/app/components/post_draft/archived/index.tsx @@ -16,9 +16,12 @@ import {popToRoot} from '@screens/navigation'; import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; import {typography} from '@utils/typography'; +import type {AvailableScreens} from '@typings/screens/navigation'; + type Props = { testID?: string; deactivated?: boolean; + location: AvailableScreens; } const getStyleSheet = makeStyleSheetFromTheme((theme) => ({ @@ -57,6 +60,7 @@ const edges: Edge[] = ['bottom']; export default function Archived({ testID, deactivated, + location, }: Props) { const theme = useTheme(); const style = getStyleSheet(theme); @@ -94,7 +98,7 @@ export default function Archived({ {...message} style={style.archivedText} baseTextStyle={style.baseTextStyle} - location='' + location={location} />