Skip to content

Commit

Permalink
[PAY-1196] Mobile dms search users empty state (#3355)
Browse files Browse the repository at this point in the history
  • Loading branch information
dharit-tan authored May 15, 2023
1 parent 315ae4f commit 6e7ece9
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 58 additions & 3 deletions packages/mobile/src/screens/chat-screen/ChatUserListScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@ import {
cacheUsersSelectors,
Status
} from '@audius/common'
import { View } from 'react-native'
import { View, Image } from 'react-native'
import { useDispatch, useSelector } from 'react-redux'
import { useDebounce } from 'react-use'

import IconCompose from 'app/assets/images/iconCompose.svg'
import IconSearch from 'app/assets/images/iconSearch.svg'
import { Screen, FlatList, ScreenContent, TextInput } from 'app/components/core'
import MagnifyingGlass from 'app/assets/images/leftPointingMagnifyingGlass.png'
import {
Screen,
Text,
FlatList,
ScreenContent,
TextInput
} from 'app/components/core'
import LoadingSpinner from 'app/components/loading-spinner'
import { makeStyles } from 'app/styles'
import { useThemeColors } from 'app/utils/theme'
Expand All @@ -31,7 +38,10 @@ const DEBOUNCE_MS = 100

const messages = {
title: 'New Message',
search: 'Search Users'
search: 'Search Users',
emptyTitle: 'Search for Friends',
emptyDescription:
'Search for fellow music lovers and strike up a conversation.'
}

const useStyles = makeStyles(({ spacing, palette, typography }) => ({
Expand Down Expand Up @@ -78,9 +88,53 @@ const useStyles = makeStyles(({ spacing, palette, typography }) => ({
},
flatListContainer: {
minHeight: '100%'
},
emptyContainer: {
marginTop: spacing(6),
margin: spacing(2),
padding: spacing(6),
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
gap: spacing(6),
backgroundColor: palette.neutralLight10,
borderRadius: spacing(2),
borderColor: palette.background,
borderWidth: 1
},
emptyTextContainer: {
flexShrink: 1,
gap: spacing(2)
},
magnifyingGlass: {
height: spacing(16),
width: spacing(16)
},
emptyTitle: {
fontSize: typography.fontSize.xxl,
fontFamily: typography.fontByWeight.bold,
lineHeight: typography.fontSize.xxl * 1.3
},
emptyDescription: {
fontSize: typography.fontSize.large,
lineHeight: typography.fontSize.large * 1.3
}
}))

const ListEmpty = () => {
const styles = useStyles()

return (
<View style={styles.emptyContainer}>
<Image source={MagnifyingGlass} style={styles.magnifyingGlass} />
<View style={styles.emptyTextContainer}>
<Text style={styles.emptyTitle}>{messages.emptyTitle}</Text>
<Text style={styles.emptyDescription}>{messages.emptyDescription}</Text>
</View>
</View>
)
}

type ChatUserListScreenProps = {
debounceMs?: number
defaultUserList?: {
Expand Down Expand Up @@ -193,6 +247,7 @@ export const ChatUserListScreen = (props: ChatUserListScreenProps) => {
renderItem={({ item }) => <ChatUserListItem user={item} />}
keyExtractor={(user: User) => user.handle}
contentContainerStyle={styles.flatListContainer}
ListEmptyComponent={<ListEmpty />}
/>
) : (
<View style={styles.spinnerContainer}>
Expand Down

0 comments on commit 6e7ece9

Please sign in to comment.