diff --git a/src/components/MangaCard.tsx b/src/components/MangaCard.tsx index 36c753fc..ab218361 100644 --- a/src/components/MangaCard.tsx +++ b/src/components/MangaCard.tsx @@ -46,7 +46,10 @@ export const MangaCard = (props: MangaCardProps) => { options: { showContinueReadingButton }, } = useLibraryOptionsContext(); - const { CategorySelectComponent, updateLibraryState, isInLibrary } = useManageMangaLibraryState(manga); + const { CategorySelectComponent, updateLibraryState, isInLibrary } = useManageMangaLibraryState( + manga, + mode === 'source', + ); const mangaLinkTo = getMangaLinkTo(mode, manga.id, manga.source?.id, manga.title); diff --git a/src/components/manga/useManageMangaLibraryState.tsx b/src/components/manga/useManageMangaLibraryState.tsx index 7eb1e078..5b361448 100644 --- a/src/components/manga/useManageMangaLibraryState.tsx +++ b/src/components/manga/useManageMangaLibraryState.tsx @@ -18,7 +18,10 @@ import { Mangas } from '@/lib/data/Mangas.ts'; import { TManga } from '@/typings.ts'; import { awaitConfirmation } from '@/lib/ui/AwaitableDialog.tsx'; -export const useManageMangaLibraryState = (manga: Pick) => { +export const useManageMangaLibraryState = ( + manga: Pick, + confirmRemoval: boolean = false, +) => { const { t } = useTranslation(); const [isInLibrary, setIsInLibrary] = useState(manga.inLibrary); @@ -55,16 +58,19 @@ export const useManageMangaLibraryState = (manga: Pick { - await awaitConfirmation({ - title: t('global.label.are_you_sure'), - message: t('manga.action.library.remove.dialog.label.message', { title: manga.title }), - actions: { - confirm: { title: t('global.button.remove') }, - }, - }); + if (confirmRemoval) { + await awaitConfirmation({ + title: t('global.label.are_you_sure'), + message: t('manga.action.library.remove.dialog.label.message', { title: manga.title }), + actions: { + confirm: { title: t('global.button.remove') }, + }, + }); + } + await Mangas.removeFromLibrary([manga.id]); setIsInLibrary(false); - }, [manga.id]); + }, [manga.id, confirmRemoval]); const { openCategorySelect, CategorySelectComponent } = useCategorySelect({ mangaId: manga.id,