mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-26 20:39:08 +01:00
95c37e1ba3
* feat: add yaml feature management Add yaml feature file per build type. Also add method to parse yaml and set enabled features env to true. The build process will then replace any process.env[feature] that exists on the config by its value * chore: add example for desktop * Added initial draft of build features * [TMP] Sync between computers * Is able to succesfully build stable extension with snaps feature * Removing var context from builds.yml * Add asssets to builds.yml * Minor bug fixes and removing debug logs * [WIP] Test changes * Removed TODOs * Fix regession bug Also * remove debug logs * merge Variables.set and Variables.setMany with an overload * Fix build, lint and a bunch of issues * Update LavaMoat policies * Re-add desktop build type * Fix some tests * Fix desktop build * Define some env variables used by MV3 * Fix lint * Fix remove-fenced-code tests * Fix README typo * Move new code * Fix missing asset copy * Move Jest env setup * Fix path for test after rebase * Fix code fences * Fix fencing and LavaMoat policies * Fix MMI code-fencing after rebase * Fix MMI code fencing after merge * Fix more MMI code fencing --------- Co-authored-by: cryptotavares <joao.tavares@consensys.net> Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com> Co-authored-by: Brad Decker <bhdecker84@gmail.com>
70 lines
1.9 KiB
JavaScript
70 lines
1.9 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import { compose } from 'redux';
|
|
import { withRouter } from 'react-router-dom';
|
|
import {
|
|
toggleAccountMenu,
|
|
setSelectedAccount,
|
|
lockMetamask,
|
|
hideWarning,
|
|
} from '../../../store/actions';
|
|
import {
|
|
getAddressConnectedSubjectMap,
|
|
getMetaMaskAccountsOrdered,
|
|
getMetaMaskKeyrings,
|
|
getOriginOfCurrentTab,
|
|
getSelectedAddress,
|
|
///: BEGIN:ONLY_INCLUDE_IN(snaps)
|
|
getUnreadNotificationsCount,
|
|
///: END:ONLY_INCLUDE_IN
|
|
} from '../../../selectors';
|
|
import AccountMenu from './account-menu.component';
|
|
|
|
/**
|
|
* The min amount of accounts to show search field
|
|
*/
|
|
const SHOW_SEARCH_ACCOUNTS_MIN_COUNT = 5;
|
|
|
|
function mapStateToProps(state) {
|
|
const {
|
|
metamask: { isAccountMenuOpen },
|
|
} = state;
|
|
const accounts = getMetaMaskAccountsOrdered(state);
|
|
const origin = getOriginOfCurrentTab(state);
|
|
const selectedAddress = getSelectedAddress(state);
|
|
///: BEGIN:ONLY_INCLUDE_IN(snaps)
|
|
const unreadNotificationsCount = getUnreadNotificationsCount(state);
|
|
///: END:ONLY_INCLUDE_IN
|
|
return {
|
|
isAccountMenuOpen,
|
|
addressConnectedSubjectMap: getAddressConnectedSubjectMap(state),
|
|
originOfCurrentTab: origin,
|
|
selectedAddress,
|
|
keyrings: getMetaMaskKeyrings(state),
|
|
accounts,
|
|
shouldShowAccountsSearch: accounts.length >= SHOW_SEARCH_ACCOUNTS_MIN_COUNT,
|
|
///: BEGIN:ONLY_INCLUDE_IN(snaps)
|
|
unreadNotificationsCount,
|
|
///: END:ONLY_INCLUDE_IN
|
|
};
|
|
}
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
return {
|
|
toggleAccountMenu: () => dispatch(toggleAccountMenu()),
|
|
setSelectedAccount: (address) => {
|
|
dispatch(setSelectedAccount(address));
|
|
dispatch(toggleAccountMenu());
|
|
},
|
|
lockMetamask: () => {
|
|
dispatch(lockMetamask());
|
|
dispatch(hideWarning());
|
|
dispatch(toggleAccountMenu());
|
|
},
|
|
};
|
|
}
|
|
|
|
export default compose(
|
|
withRouter,
|
|
connect(mapStateToProps, mapDispatchToProps),
|
|
)(AccountMenu);
|