()
| 125 | } |
| 126 | |
| 127 | function App() { |
| 128 | //const [router, setRouter] = useState<Routers | null>(); |
| 129 | const navigate = useNavigate() |
| 130 | const location = useLocation() |
| 131 | const { t } = useTranslation() |
| 132 | const [localeStr, setLocaleStr] = useState<string>(getLangCode(nmConfig.settings.language!)) |
| 133 | const [selectedKeys, setSelectedKeys] = useState<string[]>(['/']) |
| 134 | |
| 135 | const routers: Array<Routers> = useMemo( |
| 136 | () => [ |
| 137 | { |
| 138 | title: ( |
| 139 | <> |
| 140 | <IconHome /> |
| 141 | {t('home')} |
| 142 | </> |
| 143 | ), |
| 144 | path: '/', |
| 145 | component: <HomePage />, |
| 146 | }, |
| 147 | { |
| 148 | title: ( |
| 149 | <> |
| 150 | <IconCloud /> |
| 151 | {t('storage')} |
| 152 | </> |
| 153 | ), |
| 154 | path: '/storage', |
| 155 | children: [ |
| 156 | { |
| 157 | title: t('manage'), |
| 158 | path: '/storage/manage', |
| 159 | component: <StoragePage />, |
| 160 | hideChildren: true, |
| 161 | children: [ |
| 162 | { |
| 163 | title: t('add'), |
| 164 | path: '/storage/manage/add', |
| 165 | key: '/storage/manage', //因为父菜单隐藏了子菜单项,在此页面时设置父菜单key以选择父菜单项 |
| 166 | component: <AddStoragePage />, |
| 167 | }, |
| 168 | ], |
| 169 | }, |
| 170 | { |
| 171 | title: t('explorer'), |
| 172 | path: '/storage/explorer', |
| 173 | component: <ExplorerPage />, |
| 174 | }, |
| 175 | ], |
| 176 | }, |
| 177 | { |
| 178 | title: ( |
| 179 | <> |
| 180 | <IconStorage /> |
| 181 | {t('mount')} |
| 182 | </> |
| 183 | ), |
| 184 | path: '/mount', |
nothing calls this directly
no test coverage detected