From 7e610c485b9d1abbabe6c388263d8043ee1bcf99 Mon Sep 17 00:00:00 2001 From: glax Date: Tue, 22 Jul 2025 22:10:52 +0200 Subject: [PATCH] MangaMerge --- .../src/Components/Mangas/MangaMerge.tsx | 59 ++++++++++++++++++- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/tranga-website/src/Components/Mangas/MangaMerge.tsx b/tranga-website/src/Components/Mangas/MangaMerge.tsx index 316bdad..2d4c8e0 100644 --- a/tranga-website/src/Components/Mangas/MangaMerge.tsx +++ b/tranga-website/src/Components/Mangas/MangaMerge.tsx @@ -4,7 +4,9 @@ import Drawer from "@mui/joy/Drawer"; import ModalClose from "@mui/joy/ModalClose"; import {ApiContext} from "../../apiClient/ApiContext.tsx"; import {MangaCard} from "./MangaCard.tsx"; -import {Button} from "@mui/joy"; +import {Button, Modal, ModalDialog, Stack, Tooltip, Typography} from "@mui/joy"; +import {KeyboardDoubleArrowRight, Warning} from "@mui/icons-material"; +import {LoadingState, StateIndicator} from "../Loading.tsx"; export default function ({manga} : {manga : Manga | undefined}) : ReactNode { const Api = useContext(ApiContext); @@ -29,10 +31,61 @@ export default function ({manga} : {manga : Manga | undefined}) : ReactNode { - setOpen(false)} anchor={"bottom"}> + setOpen(false)} anchor={"bottom"}> - {similar.map(manga => )} + + {similar.map(similarManga => + + )} + ); +} + +function ConfirmationModal({manga, similarManga} : {manga : Manga, similarManga : Manga}) : ReactNode { + const [open, setOpen] = useState(false); + const Api = useContext(ApiContext); + + const [loadingState, setLoadingState] = useState(LoadingState.none); + + const merge = () => { + setLoadingState(LoadingState.loading); + Api.mangaMergeIntoPartialUpdate(manga.key as string, similarManga.key as string).then(response => { + if (response.ok){ + setLoadingState(LoadingState.success); + setTimeout(() => setOpen(false), 2000); + }else + setLoadingState(LoadingState.failure); + }).catch(_ => setLoadingState(LoadingState.failure)); + } + + return ( + <> + + setOpen(false)}> + + + Confirm Merge + + + + + + + + + + + + ); } \ No newline at end of file