feat: Add Empty State in Available Plugins Tab

This commit is contained in:
Rajarshee Chatterjee
2024-07-13 10:53:25 +05:30
parent f68a7a4e6a
commit ed6c2b7ba2
6 changed files with 35 additions and 4 deletions
+1
View File
@@ -60,6 +60,7 @@ const styles = StyleSheet.create({
fontWeight: 'bold',
},
text: {
textAlign: 'center',
marginTop: 16,
},
buttonWrapper: {
@@ -52,6 +52,7 @@ export const ThemePicker = ({
elevation: 2,
borderRadius: 50,
padding: 1.6,
zIndex: 1,
}}
/>
) : null}
+27 -2
View File
@@ -9,6 +9,7 @@ import {
RefreshControl,
ListRenderItem,
} from 'react-native';
import { useNavigation } from '@react-navigation/native';
import { useBrowseSettings, usePlugins } from '@hooks/persisted';
import { PluginItem } from '@plugins/types';
import {
@@ -20,8 +21,8 @@ import { coverPlaceholderColor } from '@theme/colors';
import { ThemeColors } from '@theme/types';
import { Swipeable } from 'react-native-gesture-handler';
import { getString } from '@strings/translations';
import { BrowseScreenProps } from '@navigators/types';
import { Button, IconButtonV2 } from '@components';
import { BrowseScreenProps, MoreStackScreenProps } from '@navigators/types';
import { Button, EmptyView, IconButtonV2 } from '@components';
import TrackerCard from '../discover/TrackerCard';
import { showToast } from '@utils/showToast';
import Animated, {
@@ -325,6 +326,8 @@ const AvailablePluginCard = ({
};
export const AvailableTab = memo(({ searchText, theme }: AvailableTabProps) => {
const navigation = useNavigation<MoreStackScreenProps['navigation']>();
const [refreshing, setRefreshing] = useState(false);
const {
filteredAvailablePlugins,
@@ -373,6 +376,28 @@ export const AvailableTab = memo(({ searchText, theme }: AvailableTabProps) => {
showsVerticalScrollIndicator={false}
removeClippedSubviews={true}
keyExtractor={item => item.id + '_available'}
contentContainerStyle={{ flexGrow: 1 }}
ListEmptyComponent={
<EmptyView
icon="(・Д・。"
description=" No repositories yet. Add your first plugin repository to get
started."
actions={[
{
iconName: 'cog-outline',
title: 'Add Repository',
onPress: () =>
navigation.navigate('MoreStack', {
screen: 'SettingsStack',
params: {
screen: 'RespositorySettings',
},
}),
},
]}
theme={theme}
/>
}
refreshControl={
<RefreshControl
refreshing={refreshing}
@@ -65,7 +65,7 @@ const SettingsBrowseScreen = () => {
ListEmptyComponent={
<EmptyView
icon="Σ(ಠ_ಠ)"
description={getString('categories.emptyMsg')}
description={getString('repositories.emptyMsg')}
theme={theme}
/>
}
+4 -1
View File
@@ -165,6 +165,9 @@
"setCategories": "Set categories",
"setModalEmptyMsg": "You have no categories. Tap the Edit button to create one for organizing your library"
},
"repositories": {
"emptyMsg": "You have no repositories. Add your first plugin repository to get started."
},
"common": {
"about": "About",
"add": "Add",
@@ -508,4 +511,4 @@
"updatesLower": "updates",
"updatingLibrary": "Updating library"
}
}
}
+1
View File
@@ -143,6 +143,7 @@ export interface StringMap {
'categories.local': 'string';
'categories.setCategories': 'string';
'categories.setModalEmptyMsg': 'string';
'repositories.emptyMsg': 'string';
'common.about': 'string';
'common.add': 'string';
'common.all': 'string';