diff --git a/tranga-website/src/Components/Manga.tsx b/tranga-website/src/Components/Manga.tsx index 5277ece..69d2dd6 100644 --- a/tranga-website/src/Components/Manga.tsx +++ b/tranga-website/src/Components/Manga.tsx @@ -1,19 +1,27 @@ -import { - Badge, - Box, - Card, - CardContent, CardCover, - Link, -} from "@mui/joy"; +import {Badge, Box, Card, CardContent, CardCover, Skeleton, Typography,} from "@mui/joy"; import IManga from "../api/types/IManga.ts"; import {CSSProperties, ReactElement, useCallback, useContext, useEffect, useRef, useState} from "react"; import {GetMangaById, GetMangaCoverImageUrl} from "../api/Manga.tsx"; import {ApiUriContext, getData} from "../api/fetchApi.tsx"; -import {ReleaseStatusToPalette} from "../api/types/EnumMangaReleaseStatus.ts"; +import {MangaReleaseStatus, ReleaseStatusToPalette} from "../api/types/EnumMangaReleaseStatus.ts"; import {SxProps} from "@mui/joy/styles/types"; import MangaPopup from "./MangaPopup.tsx"; import {MangaConnectorContext} from "../api/Contexts/MangaConnectorContext.tsx"; +export const CardWidth = 190; +export const CardHeight = 300; + +const coverSx : SxProps = { + height: CardHeight + "px", + width: CardWidth + "px", + position: "relative", +} + +const coverCss : CSSProperties = { + maxHeight: "calc("+CardHeight+"px + 2rem)", + maxWidth: "calc("+CardWidth+"px + 2rem)", +} + export function MangaFromId({mangaId, children} : { mangaId: string, children?: ReactElement | ReactElement[] | undefined }){ const [manga, setManga] = useState(); @@ -29,14 +37,33 @@ export function MangaFromId({mangaId, children} : { mangaId: string, children?: return ( <> - {manga === undefined ? <> : } + {manga === undefined ? + } color={ReleaseStatusToPalette(MangaReleaseStatus.Completed)} size={"lg"}> + + + Manga Cover + + + + + + + {"x ".repeat(Math.random()*25+5)} + + + + + + + : + } ); } -export const CardWidth = 190; -export const CardHeight = 300; - export function Manga({manga: manga, children} : { manga: IManga, children?: ReactElement | ReactElement[] | undefined}) { const CoverRef = useRef(null); @@ -60,18 +87,7 @@ export function Manga({manga: manga, children} : { manga: IManga, children?: Rea getData(coverUrl).then(() => { if(CoverRef.current) CoverRef.current.src = coverUrl; }); - }, [manga, apiUri]) - - const coverSx : SxProps = { - height: CardHeight + "px", - width: CardWidth + "px", - position: "relative", - } - - const coverCss : CSSProperties = { - maxHeight: "calc("+CardHeight+"px + 2rem)", - maxWidth: "calc("+CardWidth+"px + 2rem)", - } + }, [manga, apiUri]); const interactiveElements = ["button", "input", "textarea", "a", "select", "option", "li"]; @@ -95,9 +111,9 @@ export function Manga({manga: manga, children} : { manga: IManga, children?: Rea }}/> - + {mangaName} - + {children} diff --git a/tranga-website/src/Components/MangaPopup.tsx b/tranga-website/src/Components/MangaPopup.tsx index e90627b..ac4c296 100644 --- a/tranga-website/src/Components/MangaPopup.tsx +++ b/tranga-website/src/Components/MangaPopup.tsx @@ -1,5 +1,5 @@ import IManga from "../api/types/IManga.ts"; -import {Badge, Box, Chip, CircularProgress, Drawer, Input, Skeleton, Stack, Typography} from "@mui/joy"; +import {Badge, Box, Chip, CircularProgress, Drawer, Input, Link, Skeleton, Stack, Typography} from "@mui/joy"; import {ReactElement, useCallback, useContext, useEffect, useRef, useState} from "react"; import {GetLatestChapterAvailable, GetMangaCoverImageUrl, SetIgnoreThreshold} from "../api/Manga.tsx"; import {ApiUriContext, getData} from "../api/fetchApi.tsx"; @@ -70,7 +70,9 @@ export default function MangaPopup({manga, open, children} : {manga: IManga | nu onLoad={LoadMangaCover}/> - {manga?.name} + + {manga?.name} + {manga?.authors?.map(author => )} {manga?.mangaTags?.map(tag => {tag.tag})}