-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Feature: Empty state UI for LHN #37361
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
roryabraham
merged 20 commits into
Expensify:main
from
tienifr:feature/empty-state-ui-lhn
Apr 1, 2024
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
cc3916e
feature: empty state ui for lhn
tienifr ec0cc27
middle align UI
tienifr 0dbec9e
fix nested teneray operation
tienifr 932231b
Merge branch 'main' of https://github.com/tienifr/App into feature/em…
tienifr d824c5a
remove storybook warning
tienifr 5cd1b27
Merge branch 'main' of https://github.com/tienifr/App into feature/em…
tienifr 685ae15
Merge branch 'main' of https://github.com/tienifr/App into feature/em…
tienifr 2197773
middle align the ui
tienifr 821278a
Merge branch 'main' of https://github.com/tienifr/App into feature/em…
tienifr 9e55810
resolve feedbacks
tienifr 6636704
Merge branch 'main' of https://github.com/tienifr/App into feature/em…
tienifr f825043
Merge branch 'main' into feature/empty-state-ui-lhn
tienifr ecc13ca
remove custom web style
tienifr b98933e
Merge branch 'main' into feature/empty-state-ui-lhn
tienifr 421f108
use type utils and useMemo
tienifr 030593a
type inference
tienifr a50a27e
Add conditional required type for BlockingView
tienifr 7e3e4f9
Fix storybook test
tienifr 9c203d2
Merge branch 'main' into feature/empty-state-ui-lhn
tienifr 2170e9d
Merge branch 'main' of https://github.com/tienifr/App into feature/em…
tienifr 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
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,10 +5,18 @@ import type {ReactElement} from 'react'; | |
| import React, {memo, useCallback, useContext, useEffect, useMemo, useRef} from 'react'; | ||
| import {StyleSheet, View} from 'react-native'; | ||
| import {withOnyx} from 'react-native-onyx'; | ||
| import BlockingView from '@components/BlockingViews/BlockingView'; | ||
| import Icon from '@components/Icon'; | ||
| import * as Expensicons from '@components/Icon/Expensicons'; | ||
| import LottieAnimations from '@components/LottieAnimations'; | ||
| import {ScrollOffsetContext} from '@components/ScrollOffsetContextProvider'; | ||
| import Text from '@components/Text'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import usePermissions from '@hooks/usePermissions'; | ||
| import usePrevious from '@hooks/usePrevious'; | ||
| import useTheme from '@hooks/useTheme'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import useWindowDimensions from '@hooks/useWindowDimensions'; | ||
| import * as ReportActionsUtils from '@libs/ReportActionsUtils'; | ||
| import variables from '@styles/variables'; | ||
| import CONST from '@src/CONST'; | ||
|
|
@@ -39,8 +47,12 @@ function LHNOptionsList({ | |
| const flashListRef = useRef<FlashList<string>>(null); | ||
| const route = useRoute(); | ||
|
|
||
| const theme = useTheme(); | ||
| const styles = useThemeStyles(); | ||
| const {canUseViolations} = usePermissions(); | ||
| const {translate} = useLocalize(); | ||
| const {isSmallScreenWidth} = useWindowDimensions(); | ||
| const shouldShowEmptyLHN = isSmallScreenWidth && 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. | ||
|
|
@@ -54,6 +66,40 @@ function LHNOptionsList({ | |
| onFirstItemRendered(); | ||
| }, [onFirstItemRendered]); | ||
|
|
||
| const emptyLHNSubtitle = useMemo( | ||
|
Member
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. UI was broken on Android devices. Let's make sure we test this so that the UI looks good on each platform. #41349 |
||
| () => ( | ||
| <View> | ||
| <Text | ||
| color={theme.placeholderText} | ||
| style={[styles.textAlignCenter]} | ||
| > | ||
| {translate('common.emptyLHN.subtitleText1')} | ||
| <Icon | ||
| src={Expensicons.MagnifyingGlass} | ||
| width={variables.emptyLHNIconWidth} | ||
| height={variables.emptyLHNIconHeight} | ||
| small | ||
| inline | ||
| fill={theme.icon} | ||
| additionalStyles={styles.alignItemsCenter} | ||
| /> | ||
| {translate('common.emptyLHN.subtitleText2')} | ||
| <Icon | ||
| src={Expensicons.Plus} | ||
| width={variables.emptyLHNIconWidth} | ||
| height={variables.emptyLHNIconHeight} | ||
| small | ||
| inline | ||
| fill={theme.icon} | ||
| additionalStyles={styles.alignItemsCenter} | ||
| /> | ||
| {translate('common.emptyLHN.subtitleText3')} | ||
| </Text> | ||
| </View> | ||
| ), | ||
| [theme, styles.alignItemsCenter, styles.textAlignCenter, translate], | ||
| ); | ||
|
|
||
| /** | ||
| * Function which renders a row in the list | ||
| */ | ||
|
|
@@ -163,22 +209,33 @@ function LHNOptionsList({ | |
| }, [route, flashListRef, getScrollOffset]); | ||
|
|
||
| return ( | ||
| <View style={style ?? styles.flex1}> | ||
| <FlashList | ||
| ref={flashListRef} | ||
| indicatorStyle="white" | ||
| keyboardShouldPersistTaps="always" | ||
| contentContainerStyle={StyleSheet.flatten(contentContainerStyles)} | ||
| data={data} | ||
| testID="lhn-options-list" | ||
| keyExtractor={keyExtractor} | ||
| renderItem={renderItem} | ||
| estimatedItemSize={optionMode === CONST.OPTION_MODE.COMPACT ? variables.optionRowHeightCompact : variables.optionRowHeight} | ||
| extraData={extraData} | ||
| showsVerticalScrollIndicator={false} | ||
| onLayout={onLayout} | ||
| onScroll={onScroll} | ||
| /> | ||
| <View style={[style ?? styles.flex1, shouldShowEmptyLHN ? styles.emptyLHNWrapper : undefined]}> | ||
| {shouldShowEmptyLHN ? ( | ||
| <BlockingView | ||
| animation={LottieAnimations.Fireworks} | ||
| animationStyles={styles.emptyLHNAnimation} | ||
| animationWebStyle={styles.emptyLHNAnimation} | ||
| title={translate('common.emptyLHN.title')} | ||
| shouldShowLink={false} | ||
| CustomSubtitle={emptyLHNSubtitle} | ||
| /> | ||
| ) : ( | ||
| <FlashList | ||
| ref={flashListRef} | ||
| indicatorStyle="white" | ||
| keyboardShouldPersistTaps="always" | ||
| contentContainerStyle={StyleSheet.flatten(contentContainerStyles)} | ||
| data={data} | ||
| testID="lhn-options-list" | ||
| keyExtractor={keyExtractor} | ||
| renderItem={renderItem} | ||
| estimatedItemSize={optionMode === CONST.OPTION_MODE.COMPACT ? variables.optionRowHeightCompact : variables.optionRowHeight} | ||
| extraData={extraData} | ||
| showsVerticalScrollIndicator={false} | ||
| onLayout={onLayout} | ||
| onScroll={onScroll} | ||
| /> | ||
| )} | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
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 |
|---|---|---|
|
|
@@ -304,6 +304,12 @@ export default { | |
| member: 'Miembro', | ||
| role: 'Role', | ||
| currency: 'Divisa', | ||
| emptyLHN: { | ||
|
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. Copy was verified here. |
||
| title: 'Woohoo! Todo al día.', | ||
| subtitleText1: 'Encuentra un chat usando el botón', | ||
| subtitleText2: 'o crea algo usando el botón', | ||
| subtitleText3: '.', | ||
| }, | ||
| }, | ||
| location: { | ||
| useCurrent: 'Usar ubicación actual', | ||
|
|
||
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
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
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.
@tienifr Using camelCase convention
Uh oh!
There was an error while loading. Please reload this page.
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 used PascalCase for component props like here, here, here and here.
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.
PascalCaseis correct for component props