From 84a2561c412dabeedcfcee879671663cb441ba08 Mon Sep 17 00:00:00 2001 From: Rajarshee Chatterjee Date: Sat, 18 Feb 2023 14:02:04 +0530 Subject: [PATCH] Minor Fixes --- src/components/Actionbar/Actionbar.tsx | 11 +-- src/components/Button/Button.tsx | 2 +- src/redux/hooks/index.ts | 6 -- .../history/components/ClearHistoryDialog.tsx | 23 +++--- src/screens/novel/NovelScreen.js | 76 ++++++++----------- src/sources/en/scribblehub.js | 13 ++-- 6 files changed, 53 insertions(+), 78 deletions(-) diff --git a/src/components/Actionbar/Actionbar.tsx b/src/components/Actionbar/Actionbar.tsx index 5d5f2647..4e860ebf 100644 --- a/src/components/Actionbar/Actionbar.tsx +++ b/src/components/Actionbar/Actionbar.tsx @@ -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 = ({ 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 = ({ key={id} android_ripple={{ radius: 50, - color: color(theme.primary).alpha(0.12).string(), + color: theme.rippleColor, borderless: true, }} onPress={onPress} diff --git a/src/components/Button/Button.tsx b/src/components/Button/Button.tsx index e46b8cf9..b81d2ccd 100644 --- a/src/components/Button/Button.tsx +++ b/src/components/Button/Button.tsx @@ -15,7 +15,7 @@ const Button: React.FC = props => { return ( - {props.title} + {props.title || props.children} ); }; diff --git a/src/redux/hooks/index.ts b/src/redux/hooks/index.ts index 112fd505..1a830b5e 100644 --- a/src/redux/hooks/index.ts +++ b/src/redux/hooks/index.ts @@ -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); diff --git a/src/screens/history/components/ClearHistoryDialog.tsx b/src/screens/history/components/ClearHistoryDialog.tsx index 4e2eab9b..b4aac138 100644 --- a/src/screens/history/components/ClearHistoryDialog.tsx +++ b/src/screens/history/components/ClearHistoryDialog.tsx @@ -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 = ({ return ( - + {getString('historyScreen.clearHistorWarning')} - - + + @@ -47,7 +47,8 @@ export default ClearHistoryDialog; const styles = StyleSheet.create({ container: { - borderRadius: 8, + margin: 20, + borderRadius: 28, }, title: { letterSpacing: 0, diff --git a/src/screens/novel/NovelScreen.js b/src/screens/novel/NovelScreen.js index a9bdf9dc..33cb8470 100644 --- a/src/screens/novel/NovelScreen.js +++ b/src/screens/novel/NovelScreen.js @@ -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 }} > { dispatch( downloadAllChaptersAction( @@ -443,7 +438,7 @@ const Novel = ({ route, navigation }) => { /> { /> { /> { downloadCustomChapterModal.setTrue(); @@ -498,7 +493,7 @@ const Novel = ({ route, navigation }) => { /> { /> { /> { /> } contentStyle={{ - backgroundColor: overlay(2, theme.surface), + backgroundColor: theme.surface2, }} > { /> { zIndex: 20, width: Dimensions.get('window').width, elevation: 2, + backgroundColor: theme.surface2, + paddingTop: StatusBar.currentHeight, + flexDirection: 'row', + alignItems: 'center', + paddingBottom: 8, }} > - setSelected([])} + /> + + { + setSelected(chapters); }} - > - setSelected([])} - /> - - { - setSelected(chapters); - }} - /> - + /> ) : null} diff --git a/src/sources/en/scribblehub.js b/src/sources/en/scribblehub.js index b17e139f..21663799 100644 --- a/src/sources/en/scribblehub.js +++ b/src/sources/en/scribblehub.js @@ -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);