import { Navigate, useSearchParams } from 'react-router-dom'; import { SettingsPage } from './settings-page.js'; /** * Sections that used to be settings tabs and are now their own pages. Old * bookmarks and in-app links keep working by redirecting. */ const relocatedSections: Record = { behaviour: '/subreddits', access: '/accounts', }; /** Former tab names that are now in-page anchors on the settings page. */ const anchorSections: Record = { monitoring: 'pacing', 'rate-limits': 'pacing', notifications: 'notifications', }; export function SettingsRoute() { const [searchParams] = useSearchParams(); const section = searchParams.get('section'); const relocated = section ? relocatedSections[section] : undefined; if (relocated) return ; return ; }