aboutsummaryrefslogtreecommitdiff
path: root/src/app/anime/recent/page.jsx
blob: 44aa30147f69cc6482f5584cd356ec1783de3681 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import Image from "next/image";
import Link from "next/link";
import styles from "../top-airing/trending.module.css";
import { preFetchAnimeInfo } from "../videoLinkfetcher";

export default async function Recent() {
	const data = await test();
	preFetchAnimeInfo(data);

	return (
		<div className={styles.TrendingContainer}>
			<div className={styles.TrendingText}>
				<h1>Recent Releases</h1>
			</div>

			<div className={styles.trending}>
				{data &&
					data.results.map((item, index) => (
						<Link
							key={index}
							href={`/anime/${item.id}`}
							style={{ textDecoration: "none", color: "white" }}
						>
							<div
								className={styles.trendingEntries}
								title={item.title}
							>
								<Image
									src={`https://sup-proxy.zephex0-f6c.workers.dev/api-content?url=${item.image}`}
									className={styles.trendingImage}
									width={167}
									height={267}
									alt="Drama"
									priority
								/>
								<p>{item.title}</p>
							</div>
						</Link>
					))}
			</div>
		</div>
	);
}

async function test() {
	const res = await fetch(
		"https://consumet-jade.vercel.app/anime/gogoanime/recent-episodes",
		{ next: { revalidate: 21600 } }
	);
	const data = res.json();
	return data;
}