'use client';
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import Link from "next/link";
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogClose,
} from "@/components/ui/dialog";
import {
Carousel,
CarouselContent,
CarouselItem,
} from "@/components/ui/carousel";
import Autoplay from "embla-carousel-autoplay";
import { Card, CardContent } from "@/components/ui/card";
import React, { useState, useRef } from "react";
// Mock data structure
interface NzbItem {
id: string;
name: string;
size: string;
age: string;
category: string;
downloads: number;
metadata: {
description: string;
groups: string[];
files: string[];
};
}
// Mock data structure for Carousel items
interface FeaturedItem {
id: string;
title: string;
category: string;
imageUrl?: string; // Optional: direct image URL or use a placeholder
description: string;
rating: string; // e.g., "IMDb: 8.5/10"
}
// Placeholder SVG for Carousel Item Image
const PlaceholderCarouselImage = ({ text }: { text: string }) => (
{text}
);
export default function IndexerPage() {
const categories = ["All", "Movies", "Series", "Anime", "Music"];
const [selectedItem, setSelectedItem] = useState(null);
// Autoplay plugin ref
const autoplayPlugin = useRef(
Autoplay({ delay: 10000, stopOnInteraction: true })
);
const mockFeaturedData: FeaturedItem[] = [
{
id: "feat1",
title: "Blockbuster Movie Premiere",
category: "Movies",
description: "The latest action-packed thriller hits the screens! Don't miss out.",
rating: "IMDb: 9.2/10",
},
{
id: "feat2",
title: "New Hit Series - Episode 1",
category: "Series",
description: "A gripping new drama series that will keep you on the edge of your seat.",
rating: "Rotten Tomatoes: 95%",
},
{
id: "feat3",
title: "Must-Watch Anime Film",
category: "Anime",
description: "Critically acclaimed anime feature with stunning visuals.",
rating: "MyAnimeList: 8.9/10",
},
];
const mockNzbData: NzbItem[] = [
{
id: "1",
name: "Example Movie Title",
size: "2.5 GB",
age: "1 day",
category: "Movies",
downloads: 1250,
metadata: {
description: "A fantastic movie about something exciting.",
groups: ["alt.binaries.movies.hd"],
files: ["movie_part1.rar", "movie_part2.rar"],
},
},
{
id: "2",
name: "Awesome Series S01E01",
size: "500 MB",
age: "5 hours",
category: "Series",
downloads: 340,
metadata: {
description: "First episode of an awesome new series.",
groups: ["alt.binaries.tv"],
files: ["series_s01e01.mkv"],
},
},
{
id: "3",
name: "Cool Anime Movie",
size: "1.2 GB",
age: "3 days",
category: "Anime",
downloads: 780,
metadata: {
description: "A visually stunning anime film.",
groups: ["alt.binaries.anime"],
files: ["anime.movie.mkv"],
},
},
{
id: "4",
name: "Great Music Album",
size: "300 MB",
age: "10 days",
category: "Music",
downloads: 50,
metadata: {
description: "An album by a popular artist.",
groups: ["alt.binaries.music.mp3"],
files: ["track01.mp3", "track02.mp3", "cover.jpg"],
},
},
];
// Filter data based on category (simple filter for now)
const getFilteredData = (category: string) => {
if (category === "All") return mockNzbData;
return mockNzbData.filter((item) => item.category === category);
};
return (
NZB Indexer
News
Upgrade
Settings
{/* Featured Carousel Section */}
Newest Uploads
{mockFeaturedData.map((featuredItem) => (
{featuredItem.title}
{featuredItem.description}
{featuredItem.rating}
View Details
))}
{categories.map((category) => (
{category}
))}
{categories.map((category) => (
Search
{category === "All"
? "A list of NZBs."
: `Results for ${category}.`}
Name
Size
Age
Downloads
Actions
{getFilteredData(category).map((item) => (
{item.name}
{item.size}
{item.age}
{item.downloads.toLocaleString()}
setSelectedItem(item)}>
Info
Download
))}
))}
{/* Dialog for NZB Info - controlled by selectedItem state */}
{selectedItem && (
!isOpen && setSelectedItem(null)}>
{selectedItem.name}
Category: {selectedItem.category} | Size: {selectedItem.size} | Age: {selectedItem.age} | Downloads: {selectedItem.downloads.toLocaleString()}
Description:
{selectedItem.metadata.description}
Groups:
{selectedItem.metadata.groups.map((group) => (
{group}
))}
Files:
{selectedItem.metadata.files.map((file) => (
{file}
))}
Close
)}
);
}