fix: unclear phrasing

This commit is contained in:
Fredrik Burmester
2025-01-03 10:24:16 +01:00
parent 7e12136211
commit 0fc48497d0

View File

@@ -6,16 +6,21 @@ import { DownloadedItem, useDownload } from "@/providers/DownloadProvider";
import { queueAtom } from "@/utils/atoms/queue"; import { queueAtom } from "@/utils/atoms/queue";
import { useSettings } from "@/utils/atoms/settings"; import { useSettings } from "@/utils/atoms/settings";
import { Ionicons } from "@expo/vector-icons"; import { Ionicons } from "@expo/vector-icons";
import {useNavigation, useRouter} from "expo-router"; import { useNavigation, useRouter } from "expo-router";
import { useAtom } from "jotai"; import { useAtom } from "jotai";
import React, {useEffect, useMemo, useRef} from "react"; import React, { useEffect, useMemo, useRef } from "react";
import {Alert, ScrollView, TouchableOpacity, View} from "react-native"; import { Alert, ScrollView, TouchableOpacity, View } from "react-native";
import { Button } from "@/components/Button"; import { Button } from "@/components/Button";
import { useSafeAreaInsets } from "react-native-safe-area-context"; import { useSafeAreaInsets } from "react-native-safe-area-context";
import {DownloadSize} from "@/components/downloads/DownloadSize"; import { DownloadSize } from "@/components/downloads/DownloadSize";
import {BottomSheetBackdrop, BottomSheetBackdropProps, BottomSheetModal, BottomSheetView} from "@gorhom/bottom-sheet"; import {
import {toast} from "sonner-native"; BottomSheetBackdrop,
import {writeToLog} from "@/utils/log"; BottomSheetBackdropProps,
BottomSheetModal,
BottomSheetView,
} from "@gorhom/bottom-sheet";
import { toast } from "sonner-native";
import { writeToLog } from "@/utils/log";
export default function page() { export default function page() {
const navigation = useNavigation(); const navigation = useNavigation();
@@ -56,28 +61,29 @@ export default function page() {
useEffect(() => { useEffect(() => {
navigation.setOptions({ navigation.setOptions({
headerRight: () => ( headerRight: () => (
<TouchableOpacity <TouchableOpacity onPress={bottomSheetModalRef.current?.present}>
onPress={bottomSheetModalRef.current?.present} <DownloadSize items={downloadedFiles?.map((f) => f.item) || []} />
>
<DownloadSize items={downloadedFiles?.map(f => f.item) || []}/>
</TouchableOpacity> </TouchableOpacity>
) ),
}) });
}, [downloadedFiles]); }, [downloadedFiles]);
const deleteMovies = () => deleteFileByType("Movie") const deleteMovies = () =>
.then(() => toast.success("Deleted all movies successfully!")) deleteFileByType("Movie")
.catch((reason) => { .then(() => toast.success("Deleted all movies successfully!"))
writeToLog("ERROR", reason); .catch((reason) => {
toast.error("Failed to delete all movies"); writeToLog("ERROR", reason);
}); toast.error("Failed to delete all movies");
const deleteShows = () => deleteFileByType("Episode") });
.then(() => toast.success("Deleted all TV-Series successfully!")) const deleteShows = () =>
.catch((reason) => { deleteFileByType("Episode")
writeToLog("ERROR", reason); .then(() => toast.success("Deleted all TV-Series successfully!"))
toast.error("Failed to delete all TV-Series"); .catch((reason) => {
}); writeToLog("ERROR", reason);
const deleteAllMedia = async () => await Promise.all([deleteMovies(), deleteShows()]) toast.error("Failed to delete all TV-Series");
});
const deleteAllMedia = async () =>
await Promise.all([deleteMovies(), deleteShows()]);
return ( return (
<> <>
@@ -94,7 +100,7 @@ export default function page() {
<View className="bg-neutral-900 p-4 rounded-2xl"> <View className="bg-neutral-900 p-4 rounded-2xl">
<Text className="text-lg font-bold">Queue</Text> <Text className="text-lg font-bold">Queue</Text>
<Text className="text-xs opacity-70 text-red-600"> <Text className="text-xs opacity-70 text-red-600">
Queue and downloads will be lost on app restart Queue and active downloads will be lost on app restart
</Text> </Text>
<View className="flex flex-col space-y-2 mt-2"> <View className="flex flex-col space-y-2 mt-2">
{queue.map((q, index) => ( {queue.map((q, index) => (
@@ -107,7 +113,9 @@ export default function page() {
> >
<View> <View>
<Text className="font-semibold">{q.item.Name}</Text> <Text className="font-semibold">{q.item.Name}</Text>
<Text className="text-xs opacity-50">{q.item.Type}</Text> <Text className="text-xs opacity-50">
{q.item.Type}
</Text>
</View> </View>
<TouchableOpacity <TouchableOpacity
onPress={() => { onPress={() => {
@@ -118,7 +126,7 @@ export default function page() {
}); });
}} }}
> >
<Ionicons name="close" size={24} color="red"/> <Ionicons name="close" size={24} color="red" />
</TouchableOpacity> </TouchableOpacity>
</TouchableOpacity> </TouchableOpacity>
))} ))}
@@ -130,7 +138,7 @@ export default function page() {
</View> </View>
)} )}
<ActiveDownloads/> <ActiveDownloads />
</View> </View>
{movies.length > 0 && ( {movies.length > 0 && (
@@ -145,7 +153,7 @@ export default function page() {
<View className="px-4 flex flex-row"> <View className="px-4 flex flex-row">
{movies?.map((item) => ( {movies?.map((item) => (
<View className="mb-2 last:mb-0" key={item.item.Id}> <View className="mb-2 last:mb-0" key={item.item.Id}>
<MovieCard item={item.item}/> <MovieCard item={item.item} />
</View> </View>
))} ))}
</View> </View>
@@ -157,13 +165,18 @@ export default function page() {
<View className="flex flex-row items-center justify-between mb-2 px-4"> <View className="flex flex-row items-center justify-between mb-2 px-4">
<Text className="text-lg font-bold">TV-Series</Text> <Text className="text-lg font-bold">TV-Series</Text>
<View className="bg-purple-600 rounded-full h-6 w-6 flex items-center justify-center"> <View className="bg-purple-600 rounded-full h-6 w-6 flex items-center justify-center">
<Text className="text-xs font-bold">{groupedBySeries?.length}</Text> <Text className="text-xs font-bold">
{groupedBySeries?.length}
</Text>
</View> </View>
</View> </View>
<ScrollView horizontal showsHorizontalScrollIndicator={false}> <ScrollView horizontal showsHorizontalScrollIndicator={false}>
<View className="px-4 flex flex-row"> <View className="px-4 flex flex-row">
{groupedBySeries?.map((items) => ( {groupedBySeries?.map((items) => (
<View className="mb-2 last:mb-0" key={items[0].item.SeriesId}> <View
className="mb-2 last:mb-0"
key={items[0].item.SeriesId}
>
<SeriesCard <SeriesCard
items={items.map((i) => i.item)} items={items.map((i) => i.item)}
key={items[0].item.SeriesId} key={items[0].item.SeriesId}
@@ -200,9 +213,15 @@ export default function page() {
> >
<BottomSheetView> <BottomSheetView>
<View className="p-4 space-y-4 mb-4"> <View className="p-4 space-y-4 mb-4">
<Button color="purple" onPress={deleteMovies}>Delete all Movies</Button> <Button color="purple" onPress={deleteMovies}>
<Button color="purple" onPress={deleteShows}>Delete all TV-Series</Button> Delete all Movies
<Button color="red" onPress={deleteAllMedia}>Delete all</Button> </Button>
<Button color="purple" onPress={deleteShows}>
Delete all TV-Series
</Button>
<Button color="red" onPress={deleteAllMedia}>
Delete all
</Button>
</View> </View>
</BottomSheetView> </BottomSheetView>
</BottomSheetModal> </BottomSheetModal>