Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add Basic Functionality to Settings Search #25185

Merged
merged 5 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 24 additions & 16 deletions ui/helpers/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,46 +144,54 @@ const SETTINGS_CONSTANTS = [
iconName: IconName.Book,
},
// securityAndPrivacy settingsRefs[0]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('basicConfigurationLabel'),
descriptionMessage: (t) => t('basicConfigurationDescription'),
route: `${SECURITY_ROUTE}#basic-functionality-toggle`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR did allow me to search + jump to the basic toggle. But I notice some other settings breaking. Looking for fix

Before on latest develop, IPFS gateway would jump correctly:

Screen.Recording.2024-06-10.at.12.44.23.PM.mov

But on this branch it jumps me to autodetect instead:

Screen.Recording.2024-06-10.at.12.45.48.PM.mov

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the fix. Just shifting the other indices that incremented (all except 18)

1dc663d

{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('revealSeedWords'),
descriptionMessage: (t) => t('revealSeedWords'),
route: `${SECURITY_ROUTE}#reveal-secretrecovery`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[1]
// securityAndPrivacy settingsRefs[2]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('showIncomingTransactions'),
descriptionMessage: (t) => t('showIncomingTransactionsDescription'),
route: `${SECURITY_ROUTE}#incoming-transaction`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[2]
// securityAndPrivacy settingsRefs[3]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('usePhishingDetection'),
descriptionMessage: (t) => t('usePhishingDetectionDescription'),
route: `${SECURITY_ROUTE}#phishing-detection`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[3]
// securityAndPrivacy settingsRefs[4]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('use4ByteResolution'),
descriptionMessage: (t) => t('use4ByteResolutionDescription'),
route: `${SECURITY_ROUTE}#decode-smart-contracts`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[4]
// securityAndPrivacy settingsRefs[5]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('participateInMetaMetrics'),
descriptionMessage: (t) => t('participateInMetaMetricsDescription'),
route: `${SECURITY_ROUTE}#metametrics`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[5]
// securityAndPrivacy settingsRefs[6]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('networkProvider'),
Expand All @@ -192,23 +200,23 @@ const SETTINGS_CONSTANTS = [
route: `${SECURITY_ROUTE}#network-provider`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[6]
// securityAndPrivacy settingsRefs[7]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('ipfsGateway'),
descriptionMessage: (t) => t('ipfsGatewayDescription'),
route: `${SECURITY_ROUTE}#add-custom-ipfs-gateway`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[7]
// securityAndPrivacy settingsRefs[8]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('autoDetectTokens'),
descriptionMessage: (t) => t('autoDetectTokensDescription'),
route: `${SECURITY_ROUTE}#auto-detect-tokens`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[8]
// securityAndPrivacy settingsRefs[9]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('useMultiAccountBalanceChecker'),
Expand All @@ -217,63 +225,63 @@ const SETTINGS_CONSTANTS = [
route: `${SECURITY_ROUTE}#batch-account-balance-requests`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[9]
// securityAndPrivacy settingsRefs[10]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('currencyRateCheckToggle'),
descriptionMessage: (t) => t('currencyRateCheckToggleDescription'),
route: `${SECURITY_ROUTE}#price-checker`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[10]
// securityAndPrivacy settingsRefs[11]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('ensDomainsSettingTitle'),
descriptionMessage: (t) => t('ensDomainsSettingDescriptionIntroduction'),
route: `${SECURITY_ROUTE}#ens-domains`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[11]
// securityAndPrivacy settingsRefs[12]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('displayNftMedia'),
descriptionMessage: (t) => t('displayNftMediaDescription'),
route: `${SECURITY_ROUTE}#display-nft-media`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[12]
// securityAndPrivacy settingsRefs[13]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('useNftDetection'),
descriptionMessage: (t) => t('useNftDetectionDescriptionText'),
route: `${SECURITY_ROUTE}#autodetect-nfts`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[13]
// securityAndPrivacy settingsRefs[14]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('useSafeChainsListValidation'),
descriptionMessage: (t) => t('useSafeChainsListValidationDescription'),
route: `${SECURITY_ROUTE}#network-details-check`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[14]
// securityAndPrivacy settingsRefs[15]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('externalNameSourcesSetting'),
descriptionMessage: (t) => t('externalNameSourcesSettingDescription'),
route: `${SECURITY_ROUTE}#proposed-nicknames`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[15]
// securityAndPrivacy settingsRefs[16]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('securityAlerts'),
descriptionMessage: (t) => t('securityAlertsDescription'),
route: `${SECURITY_ROUTE}#security-alerts`,
icon: 'fa fa-lock',
},
// securityAndPrivacy settingsRefs[16]
// securityAndPrivacy settingsRefs[17]
{
tabMessage: (t) => t('securityAndPrivacy'),
sectionMessage: (t) => t('blockaid'),
Expand Down
2 changes: 1 addition & 1 deletion ui/helpers/utils/settings-search.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ describe('Settings Search Utils', () => {
it('returns "Security & privacy" section count', () => {
expect(
getNumberOfSettingRoutesInTab(t, t('securityAndPrivacy')),
).toStrictEqual(18);
).toStrictEqual(19);
});

it('returns "Alerts" section count', () => {
Expand Down
34 changes: 17 additions & 17 deletions ui/pages/settings/security-tab/security-tab.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export default class SecurityTab extends PureComponent {
return (
<>
<div
ref={this.settingsRefs[0]}
ref={this.settingsRefs[1]}
className="settings-page__security-tab-sub-header"
>
{t('secretRecoveryPhrase')}
Expand Down Expand Up @@ -211,14 +211,14 @@ export default class SecurityTab extends PureComponent {

return (
<>
<div ref={this.settingsRefs[15]}>
<div ref={this.settingsRefs[16]}>
<span className="settings-page__security-tab-sub-header">
{t('securityAlerts')}
</span>
</div>
<div className="settings-page__content-padded">
<Box
ref={this.settingsRefs[2]}
ref={this.settingsRefs[3]}
className="settings-page__content-row"
display={Display.Flex}
flexDirection={FlexDirection.Row}
Expand Down Expand Up @@ -265,7 +265,7 @@ export default class SecurityTab extends PureComponent {

return (
<IncomingTransactionToggle
wrapperRef={this.settingsRefs[1]}
wrapperRef={this.settingsRefs[2]}
allNetworks={allNetworks}
setIncomingTransactionsPreferences={setIncomingTransactionsPreferences}
incomingTransactionsPreferences={incomingTransactionsPreferences}
Expand All @@ -279,7 +279,7 @@ export default class SecurityTab extends PureComponent {

return (
<Box
ref={this.settingsRefs[2]}
ref={this.settingsRefs[3]}
className="settings-page__content-row"
display={Display.Flex}
flexDirection={FlexDirection.Row}
Expand Down Expand Up @@ -313,7 +313,7 @@ export default class SecurityTab extends PureComponent {
const { use4ByteResolution, setUse4ByteResolution } = this.props;
return (
<Box
ref={this.settingsRefs[3]}
ref={this.settingsRefs[4]}
className="settings-page__content-row"
display={Display.Flex}
flexDirection={FlexDirection.Row}
Expand Down Expand Up @@ -454,7 +454,7 @@ export default class SecurityTab extends PureComponent {

return (
<Box
ref={this.settingsRefs[13]}
ref={this.settingsRefs[14]}
className="settings-page__content-row"
data-testid="setting-safe-chains-validation"
display={Display.Flex}
Expand Down Expand Up @@ -533,7 +533,7 @@ export default class SecurityTab extends PureComponent {

return (
<Box
ref={this.settingsRefs[6]}
ref={this.settingsRefs[7]}
className="settings-page__content-row"
data-testid="setting-ipfs-gateway"
display={Display.Flex}
Expand Down Expand Up @@ -598,7 +598,7 @@ export default class SecurityTab extends PureComponent {
flexDirection={FlexDirection.Row}
justifyContent={JustifyContent.spaceBetween}
gap={4}
ref={this.settingsRefs[10]}
ref={this.settingsRefs[11]}
marginTop={3}
id="ens-domains"
>
Expand Down Expand Up @@ -660,7 +660,7 @@ export default class SecurityTab extends PureComponent {

return (
<Box
ref={this.settingsRefs[7]}
ref={this.settingsRefs[8]}
className="settings-page__content-row"
data-testid="advanced-setting-gas-fee-estimation"
display={Display.Flex}
Expand Down Expand Up @@ -715,7 +715,7 @@ export default class SecurityTab extends PureComponent {

return (
<Box
ref={this.settingsRefs[8]}
ref={this.settingsRefs[9]}
className="settings-page__content-row"
display={Display.Flex}
flexDirection={FlexDirection.Row}
Expand Down Expand Up @@ -757,7 +757,7 @@ export default class SecurityTab extends PureComponent {

return (
<Box
ref={this.settingsRefs[9]}
ref={this.settingsRefs[10]}
className="settings-page__content-row"
display={Display.Flex}
flexDirection={FlexDirection.Row}
Expand Down Expand Up @@ -822,7 +822,7 @@ export default class SecurityTab extends PureComponent {

return (
<Box
ref={this.settingsRefs[11]}
ref={this.settingsRefs[12]}
className="settings-page__content-row"
display={Display.Flex}
flexDirection={FlexDirection.Row}
Expand Down Expand Up @@ -875,7 +875,7 @@ export default class SecurityTab extends PureComponent {
} = this.props;
return (
<Box
ref={this.settingsRefs[12]}
ref={this.settingsRefs[13]}
className="settings-page__content-row"
display={Display.Flex}
flexDirection={FlexDirection.Row}
Expand Down Expand Up @@ -923,7 +923,7 @@ export default class SecurityTab extends PureComponent {

return (
<Box
ref={this.settingsRefs[14]}
ref={this.settingsRefs[15]}
className="settings-page__content-row"
display={Display.Flex}
flexDirection={FlexDirection.Row}
Expand Down Expand Up @@ -1025,7 +1025,7 @@ export default class SecurityTab extends PureComponent {

return (
<Box
ref={this.settingsRefs[3]}
ref={this.settingsRefs[0]}
className="settings-page__content-row"
display={Display.Flex}
flexDirection={FlexDirection.Row}
Expand Down Expand Up @@ -1180,7 +1180,7 @@ export default class SecurityTab extends PureComponent {

<span
className="settings-page__security-tab-sub-header"
ref={this.settingsRefs[5]}
ref={this.settingsRefs[6]}
>
{this.context.t('networkProvider')}
</span>
Expand Down