diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/app/manga/components/chapterPages.jsx | 2 | ||||
| -rw-r--r-- | src/app/manga/components/descriptionTabs.jsx | 65 | ||||
| -rw-r--r-- | src/app/manga/components/downloadButton.jsx | 15 | ||||
| -rw-r--r-- | src/app/manga/components/inputContainer.jsx | 2 |
4 files changed, 57 insertions, 27 deletions
diff --git a/src/app/manga/components/chapterPages.jsx b/src/app/manga/components/chapterPages.jsx index c403357..8e14a89 100644 --- a/src/app/manga/components/chapterPages.jsx +++ b/src/app/manga/components/chapterPages.jsx @@ -21,7 +21,7 @@ const MangaChapters = async (id) => { 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" + className="h-auto w-auto rounded-md" alt="Manga Pages" /> <p className="text-center">{index}</p> diff --git a/src/app/manga/components/descriptionTabs.jsx b/src/app/manga/components/descriptionTabs.jsx index 19191ab..b7fe612 100644 --- a/src/app/manga/components/descriptionTabs.jsx +++ b/src/app/manga/components/descriptionTabs.jsx @@ -9,6 +9,7 @@ import { Image, Select, SelectItem, + Button, } from "@nextui-org/react"; import { FaRegThumbsUp, FaRegStar } from "react-icons/fa"; import Link from "next/link"; @@ -18,9 +19,11 @@ import MangaChapters from "./chapterPages"; const MangaDescriptionTabs = ({ data }) => { const [pages, setPages] = useState(<></>); + const [url, setUrl] = useState(""); async function get_pages(id) { setPages(<p className="text-center">Loading...</p>); + setUrl(`https://manga-downloader-api.vercel.app/${id}`); const data = await MangaChapters(id); setPages(data); } @@ -121,31 +124,43 @@ const MangaDescriptionTabs = ({ data }) => { </Tab> <Tab key="chapter" title="Chapter"> <Card shadow="sm" className="p-2"> - <Select - className="w-full lg:max-w-md" - label="Select chapter" - > - {data.chapters && - data.chapters.length > 0 && - data.chapters.map((item, index) => { - if (item.pages > 0) { - return ( - <SelectItem - key={index} - onClick={async () => - await get_pages(item.id) - } - textValue={item.title} - > - {item.title} -{" "} - {item.chapterNumber} - </SelectItem> - ); - } else { - return; - } - })} - </Select> + <div className="flex items-center"> + <Select + className="w-full lg:max-w-md" + label="Select chapter" + > + {data.chapters && + data.chapters.length > 0 && + data.chapters.map((item, index) => { + if (item.pages > 0) { + return ( + <SelectItem + key={index} + onClick={async () => + await get_pages(item.id) + } + textValue={item.title} + > + {item.title} -{" "} + {item.chapterNumber} + </SelectItem> + ); + } else { + return; + } + })} + </Select> + <Button + as={Link} + href={url} + className="mt-2 ml-2" + size="lg" + color="warning" + variant="ghost" + > + Download + </Button> + </div> <CardBody> <div className="w-full">{pages}</div> </CardBody> diff --git a/src/app/manga/components/downloadButton.jsx b/src/app/manga/components/downloadButton.jsx new file mode 100644 index 0000000..0942dfb --- /dev/null +++ b/src/app/manga/components/downloadButton.jsx @@ -0,0 +1,15 @@ +import { Button } from "@nextui-org/react"; +import Link from "next/link"; + +const DownloadButton = async ({ id: id }) => { + return ( + <Button + as={Link} + href={`https://manga-downloader-api.vercel.app/${id}`} + > + Download + </Button> + ); +}; + +export default DownloadButton; diff --git a/src/app/manga/components/inputContainer.jsx b/src/app/manga/components/inputContainer.jsx index 10b0a73..55ab970 100644 --- a/src/app/manga/components/inputContainer.jsx +++ b/src/app/manga/components/inputContainer.jsx @@ -103,7 +103,7 @@ const MangaSearchBox = () => { setMangaSearchedTitle(event.target.value); }} onKeyDown={async (event) => { - if (event.key !== "Control") { + if (event.key === "Enter" || event.code === "Enter") { await GetResults(); } }} |