feat: better menu matching and overview page (#4384)

pull/4405/head
James Elliott 2022-11-15 19:26:09 +11:00 committed by GitHub
parent 0f8de33f2f
commit ff26673659
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -15,12 +15,13 @@
"Manage your security keys": "Manage your security keys",
"Name": "Name",
"No": "No",
"Overview": "Overview",
"Provide the details for the new security key": "Provide the details for the new security key",
"Relying Party ID": "Relying Party ID",
"Security Keys": "Security Keys",
"Settings": "Settings",
"Show Details": "Show Details",
"Transports": "Transports",
"Two-Factor Authentication": "Two-Factor Authentication",
"Usage Count": "Usage Count",
"Webauthn Credential Identifier": "Credential Identifier: {{id}}",
"Webauthn Public Key": "Public Key: {{key}}",

View File

@ -1,5 +1,6 @@
import React, { ReactNode, useCallback, useEffect } from "react";
import { Dashboard } from "@mui/icons-material";
import SystemSecurityUpdateGoodIcon from "@mui/icons-material/SystemSecurityUpdateGood";
import {
AppBar,
@ -68,9 +69,10 @@ const SettingsLayout = function (props: Props) {
<Toolbar variant="dense" />
<Box sx={{ overflow: "auto" }}>
<List>
<SettingsMenuItem pathname={SettingsRoute} text={translate("Overview")} icon={<Dashboard />} />
<SettingsMenuItem
pathname={`${SettingsRoute}${SettingsTwoFactorAuthenticationSubRoute}`}
text={translate("Security Keys")}
text={translate("Two-Factor Authentication")}
icon={<SystemSecurityUpdateGoodIcon />}
/>
</List>
@ -97,7 +99,7 @@ interface SettingsMenuItemProps {
}
const SettingsMenuItem = function (props: SettingsMenuItemProps) {
const selected = window.location.pathname === props.pathname;
const selected = window.location.pathname === props.pathname || window.location.pathname === props.pathname + "/";
const navigate = useRouterNavigate();
return (