-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[No QA] refactor: Extract LHNEmptyState from LHNOptionsList #86964
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
JS00001
merged 5 commits into
Expensify:main
from
callstack-internal:refactor/lhn-extract-empty-state
Apr 6, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
036b7d6
refactor: extract LHNEmptyState, conditionally render from SidebarLinks
BartekObudzinski fa99d50
fix: remove redundant useConfirmReadyToOpenApp from SidebarLinks
BartekObudzinski 826b077
refactor: remove dead empty-state code from LHNOptionsList
BartekObudzinski 3a7528e
fix: match original empty state condition in SidebarLinks
BartekObudzinski 7090a59
fix: relocate dead logging useEffect to LHNEmptyState
BartekObudzinski 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| import React, {useEffect} from 'react'; | ||
| import {View} from 'react-native'; | ||
| import type {BlockingViewProps} from '@components/BlockingViews/BlockingView'; | ||
| import BlockingView from '@components/BlockingViews/BlockingView'; | ||
| import Icon from '@components/Icon'; | ||
| import TextBlock from '@components/TextBlock'; | ||
| import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useOnyx from '@hooks/useOnyx'; | ||
| import useTheme from '@hooks/useTheme'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import Log from '@libs/Log'; | ||
| import variables from '@styles/variables'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import useEmptyLHNIllustration from './useEmptyLHNIllustration'; | ||
|
|
||
| function LHNEmptyState() { | ||
| const theme = useTheme(); | ||
| const styles = useThemeStyles(); | ||
| const {translate} = useLocalize(); | ||
| const expensifyIcons = useMemoizedLazyExpensifyIcons(['MagnifyingGlass', 'Plus']); | ||
| const emptyLHNIllustration = useEmptyLHNIllustration(); | ||
| const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT); | ||
| const [policy] = useOnyx(ONYXKEYS.COLLECTION.POLICY); | ||
| const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST); | ||
|
|
||
| useEffect(() => { | ||
| Log.info('Woohoo! All caught up. Was rendered', false, { | ||
| reportsCount: Object.keys(reports ?? {}).length, | ||
| policyCount: Object.keys(policy ?? {}).length, | ||
| personalDetailsCount: Object.keys(personalDetails ?? {}).length, | ||
| }); | ||
| }, [reports, policy, personalDetails]); | ||
|
|
||
| const subtitle = ( | ||
| <View style={[styles.alignItemsCenter, styles.flexRow, styles.justifyContentCenter, styles.flexWrap, styles.textAlignCenter]}> | ||
| <TextBlock | ||
| color={theme.textSupporting} | ||
| textStyles={[styles.textAlignCenter, styles.textNormal]} | ||
| text={translate('common.emptyLHN.subtitleText1')} | ||
| /> | ||
| <Icon | ||
| src={expensifyIcons.MagnifyingGlass} | ||
| width={variables.emptyLHNIconWidth} | ||
| height={variables.emptyLHNIconHeight} | ||
| fill={theme.icon} | ||
| small | ||
| additionalStyles={styles.mh1} | ||
| /> | ||
| <TextBlock | ||
| color={theme.textSupporting} | ||
| textStyles={[styles.textAlignCenter, styles.textNormal]} | ||
| text={translate('common.emptyLHN.subtitleText2')} | ||
| /> | ||
| <Icon | ||
| src={expensifyIcons.Plus} | ||
| width={variables.emptyLHNIconWidth} | ||
| height={variables.emptyLHNIconHeight} | ||
| fill={theme.icon} | ||
| small | ||
| additionalStyles={styles.mh1} | ||
| /> | ||
| <TextBlock | ||
| color={theme.textSupporting} | ||
| textStyles={[styles.textAlignCenter, styles.textNormal]} | ||
| text={translate('common.emptyLHN.subtitleText3')} | ||
| /> | ||
| </View> | ||
| ); | ||
|
|
||
| return ( | ||
| <BlockingView | ||
| // eslint-disable-next-line react/jsx-props-no-spreading | ||
| {...(emptyLHNIllustration as BlockingViewProps)} | ||
| title={translate('common.emptyLHN.title')} | ||
| CustomSubtitle={subtitle} | ||
| accessibilityLabel={translate('common.emptyLHN.title')} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| export default LHNEmptyState; | ||
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
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.
Should we log this only once on first time render? Now it's logged every time reports, policy or personalDetails is updated.
This was existing logic so not a blocker.