Improve backup install missing extension routing

Only opened the "browse" page instead of routing to the "extension" tab of the "browse" page
This commit is contained in:
schroda
2025-07-23 01:12:13 +02:00
parent cc4ab2e0dd
commit 39d34af9bc
5 changed files with 19 additions and 16 deletions

View File

@@ -38,6 +38,7 @@ import { ServerSettings } from '@/modules/settings/Settings.types.ts';
import { AppRoutes } from '@/modules/core/AppRoute.constants.ts'; import { AppRoutes } from '@/modules/core/AppRoute.constants.ts';
import { getErrorMessage } from '@/lib/HelperFunctions.ts'; import { getErrorMessage } from '@/lib/HelperFunctions.ts';
import { useAppTitle } from '@/modules/navigation-bar/hooks/useAppTitle.ts'; import { useAppTitle } from '@/modules/navigation-bar/hooks/useAppTitle.ts';
import { BrowseTab } from '@/modules/browse/Browse.types.ts';
type BackupSettingsType = Pick<ServerSettings, 'backupPath' | 'backupTime' | 'backupInterval' | 'backupTTL'>; type BackupSettingsType = Pick<ServerSettings, 'backupPath' | 'backupTime' | 'backupInterval' | 'backupTTL'>;
@@ -337,7 +338,7 @@ export function Backup() {
<Button <Button
onClick={closeInvalidBackupDialog} onClick={closeInvalidBackupDialog}
component={Link} component={Link}
to={AppRoutes.browse.path} to={AppRoutes.browse.path(BrowseTab.EXTENSIONS)}
autoFocus={!!validationResult?.missingSources.length} autoFocus={!!validationResult?.missingSources.length}
variant={validationResult?.missingSources.length ? 'contained' : 'text'} variant={validationResult?.missingSources.length ? 'contained' : 'text'}
> >

View File

@@ -16,3 +16,9 @@ export type MetadataBrowseSettings = {
lastUsedSourceId: SourceIdInfo['id'] | null; lastUsedSourceId: SourceIdInfo['id'] | null;
shouldShowOnlySourcesWithResults: boolean; shouldShowOnlySourcesWithResults: boolean;
}; };
export enum BrowseTab {
SOURCE = 'source',
EXTENSIONS = 'extensions',
MIGRATE = 'migrate',
}

View File

@@ -19,12 +19,7 @@ import { Migration } from '@/modules/migration/screens/Migration.tsx';
import { useResizeObserver } from '@/modules/core/hooks/useResizeObserver.tsx'; import { useResizeObserver } from '@/modules/core/hooks/useResizeObserver.tsx';
import { GROUPED_VIRTUOSO_Z_INDEX } from '@/modules/core/AppRoute.constants.ts'; import { GROUPED_VIRTUOSO_Z_INDEX } from '@/modules/core/AppRoute.constants.ts';
import { useAppTitle } from '@/modules/navigation-bar/hooks/useAppTitle.ts'; import { useAppTitle } from '@/modules/navigation-bar/hooks/useAppTitle.ts';
import { BrowseTab } from '@/modules/browse/Browse.types.ts';
enum Tabs {
SOURCE = 'source',
EXTENSIONS = 'extensions',
MIGRATE = 'migrate',
}
export function Browse() { export function Browse() {
const { t } = useTranslation(); const { t } = useTranslation();
@@ -38,7 +33,7 @@ export function Browse() {
); );
const [tabSearchParam, setTabSearchParam] = useQueryParam('tab', StringParam, {}); const [tabSearchParam, setTabSearchParam] = useQueryParam('tab', StringParam, {});
const tabName = (tabSearchParam as Tabs) ?? Tabs.SOURCE; const tabName = (tabSearchParam as BrowseTab) ?? BrowseTab.SOURCE;
if (!tabSearchParam) { if (!tabSearchParam) {
setTabSearchParam(tabName, 'replaceIn'); setTabSearchParam(tabName, 'replaceIn');
@@ -53,17 +48,17 @@ export function Browse() {
value={tabName} value={tabName}
onChange={(_, newTab) => setTabSearchParam(newTab, 'replaceIn')} onChange={(_, newTab) => setTabSearchParam(newTab, 'replaceIn')}
> >
<Tab value={Tabs.SOURCE} sx={{ textTransform: 'none' }} label={t('source.title_one')} /> <Tab value={BrowseTab.SOURCE} sx={{ textTransform: 'none' }} label={t('source.title_other')} />
<Tab value={Tabs.EXTENSIONS} sx={{ textTransform: 'none' }} label={t('extension.title_other')} /> <Tab value={BrowseTab.EXTENSIONS} sx={{ textTransform: 'none' }} label={t('extension.title_other')} />
<Tab value={Tabs.MIGRATE} sx={{ textTransform: 'none' }} label={t('migrate.title')} /> <Tab value={BrowseTab.MIGRATE} sx={{ textTransform: 'none' }} label={t('migrate.title')} />
</TabsMenu> </TabsMenu>
<TabPanel index={Tabs.SOURCE} currentIndex={tabName}> <TabPanel index={BrowseTab.SOURCE} currentIndex={tabName}>
<Sources tabsMenuHeight={tabsMenuHeight} /> <Sources tabsMenuHeight={tabsMenuHeight} />
</TabPanel> </TabPanel>
<TabPanel index={Tabs.EXTENSIONS} currentIndex={tabName}> <TabPanel index={BrowseTab.EXTENSIONS} currentIndex={tabName}>
<Extensions tabsMenuHeight={tabsMenuHeight} /> <Extensions tabsMenuHeight={tabsMenuHeight} />
</TabPanel> </TabPanel>
<TabPanel index={Tabs.MIGRATE} currentIndex={tabName}> <TabPanel index={BrowseTab.MIGRATE} currentIndex={tabName}>
<Migration tabsMenuHeight={tabsMenuHeight} /> <Migration tabsMenuHeight={tabsMenuHeight} />
</TabPanel> </TabPanel>
</TabsWrapper> </TabsWrapper>

View File

@@ -10,6 +10,7 @@ import { SourceType } from '@/lib/graphql/generated/graphql.ts';
import { MangaIdInfo } from '@/modules/manga/Manga.types.ts'; import { MangaIdInfo } from '@/modules/manga/Manga.types.ts';
import { ChapterSourceOrderInfo } from '@/modules/chapter/Chapter.types.ts'; import { ChapterSourceOrderInfo } from '@/modules/chapter/Chapter.types.ts';
import { BrowseTab } from '@/modules/browse/Browse.types.ts';
type AppRouteInfo = { type AppRouteInfo = {
match: string; match: string;
@@ -166,7 +167,7 @@ export const AppRoutes = {
}, },
browse: { browse: {
match: 'browse', match: 'browse',
path: '/browse', path: (tab?: BrowseTab) => addParams('/browse', createParam('tab', tab)),
}, },
migrate: { migrate: {
match: 'migrate/source/:sourceId', match: 'migrate/source/:sourceId',

View File

@@ -53,7 +53,7 @@ const NAVIGATION_BAR_BASE_ITEMS = [
moreGroup: NavBarItemMoreGroup.GENERAL, moreGroup: NavBarItemMoreGroup.GENERAL,
}, },
{ {
path: AppRoutes.browse.path, path: AppRoutes.browse.path() as RestrictedNavBarItem<'both'>['path'],
title: 'global.label.browse', title: 'global.label.browse',
SelectedIconComponent: ExploreIcon, SelectedIconComponent: ExploreIcon,
IconComponent: ExploreOutlinedIcon, IconComponent: ExploreOutlinedIcon,