mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
3eefe874a8
* Revert changes made to stable permission display (UI design) * Add test for new component * Update paddings for install flow * Fix missing icons on snap installation flow * Update storybook path * Add targetSubjectMetadata param --------- Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { getWeightedPermissions } from '../../../../helpers/utils/permission';
|
|
import { useI18nContext } from '../../../../hooks/useI18nContext';
|
|
import PermissionCell from '../../permission-cell';
|
|
import Box from '../../../ui/box';
|
|
|
|
export default function SnapPermissionsList({
|
|
permissions,
|
|
targetSubjectMetadata,
|
|
}) {
|
|
const t = useI18nContext();
|
|
|
|
return (
|
|
<Box paddingTop={2} paddingBottom={2} className="snap-permissions-list">
|
|
{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>
|
|
);
|
|
}
|
|
|
|
SnapPermissionsList.propTypes = {
|
|
permissions: PropTypes.object.isRequired,
|
|
targetSubjectMetadata: PropTypes.object.isRequired,
|
|
};
|