mirror of
https://github.com/streamyfin/streamyfin.git
synced 2026-01-16 08:08:18 +00:00
Some checks failed
🤖 Android APK Build / 🏗️ Build Android APK (push) Has been cancelled
🤖 iOS IPA Build / 🏗️ Build iOS IPA (push) Has been cancelled
🔒 Lockfile Consistency Check / 🔍 Check bun.lock and package.json consistency (push) Has been cancelled
🛡️ CodeQL Analysis / 🔎 Analyze with CodeQL (javascript-typescript) (push) Has been cancelled
🏷️🔀Merge Conflict Labeler / 🏷️ Labeling Merge Conflicts (push) Has been cancelled
🕒 Handle Stale Issues / 🗑️ Cleanup Stale Issues (push) Has been cancelled
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { Ionicons } from "@expo/vector-icons";
|
|
import { useAtom } from "jotai";
|
|
import { TouchableOpacity, type TouchableOpacityProps } from "react-native";
|
|
import {
|
|
genreFilterAtom,
|
|
tagsFilterAtom,
|
|
yearFilterAtom,
|
|
} from "@/utils/atoms/filters";
|
|
|
|
interface Props extends TouchableOpacityProps {}
|
|
|
|
export const ResetFiltersButton: React.FC<Props> = ({ ...props }) => {
|
|
const [selectedGenres, setSelectedGenres] = useAtom(genreFilterAtom);
|
|
const [selectedTags, setSelectedTags] = useAtom(tagsFilterAtom);
|
|
const [selectedYears, setSelectedYears] = useAtom(yearFilterAtom);
|
|
|
|
if (
|
|
selectedGenres.length === 0 &&
|
|
selectedTags.length === 0 &&
|
|
selectedYears.length === 0
|
|
) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<TouchableOpacity
|
|
onPress={() => {
|
|
setSelectedGenres([]);
|
|
setSelectedTags([]);
|
|
setSelectedYears([]);
|
|
}}
|
|
className='bg-purple-600 rounded-full w-[30px] h-[30px] flex items-center justify-center mr-1'
|
|
{...props}
|
|
>
|
|
<Ionicons name='close' size={20} color='white' />
|
|
</TouchableOpacity>
|
|
);
|
|
};
|