feat(source): Add More Filters
This commit is contained in:
@@ -4,7 +4,13 @@ import { Checkbox as PaperCheckbox } from 'react-native-paper';
|
||||
|
||||
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||
|
||||
export const Checkbox = ({ label, status, onPress, disabled, theme }) => (
|
||||
export const Checkbox = ({
|
||||
label,
|
||||
status,
|
||||
onPress,
|
||||
disabled = false,
|
||||
theme,
|
||||
}) => (
|
||||
<Pressable
|
||||
android_ripple={{ color: theme.rippleColor }}
|
||||
style={styles.pressable}
|
||||
|
||||
@@ -32,5 +32,7 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
error: {
|
||||
marginTop: 16,
|
||||
paddingHorizontal: 16,
|
||||
textAlign: 'center',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -167,6 +167,7 @@ const BottomSheet: React.FC<BottomSheetProps> = ({
|
||||
<FlatList
|
||||
contentContainerStyle={styles.filterContainer}
|
||||
data={filtersValues}
|
||||
keyExtractor={item => item.key}
|
||||
renderItem={({ item }: { item: SourceFilter }) => (
|
||||
<FilterItem
|
||||
filter={item}
|
||||
|
||||
@@ -37,7 +37,7 @@ export const useBrowseSource = (
|
||||
setTotalPages(res.totalPages);
|
||||
setFilterValues(source.filters);
|
||||
} catch (err: unknown) {
|
||||
setError(`Error: ${err}`);
|
||||
setError(`${err}`);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ export const useSearchSource = (sourceId: number) => {
|
||||
const res = await sourceManager(sourceId).searchNovels(searchTerm);
|
||||
setSearchResults(res);
|
||||
} catch (err) {
|
||||
setSearchError(`Error: ${err}`);
|
||||
setSearchError(`${err}`);
|
||||
} finally {
|
||||
setIsSearching(false);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,10 @@ const getPopularNovelsUrl = (page, { showLatestNovels, filters }) => {
|
||||
url += '&org=' + filters?.language.join(',');
|
||||
}
|
||||
|
||||
if (filters?.storyStatus) {
|
||||
url += '&ss=' + filters?.storyStatus;
|
||||
}
|
||||
|
||||
url += '&sort=' + defaultTo(filters?.sort, 'sdate');
|
||||
|
||||
url += '&order=' + defaultTo(filters?.order, 'desc');
|
||||
@@ -368,13 +372,30 @@ const filters = [
|
||||
],
|
||||
inputType: FilterInputs.Picker,
|
||||
},
|
||||
{
|
||||
key: 'storyStatus',
|
||||
label: 'Story Status (Translation)',
|
||||
values: [
|
||||
{ label: 'All', value: '' },
|
||||
{ label: 'Completed', value: '2' },
|
||||
{ label: 'Ongoing', value: '3' },
|
||||
{ label: 'Hiatus', value: '4' },
|
||||
],
|
||||
inputType: FilterInputs.Picker,
|
||||
},
|
||||
{
|
||||
key: 'language',
|
||||
label: 'Language',
|
||||
values: [
|
||||
{ label: 'Chinese', value: '495' },
|
||||
{ label: 'Japanese', value: '496' },
|
||||
{ label: 'Korean', value: '497' },
|
||||
{ label: 'Chinese', value: 495 },
|
||||
{ label: 'Filipino', value: 9181 },
|
||||
{ label: 'Indonesian', value: 9179 },
|
||||
{ label: 'Japanese', value: 496 },
|
||||
{ label: 'Khmer', value: 18657 },
|
||||
{ label: 'Korean', value: 497 },
|
||||
{ label: 'Malaysian', value: 9183 },
|
||||
{ label: 'Thai', value: 9954 },
|
||||
{ label: 'Vietnamese', value: 9177 },
|
||||
],
|
||||
inputType: FilterInputs.Checkbox,
|
||||
},
|
||||
@@ -392,15 +413,41 @@ const filters = [
|
||||
key: 'genres',
|
||||
label: 'Genres',
|
||||
values: [
|
||||
{ label: 'Adventure', value: 8 },
|
||||
{ label: 'Historical', value: 330 },
|
||||
{ label: 'School Life', value: 6 },
|
||||
{ label: 'Sports', value: 1357 },
|
||||
{ label: 'Action', value: 8 },
|
||||
{ label: 'Adult', value: 280 },
|
||||
{ label: 'Adventure', value: 13 },
|
||||
{ label: 'Comedy', value: 17 },
|
||||
{ label: 'Drama', value: 9 },
|
||||
{ label: 'Ecchi', value: 292 },
|
||||
{ label: 'Fantasy', value: 5 },
|
||||
{ label: 'Gender Bender', value: 168 },
|
||||
{ label: 'Harem', value: 3 },
|
||||
{ label: 'Historical', value: 330 },
|
||||
{ label: 'Horror', value: 343 },
|
||||
{ label: 'Sci-fi', value: 11 },
|
||||
{ label: 'Romance', value: 15 },
|
||||
{ label: 'Josei', value: 324 },
|
||||
{ label: 'Martial Arts', value: 14 },
|
||||
{ label: 'Mature', value: 4 },
|
||||
{ label: 'Mecha', value: 10 },
|
||||
{ label: 'Mystery', value: 245 },
|
||||
{ label: 'Psychoical', value: 486 },
|
||||
{ label: 'Romance', value: 15 },
|
||||
{ label: 'School Life', value: 6 },
|
||||
{ label: 'Sci-fi', value: 11 },
|
||||
{ label: 'Seinen', value: 18 },
|
||||
{ label: 'Shoujo', value: 157 },
|
||||
{ label: 'Shoujo Ai', value: 851 },
|
||||
{ label: 'Shounen', value: 12 },
|
||||
{ label: 'Shounen Ai', value: 1692 },
|
||||
{ label: 'Slice of Life', value: 7 },
|
||||
{ label: 'Smut', value: 281 },
|
||||
{ label: 'Sports', value: 1357 },
|
||||
{ label: 'Supernatural', value: 16 },
|
||||
{ label: 'Tragedy', value: 132 },
|
||||
{ label: 'Wuxia', value: 479 },
|
||||
{ label: 'Xianxia', value: 480 },
|
||||
{ label: 'Xuanhuan', value: 3954 },
|
||||
{ label: 'Yaoi', value: 560 },
|
||||
{ label: 'Yuri', value: 922 },
|
||||
],
|
||||
inputType: FilterInputs.Checkbox,
|
||||
},
|
||||
|
||||
@@ -244,6 +244,54 @@ export const filters: SourceFilter[] = [
|
||||
{ label: 'Action', value: 'action' },
|
||||
{ label: 'Adventure', value: 'adventure' },
|
||||
{ label: 'Billionaire', value: 'billionaire' },
|
||||
{ label: 'Boys Love', value: 'boys-love' },
|
||||
{ label: 'Celebrity', value: 'celebrity' },
|
||||
{ label: 'Comedy', value: 'comedy' },
|
||||
{ label: 'Dark Fantasy', value: 'dark-fantasy' },
|
||||
{ label: 'Drama', value: 'drama' },
|
||||
{ label: 'Ecchi', value: 'ecchi' },
|
||||
{ label: 'Fantasy', value: 'fantasy' },
|
||||
{ label: 'Games', value: 'games' },
|
||||
{ label: 'Gender Bender', value: 'gender-bender' },
|
||||
{ label: 'Harem', value: 'harem' },
|
||||
{ label: 'Historical', value: 'historical' },
|
||||
{ label: 'Horror', value: 'horror' },
|
||||
{ label: 'Isekai', value: 'isekai' },
|
||||
{ label: 'Josei', value: 'josei' },
|
||||
{ label: 'LitRPG', value: 'litrpg' },
|
||||
{ label: 'Magic', value: 'magic' },
|
||||
{ label: 'Magical Realism', value: 'magical-realism' },
|
||||
{ label: 'Martial Arts', value: 'martial-arts' },
|
||||
{ label: 'Mature', value: 'mature' },
|
||||
{ label: 'Mecha', value: 'mecha' },
|
||||
{ label: 'Military', value: 'military' },
|
||||
{ label: 'Modern Life', value: 'modern-life' },
|
||||
{ label: 'Mystery', value: 'mystery' },
|
||||
{ label: 'Psychoical', value: 'psychoical' },
|
||||
{ label: 'Recarnation', value: 'recarnation' },
|
||||
{ label: 'Romance', value: 'romance' },
|
||||
{ label: 'School Life', value: 'school-life' },
|
||||
{ label: 'Sci-fi', value: 'sci-fi' },
|
||||
{ label: 'Seinen', value: 'seinen' },
|
||||
{ label: 'Shotacon', value: 'shotacon' },
|
||||
{ label: 'Shoujo', value: 'shoujo' },
|
||||
{ label: 'Shoujo Ai', value: 'shoujo-ai' },
|
||||
{ label: 'Shounen', value: 'shounen' },
|
||||
{ label: 'Shounen Ai', value: 'shounen-ai' },
|
||||
{ label: 'Slice of Life', value: 'slice-of-life' },
|
||||
{ label: 'Smut', value: 'smut' },
|
||||
{ label: 'Sports', value: 'sports' },
|
||||
{ label: 'Supernatural', value: 'supernatural' },
|
||||
{ label: 'Tragedy', value: 'tragedy' },
|
||||
{ label: 'Urban Life', value: 'urban-life' },
|
||||
{ label: 'Urban Life', value: 'urban-life' },
|
||||
{ label: 'Virtual Reality', value: 'virtual-reality' },
|
||||
{ label: 'War', value: 'war' },
|
||||
{ label: 'Wuxia', value: 'wuxia' },
|
||||
{ label: 'Xianxia', value: 'xianxia' },
|
||||
{ label: 'Xuanhuan', value: 'xuanhuan' },
|
||||
{ label: 'Yaoi', value: 'yaoi' },
|
||||
{ label: 'Yuri', value: 'yuri' },
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user