-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
272 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { Connections } from './connections'; | ||
export { PermissionsPage } from './permissions-page/permissions-page'; | ||
export { ReviewPermissions } from './review-permissions-page/review-permissions-page'; |
1 change: 1 addition & 0 deletions
1
ui/components/multichain/pages/review-permissions-page/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { ReviewPermissions } from './review-permissions-page'; |
10 changes: 10 additions & 0 deletions
10
ui/components/multichain/pages/review-permissions-page/review-permissions-page.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import { ReviewPermissions } from '.'; | ||
|
||
export default { | ||
title: 'Components/Multichain/ReviewPermissions', | ||
}; | ||
|
||
export const DefaultStory = () => <ReviewPermissions />; | ||
|
||
DefaultStory.storyName = 'Default'; |
Empty file.
45 changes: 45 additions & 0 deletions
45
ui/components/multichain/pages/review-permissions-page/review-permissions-page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React, { useState } from 'react'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import { useHistory } from 'react-router-dom'; | ||
import { | ||
BackgroundColor, | ||
IconColor, | ||
} from '../../../../helpers/constants/design-system'; | ||
import { useI18nContext } from '../../../../hooks/useI18nContext'; | ||
import { getConnectedSitesListWithNetworkInfo } from '../../../../selectors/index'; | ||
import { | ||
ButtonIcon, | ||
ButtonIconSize, | ||
IconName, | ||
} from '../../../component-library'; | ||
import { Content, Footer, Header, Page } from '../page'; | ||
|
||
export const ReviewPermissions = () => { | ||
const t = useI18nContext(); | ||
const dispatch = useDispatch(); | ||
const history = useHistory(); | ||
const sitesConnectionsList = useSelector( | ||
getConnectedSitesListWithNetworkInfo, | ||
); | ||
console.log(sitesConnectionsList, 'sitesConnectionsList'); | ||
return ( | ||
<Page | ||
data-testid="connections-page" | ||
className="main-container connections-page" | ||
> | ||
<Header | ||
backgroundColor={BackgroundColor.backgroundDefault} | ||
startAccessory={ | ||
<ButtonIcon | ||
ariaLabel={t('back')} | ||
iconName={IconName.ArrowLeft} | ||
className="connections-header__start-accessory" | ||
size={ButtonIconSize.Sm} | ||
/> | ||
} | ||
></Header> | ||
<Content padding={0}>Nidhi</Content> | ||
<Footer></Footer> | ||
</Page> | ||
); | ||
}; |
Empty file.
184 changes: 184 additions & 0 deletions
184
ui/components/multichain/pages/review-permissions-page/site-cell/site-cell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { SubjectType } from '@metamask/permission-controller'; | ||
import { | ||
AlignItems, | ||
BackgroundColor, | ||
BlockSize, | ||
Display, | ||
FlexDirection, | ||
IconColor, | ||
JustifyContent, | ||
TextAlign, | ||
TextColor, | ||
TextVariant, | ||
} from '../../../../../helpers/constants/design-system'; | ||
import { useI18nContext } from '../../../../../hooks/useI18nContext'; | ||
import { | ||
AvatarFavicon, | ||
AvatarNetwork, | ||
AvatarNetworkSize, | ||
BadgeWrapper, | ||
Box, | ||
Icon, | ||
IconName, | ||
IconSize, | ||
Text, | ||
} from '../../../../component-library'; | ||
import { getURLHost } from '../../../../../helpers/utils/util'; | ||
import { ConnectionListTooltip } from '../../permissions-page/connection-list-tooltip/connection-list-tooltip'; | ||
|
||
export const ConnectionListItem = ({ connection, onClick }) => { | ||
const t = useI18nContext(); | ||
const isSnap = connection.subjectType === SubjectType.Snap; | ||
|
||
return ( | ||
<> | ||
<Box | ||
data-testid="connection-list-item" | ||
as="button" | ||
display={Display.Flex} | ||
flexDirection={FlexDirection.Row} | ||
alignItems={AlignItems.baseline} | ||
width={BlockSize.Full} | ||
backgroundColor={BackgroundColor.backgroundDefault} | ||
onClick={onClick} | ||
padding={4} | ||
gap={4} | ||
className="multichain-connection-list-item" | ||
> | ||
<Icon | ||
display={Display.Flex} | ||
name={IconName.ArrowRight} | ||
color={IconColor.iconDefault} | ||
size={IconSize.Sm} | ||
backgroundColor={BackgroundColor.backgroundDefault} | ||
/> | ||
<Box | ||
display={Display.Flex} | ||
flexDirection={FlexDirection.Column} | ||
width={BlockSize.FiveTwelfths} | ||
style={{ alignSelf: 'center', flexGrow: '1' }} | ||
> | ||
<Text | ||
variant={TextVariant.bodyMd} | ||
textAlign={TextAlign.Left} | ||
ellipsis | ||
> | ||
{t('accountsPermissionsTitle')} | ||
</Text> | ||
|
||
<Box | ||
display={Display.Flex} | ||
flexDirection={FlexDirection.Row} | ||
alignItems={AlignItems.center} | ||
gap={1} | ||
> | ||
<Text | ||
as="span" | ||
width={BlockSize.Max} | ||
color={TextColor.textAlternative} | ||
variant={TextVariant.bodyMd} | ||
> | ||
{t('connectedWith')} | ||
</Text> | ||
<ConnectionListTooltip connection={connection} /> | ||
</Box> | ||
</Box> | ||
<Box | ||
display={Display.Flex} | ||
justifyContent={JustifyContent.flexEnd} | ||
alignItems={AlignItems.center} | ||
style={{ flex: '1', alignSelf: 'center' }} | ||
gap={2} | ||
> | ||
<Icon | ||
display={Display.Flex} | ||
name={IconName.MoreVertical} | ||
color={IconColor.iconDefault} | ||
size={IconSize.Sm} | ||
backgroundColor={BackgroundColor.backgroundDefault} | ||
/> | ||
</Box> | ||
</Box> | ||
<Box | ||
data-testid="connection-list-item" | ||
as="button" | ||
display={Display.Flex} | ||
flexDirection={FlexDirection.Row} | ||
alignItems={AlignItems.baseline} | ||
width={BlockSize.Full} | ||
backgroundColor={BackgroundColor.backgroundDefault} | ||
onClick={onClick} | ||
padding={4} | ||
gap={4} | ||
className="multichain-connection-list-item" | ||
> | ||
<Icon | ||
display={Display.Flex} | ||
name={IconName.ArrowRight} | ||
color={IconColor.iconDefault} | ||
size={IconSize.Sm} | ||
backgroundColor={BackgroundColor.backgroundDefault} | ||
/> | ||
<Box | ||
display={Display.Flex} | ||
flexDirection={FlexDirection.Column} | ||
width={BlockSize.FiveTwelfths} | ||
style={{ alignSelf: 'center', flexGrow: '1' }} | ||
> | ||
<Text | ||
variant={TextVariant.bodyMd} | ||
textAlign={TextAlign.Left} | ||
ellipsis | ||
> | ||
{t('accountsPermissionsTitle')} | ||
</Text> | ||
|
||
<Box | ||
display={Display.Flex} | ||
flexDirection={FlexDirection.Row} | ||
alignItems={AlignItems.center} | ||
gap={1} | ||
> | ||
<Text | ||
as="span" | ||
width={BlockSize.Max} | ||
color={TextColor.textAlternative} | ||
variant={TextVariant.bodyMd} | ||
> | ||
{t('connectedWith')} | ||
</Text> | ||
<ConnectionListTooltip connection={connection} /> | ||
</Box> | ||
</Box> | ||
<Box | ||
display={Display.Flex} | ||
justifyContent={JustifyContent.flexEnd} | ||
alignItems={AlignItems.center} | ||
style={{ flex: '1', alignSelf: 'center' }} | ||
gap={2} | ||
> | ||
<Icon | ||
display={Display.Flex} | ||
name={IconName.MoreVertical} | ||
color={IconColor.iconDefault} | ||
size={IconSize.Sm} | ||
backgroundColor={BackgroundColor.backgroundDefault} | ||
/> | ||
</Box> | ||
</Box> | ||
</> | ||
); | ||
}; | ||
|
||
ConnectionListItem.propTypes = { | ||
/** | ||
* The connection data to display | ||
*/ | ||
connection: PropTypes.object.isRequired, | ||
/** | ||
* The function to call when the connection is clicked | ||
*/ | ||
onClick: PropTypes.func.isRequired, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters