Skip to content

Commit

Permalink
Merge branch 'develop' into 17191/onboarding-unit-tests-create-new-vault
Browse files Browse the repository at this point in the history
  • Loading branch information
tmashuang authored Apr 6, 2023
2 parents 9aca244 + baee6f1 commit a7b765e
Show file tree
Hide file tree
Showing 65 changed files with 1,090 additions and 336 deletions.
24 changes: 24 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion app/scripts/controllers/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export default class PreferencesController {
this._onInfuraIsUnblocked = opts.onInfuraIsUnblocked;
this.store = new ObservableStore(initState);
this.store.setMaxListeners(13);
this.openPopup = opts.openPopup;
this.tokenListController = opts.tokenListController;

this._subscribeToInfuraAvailability();
Expand Down
1 change: 0 additions & 1 deletion app/scripts/metamask-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ export default class MetamaskController extends EventEmitter {
this.preferencesController = new PreferencesController({
initState: initState.PreferencesController,
initLangCode: opts.initLangCode,
openPopup: opts.openPopup,
onInfuraIsBlocked: networkControllerMessenger.subscribe.bind(
networkControllerMessenger,
NetworkControllerEventTypes.InfuraIsBlocked,
Expand Down
8 changes: 4 additions & 4 deletions coverage-targets.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
// subset of files to check against these targets.
module.exports = {
global: {
lines: 65.5,
branches: 53.5,
statements: 64.75,
functions: 58,
lines: 66,
branches: 54.4,
statements: 65,
functions: 58.5,
},
transforms: {
branches: 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,13 @@ export default function UpdateSnapPermissionList({
approvedPermissions,
revokedPermissions,
newPermissions,
targetSubjectMetadata,
}) {
const t = useI18nContext();

return (
<Box paddingTop={1}>
{getWeightedPermissions(t, newPermissions).map((permission, index) => {
return (
<PermissionCell
title={permission.label}
description={permission.description}
weight={permission.weight}
avatarIcon={permission.leftIcon}
dateApproved={permission?.permissionValue?.date}
key={`${permission.permissionName}-${index}`}
/>
);
})}
{getWeightedPermissions(t, approvedPermissions).map(
{getWeightedPermissions(t, newPermissions, targetSubjectMetadata).map(
(permission, index) => {
return (
<PermissionCell
Expand All @@ -40,7 +29,23 @@ export default function UpdateSnapPermissionList({
);
},
)}
{getWeightedPermissions(t, revokedPermissions).map(
{getWeightedPermissions(
t,
approvedPermissions,
targetSubjectMetadata,
).map((permission, index) => {
return (
<PermissionCell
title={permission.label}
description={permission.description}
weight={permission.weight}
avatarIcon={permission.leftIcon}
dateApproved={permission?.permissionValue?.date}
key={`${permission.permissionName}-${index}`}
/>
);
})}
{getWeightedPermissions(t, revokedPermissions, targetSubjectMetadata).map(
(permission, index) => {
return (
<PermissionCell
Expand Down Expand Up @@ -72,4 +77,5 @@ UpdateSnapPermissionList.propTypes = {
* New permissions that are being requested
*/
newPermissions: PropTypes.object.isRequired,
targetSubjectMetadata: PropTypes.object.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,33 @@ import { useI18nContext } from '../../../hooks/useI18nContext';
import PermissionCell from '../permission-cell';
import Box from '../../ui/box';

export default function PermissionsConnectPermissionList({ permissions }) {
export default function PermissionsConnectPermissionList({
permissions,
targetSubjectMetadata,
}) {
const t = useI18nContext();

return (
<Box paddingTop={2} paddingBottom={2}>
{getWeightedPermissions(t, permissions).map((permission, index) => {
return (
<PermissionCell
title={permission.label}
description={permission.description}
weight={permission.weight}
avatarIcon={permission.leftIcon}
dateApproved={permission?.permissionValue?.date}
key={`${permission.permissionName}-${index}`}
/>
);
})}
{getWeightedPermissions(t, permissions, targetSubjectMetadata).map(
(permission, index) => {
return (
<PermissionCell
title={permission.label}
description={permission.description}
weight={permission.weight}
avatarIcon={permission.leftIcon}
dateApproved={permission?.permissionValue?.date}
key={`${permission.permissionName}-${index}`}
/>
);
},
)}
</Box>
);
}

PermissionsConnectPermissionList.propTypes = {
permissions: PropTypes.object.isRequired,
targetSubjectMetadata: PropTypes.object.isRequired,
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

import Box from '../../ui/box/box';

import { Icon, ICON_NAMES } from '../icon/deprecated';
import { Icon, IconName } from '..';
import README from './README.mdx';
import { AvatarBase } from './avatar-base';
import { AVATAR_BASE_SIZES } from './avatar-base.constants';
Expand Down Expand Up @@ -124,7 +124,7 @@ export const Children = (args) => (
backgroundColor={BackgroundColor.infoMuted}
borderColor={BorderColor.infoMuted}
>
<Icon name={ICON_NAMES.USER} color={Color.infoDefault} />
<Icon name={IconName.User} color={Color.infoDefault} />
</AvatarBase>
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import classnames from 'classnames';
import { AvatarBase } from '../avatar-base';
import Box from '../../ui/box/box';
import { ICON_NAMES, Icon } from '../icon/deprecated';
import { IconName, Icon } from '../icon';
import {
BorderColor,
Size,
Expand Down Expand Up @@ -43,7 +43,7 @@ export const AvatarFavicon = ({
/>
) : (
<Icon
name={ICON_NAMES.GLOBAL}
name={IconName.Global}
color={IconColor.iconDefault}
size={size}
{...fallbackIconProps}
Expand All @@ -65,7 +65,7 @@ AvatarFavicon.propTypes = {
/**
* Props for the fallback icon. All Icon props can be used
*/
fallbackIconProps: PropTypes.shape(Icon.PropTypes),
fallbackIconProps: PropTypes.object,
/**
* The size of the AvatarFavicon
* Possible values could be 'Size.XS' 16px, 'Size.SM' 24px, 'Size.MD' 32px, 'Size.LG' 40px, 'Size.XL' 48px
Expand Down
18 changes: 9 additions & 9 deletions ui/components/component-library/avatar-icon/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Defaults to `Size.MD`

```jsx
import { Size } from '../../../helpers/constants/design-system';
import { AvatarIcon, ICON_NAMES } from '../ui/component-library';
import { AvatarIcon, IconName } from '../ui/component-library';

<AvatarIcon {...args} size={Size.XS} />
<AvatarIcon {...args} size={Size.SM} />
Expand All @@ -55,22 +55,22 @@ import { AvatarIcon, ICON_NAMES } from '../ui/component-library';

### Icon Name<span style={{ color: 'red' }}>\*</span>

Use the required `iconName` prop with `ICON_NAMES` object from `./ui/components/component-library` to select icon
Use the required `iconName` prop with `IconName` enum from `./ui/components/component-library` to select icon

Use the [IconSearch](/story/components-componentlibrary-icon--default-story) story to find the icon you want to use.

<Canvas>
<Story id="components-componentlibrary-avataricon--icon-name" />
<Story id="components-componentlibrary-avataricon--icon-name-story" />
</Canvas>

```jsx
import { AvatarIcon, ICON_NAMES } from '../ui/component-library';
import { AvatarIcon, IconName } from '../ui/component-library';

<AvatarIcon iconName={ICON_NAMES.SWAP_HORIZONTAL} />
<AvatarIcon iconName={ICON_NAMES.CONFIRMATION} />
<AvatarIcon iconName={ICON_NAMES.INFO} />
<AvatarIcon iconName={ICON_NAMES.WARNING} />
<AvatarIcon iconName={ICON_NAMES.DANGER} />
<AvatarIcon iconName={IconName.SwapHorizontal} />
<AvatarIcon iconName={IconName.Confirmation} />
<AvatarIcon iconName={IconName.Info} />
<AvatarIcon iconName={IconName.Warning} />
<AvatarIcon iconName={IconName.Danger} />
```

### Color and Background Color
Expand Down
48 changes: 23 additions & 25 deletions ui/components/component-library/avatar-icon/avatar-icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {

import Box from '../../ui/box/box';

import { Icon, ICON_NAMES } from '../icon/deprecated';
import { IconName, Icon } from '../icon';
import { AvatarBase } from '../avatar-base';

import { AVATAR_ICON_SIZES } from './avatar-icon.constants';
Expand All @@ -27,39 +27,37 @@ export const AvatarIcon = ({
iconProps,
iconName,
...props
}) => {
return (
<AvatarBase
}) => (
<AvatarBase
size={size}
display={DISPLAY.FLEX}
alignItems={AlignItems.center}
justifyContent={JustifyContent.center}
color={color}
backgroundColor={backgroundColor}
borderColor={BorderColor.transparent}
className={classnames('mm-avatar-icon', className)}
{...props}
>
<Icon
color={IconColor.inherit}
name={iconName}
size={size}
display={DISPLAY.FLEX}
alignItems={AlignItems.center}
justifyContent={JustifyContent.center}
color={color}
backgroundColor={backgroundColor}
borderColor={BorderColor.transparent}
className={classnames('mm-avatar-icon', className)}
{...props}
>
<Icon
color={IconColor.inherit}
name={iconName}
size={size}
{...iconProps}
/>
</AvatarBase>
);
};
{...iconProps}
/>
</AvatarBase>
);

AvatarIcon.propTypes = {
/**
*
* The name of the icon to display. Should be one of ICON_NAMES
* The name of the icon to display. Should be one of IconName
*/
iconName: PropTypes.oneOf(Object.values(ICON_NAMES)).isRequired,
iconName: PropTypes.oneOf(Object.values(IconName)).isRequired,
/**
* Props for the icon inside AvatarIcon. All Icon props can be used
*/
iconProps: PropTypes.shape(Icon.PropTypes),
iconProps: PropTypes.object,
/**
* The size of the AvatarIcon
* Possible values could be 'SIZES.XS' 16px, 'SIZES.SM' 24px, 'SIZES.MD' 32px, 'SIZES.LG' 40px, 'SIZES.XL' 48px
Expand Down
Loading

0 comments on commit a7b765e

Please sign in to comment.