aboutsummaryrefslogtreecommitdiff
path: root/src/app/manga/components/chapterPages.jsx
blob: c403357ca95c9ddde9ac75dde66f5e51a4b01480 (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
"use server";

import { MangaPages } from "./requests";
import Image from "next/image";

const MangaChapters = async (id) => {
	const data = await MangaPages(id);

	let chapterPages = [];
	for (let items of data.chapter.data) {
		chapterPages.push(`${data.baseUrl}/data/${data.chapter.hash}/${items}`);
	}

	return (
		<div className="flex flex-col items-center">
			{chapterPages &&
				chapterPages.length > 0 &&
				chapterPages.map((item, index) => (
					<div key={index} className="mb-4">
						<Image
							src={`https://sup-proxy.zephex0-f6c.workers.dev/api-content?url=${item}&referer=https://mangadex.org`}
							width={1280}
							height={720}
							className="h-auto w-auto"
							alt="Manga Pages"
						/>
						<p className="text-center">{index}</p>
					</div>
				))}
		</div>
	);
};

export default MangaChapters;