diff --git a/tranga-website/src/Components/Manga.tsx b/tranga-website/src/Components/Manga.tsx index 8a902f3..5277ece 100644 --- a/tranga-website/src/Components/Manga.tsx +++ b/tranga-website/src/Components/Manga.tsx @@ -13,7 +13,6 @@ import {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"; -import IMangaConnector from "../api/types/IMangaConnector.ts"; export function MangaFromId({mangaId, children} : { mangaId: string, children?: ReactElement | ReactElement[] | undefined }){ const [manga, setManga] = useState(); @@ -42,15 +41,13 @@ export function Manga({manga: manga, children} : { manga: IManga, children?: Rea const CoverRef = useRef(null); const apiUri = useContext(ApiUriContext); - const mangaConnectors = useContext(MangaConnectorContext); + const mangaConnector = useContext(MangaConnectorContext).find(all => all.name == manga.mangaConnectorName); const [expanded, setExpanded] = useState(false); - const [mangaConnector, setMangaConnector] = useState(); useEffect(() => { LoadMangaCover(); - setMangaConnector(mangaConnectors.find(all => all.name == manga.mangaConnectorName)); - }, [manga]); + }, [manga, apiUri]); const LoadMangaCover = useCallback(() => { if(CoverRef.current == null) diff --git a/tranga-website/src/Components/MangaPopup.tsx b/tranga-website/src/Components/MangaPopup.tsx index e086751..e90627b 100644 --- a/tranga-website/src/Components/MangaPopup.tsx +++ b/tranga-website/src/Components/MangaPopup.tsx @@ -9,6 +9,7 @@ import MarkdownPreview from "@uiw/react-markdown-preview"; import {CardHeight} from "./Manga.tsx"; import IChapter from "../api/types/IChapter.ts"; import {MangaReleaseStatus, ReleaseStatusToPalette} from "../api/types/EnumMangaReleaseStatus.ts"; +import {MangaConnectorContext} from "../api/Contexts/MangaConnectorContext.tsx"; export default function MangaPopup({manga, open, children} : {manga: IManga | null, open: boolean, children?: ReactElement | ReactElement[] | undefined}) { @@ -56,12 +57,14 @@ export default function MangaPopup({manga, open, children} : {manga: IManga | nu SetIgnoreThreshold(apiUri, manga.mangaId, value).finally(() => setUpdatingThreshold(false)); },[manga, apiUri]) + const mangaConnector = useContext(MangaConnectorContext).find(all => all.name == manga?.mangaConnectorName); + return ( { /* Cover and Description */ } - + : manga?.mangaConnectorName} color={ReleaseStatusToPalette(manga?.releaseStatus??MangaReleaseStatus.Unreleased)} size={"lg"}> Manga Cover