Skip to content
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

fix: LHN shows empty without any placeholder #55147

Merged
merged 12 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/components/BlockingViews/FullPageNotFoundView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import {View} from 'react-native';
import type {StyleProp, TextStyle} from 'react-native';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import * as Illustrations from '@components/Icon/Illustrations';
import useLocalize from '@hooks/useLocalize';
Expand Down Expand Up @@ -43,6 +44,12 @@ type FullPageNotFoundViewProps = {

/** Whether we should force the full page view */
shouldForceFullScreen?: boolean;

/** The style of the subtitle message */
subtitleStyle?: StyleProp<TextStyle>;

/** Whether we should display the button that opens new SearchRouter */
shouldDisplaySearchRouter?: boolean;
};

// eslint-disable-next-line rulesdir/no-negated-variables
Expand All @@ -58,6 +65,8 @@ function FullPageNotFoundView({
shouldShowBackButton = true,
onLinkPress = () => Navigation.dismissModal(),
shouldForceFullScreen = false,
subtitleStyle,
shouldDisplaySearchRouter,
}: FullPageNotFoundViewProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
Expand All @@ -68,6 +77,7 @@ function FullPageNotFoundView({
<HeaderWithBackButton
onBackButtonPress={onBackButtonPress}
shouldShowBackButton={shouldShowBackButton}
shouldDisplaySearchRouter={shouldDisplaySearchRouter}
/>
<View
style={[styles.flex1, styles.blockingViewContainer]}
Expand All @@ -82,6 +92,7 @@ function FullPageNotFoundView({
linkKey={linkKey}
shouldShowLink={shouldShowLink}
onLinkPress={onLinkPress}
subtitleStyle={subtitleStyle}
/>
</View>
</ForceFullScreenView>
Expand Down
4 changes: 1 addition & 3 deletions src/components/LHNOptionsList/LHNOptionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import TextBlock from '@components/TextBlock';
import useLHNEstimatedListSize from '@hooks/useLHNEstimatedListSize';
import useLocalize from '@hooks/useLocalize';
import usePrevious from '@hooks/usePrevious';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import {isValidDraftComment} from '@libs/DraftCommentUtils';
Expand Down Expand Up @@ -48,9 +47,8 @@ function LHNOptionsList({style, contentContainerStyles, data, onSelectRow, optio
const theme = useTheme();
const styles = useThemeStyles();
const {translate, preferredLocale} = useLocalize();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const estimatedListSize = useLHNEstimatedListSize();
const shouldShowEmptyLHN = shouldUseNarrowLayout && data.length === 0;
const shouldShowEmptyLHN = data.length === 0;

// When the first item renders we want to call the onFirstItemRendered callback.
// At this point in time we know that the list is actually displaying items.
Expand Down
2 changes: 1 addition & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1930,7 +1930,7 @@ const translations = {
iouReportNotFound: 'The payment details you are looking for cannot be found.',
notHere: "Hmm... it's not here",
pageNotFound: 'Oops, this page cannot be found',
noAccess: "You don't have access to this chat",
noAccess: "That chat doesn't exist or you don't have access to it. Try using search to find a chat.",
goBackHome: 'Go back to home page',
},
setPasswordPage: {
Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1935,7 +1935,7 @@ const translations = {
iouReportNotFound: 'Los detalles del pago que estás buscando no se pudieron encontrar.',
notHere: 'Hmm… no está aquí',
pageNotFound: 'Ups, no deberías estar aquí',
noAccess: 'No tienes acceso a este chat',
noAccess: 'Ese chat no existe o no tienes acceso a él. Intenta usar la búsqueda para encontrar un chat.',
goBackHome: 'Volver a la página principal',
},
setPasswordPage: {
Expand Down
2 changes: 2 additions & 0 deletions src/pages/home/ReportScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,8 @@ function ReportScreen({route, navigation}: ReportScreenProps) {
<FullPageNotFoundView
shouldShow={shouldShowNotFoundPage}
subtitleKey={shouldShowNotFoundLinkedAction ? '' : 'notFound.noAccess'}
subtitleStyle={[styles.textSupporting]}
shouldDisplaySearchRouter
shouldShowBackButton={shouldUseNarrowLayout}
onBackButtonPress={shouldShowNotFoundLinkedAction ? navigateToEndOfReport : Navigation.goBack}
shouldShowLink={shouldShowNotFoundLinkedAction}
Expand Down
Loading