diff --git a/src/components/NovelCover.js b/src/components/NovelCover.js index ff1c5bf9..00b9f9ac 100644 --- a/src/components/NovelCover.js +++ b/src/components/NovelCover.js @@ -69,7 +69,10 @@ const NovelCover = ({ item, onPress, libraryStatus }) => { !showDownloadBadges && { borderRadius: 4, }, - { backgroundColor: theme.colorAccent }, + { + backgroundColor: theme.colorAccent, + color: theme.colorButtonText, + }, ]} > {item.chaptersUnread} diff --git a/src/screens/Browse/discover/BrowseMalCard.js b/src/screens/Browse/discover/BrowseMalCard.js new file mode 100644 index 00000000..7d5bee93 --- /dev/null +++ b/src/screens/Browse/discover/BrowseMalCard.js @@ -0,0 +1,134 @@ +import React from "react"; +import { StyleSheet, Pressable, Text, View, FlatList } from "react-native"; +import FastImage from "react-native-fast-image"; +import { Row } from "../../../components/Common"; + +const GenreChip = ({ children, theme }) => ( + + + + {`${"Score "}`} + + {children} + + +); + +const BrowseMalCard = ({ novel, theme, onPress }) => { + return ( + + + + + + {novel.novelName} + + {novel.score} + + + + + {`${"Type "}`} + + {novel.info[1]} + + + + + + {`${"Published "}`} + + {novel.info[2]} + + + + + + ); +}; + +export default BrowseMalCard; + +const styles = StyleSheet.create({ + novelUpdatesCard: { + flex: 1, + flexDirection: "row", + }, + contentContainer: { + flex: 1, + }, + genreChip: { + marginTop: 4, + fontSize: 13, + // fontStyle: "italic", + }, +}); diff --git a/src/screens/Browse/discover/MalTopNovels.js b/src/screens/Browse/discover/MalTopNovels.js index b9f154e7..e87cf604 100644 --- a/src/screens/Browse/discover/MalTopNovels.js +++ b/src/screens/Browse/discover/MalTopNovels.js @@ -17,6 +17,7 @@ import { useTheme, useSettings } from "../../../hooks/reduxHooks"; import { showToast } from "../../../hooks/showToast"; import { getDeviceOrientation } from "../../../services/utils/helpers"; import { scrapeSearchResults, scrapeTopNovels } from "./MyAnimeListScraper"; +import BrowseMalCard from "./BrowseMalCard"; const BrowseMalScreen = ({ navigation, route }) => { const theme = useTheme(); @@ -72,8 +73,9 @@ const BrowseMalScreen = ({ navigation, route }) => { }, []); const renderItem = ({ item }) => ( - navigation.navigate("GlobalSearch", { novelName: item.novelName, @@ -153,8 +155,8 @@ const BrowseMalScreen = ({ navigation, route }) => { ) : ( item.novelName} renderItem={renderItem} @@ -189,7 +191,7 @@ const styles = StyleSheet.create({ }, novelsContainer: { flexGrow: 1, - paddingVertical: 8, + paddingBottom: 8, paddingHorizontal: 4, }, }); diff --git a/src/screens/Browse/discover/MyAnimeListScraper.js b/src/screens/Browse/discover/MyAnimeListScraper.js index 2e402bf5..00f92eff 100644 --- a/src/screens/Browse/discover/MyAnimeListScraper.js +++ b/src/screens/Browse/discover/MyAnimeListScraper.js @@ -22,7 +22,12 @@ const scrapeTopNovels = async (pageNo) => { ".jpg"; const novelName = $(this).find("h3").text(); - const novel = { novelName, novelCover }; + const score = $(this) + .find(".js-top-ranking-score-col > span.score-label") + .text(); + + const info = $(this).find("div.information").text().split(/\s\s+/); + const novel = { novelName, novelCover, score, info }; novels.push(novel); }); diff --git a/src/screens/Browse/discover/NovelUpdatesNovelCard.js b/src/screens/Browse/discover/NovelUpdatesNovelCard.js index 969bf1ff..61d42398 100644 --- a/src/screens/Browse/discover/NovelUpdatesNovelCard.js +++ b/src/screens/Browse/discover/NovelUpdatesNovelCard.js @@ -4,53 +4,103 @@ import FastImage from "react-native-fast-image"; import { Row } from "../../../components/Common"; const GenreChip = ({ children, theme }) => ( - - {children} - + + + + {`${"Genre "}`} + + {children} + + ); const NovelUpdatesNovelCard = ({ novel, theme, onPress }) => { return ( - - + - + {novel.novelName} {novel.genres} + + + + {`${"Chapter Count "}`} + + {novel.chapterCount} + + {novel.novelSummary} - - + + ); }; @@ -59,14 +109,14 @@ export default NovelUpdatesNovelCard; const styles = StyleSheet.create({ novelUpdatesCard: { flex: 1, - padding: 16, + flexDirection: "row", }, contentContainer: { flex: 1, }, genreChip: { - marginVertical: 4, - fontSize: 12, + marginTop: 4, + fontSize: 13, // fontStyle: "italic", }, }); diff --git a/src/screens/Browse/discover/NovelUpdatesScraper.js b/src/screens/Browse/discover/NovelUpdatesScraper.js index d0300dfc..f23e6b9f 100644 --- a/src/screens/Browse/discover/NovelUpdatesScraper.js +++ b/src/screens/Browse/discover/NovelUpdatesScraper.js @@ -34,7 +34,31 @@ const scrapeTopNovels = async (pageNo) => { const novelSummary = $(this).find(".search_genre")[0].nextSibling.nodeValue; - const novel = { novelName, novelCover, genres, novelSummary }; + let chapterCount = ""; + + $(this) + .find(".search_stats > span") + .each(function () { + let detail = $(this).text(); + + if (detail.includes("Chapters")) { + chapterCount = detail.replace(" Chapters", ""); + } + }); + + // const chapterCount = $(this) + // .find('i[title="Chapter Count"]') + // const updateFrequency = $(this) + // .find('i[title="Updates Frequency"]') + + const novel = { + novelName, + novelCover, + genres, + novelSummary, + chapterCount, + // updateFrequency, + }; novels.push(novel); });