Fix missing migration manual search title
This commit is contained in:
@@ -59,6 +59,7 @@ import { SearchParam } from '@/base/Base.types.ts';
|
||||
import { MigrationManager } from '@/features/migration/MigrationManager.ts';
|
||||
import { assertIsDefined } from '@/base/Asserts.ts';
|
||||
import { ReactRouter } from '@/lib/react-router/ReactRouter.ts';
|
||||
import { SubpathUtil } from '@/lib/utils/SubpathUtil.ts';
|
||||
|
||||
type SourceLoadingState = { isLoading: boolean; hasResults: boolean; emptySearch: boolean; error: any };
|
||||
type SourceToLoadingStateMap = Map<string, SourceLoadingState>;
|
||||
@@ -249,10 +250,10 @@ export const SearchAll = ({
|
||||
}) => {
|
||||
const { t } = useLingui();
|
||||
const navigate = useNavigate();
|
||||
const { pathname, state } = useLocation<{ mangaTitle?: string; shouldShowOnlyPinnedSources?: boolean }>();
|
||||
const { state } = useLocation<{ title?: string; shouldShowOnlyPinnedSources?: boolean }>();
|
||||
const { ref: filterHeaderRef, height: filterHeaderHeight } = useElementSize();
|
||||
|
||||
const isMigrateMode = pathname.startsWith('/migrate/source') || pathname.startsWith('/migrate/manual-search');
|
||||
const isMigrateMode = SubpathUtil.getPathname().startsWith(AppRoutes.migrate.path);
|
||||
|
||||
const { mangaId } = useParams<{ mangaId?: string }>() ?? STABLE_EMPTY_OBJECT;
|
||||
const [query] = useQueryParam(SearchParam.QUERY, StringParam);
|
||||
@@ -317,7 +318,7 @@ export const SearchAll = ({
|
||||
);
|
||||
|
||||
useAppTitleAndAction(
|
||||
isMigrateMode ? t`Migrate "${state?.mangaTitle}"` : t`Global Search`,
|
||||
isMigrateMode ? state?.title : t`Global Search`,
|
||||
<>
|
||||
<AppbarSearch isClosable={false} />
|
||||
<SourceLanguageSelect
|
||||
|
||||
@@ -94,7 +94,7 @@ export const MangaToolbarMenu = ({ manga, onRefresh, refreshing }: IProps) => {
|
||||
manga.id,
|
||||
manga.title,
|
||||
)}
|
||||
state={{ mangaTitle: manga.title }}
|
||||
state={{ title: t`Migrate "${manga.title}"` }}
|
||||
style={{ textDecoration: 'none', color: 'inherit' }}
|
||||
>
|
||||
<IconButton color="inherit">
|
||||
@@ -168,7 +168,7 @@ export const MangaToolbarMenu = ({ manga, onRefresh, refreshing }: IProps) => {
|
||||
manga.id,
|
||||
manga.title,
|
||||
)}
|
||||
state={{ mangaTitle: manga.title }}
|
||||
state={{ title: t`Migrate "${manga.title}"` }}
|
||||
style={{ textDecoration: 'none', color: 'inherit' }}
|
||||
>
|
||||
<ListItemIcon>
|
||||
|
||||
@@ -321,7 +321,7 @@ export class MigrationManager {
|
||||
ReactRouter.navigate(
|
||||
AppRoutes.migrate.childRoutes.singleMangaSearch.path(manga.sourceId, manga.id, manga.title),
|
||||
{
|
||||
state: { mangaTitle: manga.title },
|
||||
state: { title: t`Migrate "${manga.title}"` },
|
||||
},
|
||||
);
|
||||
|
||||
@@ -645,6 +645,12 @@ export class MigrationManager {
|
||||
});
|
||||
}
|
||||
|
||||
static openManualSearch(mangaId: MangaIdInfo['id'], title: string): void {
|
||||
ReactRouter.navigate(AppRoutes.migrate.childRoutes.manualSearch.path(mangaId, title), {
|
||||
state: { title: t`Manual migration search for "${title}"` },
|
||||
});
|
||||
}
|
||||
|
||||
static getState(): MigrationState {
|
||||
return migrationStore.getState();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import { MediaQuery } from '@/base/utils/MediaQuery.tsx';
|
||||
import { MigrationEntryCard } from '@/features/migration/components/migration-entry/MigrationEntryCard.tsx';
|
||||
import { MigrationEntryCardContent } from '@/features/migration/components/migration-entry/MigrationEntryCardContent.tsx';
|
||||
import { ENTRY_STATUS_TRANSLATION } from '@/features/migration/Migration.constants.ts';
|
||||
import { ReactRouter } from '@/lib/react-router/ReactRouter.ts';
|
||||
import { AppRoutes } from '@/base/AppRoute.constants.ts';
|
||||
import { MigrationManager } from '@/features/migration/MigrationManager.ts';
|
||||
import { extractGraphqlExceptionInfo } from '@/lib/HelperFunctions.ts';
|
||||
@@ -61,12 +60,7 @@ const EntryStatus = ({
|
||||
startIcon={<SearchIcon />}
|
||||
variant="contained"
|
||||
onClick={() => {
|
||||
ReactRouter.navigate(
|
||||
AppRoutes.migrate.childRoutes.manualSearch.path(sourceMangaId, sourceMangaTitle),
|
||||
{
|
||||
state: { mangaTitle: sourceMangaTitle },
|
||||
},
|
||||
);
|
||||
MigrationManager.openManualSearch(sourceMangaId, sourceMangaTitle);
|
||||
}}
|
||||
>{t`Manual search`}</Button>
|
||||
)}
|
||||
|
||||
@@ -14,8 +14,6 @@ import { MediaQuery } from '@/base/utils/MediaQuery.tsx';
|
||||
import { applyStyles } from '@/base/utils/ApplyStyles.ts';
|
||||
import { MigrationSourceEntry } from '@/features/migration/components/migration-entry/MigrationSourceEntry.tsx';
|
||||
import { MigrationDestinationEntry } from '@/features/migration/components/migration-entry/MigrationDestinationEntry.tsx';
|
||||
import { ReactRouter } from '@/lib/react-router/ReactRouter.ts';
|
||||
import { AppRoutes } from '@/base/AppRoute.constants.ts';
|
||||
import { MigrationMatchedEntry } from '@/features/migration/components/migration-entry/MigrationMatchedEntry.tsx';
|
||||
import { MigrationEntrySearchExcludeActions } from '@/features/migration/components/migration-entry/MigrationEntrySearchExcludeActions.tsx';
|
||||
import Typography from '@mui/material/Typography';
|
||||
@@ -70,12 +68,7 @@ const MigrationEntryMobile = memo(
|
||||
startIcon={<SearchIcon />}
|
||||
variant="text"
|
||||
onClick={() => {
|
||||
ReactRouter.navigate(
|
||||
AppRoutes.migrate.childRoutes.manualSearch.path(mangaId, mangaTitle),
|
||||
{
|
||||
state: { mangaTitle: mangaTitle },
|
||||
},
|
||||
);
|
||||
MigrationManager.openManualSearch(mangaId, mangaTitle);
|
||||
}}
|
||||
>{t`Manual search`}</Button>
|
||||
</Stack>
|
||||
|
||||
@@ -10,8 +10,6 @@ import type { MangaIdInfo } from '@/features/manga/Manga.types.ts';
|
||||
import { MediaQuery } from '@/base/utils/MediaQuery.tsx';
|
||||
import { CustomTooltip } from '@/base/components/CustomTooltip.tsx';
|
||||
import { CustomButtonIcon } from '@/base/components/buttons/CustomButtonIcon.tsx';
|
||||
import { ReactRouter } from '@/lib/react-router/ReactRouter.ts';
|
||||
import { AppRoutes } from '@/base/AppRoute.constants.ts';
|
||||
import { MigrationManager } from '@/features/migration/MigrationManager.ts';
|
||||
import IconButton from '@mui/material/IconButton';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
@@ -71,12 +69,7 @@ export const MigrationEntrySearchExcludeActions = ({
|
||||
flexGrow: Number(!otherResultsCount),
|
||||
}}
|
||||
onClick={() => {
|
||||
ReactRouter.navigate(
|
||||
AppRoutes.migrate.childRoutes.manualSearch.path(mangaId, mangaTitle),
|
||||
{
|
||||
state: { mangaTitle: mangaTitle },
|
||||
},
|
||||
);
|
||||
MigrationManager.openManualSearch(mangaId, mangaTitle);
|
||||
}}
|
||||
>
|
||||
<SearchIcon />
|
||||
@@ -113,7 +106,7 @@ export const MigrationEntrySearchExcludeActions = ({
|
||||
<CustomTooltip title={t`Manual search`} placement="auto">
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
ReactRouter.navigate(AppRoutes.migrate.childRoutes.manualSearch.path(mangaId, mangaTitle));
|
||||
MigrationManager.openManualSearch(mangaId, mangaTitle);
|
||||
}}
|
||||
>
|
||||
<SearchIcon />
|
||||
|
||||
Reference in New Issue
Block a user