Minor Fixes

This commit is contained in:
Rajarshee Chatterjee
2023-02-18 14:02:04 +05:30
parent 929bd2c97d
commit 84a2561c41
6 changed files with 53 additions and 78 deletions
+3 -8
View File
@@ -8,11 +8,8 @@ import {
View,
ViewProps,
} from 'react-native';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
import color from 'color';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { overlay } from 'react-native-paper';
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
type Action = {
icon: string;
@@ -40,9 +37,7 @@ export const Actionbar: React.FC<ActionbarProps> = ({
style={[
styles.actionbarContainer,
{
backgroundColor: theme.isDark
? overlay(2, theme.surface)
: theme.secondaryContainer,
backgroundColor: theme.surface2,
minHeight: 80 + bottom,
paddingBottom: bottom,
},
@@ -54,7 +49,7 @@ export const Actionbar: React.FC<ActionbarProps> = ({
key={id}
android_ripple={{
radius: 50,
color: color(theme.primary).alpha(0.12).string(),
color: theme.rippleColor,
borderless: true,
}}
onPress={onPress}
+1 -1
View File
@@ -15,7 +15,7 @@ const Button: React.FC<ButtonProps> = props => {
return (
<PaperButton {...props} theme={{ colors: theme }}>
{props.title}
{props.title || props.children}
</PaperButton>
);
};
-6
View File
@@ -13,9 +13,6 @@ export const useSettingsV2 = () =>
export const useBrowseSettings = () =>
useAppSelector((state: RootState) => state.settingsReducerV2.browse) || {};
export const useAppearanceSettings = () =>
useAppSelector((state: RootState) => state.settingsReducerV2.appearance);
export const useReaderSettings = () =>
useAppSelector((state: RootState) => state.settingsReducer.reader);
@@ -23,9 +20,6 @@ export const useReaderSettings = () =>
export const useLibrarySettings = () =>
useAppSelector((state: RootState) => state.settingsReducerV2.library);
export const useUpdateSettings = () =>
useAppSelector((state: RootState) => state.settingsReducerV2.updates);
export const useDownloadQueue = () =>
useAppSelector((state: RootState) => state.downloadsReducer.downloadQueue);
@@ -1,10 +1,10 @@
import React from 'react';
import { StyleSheet } from 'react-native';
import { Dialog, Portal } from 'react-native-paper';
import { Button } from '@components';
import { getString } from '@strings/translations';
import { Button, Dialog, Portal } from 'react-native-paper';
import { ThemeColors } from '../../../theme/types';
import { ThemeColors } from '@theme/types';
interface ClearHistoryDialogProps {
visible: boolean;
@@ -26,17 +26,17 @@ const ClearHistoryDialog: React.FC<ClearHistoryDialogProps> = ({
return (
<Portal>
<Dialog visible={visible} onDismiss={onDismiss} style={styles.container}>
<Dialog
visible={visible}
onDismiss={onDismiss}
style={[styles.container, { backgroundColor: theme.overlay3 }]}
>
<Dialog.Title style={[styles.title, { color: theme.onSurface }]}>
{getString('historyScreen.clearHistorWarning')}
</Dialog.Title>
<Dialog.Actions>
<Button theme={{ colors: { ...theme } }} onPress={onDismiss}>
{getString('common.cancel')}
</Button>
<Button theme={{ colors: { ...theme } }} onPress={handleOnSubmit}>
{getString('common.ok')}
</Button>
<Button onPress={onDismiss}>{getString('common.cancel')}</Button>
<Button onPress={handleOnSubmit}>{getString('common.ok')}</Button>
</Dialog.Actions>
</Dialog>
</Portal>
@@ -47,7 +47,8 @@ export default ClearHistoryDialog;
const styles = StyleSheet.create({
container: {
borderRadius: 8,
margin: 20,
borderRadius: 28,
},
title: {
letterSpacing: 0,
+32 -44
View File
@@ -25,7 +25,6 @@ import {
Menu,
FAB,
Snackbar,
overlay,
} from 'react-native-paper';
import { useDispatch, useSelector } from 'react-redux';
import * as Haptics from 'expo-haptics';
@@ -414,16 +413,12 @@ const Novel = ({ route, navigation }) => {
onPress={() => showDownloadMenu(true)}
/>
}
contentStyle={{
backgroundColor: overlay(2, theme.surface),
}}
contentStyle={{ backgroundColor: theme.surface2 }}
>
<Menu.Item
title="Next chapter"
style={{ backgroundColor: overlay(2, theme.surface) }}
titleStyle={{
color: theme.onSurface,
}}
style={{ backgroundColor: theme.surface2 }}
titleStyle={{ color: theme.onSurface }}
onPress={() => {
dispatch(
downloadAllChaptersAction(
@@ -443,7 +438,7 @@ const Novel = ({ route, navigation }) => {
/>
<Menu.Item
title="Next 5 chapter"
style={{ backgroundColor: overlay(2, theme.surface) }}
style={{ backgroundColor: theme.surface2 }}
titleStyle={{
color: theme.onSurface,
}}
@@ -466,7 +461,7 @@ const Novel = ({ route, navigation }) => {
/>
<Menu.Item
title="Next 10 chapter"
style={{ backgroundColor: overlay(2, theme.surface) }}
style={{ backgroundColor: theme.surface2 }}
titleStyle={{
color: theme.onSurface,
}}
@@ -489,7 +484,7 @@ const Novel = ({ route, navigation }) => {
/>
<Menu.Item
title="Custom"
style={{ backgroundColor: overlay(2, theme.surface) }}
style={{ backgroundColor: theme.surface2 }}
titleStyle={{ color: theme.onSurface }}
onPress={() => {
downloadCustomChapterModal.setTrue();
@@ -498,7 +493,7 @@ const Novel = ({ route, navigation }) => {
/>
<Menu.Item
title="Unread"
style={{ backgroundColor: overlay(2, theme.surface) }}
style={{ backgroundColor: theme.surface2 }}
titleStyle={{
color: theme.onSurface,
}}
@@ -515,7 +510,7 @@ const Novel = ({ route, navigation }) => {
/>
<Menu.Item
title="All"
style={{ backgroundColor: overlay(2, theme.surface) }}
style={{ backgroundColor: theme.surface2 }}
titleStyle={{
color: theme.onSurface,
}}
@@ -532,7 +527,7 @@ const Novel = ({ route, navigation }) => {
/>
<Menu.Item
title="Delete downloads"
style={{ backgroundColor: overlay(2, theme.surface) }}
style={{ backgroundColor: theme.surface2 }}
titleStyle={{
color: theme.onSurface,
}}
@@ -558,12 +553,12 @@ const Novel = ({ route, navigation }) => {
/>
}
contentStyle={{
backgroundColor: overlay(2, theme.surface),
backgroundColor: theme.surface2,
}}
>
<Menu.Item
title="Edit info"
style={{ backgroundColor: overlay(2, theme.surface) }}
style={{ backgroundColor: theme.surface2 }}
titleStyle={{
color: theme.onSurface,
}}
@@ -574,7 +569,7 @@ const Novel = ({ route, navigation }) => {
/>
<Menu.Item
title="Edit cover"
style={{ backgroundColor: overlay(2, theme.surface) }}
style={{ backgroundColor: theme.surface2 }}
titleStyle={{
color: theme.onSurface,
}}
@@ -716,36 +711,29 @@ const Novel = ({ route, navigation }) => {
zIndex: 20,
width: Dimensions.get('window').width,
elevation: 2,
backgroundColor: theme.surface2,
paddingTop: StatusBar.currentHeight,
flexDirection: 'row',
alignItems: 'center',
paddingBottom: 8,
}}
>
<View
style={{
backgroundColor: theme.isDark
? overlay(2, theme.surface)
: theme.secondaryContainer,
paddingTop: StatusBar.currentHeight,
flexDirection: 'row',
alignItems: 'center',
paddingBottom: 8,
<Appbar.Action
icon="close"
iconColor={theme.onBackground}
onPress={() => setSelected([])}
/>
<Appbar.Content
title={`${selected.length}`}
titleStyle={{ color: theme.onSurface }}
/>
<Appbar.Action
icon="select-all"
iconColor={theme.onBackground}
onPress={() => {
setSelected(chapters);
}}
>
<Appbar.Action
icon="close"
iconColor={theme.onBackground}
onPress={() => setSelected([])}
/>
<Appbar.Content
title={selected.length}
titleStyle={{ color: theme.onSurface }}
/>
<Appbar.Action
icon="select-all"
iconColor={theme.onBackground}
onPress={() => {
setSelected(chapters);
}}
/>
</View>
/>
</Animated.View>
) : null}
</View>
+5 -8
View File
@@ -1,12 +1,12 @@
import * as cheerio from 'cheerio';
import { fetchHtml } from '@utils/fetch/fetch';
const baseUrl = 'https://www.scribblehub.com/';
const popularNovels = async page => {
const totalPages = 326;
let url = baseUrl + 'series-ranking/?sort=1&order=4&pg=' + page;
const result = await fetch(url);
const body = await result.text();
const body = await fetchHtml({ url, sourceId });
const loadedCheerio = cheerio.load(body);
@@ -40,8 +40,7 @@ const popularNovels = async page => {
const parseNovelAndChapters = async novelUrl => {
const url = baseUrl + 'read/' + novelUrl;
const result = await fetch(url);
const body = await result.text();
const body = await fetchHtml({ url, sourceId });
let loadedCheerio = cheerio.load(body);
@@ -120,8 +119,7 @@ const parseNovelAndChapters = async novelUrl => {
const parseChapter = async (novelUrl, chapterUrl) => {
const url = `${baseUrl}read/${novelUrl}/chapter/${chapterUrl}`;
const result = await fetch(url);
const body = await result.text();
const body = await fetchHtml({ url, sourceId });
const loadedCheerio = cheerio.load(body);
@@ -143,8 +141,7 @@ const searchNovels = async searchTerm => {
const url =
'https://www.scribblehub.com/?s=' + searchTerm + '&post_type=fictionposts';
const result = await fetch(url);
const body = await result.text();
const body = await fetchHtml({ url, sourceId });
const loadedCheerio = cheerio.load(body);