{props.children}
diff --git a/src/pages/Discover.tsx b/src/pages/Discover.tsx
index 2f34c46b..3091f882 100644
--- a/src/pages/Discover.tsx
+++ b/src/pages/Discover.tsx
@@ -23,6 +23,25 @@ import { SubPageLayout } from "./layouts/SubPageLayout";
import { Icon, Icons } from "../components/Icon";
import { PageTitle } from "./parts/util/PageTitle";
+const editorPicks = [
+ { id: 9342, type: "movie" }, // The Mask of Zorro
+ { id: 293, type: "movie" }, // A River Runs Through It
+ { id: 370172, type: "movie" }, // No Time To Die
+ { id: 661374, type: "movie" }, // The Glass Onion
+ { id: 207, type: "movie" }, // Dead Poets Society
+ { id: 378785, type: "movie" }, // The Best of the Blues Brothers
+ { id: 335984, type: "movie" }, // Blade Runner 2049
+ { id: 13353, type: "movie" }, // It's the Great Pumpkin, Charlie Brown
+ { id: 27205, type: "movie" }, // Inception
+ { id: 106646, type: "movie" }, // The Wolf of Wall Street
+ { id: 334533, type: "movie" }, // Captain Fantastic
+ { id: 693134, type: "movie" }, // Dune: Part Two
+ { id: 765245, type: "movie" }, // Swan Song
+ { id: 264660, type: "movie" }, // Ex Machina
+ { id: 92591, type: "movie" }, // Bernie
+ { id: 976893, type: "movie" }, // Perfect Days
+];
+
export function Discover() {
const { t } = useTranslation();
const [genres, setGenres] = useState
([]);
@@ -48,6 +67,45 @@ export function Discover() {
const [countdownTimeout, setCountdownTimeout] =
useState(null);
+ const [editorPicksData, setEditorPicksData] = useState([]);
+
+ useEffect(() => {
+ // Function to shuffle array
+ const shuffleArray = (array: any[]) => {
+ for (let i = array.length - 1; i > 0; i -= 1) {
+ const j = Math.floor(Math.random() * (i + 1));
+ [array[i], array[j]] = [array[j], array[i]];
+ }
+ return array;
+ };
+
+ const fetchEditorPicks = async () => {
+ try {
+ // Shuffle the editorPicks array
+ const shuffledPicks = shuffleArray([...editorPicks]);
+
+ const promises = shuffledPicks.map(async (pick) => {
+ const endpoint =
+ pick.type === "movie" ? `/movie/${pick.id}` : `/tv/${pick.id}`;
+ const data = await get(endpoint, {
+ api_key: conf().TMDB_READ_API_KEY,
+ language: "en-US",
+ });
+ return {
+ ...data,
+ type: pick.type,
+ };
+ });
+ const results = await Promise.all(promises);
+ setEditorPicksData(results);
+ } catch (error) {
+ console.error("Error fetching editor picks:", error);
+ }
+ };
+
+ fetchEditorPicks();
+ }, []);
+
useEffect(() => {
const fetchMoviesForCategory = async (category: Category) => {
try {
@@ -315,11 +373,13 @@ export function Discover() {
const displayCategory =
category === "Now Playing"
? "In Cinemas"
- : category.includes("Movie")
- ? `${category}s`
- : isTVShow
- ? `${category} Shows`
- : `${category} Movies`;
+ : category === "Editor Picks" // Check for "Editor Picks" specifically
+ ? category
+ : category.includes("Movie")
+ ? `${category}s`
+ : isTVShow
+ ? `${category} Shows`
+ : `${category} Movies`;
// https://tailwindcss.com/docs/border-style
return (
@@ -532,6 +592,16 @@ export function Discover() {
)}
+
+ {/* Editor Picks Section */}
+
+ {editorPicksData.length > 0 && (
+
+ {renderMovies(editorPicksData, "Editor Picks")}
+
+ )}
+
+