Skip to content
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
2 changes: 2 additions & 0 deletions src/Globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ export default {
BG_PUSHNOTIFY: '#FCF2E3',
BG_ALLSET: '#F8ECFF',
BG_OBSLIDER: '#F8ECFF',
BG_SEARCH_BAR: '#EFEFEF',

// Notification
IC_NOTIFICATION: '#e20880',
Expand All @@ -174,6 +175,7 @@ export default {

// Border
BORDER_DEFAULT: '#C4CBD5',
BORDER_SEPARATOR: '#E5E5E5',
},
SCREENS: {
WELCOME: 'Welcome',
Expand Down
8 changes: 7 additions & 1 deletion src/components/ui/ChannelCategories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ const ChannelCategories: FC<ChannelCategoriesProps> = ({
if (!isLoading && channelCategories?.length > 0) {
return (
<View style={styles.mainView}>
<ScrollView showsHorizontalScrollIndicator={false} horizontal>
<ScrollView
contentContainerStyle={styles.scrollViewStyle}
showsHorizontalScrollIndicator={false}
horizontal>
{channelCategories.map((item, index) => (
<Pill
disabled={disabled || item.value === value}
Expand Down Expand Up @@ -49,4 +52,7 @@ const styles = StyleSheet.create({
flexDirection: 'row',
marginBottom: 16,
},
scrollViewStyle: {
paddingHorizontal: 16,
},
});
125 changes: 66 additions & 59 deletions src/components/ui/ChannelsDisplayer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '@ethersproject/shims';
import React, {useEffect, useMemo, useState} from 'react';
import React, {useEffect, useState} from 'react';
import {
FlatList,
Image,
Expand Down Expand Up @@ -68,8 +68,9 @@ const ChannelsDisplayer = () => {
};

return (
<>
<View style={styles.container}>
<View style={styles.container}>
{/* Render Search Bar */}
<View style={styles.searchBarWrapper}>
<View style={styles.searchView}>
<Image
source={require('assets/ui/search.png')}
Expand All @@ -85,73 +86,75 @@ const ChannelsDisplayer = () => {
placeholderTextColor="#7D7F89"
/>
</View>
</View>

<ChannelCategories
disabled={isLoading}
onChangeCategory={handleCategoryChange}
value={selectedCategory}
/>
{/* Render Channel Categories(tags) */}
<ChannelCategories
disabled={isLoading}
onChangeCategory={handleCategoryChange}
value={selectedCategory}
/>

{channelResults.length === 0 && (
<View style={[styles.infodisplay]}>
{!isLoading && !isLoadingSubscriptions ? (
// Show channel not found label
{/* Render No Data View */}
{channelResults.length === 0 && (
<View style={[styles.infodisplay]}>
{!isLoading && !isLoadingSubscriptions ? (
// Show channel not found label
<StylishLabel
style={styles.infoText}
fontSize={16}
title={
search.length
? '[dg:No channels match your query, please search for another name/address]'
: '[dg:No results available.]'
}
/>
) : (
// Show channel fetching label
<>
<EPNSActivity style={{}} size="small" />
<StylishLabel
style={styles.infoText}
fontSize={16}
title={
search.length
? '[dg:No channels match your query, please search for another name/address]'
: '[dg:No results available.]'
}
title="[dg:Fetching Channels!]"
/>
) : (
// Show channel fetching label
<>
<EPNSActivity style={{}} size="small" />
<StylishLabel
style={styles.infoText}
fontSize={16}
title="[dg:Fetching Channels!]"
/>
</>
)}
</View>
)}
</>
)}
</View>
)}

{channelResults.length !== 0 && !isLoadingSubscriptions && (
<FlatList
data={channelResults}
style={styles.channels}
contentContainerStyle={styles.channelListContentContainerStyle}
keyExtractor={(item, index) => `${item.name}-${index}-channel-key`}
initialNumToRender={20}
showsVerticalScrollIndicator={false}
ItemSeparatorComponent={() => <View style={styles.seperator} />}
onEndReached={loadMore}
onEndReachedThreshold={0.8}
renderItem={({item: channel}) => (
<ChannelItem {...{channel, selectChannelForSettings}} />
)}
ListFooterComponent={() => {
return isLoading || isLoadingMore ? (
<View style={styles.footerLoadingView}>
<EPNSActivity style={{}} size="small" />
</View>
) : null;
}}
/>
)}
</View>
</>
{/* Render Channel List */}
{channelResults.length !== 0 && !isLoadingSubscriptions && (
<FlatList
data={channelResults}
style={styles.channels}
contentContainerStyle={styles.channelListContentContainerStyle}
keyExtractor={(item, index) => `${item.name}-${index}-channel-key`}
initialNumToRender={20}
showsVerticalScrollIndicator={false}
ItemSeparatorComponent={() => <View style={styles.seperator} />}
onEndReached={loadMore}
onEndReachedThreshold={0.8}
renderItem={({item: channel}) => (
<ChannelItem {...{channel, selectChannelForSettings}} />
)}
ListFooterComponent={() => {
return isLoading || isLoadingMore ? (
<View style={styles.footerLoadingView}>
<EPNSActivity style={{}} size="small" />
</View>
) : null;
}}
/>
)}
</View>
);
};

// Styling
const styles = StyleSheet.create({
container: {
flex: 1,
paddingHorizontal: 16,
backgroundColor: GLOBALS.COLORS.WHITE,
},
channels: {
Expand All @@ -161,6 +164,7 @@ const styles = StyleSheet.create({
channelListContentContainerStyle: {
paddingTop: 10,
paddingBottom: Platform.OS === 'android' ? 100 : 140, // Add some padding to the bottom to display last item content
paddingHorizontal: 16,
},
infodisplay: {
width: '100%',
Expand All @@ -177,12 +181,15 @@ const styles = StyleSheet.create({
infoText: {
marginVertical: 10,
},
searchBarWrapper: {
paddingHorizontal: 16,
marginBottom: 24,
},
searchView: {
flexDirection: 'row',
alignItems: 'center',
borderRadius: 16,
backgroundColor: '#EFEFEF',
marginBottom: 24,
backgroundColor: GLOBALS.COLORS.BG_SEARCH_BAR,
height: 42,
paddingHorizontal: 8,
},
Expand All @@ -200,7 +207,7 @@ const styles = StyleSheet.create({
},
seperator: {
borderBottomWidth: 1,
borderColor: '#E5E5E5',
borderColor: GLOBALS.COLORS.BORDER_SEPARATOR,
marginVertical: 24,
},
footerLoadingView: {paddingVertical: 10},
Expand Down
Loading