Skip to content

Commit

Permalink
Merge pull request #3489 from LiskHQ/3488-fix-voters
Browse files Browse the repository at this point in the history
  • Loading branch information
usama authored Apr 19, 2021
2 parents 6faaba1 + 8cb154d commit c16d5fa
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 27 deletions.
6 changes: 4 additions & 2 deletions config/webpack.config.analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
const baseConfig = require('./webpack.config');
const reactConfig = require('./webpack.config.react');

module.exports = merge(baseConfig, reactConfig, {
const config = {
output: {
path: resolve(__dirname, '../dist'),
filename: 'bundle.[name].js',
Expand All @@ -13,4 +13,6 @@ module.exports = merge(baseConfig, reactConfig, {
plugins: [
new BundleAnalyzerPlugin(),
],
});
};

module.exports = merge(baseConfig, reactConfig, config);
6 changes: 4 additions & 2 deletions config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const baseConfig = require('./webpack.config');
const reactConfig = require('./webpack.config.react');
const version = require('../package.json').version;

module.exports = merge(baseConfig, reactConfig, {
const config = {
mode: 'development',
output: {
path: resolve(__dirname, '../app', '../dist'),
Expand All @@ -31,4 +31,6 @@ module.exports = merge(baseConfig, reactConfig, {
VERSION: JSON.stringify(version),
}),
],
});
};

module.exports = merge(baseConfig, reactConfig, config);
6 changes: 4 additions & 2 deletions config/webpack.config.electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { resolve } = require('path');
const merge = require('webpack-merge');
const baseConfig = require('./webpack.config');

module.exports = merge(baseConfig, {
const config = {
mode: 'production',
entry: {
main: ['babel-polyfill', `${resolve(__dirname, '../app/src')}/main.js`],
Expand All @@ -25,4 +25,6 @@ module.exports = merge(baseConfig, {
},
],
},
});
};

module.exports = merge(baseConfig, config);
4 changes: 3 additions & 1 deletion config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const webpack = require('webpack');
const { resolve } = require('path');
const { ProvidePlugin } = require('webpack');

module.exports = {
const config = {
mode: 'development',
resolve: {
alias: {
Expand Down Expand Up @@ -97,3 +97,5 @@ module.exports = {
}),
],
};

module.exports = config;
6 changes: 4 additions & 2 deletions config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const baseConfig = require('./webpack.config');
const reactConfig = require('./webpack.config.react');
const version = require('../package.json').version;

module.exports = merge(baseConfig, reactConfig, {
const config = {
output: {
path: resolve(__dirname, '../app', '../app/build'),
filename: 'bundle.[name].[contenthash].js',
Expand All @@ -32,4 +32,6 @@ module.exports = merge(baseConfig, reactConfig, {
VERSION: JSON.stringify(version),
}),
],
});
};

module.exports = merge(baseConfig, reactConfig, config);
4 changes: 3 additions & 1 deletion config/webpack.config.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const postCssLoader = {
},
};

module.exports = {
const config = {
mode: 'development',
entry: {
app: `${resolve(__dirname, '../src')}/main.js`,
Expand Down Expand Up @@ -151,3 +151,5 @@ module.exports = {
],
},
};

module.exports = config;
4 changes: 3 additions & 1 deletion config/webpack.config.storybook.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const MiniCssExtractPlugin = require('mini-css-extract-plugin');

module.exports = {
const config = {
plugins: [
new MiniCssExtractPlugin({
filename: 'styles.css',
Expand Down Expand Up @@ -82,3 +82,5 @@ module.exports = {
],
},
};

module.exports = config;
23 changes: 13 additions & 10 deletions src/components/screens/wallet/delegateProfile/voterRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ import React from 'react';
import AccountVisual from '@toolbox/accountVisual';
import styles from './delegateProfile.css';

const VoterRow = props => (
<div className={styles.voteItem} key={props.data}>
<AccountVisual
className={styles.accountVisual}
address={props.data}
size={40}
/>
<span className={styles.address}>{props.data}</span>
</div>
);
const VoterRow = ({ data = {} }) => {
const { address, username } = data;
return (
<div className={styles.voteItem}>
<AccountVisual
className={styles.accountVisual}
address={address}
size={40}
/>
<span className={styles.address}>{username || address}</span>
</div>
);
};

export default VoterRow;
8 changes: 4 additions & 4 deletions src/components/screens/wallet/explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ import Transactions from './transactions';
const Wallet = ({
t, account, history,
}) => {
if (!account || !account.data || isEmpty(account.data)) return (<div />);

const activeToken = useSelector(selectActiveToken);
const { discreetMode } = useSelector(selectSettings);
const isDelegate = account.data.summary?.isDelegate;
const address = selectSearchParamValue(history.location.search, 'address');

useEffect(() => {
account.loadData();
}, [history.location.search]);
}, [address]);

if (!account || !account.data || isEmpty(account.data)) return (<div />);

const isDelegate = account.data.summary?.isDelegate;

return (
<section>
Expand Down
4 changes: 2 additions & 2 deletions src/utils/account.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { passphrase as LiskPassphrase, cryptography } from '@liskhq/lisk-client';
import { tokenMap, regex, balanceNeededForInitialization } from '@constants';
import { tokenMap, regex, account as accountConst } from '@constants';

/**
* Extracts Lisk PublicKey from a given valid Mnemonic passphrase
Expand Down Expand Up @@ -180,4 +180,4 @@ export const isAccountInitialized = account => account
&& !!account.info.LSK.serverPublicKey;

export const hasEnoughBalanceForInitialization = (balance = 0) =>
Number(balance) >= balanceNeededForInitialization;
Number(balance) >= accountConst.balanceNeededForInitialization;

0 comments on commit c16d5fa

Please sign in to comment.