Fix/manga migration opening search twice (#586)
* Update "MenuItem" props * Navigate to manga migration only once * Remove disabling migrate button on manga refresh too much copy&paste
This commit is contained in:
@@ -16,7 +16,7 @@ import FavoriteBorderIcon from '@mui/icons-material/FavoriteBorder';
|
||||
import Label from '@mui/icons-material/Label';
|
||||
import { useMemo, useState } from 'react';
|
||||
import SyncAltIcon from '@mui/icons-material/SyncAlt';
|
||||
import { Link, useNavigate } from 'react-router-dom';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { TManga } from '@/typings.ts';
|
||||
import { actionToTranslationKey, MangaAction, MangaDownloadInfo, Mangas, MangaUnreadInfo } from '@/lib/data/Mangas.ts';
|
||||
import { SelectableCollectionReturnType } from '@/components/collection/useSelectableCollection.ts';
|
||||
@@ -51,8 +51,6 @@ export const MangaActionMenuItems = ({
|
||||
}: Props) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const [isCategorySelectOpen, setIsCategorySelectOpen] = useState(false);
|
||||
|
||||
const isSingleMode = !!manga;
|
||||
@@ -104,7 +102,7 @@ export const MangaActionMenuItems = ({
|
||||
{shouldShowMenuItem(!isFullyDownloaded) && (
|
||||
<MenuItem
|
||||
Icon={Download}
|
||||
isDisabled={isMenuItemDisabled(!downloadableMangas.length)}
|
||||
disabled={isMenuItemDisabled(!downloadableMangas.length)}
|
||||
onClick={() => performAction('download', downloadableMangas)}
|
||||
title={getMenuItemTitle('download', downloadableMangas.length)}
|
||||
/>
|
||||
@@ -112,7 +110,7 @@ export const MangaActionMenuItems = ({
|
||||
{shouldShowMenuItem(hasDownloadedChapters) && (
|
||||
<MenuItem
|
||||
Icon={Delete}
|
||||
isDisabled={isMenuItemDisabled(!downloadedMangas.length)}
|
||||
disabled={isMenuItemDisabled(!downloadedMangas.length)}
|
||||
onClick={() => performAction('delete', downloadedMangas)}
|
||||
title={getMenuItemTitle('delete', downloadedMangas.length)}
|
||||
/>
|
||||
@@ -120,7 +118,7 @@ export const MangaActionMenuItems = ({
|
||||
{shouldShowMenuItem(hasUnreadChapters) && (
|
||||
<MenuItem
|
||||
Icon={Done}
|
||||
isDisabled={isMenuItemDisabled(!unreadMangas.length)}
|
||||
disabled={isMenuItemDisabled(!unreadMangas.length)}
|
||||
onClick={() => performAction('mark_as_read', unreadMangas)}
|
||||
title={getMenuItemTitle('mark_as_read', unreadMangas.length)}
|
||||
/>
|
||||
@@ -128,7 +126,7 @@ export const MangaActionMenuItems = ({
|
||||
{shouldShowMenuItem(hasReadChapters) && (
|
||||
<MenuItem
|
||||
Icon={RemoveDone}
|
||||
isDisabled={isMenuItemDisabled(!readMangas.length)}
|
||||
disabled={isMenuItemDisabled(!readMangas.length)}
|
||||
onClick={() => performAction('mark_as_unread', readMangas)}
|
||||
title={getMenuItemTitle('mark_as_unread', readMangas.length)}
|
||||
/>
|
||||
@@ -139,15 +137,7 @@ export const MangaActionMenuItems = ({
|
||||
state={{ mangaTitle: manga?.title }}
|
||||
style={{ textDecoration: 'none', color: 'inherit' }}
|
||||
>
|
||||
<MenuItem
|
||||
onClick={() =>
|
||||
navigate(
|
||||
`/migrate/source/${manga?.source?.id}/manga/${manga?.id}/search?query=${manga?.title}`,
|
||||
)
|
||||
}
|
||||
Icon={SyncAltIcon}
|
||||
title={getMenuItemTitle('migrate', selectedMangas.length)}
|
||||
/>
|
||||
<MenuItem Icon={SyncAltIcon} title={getMenuItemTitle('migrate', selectedMangas.length)} />
|
||||
</Link>
|
||||
)}
|
||||
<MenuItem
|
||||
|
||||
Reference in New Issue
Block a user