diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx
index 7cd06d5..26c4bd6 100644
--- a/app/(tabs)/index.tsx
+++ b/app/(tabs)/index.tsx
@@ -4,7 +4,13 @@ import { useShowContext } from "@/contexts/ShowContext";
import { useStreamingServiceContext } from "@/contexts/StreamingServiceContext";
import { router } from "expo-router";
import React from "react";
-import { ActivityIndicator, Text, View } from "react-native";
+import {
+ ActivityIndicator,
+ Text,
+ TouchableOpacity,
+ View,
+ Image,
+} from "react-native";
import {
GestureHandlerRootView,
ScrollView,
@@ -13,6 +19,32 @@ import {
export default function HomeScreen() {
const { shows, error, loading } = useShowContext();
const { streamingServices } = useStreamingServiceContext();
+ const [filteredShows, setFilteredShows] = React.useState(shows);
+
+ React.useEffect(() => {
+ setFilteredShows(shows);
+ }, [shows]);
+
+ const handleFilter = (type: string) => {
+ if (type === "all") {
+ setFilteredShows(shows);
+ return;
+ }
+
+ if (type === "live") {
+ const filtered = shows.filter((show) => show.running);
+ setFilteredShows(filtered);
+ return;
+ }
+
+ const filtered = shows.filter((show) => show.streamingService === type);
+ setFilteredShows(filtered);
+ };
+
+ const uniqueStreamingServices = React.useMemo(() => {
+ const uniqueServices = new Set(shows.map((show) => show.streamingService));
+ return Array.from(uniqueServices);
+ }, [shows]);
if (loading) {
return (
@@ -47,7 +79,46 @@ export default function HomeScreen() {
FLTR
- {shows.map((show) => {
+
+
+ {uniqueStreamingServices.map((serviceName) => {
+ const streamingService =
+ streamingServices[
+ `assets.images.streamingServices.${serviceName.toLowerCase()}`
+ ];
+ return (
+ handleFilter(serviceName)}
+ >
+
+
+ );
+ })}
+
+
+ {filteredShows.map((show) => {
const showLiveBadge = show.running;
const streamingService =
streamingServices[
diff --git a/app/tabStyles/indexStyles.tsx b/app/tabStyles/indexStyles.tsx
index 86f0c8c..561002b 100644
--- a/app/tabStyles/indexStyles.tsx
+++ b/app/tabStyles/indexStyles.tsx
@@ -37,4 +37,10 @@ export default StyleSheet.create({
paddingVertical: 5,
paddingHorizontal: 10,
},
+ filterSection: {
+ width: "100%",
+ height: 70,
+ backgroundColor: "hsl(221, 39%, 5%)",
+ marginTop: 20,
+ },
});