From 09b8d00762ba7cb7c4a8d5899e6c5d5672699cf4 Mon Sep 17 00:00:00 2001 From: Eric Park Date: Mon, 26 Feb 2024 12:13:01 -0500 Subject: [PATCH] mobile: LibraryCarouselTabs: refactor to one function --- .../LibraryCarousel/LibraryCarouselTabs.tsx | 43 ++++--------------- 1 file changed, 9 insertions(+), 34 deletions(-) diff --git a/mobile/Components/LibraryCarousel/LibraryCarouselTabs.tsx b/mobile/Components/LibraryCarousel/LibraryCarouselTabs.tsx index d83b0491..b5329988 100644 --- a/mobile/Components/LibraryCarousel/LibraryCarouselTabs.tsx +++ b/mobile/Components/LibraryCarousel/LibraryCarouselTabs.tsx @@ -1,13 +1,5 @@ import * as React from "react"; -import { - Button, - FlatList, - StyleSheet, - Text, - View, - ScrollView, - Pressable, -} from "react-native"; +import { Text, View, ScrollView, Pressable } from "react-native"; import { createMaterialTopTabNavigator } from "@react-navigation/material-top-tabs"; import Carousel from "../Carousel/Carousel"; import Colors from "../../Constants/Colors"; @@ -15,7 +7,6 @@ import { client } from "../../appwrite"; import { Databases, Account } from "appwrite"; import { useEffect, useState } from "react"; import ID from "../../Constants/ID"; -import { BACKEND_API_BOOK_SEARCH_URL } from "../../Constants/URLs"; import { Query } from "appwrite"; const Tab = createMaterialTopTabNavigator(); @@ -111,11 +102,13 @@ function MyTabBar({ state, descriptors, navigation, position }) { ); } -function CurrentlyReadingCarousel() { +function ReadingStatusCarousel({ status }) { const [books, setBooks] = useState([]); useEffect(() => { - (async () => {setBooks(await getBooksOfStatus("CURRENTLY_READING"))})(); + (async () => { + setBooks(await getBooksOfStatus(status)); + })(); }, []); return ( @@ -125,24 +118,6 @@ function CurrentlyReadingCarousel() { ); } -function WantToReadCarousel() { - return {/* */}; -} - -function ReadCarousel() { - return ( - {/* */} - ); -} - -function DNFCarousel() { - return ( - - {/* */} - - ); -} - function LibraryCarouselTabs({ navigation }) { return ( } listeners={{ tabPress: (e) => { shelf = "Currently Reading"; @@ -160,7 +135,7 @@ function LibraryCarouselTabs({ navigation }) { /> } listeners={{ tabPress: (e) => { shelf = "Want To Read"; @@ -169,7 +144,7 @@ function LibraryCarouselTabs({ navigation }) { /> } listeners={{ tabPress: (e) => { shelf = "Read"; @@ -178,7 +153,7 @@ function LibraryCarouselTabs({ navigation }) { /> } listeners={{ tabPress: (e) => { shelf = "Did Not Finish";