Skip to content

Commit

Permalink
updates types
Browse files Browse the repository at this point in the history
  • Loading branch information
NidhiKJha committed Feb 26, 2024
1 parent 04d8a10 commit 58f9090
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 36 deletions.
26 changes: 10 additions & 16 deletions ui/components/multichain/connected-status/connected-status.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useSelector } from 'react-redux';
import {
BackgroundColor,
Expand All @@ -18,7 +17,15 @@ import {
import { useI18nContext } from '../../../hooks/useI18nContext';
import { BadgeStatus } from '../badge-status';

export const ConnectedStatus = ({ address = '', isActive = false }) => {
export type ConnectedStatusProps = {
address: string;
isActive?: boolean;
};

export const ConnectedStatus: React.FC<ConnectedStatusProps> = ({
address = '',
isActive,
}): JSX.Element => {
const t = useSelector(useI18nContext);

const addressConnectedSubjectMap: any = useSelector(
Expand All @@ -31,13 +38,11 @@ export const ConnectedStatus = ({ address = '', isActive = false }) => {
selectedAddressSubjectMap?.[originOfCurrentTab],
);

let status;
let status = STATUS_NOT_CONNECTED;
if (isActive) {
status = STATUS_CONNECTED;
} else if (currentTabIsConnectedToSelectedAddress) {
status = STATUS_CONNECTED_TO_ANOTHER_ACCOUNT;
} else {
status = STATUS_NOT_CONNECTED;
}

let badgeBorderColor = BackgroundColor.backgroundDefault; // TODO: Replace it once border-color has this value.
Expand Down Expand Up @@ -76,14 +81,3 @@ export const ConnectedStatus = ({ address = '', isActive = false }) => {
/>
);
};

ConnectedStatus.propTypes = {
/**
* Address for AvatarAccount
*/
address: PropTypes.string.isRequired,
/**
* Boolean to determine active status
*/
isActive: PropTypes.bool,
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,33 @@ import { SendPageAccountPicker } from '.';
const render = (props = {}) => {
const store = configureStore({
...mockState,
metamask: {...mockState.metamask,
permissionHistory: {
'https://test.dapp': {
eth_accounts: {
accounts: {
'0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc': 1596681857076,
},
metamask: {
...mockState.metamask,
permissionHistory: {
'https://test.dapp': {
eth_accounts: {
accounts: {
'0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc': 1596681857076,
},
},
},
subjects: {
'https://test.dapp': {
permissions: {
eth_accounts: {
caveats: [
{
type: 'restrictReturnedAccounts',
value: ['0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'],
},
],
invoker: 'https://test.dapp',
parentCapability: 'eth_accounts',
},
},
subjects: {
'https://test.dapp': {
permissions: {
eth_accounts: {
caveats: [
{
type: 'restrictReturnedAccounts',
value: ['0x0dcd5d886577d5081b0c52e242ef29e70be3e7bc'],
},
],
invoker: 'https://test.dapp',
parentCapability: 'eth_accounts',
},
},
},
},
},
activeTab: {
origin: 'https://test.dapp',
Expand Down

0 comments on commit 58f9090

Please sign in to comment.