Skip to content

Commit 76631aa

Browse files
committed
stash
1 parent c842da9 commit 76631aa

File tree

47 files changed

+418
-137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+418
-137
lines changed

ui/components/app/alert-system/general-alert/general-alert.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function AlertDetails({
8282
return (
8383
<Box marginTop={1}>
8484
<Disclosure title={t('seeDetails')} variant={DisclosureVariant.Arrow}>
85-
{details instanceof Array ? (
85+
{Array.isArray(details) ? (
8686
<Box as="ul" className="alert-modal__alert-details" paddingLeft={6}>
8787
{details.map((detail, index) => (
8888
<Box as="li" key={`disclosure-detail-${index}`}>

ui/components/app/identity/backup-and-sync-features-toggles/backup-and-sync-features-toggles.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,12 @@ const FeatureToggle = ({
6262
section,
6363
isBackupAndSyncUpdateLoading,
6464
isBackupAndSyncEnabled,
65+
key,
6566
}: {
6667
section: (typeof backupAndSyncFeaturesTogglesSections)[number];
6768
isBackupAndSyncUpdateLoading: boolean;
6869
isBackupAndSyncEnabled: boolean;
70+
key: number;
6971
}) => {
7072
const t = useI18nContext();
7173
const trackEvent = useContext(MetaMetricsContext);
@@ -107,6 +109,7 @@ const FeatureToggle = ({
107109

108110
return (
109111
<Box
112+
key={key}
110113
display={Display.Flex}
111114
justifyContent={JustifyContent.spaceBetween}
112115
alignItems={AlignItems.flexStart}
@@ -169,11 +172,12 @@ export const BackupAndSyncFeaturesToggles = () => {
169172
{t('backupAndSyncManageWhatYouSyncDescription')}
170173
</Text>
171174

172-
{backupAndSyncFeaturesTogglesSections.map((section) =>
175+
{backupAndSyncFeaturesTogglesSections.map((section, index) =>
173176
FeatureToggle({
174177
section,
175178
isBackupAndSyncUpdateLoading,
176179
isBackupAndSyncEnabled,
180+
key: index,
177181
}),
178182
)}
179183
</Box>

ui/components/app/menu-droppo.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export default class MenuDroppoComponent extends Component {
3838

3939
globalClickOccurred = (event) => {
4040
const { target } = event;
41+
42+
// TODO: Remove `findDOMNode`
4143
// eslint-disable-next-line react/no-find-dom-node
4244
const container = findDOMNode(this);
4345

@@ -53,6 +55,8 @@ export default class MenuDroppoComponent extends Component {
5355
componentDidMount() {
5456
if (this && document.body) {
5557
document.body.addEventListener('click', this.globalClickOccurred);
58+
59+
// TODO: Remove `findDOMNode`
5660
// eslint-disable-next-line react/no-find-dom-node
5761
const container = findDOMNode(this);
5862
this.container = container;

ui/components/app/permission-page-container/permission-page-container.component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export default class PermissionPageContainer extends Component {
134134

135135
onCancel = () => {
136136
const { request, rejectPermissionsRequest } = this.props;
137-
rejectPermissionsRequest(request.metadata.id);
137+
rejectPermissionsRequest(request?.metadata?.id);
138138
};
139139

140140
onSubmit = () => {
@@ -169,7 +169,7 @@ export default class PermissionPageContainer extends Component {
169169
if (Object.keys(request.permissions).length > 0) {
170170
approvePermissionsRequest(request);
171171
} else {
172-
rejectPermissionsRequest(request.metadata.id);
172+
rejectPermissionsRequest(request?.metadata?.id);
173173
}
174174
};
175175

ui/components/app/snaps/snap-ui-renderer/snap-ui-renderer.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ const SnapUIRendererComponent = ({
4545
contentBackgroundColor,
4646
PERF_DEBUG,
4747
}) => {
48+
// eslint-disable-next-line react-compiler/react-compiler
49+
'use no memo';
50+
4851
const t = useI18nContext();
4952

5053
const interfaceState = useSelector(

ui/components/multichain/asset-picker-amount/asset-picker-modal/hooks/useAssetMetadata.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const useAssetMetadata = (
6161
const metadata = await fetchAssetMetadata(
6262
trimmedSearchQuery,
6363
chainId,
64-
abortControllerRef.current.signal,
64+
abortControllerRef.current?.signal,
6565
);
6666

6767
if (metadata) {

ui/components/multichain/network-manager/components/default-networks/default-networks.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ const DefaultNetworks = memo(() => {
269269
solAccountGroup,
270270
isMultichainAccountsState2Enabled,
271271
evmAccountGroup,
272+
selectedAccount.scopes,
272273
dispatch,
273274
selectedAccount,
274275
enabledChainIds,
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
import React, { useState, useRef, useEffect } from 'react';
2+
import PropTypes from 'prop-types';
3+
import classnames from 'classnames';
4+
import { Icon, IconName, IconSize, Text } from '../../component-library';
5+
import { Color, TextVariant } from '../../../helpers/constants/design-system';
6+
import { DisclosureVariant } from './disclosure.constants';
7+
8+
const renderSummaryByType = (
9+
variant: DisclosureVariant,
10+
title: string,
11+
size?: string,
12+
) => {
13+
switch (variant) {
14+
case DisclosureVariant.Arrow: {
15+
const textVariant =
16+
size === 'small' ? TextVariant.bodySm : TextVariant.bodyMd;
17+
18+
return (
19+
<summary className="disclosure__summary is-arrow">
20+
{/* @ts-expect-error TODO: update prop type in design systems component */}
21+
<Text color={Color.primaryDefault} variant={textVariant}>
22+
{title}
23+
</Text>
24+
<Icon
25+
className="disclosure__summary--icon"
26+
// @ts-expect-error TODO: update prop types in design systems component
27+
color={Color.primaryDefault}
28+
name={IconName.ArrowUp}
29+
size={IconSize.Sm}
30+
marginInlineStart={2}
31+
/>
32+
</summary>
33+
);
34+
}
35+
default:
36+
return (
37+
<summary className="disclosure__summary">
38+
<Icon
39+
className="disclosure__summary--icon"
40+
name={IconName.Add}
41+
size={IconSize.Sm}
42+
marginInlineEnd={2}
43+
/>
44+
{title}
45+
</summary>
46+
);
47+
}
48+
};
49+
50+
const Disclosure = ({
51+
children,
52+
isScrollToBottomOnOpen,
53+
title = null,
54+
size = 'normal',
55+
variant = DisclosureVariant.Default,
56+
}: {
57+
children: JSX.Element[];
58+
isScrollToBottomOnOpen: boolean;
59+
size: string;
60+
title: string | null;
61+
variant: DisclosureVariant;
62+
}) => {
63+
const disclosureFooterEl = useRef<HTMLDivElement | null>(null);
64+
const [open, setOpen] = useState(false);
65+
66+
const scrollToBottom = () => {
67+
disclosureFooterEl?.current?.scrollIntoView({ behavior: 'smooth' });
68+
};
69+
70+
useEffect(() => {
71+
if (isScrollToBottomOnOpen && open) {
72+
scrollToBottom();
73+
}
74+
}, [isScrollToBottomOnOpen, open]);
75+
76+
return (
77+
<div
78+
className="disclosure"
79+
data-testid="disclosure"
80+
onClick={() => setOpen((state) => !state)}
81+
>
82+
{title ? (
83+
<details>
84+
{renderSummaryByType(variant, title)}
85+
86+
<div className={classnames('disclosure__content', size)}>
87+
{children}
88+
</div>
89+
<div ref={disclosureFooterEl} className="disclosure__footer"></div>
90+
</details>
91+
) : (
92+
children
93+
)}
94+
</div>
95+
);
96+
};
97+
98+
Disclosure.propTypes = {
99+
children: PropTypes.node.isRequired,
100+
isScrollToBottomOnOpen: PropTypes.bool,
101+
size: PropTypes.string,
102+
title: PropTypes.string,
103+
variant: PropTypes.string,
104+
};
105+
106+
Disclosure.defaultProps = {
107+
isScrollToBottomOnOpen: false,
108+
size: 'normal',
109+
title: null,
110+
variant: DisclosureVariant.Default,
111+
};
112+
113+
export default Disclosure;

ui/components/ui/metafox-logo/metafox-logo.component.test.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ import React from 'react';
22
import { renderWithProvider } from '../../../../test/lib/render-helpers';
33
import MetaFoxLogo from '.';
44

5-
// eslint-disable-next-line react/display-name
6-
jest.mock('./horizontal-logo.js', () => () => {
7-
return <div></div>;
8-
});
5+
jest.mock(
6+
'./horizontal-logo.js',
7+
() =>
8+
function mockRender() {
9+
return <div></div>;
10+
},
11+
);
912

1013
describe('MetaFoxLogo', () => {
1114
it('should match snapshot with img width and height default set to 42', () => {

ui/ducks/confirm-alerts/confirm-alerts.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export type ConfirmAlertsState = {
116116

117117
type UpdateAlertsAction = {
118118
type: 'UPDATE_ALERTS';
119-
ownerId: string;
119+
ownerId: string | undefined;
120120
alerts: Alert[];
121121
};
122122

@@ -129,7 +129,7 @@ type SetAlertConfirmedAction = {
129129

130130
type ClearAlertsAction = {
131131
type: 'CLEAR_ALERTS';
132-
ownerId: string;
132+
ownerId: string | undefined;
133133
};
134134

135135
type Action = UpdateAlertsAction | SetAlertConfirmedAction | ClearAlertsAction;
@@ -150,7 +150,7 @@ export default function confirmAlertsReducer(
150150
...state,
151151
alerts: {
152152
...state.alerts,
153-
[action.ownerId]: action.alerts,
153+
[action.ownerId ?? '']: action.alerts,
154154
},
155155
};
156156

@@ -171,11 +171,11 @@ export default function confirmAlertsReducer(
171171
...state,
172172
alerts: {
173173
...state.alerts,
174-
[action.ownerId]: [],
174+
[action.ownerId ?? '']: [],
175175
},
176176
confirmed: {
177177
...state.confirmed,
178-
[action.ownerId]: {},
178+
[action.ownerId ?? '']: {},
179179
},
180180
};
181181

@@ -185,7 +185,7 @@ export default function confirmAlertsReducer(
185185
}
186186

187187
export function updateAlerts(
188-
ownerId: string,
188+
ownerId: string | undefined,
189189
alerts: Alert[],
190190
): UpdateAlertsAction {
191191
return {
@@ -208,7 +208,7 @@ export function setAlertConfirmed(
208208
};
209209
}
210210

211-
export function clearAlerts(ownerId: string): ClearAlertsAction {
211+
export function clearAlerts(ownerId: string | undefined): ClearAlertsAction {
212212
return {
213213
type: 'CLEAR_ALERTS',
214214
ownerId,

0 commit comments

Comments
 (0)