feat: update backup routes and navigation links for consistency

This commit is contained in:
shuaiplus
2026-03-20 05:53:24 +08:00
parent c2b920532d
commit a17ed646a0
3 changed files with 16 additions and 5 deletions
@@ -87,7 +87,7 @@ export default function AppAuthenticatedShell(props: AppAuthenticatedShellProps)
<span>{t('nav_device_management')}</span>
</Link>
{props.profile?.role === 'admin' && (
<Link href="/help" className={`side-link ${props.location === '/help' ? 'active' : ''}`}>
<Link href="/backup" className={`side-link ${props.location === '/backup' ? 'active' : ''}`}>
<Cloud size={16} />
<span>{t('nav_backup_strategy')}</span>
</Link>
+12 -1
View File
@@ -1,4 +1,5 @@
import { lazy, Suspense } from 'preact/compat';
import { useEffect } from 'preact/hooks';
import { Link, Route, Switch } from 'wouter';
import { ArrowUpDown, Cloud, LogOut, Settings as SettingsIcon, Shield, ShieldUser } from 'lucide-preact';
import type { ImportAttachmentFile, ImportResultSummary } from '@/components/ImportPage';
@@ -21,6 +22,13 @@ function RouteContentFallback() {
return <div className="loading-screen">{t('txt_loading_nodewarden')}</div>;
}
function LegacyBackupRedirect(props: { onNavigate: (path: string) => void }) {
useEffect(() => {
props.onNavigate('/backup');
}, [props]);
return null;
}
export interface AppMainRoutesProps {
profile: Profile | null;
session: SessionState | null;
@@ -232,7 +240,7 @@ export default function AppMainRoutes(props: AppMainRoutesProps) {
</Link>
)}
{props.profile.role === 'admin' && (
<Link href="/help" className="mobile-settings-link">
<Link href="/backup" className="mobile-settings-link">
<Cloud size={18} />
<span>{t('nav_backup_strategy')}</span>
</Link>
@@ -299,6 +307,9 @@ export default function AppMainRoutes(props: AppMainRoutesProps) {
</Route>
))}
<Route path="/help">
<LegacyBackupRedirect onNavigate={props.onNavigate} />
</Route>
<Route path="/backup">
{props.profile?.role === 'admin' ? (
<div className="stack">
{props.mobileLayout && (