From c0fc0c868f15eadb1c131b65ccff0259ff433efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Espino=20Garc=C3=ADa?= Date: Mon, 19 Jan 2026 17:40:45 +0100 Subject: [PATCH] [MM-66839] (#9365) * [MM-66839] * i18n-extract * Address feedback * Fix lint --- app/components/markdown/error_boundary.tsx | 4 ++- app/components/markdown/markdown.tsx | 2 +- .../markdown/markdown_table/index.tsx | 6 ++++ app/components/post_list/post/body/index.tsx | 32 ++++++++++++------- app/screens/table/index.tsx | 32 +++++++++++++++++-- assets/base/i18n/en.json | 4 ++- 6 files changed, 62 insertions(+), 18 deletions(-) diff --git a/app/components/markdown/error_boundary.tsx b/app/components/markdown/error_boundary.tsx index 282e22a95..9aa0f068f 100644 --- a/app/components/markdown/error_boundary.tsx +++ b/app/components/markdown/error_boundary.tsx @@ -4,6 +4,7 @@ import React from 'react'; import {Text} from 'react-native'; +import {logError} from '@utils/log'; import {makeStyleSheetFromTheme} from '@utils/theme'; import {typography} from '@utils/typography'; @@ -33,7 +34,8 @@ class ErrorBoundary extends React.PureComponent { this.state = {hasError: false}; } - componentDidCatch() { + componentDidCatch(error: unknown) { + logError('Error in ErrorBoundary:', error); this.setState({hasError: true}); } diff --git a/app/components/markdown/markdown.tsx b/app/components/markdown/markdown.tsx index 02160219e..8add4accc 100644 --- a/app/components/markdown/markdown.tsx +++ b/app/components/markdown/markdown.tsx @@ -571,7 +571,7 @@ const Markdown = ({ return ( diff --git a/app/components/markdown/markdown_table/index.tsx b/app/components/markdown/markdown_table/index.tsx index e89045801..9fdf59cae 100644 --- a/app/components/markdown/markdown_table/index.tsx +++ b/app/components/markdown/markdown_table/index.tsx @@ -219,9 +219,15 @@ class MarkdownTable extends PureComponent { diff --git a/app/components/post_list/post/body/index.tsx b/app/components/post_list/post/body/index.tsx index b320c463a..0d89ba466 100644 --- a/app/components/post_list/post/body/index.tsx +++ b/app/components/post_list/post/body/index.tsx @@ -2,11 +2,13 @@ // See LICENSE.txt for license information. import React, {useCallback, useMemo, useState} from 'react'; +import {useIntl} from 'react-intl'; import {type LayoutChangeEvent, type StyleProp, View, type ViewStyle} from 'react-native'; import Files from '@components/files'; import FormattedText from '@components/formatted_text'; import JumboEmoji from '@components/jumbo_emoji'; +import ErrorBoundary from '@components/markdown/error_boundary'; import {Screens} from '@constants'; import {THREAD} from '@constants/screens'; import StatusUpdatePost from '@playbooks/components/status_update_post'; @@ -91,6 +93,7 @@ const Body = ({ isCRTEnabled, isEphemeral, isFirstReply, isJumboEmoji, isLastReply, isPendingOrFailed, isPostAcknowledgementEnabled, isPostAddChannelMember, location, post, searchPatterns, showAddReaction, theme, }: BodyProps) => { + const intl = useIntl(); const style = getStyleSheet(theme); const isEdited = postEdited(post); const isFailed = isPostFailed(post); @@ -229,19 +232,24 @@ const Body = ({ } return ( - - - {body} - {isFailed && - - } - + + + {body} + {isFailed && + + } + + ); }; diff --git a/app/screens/table/index.tsx b/app/screens/table/index.tsx index e7127868c..bb2d5e448 100644 --- a/app/screens/table/index.tsx +++ b/app/screens/table/index.tsx @@ -2,12 +2,16 @@ // See LICENSE.txt for license information. import React, {useCallback} from 'react'; -import {Platform, ScrollView, StyleSheet, View} from 'react-native'; +import {useIntl} from 'react-intl'; +import {Platform, ScrollView, Text, View} from 'react-native'; import {SafeAreaView} from 'react-native-safe-area-context'; +import {useTheme} from '@context/theme'; import useAndroidHardwareBackHandler from '@hooks/android_back_handler'; import SecurityManager from '@managers/security_manager'; import {popTopScreen} from '@screens/navigation'; +import {makeStyleSheetFromTheme} from '@utils/theme'; +import {typography} from '@utils/typography'; import type {AvailableScreens} from '@typings/screens/navigation'; @@ -18,7 +22,7 @@ type Props = { width: number; } -const styles = StyleSheet.create({ +const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => ({ container: { flex: 1, }, @@ -35,18 +39,40 @@ const styles = StyleSheet.create({ }, }), }, -}); + noTableText: { + color: theme.dndIndicator, + ...typography('Body', 200, 'Regular'), + }, + noTableContainer: { + padding: 24, + }, +})); const Table = ({componentId, renderAsFlex, renderRows, width}: Props) => { + const theme = useTheme(); + const styles = getStyleSheet(theme); const content = renderRows(true); const viewStyle = renderAsFlex ? styles.displayFlex : {width}; + const intl = useIntl(); + const close = useCallback(() => { popTopScreen(componentId); }, [componentId]); useAndroidHardwareBackHandler(componentId, close); + if (!content) { + return ( + + {intl.formatMessage({id: 'table.cannot_display_table', defaultMessage: 'Cannot display table'})} + + ); + } + if (Platform.OS === 'android') { return (