chore: general code cleanup

This commit is contained in:
André Neves 2019-02-04 23:41:45 -05:00
parent b99db4e7cf
commit 0726c8bdd2
100 changed files with 498 additions and 242 deletions

View File

@ -18,7 +18,7 @@ describe('Receive Actions', () => {
const payload = {
addresses: [
'tm0a9si0ds09gj02jj',
'smas098gk02jf0kskk'
'smas098gk02jf0kskk',
],
};

View File

@ -36,7 +36,7 @@ describe('Send Actions', () => {
test('should create an action to send transaction with success', () => {
const payload = {
operationId: '0b9ii4590ab-1d012klfo'
operationId: '0b9ii4590ab-1d012klfo',
};
store.dispatch(sendTransactionSuccess(payload));
@ -76,7 +76,7 @@ describe('Send Actions', () => {
test('should validate a address with success', () => {
const payload = {
isValid: true
isValid: true,
};
store.dispatch(validateAddressSuccess(payload));
@ -101,7 +101,7 @@ describe('Send Actions', () => {
test('should load ZEC price', () => {
const payload = {
value: 1.35
value: 1.35,
};
store.dispatch(loadZECPrice(payload));
@ -109,7 +109,7 @@ describe('Send Actions', () => {
expect(store.getActions()[0]).toEqual(
expect.objectContaining({
type: LOAD_ZEC_PRICE,
payload
payload,
}),
);
});

View File

@ -16,10 +16,10 @@ describe('<Button />', () => {
<ThemeProvider theme={appTheme}>
<Button
label='Click me!'
onClick={() => alert('Clicked')}
variant='primary'
onClick={() => alert('Clicked')} // eslint-disable-line
variant='primary'
/>
</ThemeProvider>
</ThemeProvider>,
);
expect(queryByTestId('PrimaryButton')).toBeInTheDocument();
@ -30,13 +30,12 @@ describe('<Button />', () => {
<ThemeProvider theme={appTheme}>
<Button
label='Click me!'
onClick={() => alert('Clicked')}
variant='secondary'
onClick={() => alert('Clicked')} // eslint-disable-line
variant='secondary'
/>
</ThemeProvider>
</ThemeProvider>,
);
expect(queryByTestId('SecondaryButton')).toBeInTheDocument();
});
});

View File

@ -30,5 +30,4 @@ describe('<Clipboard />', () => {
expect(queryByTestId('PrimaryButton')).toBeInTheDocument();
});
});

View File

@ -12,11 +12,18 @@ describe('<ConfirmDialogComponent />', () => {
test('should render confirm dialog correctly', () => {
const { container } = render(
<ConfirmDialogComponent
title="Confirm example"
onConfirm={() => alert('Confirm')}
renderTrigger={toggle => <button onClick={toggle}> Open! </button>}
title='Confirm example'
onConfirm={() => alert('Confirm')} // eslint-disable-line
renderTrigger={toggle => (
<button
onClick={toggle}
type='button'
>
Open!
</button>
)}
>
{toggle => <div>Confirm content</div>}
{(/* toggle */) => <div>Confirm content</div>}
</ConfirmDialogComponent>,
);
@ -26,11 +33,19 @@ describe('<ConfirmDialogComponent />', () => {
test('should render confirm dialog trigger', () => {
const { queryByTestId } = render(
<ConfirmDialogComponent
title="Confirm example"
onConfirm={() => alert('Confirm')}
renderTrigger={toggle => <button data-testid='ConfirmDialogTrigger' onClick={toggle}> Open! </button>}
title='Confirm example'
onConfirm={() => alert('Confirm')} // eslint-disable-line
renderTrigger={toggle => (
<button
data-testid='ConfirmDialogTrigger'
onClick={toggle}
type='button'
>
Open!
</button>
)}
>
{toggle => <div>Confirm content</div>}
{(/* toggle */) => <div>Confirm content</div>}
</ConfirmDialogComponent>,
);

View File

@ -15,7 +15,10 @@ describe('<DropdownComponent />', () => {
test('should render dropdown correctly', () => {
const { queryByTestId } = render(
<ThemeProvider theme={appTheme}>
<div style={{ height: '500px' }} data-testid='DropdownWrapper'>
<div
style={{ height: '500px' }}
data-testid='DropdownWrapper'
>
<DropdownComponent
label='Addresses'
renderTrigger={toggleVisibility => (
@ -60,5 +63,4 @@ describe('<DropdownComponent />', () => {
expect(queryByTestId('PrimaryButton')).toBeInTheDocument();
});
});

View File

@ -19,7 +19,7 @@ describe('<InputLabelComponent />', () => {
);
const label = container.querySelector('p');
expect(label).toBeVisible();
});

View File

@ -17,9 +17,9 @@ describe('<InputComponent />', () => {
<InputComponent
inputType='input'
value='Hello World!'
onChange={console.log}
onChange={console.log} // eslint-disable-line
/>
</ThemeProvider>
</ThemeProvider>,
);
expect(queryByTestId('Input')).toBeInTheDocument();
@ -31,10 +31,10 @@ describe('<InputComponent />', () => {
<InputComponent
inputType='textarea'
value='I am Zcash Electron Wallet'
onChange={console.log}
onChange={console.log} // eslint-disable-line
rows={10}
/>
</ThemeProvider>
</ThemeProvider>,
);
expect(queryByTestId('Textarea')).toBeInTheDocument();

View File

@ -14,7 +14,7 @@ describe('<LoadingScreen />', () => {
test('should render status pill correctly', () => {
const { queryByTestId } = render(
<ThemeProvider theme={appTheme}>
<LoadingScreen progress={83.} />
<LoadingScreen progress={83.0} />
</ThemeProvider>,
);

View File

@ -13,7 +13,11 @@ describe('<ModalComponent />', () => {
const { queryByTestId } = render(
<ModalComponent
renderTrigger={toggleVisibility => (
<button type="button" data-testid='ModalTrigger' onClick={toggleVisibility}>
<button
type='button'
data-testid='ModalTrigger'
onClick={toggleVisibility}
>
Open Modal
</button>
)}
@ -21,7 +25,10 @@ describe('<ModalComponent />', () => {
{toggleVisibility => (
<div style={{ padding: '50px', backgroundColor: 'white' }}>
Modal Content
<button type="button" onClick={toggleVisibility}>
<button
type='button'
onClick={toggleVisibility}
>
Close Modal
</button>
</div>
@ -31,5 +38,4 @@ describe('<ModalComponent />', () => {
expect(queryByTestId('ModalTrigger')).toBeInTheDocument();
});
});

View File

@ -15,7 +15,7 @@ describe('<SelectComponent />', () => {
const { container } = render(
<ThemeProvider theme={appTheme}>
<SelectComponent
onChange={console.log}
onChange={console.log} // eslint-disable-line
value='asbh1yeasbdh23848asdasd'
placeholder='Select a address'
options={[

View File

@ -22,10 +22,9 @@ describe('<TransactionItem />', () => {
date={new Date().toISOString()}
zecPrice={2.94}
/>
</ThemeProvider>
</ThemeProvider>,
);
expect(container).toMatchSnapshot();
});
});

View File

@ -1,7 +1,7 @@
// @flow
import React from 'react';
import { render, cleanup, queryByText } from 'react-testing-library';
import { render, cleanup } from 'react-testing-library';
import { ThemeProvider } from 'styled-components';
import 'jest-dom/extend-expect';

View File

@ -1,4 +1,5 @@
// @flow
import { getApp } from '../setup/utils';
const app = getApp();
@ -8,6 +9,7 @@ beforeAll(async () => {
await app.client.waitUntilWindowLoaded();
await app.client.waitUntilTextExists('#sidebar', 'Console');
});
afterAll(() => app.stop());
describe('Console', () => {
@ -16,8 +18,10 @@ describe('Console', () => {
expect(app.client.getText('#header p:first-child')).resolves.toEqual('Console');
expect(app.client.element('#console-wrapper img').getAttribute('src')).resolves.toEqual(
expect.stringContaining('/assets/console_zcash.png'),
);
expect(app.client.element('#console-wrapper img')
.getAttribute('src'))
.resolves.toEqual(
expect.stringContaining('/assets/console_zcash.png'),
);
});
});

View File

@ -1,4 +1,5 @@
// @flow
import { getApp } from '../setup/utils';
const app = getApp();
@ -9,29 +10,28 @@ beforeEach(async () => {
await app.client.waitUntilTextExists('#sidebar', 'Send');
await app.client.element('#sidebar a:nth-child(2)').click();
});
afterEach(() => app.stop());
describe('Send', () => {
test('should load "Send Page"', async () => {
expect(app.client.element('#send-wrapper').isVisible()).resolves.toEqual(true);
expect(app.client.element('#send-wrapper')
.isVisible()).resolves.toEqual(true);
});
test('should show Additional Options click', async () => {
expect(app.client.element('#send-wrapper #send-fee-wrapper').isVisible()).resolves.toEqual(
false,
);
expect(app.client.element('#send-wrapper #send-fee-wrapper')
.isVisible()).resolves.toEqual(false);
await app.client.element('#send-show-additional-options-button').click();
expect(app.client.element('#send-wrapper #send-fee-wrapper').isVisible()).resolves.toEqual(
true,
);
expect(app.client.element('#send-wrapper #send-fee-wrapper')
.isVisible()).resolves.toEqual(true);
});
test('should disable send button if required fields are empty', async () => {
expect(app.client.element('#send-submit-button').getAttribute('disabled')).resolves.toEqual(
true,
);
expect(app.client.element('#send-submit-button')
.getAttribute('disabled')).resolves.toEqual(true);
});
test('should enable send button if required fields are filled', async () => {
@ -68,9 +68,8 @@ describe('Send', () => {
await app.client.element('#send-submit-button').click();
expect(app.client.element('#send-confirm-transaction-modal').isVisible()).resolves.toEqual(
true,
);
expect(app.client.element('#send-confirm-transaction-modal')
.isVisible()).resolves.toEqual(true);
});
test('should display a load indicator while the transaction is processed', async () => {
@ -88,17 +87,19 @@ describe('Send', () => {
await app.client.element('#send-submit-button').click();
await app.client.element('#confirm-modal-button').click();
expect(app.client.getAttribute('#send-confirm-transaction-modal img', 'src')).resolves.toEqual(
expect.stringContaining('/assets/sync_icon.png'),
);
expect(app.client.getText('#send-confirm-transaction-modal p')).resolves.toEqual(
'Processing transaction...',
);
expect(app.client.element('#confirm-modal-button').isVisible()).resolves.toEqual(false);
expect(app.client.getText('#send-confirm-transaction-modal p'))
.resolves.toEqual('Processing transaction...');
expect(app.client.element('#confirm-modal-button')
.isVisible()).resolves.toEqual(false);
});
test('should show an error in invalid transaction', async () => {
expect(app.client.element('#send-error-text').isVisible()).resolves.toEqual(false);
expect(app.client.element('#send-error-text')
.isVisible()).resolves.toEqual(false);
await app.client.element('#sidebar a:nth-child(1)').click();
await app.client.element('#sidebar a:nth-child(2)').click();
@ -123,7 +124,8 @@ describe('Send', () => {
});
test('should show a success screen after transaction and show a transaction item', async () => {
expect(app.client.element('#send-success-wrapper').isVisible()).resolves.toEqual(false);
expect(app.client.element('#send-success-wrapper')
.isVisible()).resolves.toEqual(false);
await app.client.element('#sidebar a:nth-child(1)').click();
await app.client.element('#sidebar a:nth-child(2)').click();
@ -147,9 +149,8 @@ describe('Send', () => {
await app.client.waitUntilTextExists('#transaction-item-operation-id-1', 'Send');
expect(await app.client.element('#transaction-item-operation-id-1 img').isVisible()).toEqual(
true,
);
expect(await app.client.element('#transaction-item-operation-id-1 img')
.isVisible()).toEqual(true);
expect(
await app.client.element('#transaction-item-operation-id-1 img').getAttribute('src'),
).toEndWith('/assets/transaction_sent_icon.svg');

View File

@ -9,6 +9,7 @@ beforeAll(async () => {
await app.client.waitUntilWindowLoaded();
await app.client.waitUntilTextExists('#sidebar', 'Dashboard');
});
afterAll(() => app.stop());
describe('Sidebar', () => {
@ -17,9 +18,8 @@ describe('Sidebar', () => {
expect(await app.client.getUrl()).toEndWith('/');
expect(await app.client.element('#sidebar a:nth-child(1)').getHTML()).toEqual(
expect.stringContaining('Dashboard'),
);
expect(await app.client.element('#sidebar a:nth-child(1)')
.getHTML()).toEqual(expect.stringContaining('Dashboard'));
expect(await app.client.element('#sidebar a:nth-child(1) img').getAttribute('src')).toEqual(
expect.stringContaining('/assets/dashboard_icon_active.svg'),
@ -31,11 +31,11 @@ describe('Sidebar', () => {
expect(await app.client.getUrl()).toEndWith('/send');
expect(await app.client.element('#sidebar a:nth-child(2)').getHTML()).toEqual(
expect.stringContaining('Send'),
);
expect(await app.client.element('#sidebar a:nth-child(2)')
.getHTML()).toEqual(expect.stringContaining('Send'));
expect(await app.client.element('#sidebar a:nth-child(2) img').getAttribute('src')).toEqual(
expect(await app.client.element('#sidebar a:nth-child(2) img')
.getAttribute('src')).toEqual(
expect.stringContaining('/assets/send_icon_active.svg'),
);
});
@ -45,11 +45,11 @@ describe('Sidebar', () => {
expect(await app.client.getUrl()).toEndWith('/receive');
expect(await app.client.element('#sidebar a:nth-child(3)').getHTML()).toEqual(
expect.stringContaining('Receive'),
);
expect(await app.client.element('#sidebar a:nth-child(3)')
.getHTML()).toEqual(expect.stringContaining('Receive'));
expect(await app.client.element('#sidebar a:nth-child(3) img').getAttribute('src')).toEqual(
expect(await app.client.element('#sidebar a:nth-child(3) img')
.getAttribute('src')).toEqual(
expect.stringContaining('/assets/receive_icon_active.svg'),
);
});
@ -59,11 +59,11 @@ describe('Sidebar', () => {
expect(await app.client.getUrl()).toEndWith('/transactions');
expect(await app.client.element('#sidebar a:nth-child(4)').getHTML()).toEqual(
expect.stringContaining('Transactions'),
);
expect(await app.client.element('#sidebar a:nth-child(4)')
.getHTML()).toEqual(expect.stringContaining('Transactions'));
expect(await app.client.element('#sidebar a:nth-child(4) img').getAttribute('src')).toEqual(
expect(await app.client.element('#sidebar a:nth-child(4) img')
.getAttribute('src')).toEqual(
expect.stringContaining('/assets/transactions_icon_active.svg'),
);
});
@ -73,11 +73,11 @@ describe('Sidebar', () => {
expect(await app.client.getUrl()).toEndWith('/settings');
expect(await app.client.element('#sidebar a:nth-child(5)').getHTML()).toEqual(
expect.stringContaining('Settings'),
);
expect(await app.client.element('#sidebar a:nth-child(5)')
.getHTML()).toEqual(expect.stringContaining('Settings'));
expect(await app.client.element('#sidebar a:nth-child(5) img').getAttribute('src')).toEqual(
expect(await app.client.element('#sidebar a:nth-child(5) img')
.getAttribute('src')).toEqual(
expect.stringContaining('/assets/settings_icon_active.svg'),
);
});
@ -87,11 +87,11 @@ describe('Sidebar', () => {
expect(await app.client.getUrl()).toEndWith('/console');
expect(await app.client.element('#sidebar a:nth-child(6)').getHTML()).toEqual(
expect.stringContaining('Console'),
);
expect(await app.client.element('#sidebar a:nth-child(6)')
.getHTML()).toEqual(expect.stringContaining('Console'));
expect(await app.client.element('#sidebar a:nth-child(6) img').getAttribute('src')).toEqual(
expect(await app.client.element('#sidebar a:nth-child(6) img')
.getAttribute('src')).toEqual(
expect.stringContaining('/assets/console_icon_active.svg'),
);
});

View File

@ -8,6 +8,7 @@ beforeAll(async () => {
await app.start();
await app.client.waitUntilWindowLoaded();
});
afterAll(() => app.stop());
describe('Startup', () => {

View File

@ -1,4 +1,5 @@
// @flow
import { getApp } from '../setup/utils';
const app = getApp();

View File

@ -1,4 +1,5 @@
// @flow
import walletSummaryReducer, {
LOAD_WALLET_SUMMARY,
LOAD_WALLET_SUMMARY_SUCCESS,
@ -80,9 +81,9 @@ describe('WalletSummary Reducer', () => {
isLoading: false,
addresses: [],
transactions: [],
zecPrice: 0
zecPrice: 0,
};
expect(walletSummaryReducer(undefined, action)).toEqual(expectedState);
});
});
});

View File

@ -1,7 +1,9 @@
// @flow
const path = require('path');
module.exports = {
process(filename) {
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
process(filename: any) {
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
},
};
};

View File

@ -1,4 +1,5 @@
// @flow
// eslint-disable-next-line import/no-unresolved
require('jest-extended');

View File

@ -1,4 +1,5 @@
// @flow
// eslint-disable-next-line import/no-extraneous-dependencies
import 'babel-polyfill';
@ -11,7 +12,7 @@ const sleep = (time: number) => new Promise(resolve => setTimeout(resolve, time)
createTestServer({
httpPort: '18232',
}).then(async (server) => {
console.log('[MOCK RPC API]', server.url);
console.log('[MOCK RPC API]', server.url); // eslint-disable-line
server.get('/', (req, res) => {
res.send('Zcash RPC');

View File

@ -1,4 +1,5 @@
// @flow
/* eslint-disable import/no-extraneous-dependencies */
import electron from 'electron';
import { Application } from 'spectron';

View File

@ -1,4 +1,5 @@
// @flow
import 'jest-dom/extend-expect';
import { filterObjectNullKeys } from '../../app/utils/filter-object-null-keys';
@ -18,5 +19,5 @@ describe('filterObjectNullKeys', () => {
};
expect(filterObjectNullKeys(initialState)).toEqual(expectedState);
})
})
});
});

View File

@ -1,4 +1,5 @@
// @flow
import { BigNumber } from 'bignumber.js';
import 'jest-dom/extend-expect';
@ -34,4 +35,4 @@ describe('formatNumber', () => {
expect(myBalanceInUsd).toEqual(expectedState);
});
})
});

View File

@ -1,4 +1,5 @@
// @flow
import 'jest-dom/extend-expect';
import { getTimestamp } from '../../app/utils/timestamp';
@ -8,6 +9,5 @@ describe('generate timestamp', () => {
const now = getTimestamp();
expect(now).toEqual(expect.any(Number));
});
})
});

View File

@ -1,4 +1,5 @@
// @flow
import 'jest-dom/extend-expect';
import { truncateAddress } from '../../app/utils/truncate-address';
@ -11,4 +12,4 @@ describe('truncateAddress', () => {
expect(myAddress).toEqual(expectedState);
});
})
});

View File

@ -1,13 +1,12 @@
// @flow
import React from 'react';
import React, { type ElementProps } from 'react';
import styled from 'styled-components';
import { Link } from 'react-router-dom';
/* eslint-disable import/no-extraneous-dependencies */
/* eslint-disable max-len */
// $FlowFixMe
import { darken } from 'polished';
import type { ElementProps } from 'react';
const DefaultButton = styled.button`
align-items: center;
@ -102,12 +101,18 @@ export const Button = ({
const buttonLabel = isLoading ? 'Loading...' : label;
const component = variant === 'primary' ? (
<Primary {...props} data-testid='PrimaryButton'>
<Primary
{...props}
data-testid='PrimaryButton'
>
{icon ? <Icon src={icon} /> : null}
{buttonLabel}
</Primary>
) : (
<Secondary {...props} data-testid='SecondaryButton'>
<Secondary
{...props}
data-testid='SecondaryButton'
>
{icon ? <Icon src={icon} /> : null}
{buttonLabel}
</Secondary>

View File

@ -1,4 +1,5 @@
// @flow
import React, { PureComponent } from 'react';
import { Button } from './button';

View File

@ -1,5 +1,6 @@
// @flow
import React, { type Element } from 'react';
import React, { Fragment, type Element } from 'react';
import styled from 'styled-components';
import { TextComponent } from './text';
@ -82,15 +83,21 @@ export const ConfirmDialogComponent = ({
{toggle => (
<Wrapper width={Number(width)}>
<CloseIconWrapper>
<CloseIconImg src={CloseIcon} onClick={handleClose(toggle)} />
<CloseIconImg
src={CloseIcon}
onClick={handleClose(toggle)}
/>
</CloseIconWrapper>
<TitleWrapper>
<TextComponent value={title} align='center' />
<TextComponent
value={title}
align='center'
/>
</TitleWrapper>
<Divider opacity={0.3} />
{children(handleClose(toggle))}
{showButtons && (
<>
<Fragment>
<Btn
id='confirm-modal-button'
label='Confirm'
@ -103,7 +110,7 @@ export const ConfirmDialogComponent = ({
variant='secondary'
disabled={isLoading}
/>
</>
</Fragment>
)}
</Wrapper>
)}

View File

@ -1,4 +1,5 @@
// @flow
import styled from 'styled-components';
export const Divider = styled.div`

View File

@ -1,4 +1,5 @@
// @flow
import React, { type Node, Component } from 'react';
import styled from 'styled-components';
/* eslint-disable import/no-extraneous-dependencies */
@ -99,16 +100,30 @@ export class DropdownComponent extends Component<Props, State> {
} = this.props;
const body = [
<ClickOutside onClickOutside={() => this.setState(() => ({ isOpen: false }))}>
<ClickOutside
onClickOutside={() => this.setState(() => ({ isOpen: false }))}
>
<MenuWrapper>
{label && (
<MenuItem disabled isGroupLabel>
<TextComponent value={label} isBold />
<MenuItem
disabled
isGroupLabel
>
<TextComponent
value={label}
isBold
/>
</MenuItem>
)}
{options.map(({ label: optionLabel, onClick }) => (
<OptionItem onClick={onClick} key={optionLabel} data-testid='DropdownOption'>
<Option value={truncate ? truncateAddress(optionLabel) : optionLabel} />
<OptionItem
onClick={onClick}
key={optionLabel}
data-testid='DropdownOption'
>
<Option
value={truncate ? truncateAddress(optionLabel) : optionLabel}
/>
</OptionItem>
))}
</MenuWrapper>
@ -123,7 +138,9 @@ export class DropdownComponent extends Component<Props, State> {
tipSize={7}
body={body}
>
{renderTrigger(() => this.setState(state => ({ isOpen: !state.isOpen })), isOpen)}
{renderTrigger(() => this.setState(state => ({
isOpen: !state.isOpen,
})), isOpen)}
</PopoverWithStyle>
);
}

View File

@ -1,4 +1,5 @@
// @flow
import React from 'react';
import styled from 'styled-components';

View File

@ -1,4 +1,5 @@
// @flow
import React, { PureComponent } from 'react';
import { createPortal } from 'react-dom';
import styled from 'styled-components';
@ -78,17 +79,21 @@ export class ErrorModalComponent extends PureComponent<Props> {
render() {
const { isVisible, message, onRequestClose } = this.props;
return isVisible
? createPortal(
<ModalWrapper id='error-modal-portal-wrapper'>
<ChildrenWrapper>
<ErrorImage src={ErrorIcon} alt='Error Icon' />
<Message value={message} />
<Button label='Ok!' onClick={onRequestClose} />
</ChildrenWrapper>
</ModalWrapper>,
this.element,
)
: null;
return !isVisible ? null : createPortal(
<ModalWrapper id='error-modal-portal-wrapper'>
<ChildrenWrapper>
<ErrorImage
src={ErrorIcon}
alt='Error Icon'
/>
<Message value={message} />
<Button
label='Ok!'
onClick={onRequestClose}
/>
</ChildrenWrapper>
</ModalWrapper>,
this.element,
);
}
}

View File

@ -1,6 +1,6 @@
// @flow
import React from 'react';
import React from 'react';
import styled from 'styled-components';
import { ZcashLogo } from './zcash-logo';
@ -69,9 +69,15 @@ export const HeaderComponent = ({ title }: Props) => (
<ZcashLogo />
</LogoWrapper>
<TitleWrapper>
<TitleRow alignItems='center' justifyContent='space-around'>
<TitleRow
alignItems='center'
justifyContent='space-around'
>
<Title value={title} />
<Status type='syncing' progress={0} />
<Status
type='syncing'
progress={0}
/>
</TitleRow>
<Divider opacity={0.1} />
</TitleWrapper>

View File

@ -1,4 +1,5 @@
// @flow
import styled from 'styled-components';
import { TextComponent } from './text';

View File

@ -1,4 +1,5 @@
// @flow
import React, { type Element } from 'react';
import styled from 'styled-components';
@ -55,7 +56,6 @@ export const InputComponent = ({
...props
}: Props) => {
const rightElement = renderRight();
const inputTypes = {
input: () => (
<Input

View File

@ -1,4 +1,5 @@
// @flow
import React, { type Element } from 'react';
import styled from 'styled-components';

View File

@ -1,4 +1,5 @@
// @flow
import React, { PureComponent } from 'react';
import styled from 'styled-components';
import { Transition, animated } from 'react-spring';
@ -86,6 +87,7 @@ export class LoadingScreen extends PureComponent<Props, State> {
>
{() => props => (
<animated.div
id='loading-screen'
style={{
...props,
display: 'flex',
@ -93,13 +95,15 @@ export class LoadingScreen extends PureComponent<Props, State> {
alignItems: 'center',
justifyContent: 'center',
}}
id='loading-screen'
>
<CircleWrapper>
<Logo src={zcashLogo} alt='Zcash logo' />
<Logo
src={zcashLogo}
alt='Zcash Logo'
/>
<CircleProgressComponent
progress={progress}
s
s // TODO: check if this has any effect
responsive
showPercentage={false}
progressColor={theme.colors.activeItem}

View File

@ -1,4 +1,5 @@
// @flow
import React, { PureComponent, Fragment, type Element } from 'react';
import { createPortal } from 'react-dom';
import styled from 'styled-components';
@ -69,23 +70,19 @@ export class ModalComponent extends PureComponent<Props, State> {
}
};
open = () => {
this.setState(
() => ({ isVisible: true }),
() => {
if (modalRoot) modalRoot.appendChild(this.element);
},
);
};
open = () => this.setState(
() => ({ isVisible: true }),
() => {
if (modalRoot) modalRoot.appendChild(this.element);
},
);
close = () => {
this.setState(
() => ({ isVisible: false }),
() => {
if (modalRoot) modalRoot.removeChild(this.element);
},
);
};
close = () => this.setState(
() => ({ isVisible: false }),
() => {
if (modalRoot) modalRoot.removeChild(this.element);
},
);
render() {
const { renderTrigger, children, closeOnBackdropClick } = this.props;
@ -95,23 +92,21 @@ export class ModalComponent extends PureComponent<Props, State> {
return (
<Fragment>
{renderTrigger(toggleVisibility)}
{isVisible
? createPortal(
<ModalWrapper
id='modal-portal-wrapper'
data-testid='Modal'
onClick={(event) => {
if (
closeOnBackdropClick
&& event.target.id === 'modal-portal-wrapper'
) this.close();
}}
>
<ChildrenWrapper>{children(toggleVisibility)}</ChildrenWrapper>
</ModalWrapper>,
this.element,
)
: null}
{!isVisible ? null : createPortal(
<ModalWrapper
id='modal-portal-wrapper'
data-testid='Modal'
onClick={(event) => {
if (
closeOnBackdropClick
&& event.target.id === 'modal-portal-wrapper'
) this.close();
}}
>
<ChildrenWrapper>{children(toggleVisibility)}</ChildrenWrapper>
</ModalWrapper>,
this.element,
)}
</Fragment>
);
}

View File

@ -12,12 +12,15 @@ import { ModalComponent } from './modal.js'
<PropsTable of={ModalComponent} />
## Basic usage
## Basic Usage
<Playground>
<ModalComponent
renderTrigger={toggleVisibility => (
<button type="button" onClick={toggleVisibility}>
<button
type="button"
onClick={toggleVisibility}
>
Open Modal
</button>
)}
@ -25,7 +28,10 @@ import { ModalComponent } from './modal.js'
{toggleVisibility => (
<div style={{ padding: '50px', backgroundColor: 'white' }}>
Modal Content
<button type="button" onClick={toggleVisibility}>
<button
type="button"
onClick={toggleVisibility}
>
Close Modal
</button>
</div>
@ -40,7 +46,10 @@ import { ModalComponent } from './modal.js'
closeOnEsc={false}
closeOnBackdropClick={false}
renderTrigger={toggleVisibility => (
<button type="button" onClick={toggleVisibility}>
<button
type="button"
onClick={toggleVisibility}
>
Open Modal
</button>
)}
@ -48,7 +57,10 @@ import { ModalComponent } from './modal.js'
{toggleVisibility => (
<div style={{ padding: '50px', backgroundColor: 'white' }}>
Modal Content
<button type="button" onClick={toggleVisibility}>
<button
type="button"
onClick={toggleVisibility}
>
Close Modal
</button>
</div>

View File

@ -9,7 +9,11 @@ type Props = {
};
export const QRCode = ({ value, size }: Props) => (
<QR data-testid='QRCode' value={value} size={size} />
<QR
data-testid='QRCode'
value={value}
size={size}
/>
);
QRCode.defaultProps = {

View File

@ -12,13 +12,13 @@ import { QRCode } from './qrcode.js'
<PropsTable of={QRCode} />
## Basic usage
## Basic Usage
<Playground>
<QRCode value='https://z.cash.foundation' />
</Playground>
## Custom size
## Custom Size
<Playground>
<QRCode

View File

@ -1,4 +1,5 @@
// @flow
import React, { PureComponent } from 'react';
import styled from 'styled-components';
@ -46,6 +47,7 @@ const SelectMenuButtonWrapper = styled.div`
padding: 13px;
border-left: ${props => `1px solid ${props.theme.colors.background}`};
`;
/* eslint-disable max-len */
const SelectMenuButton = styled.button`
padding: 3px 7px;
@ -100,6 +102,7 @@ type Props = {
placement?: 'top' | 'bottom',
bgColor?: string,
};
type State = {
isOpen: boolean,
};
@ -123,7 +126,10 @@ export class SelectComponent extends PureComponent<Props, State> {
handleClickOutside = (event: Object) => {
const { isOpen } = this.state;
if (isOpen && event.target.id !== 'select-options-wrapper') this.setState(() => ({ isOpen: false }));
if (isOpen && event.target.id !== 'select-options-wrapper') {
this.setState(() => ({ isOpen: false }));
}
};
getSelectedLabel = (value: string) => {
@ -145,10 +151,10 @@ export class SelectComponent extends PureComponent<Props, State> {
};
render() {
const { isOpen } = this.state;
const {
value, options, placeholder, placement, bgColor,
} = this.props;
const { isOpen } = this.state;
return (
<SelectWrapper

View File

@ -1,4 +1,5 @@
// @flow
/* eslint-disable max-len */
import React from 'react';
import styled from 'styled-components';
@ -15,6 +16,7 @@ const Wrapper = styled.div`
padding-top: 15px;
position: relative;
`;
/* eslint-disable max-len */
const StyledLink = styled.a`
color: ${props => (props.isActive ? props.theme.colors.sidebarItemActive : props.theme.colors.sidebarItem)};
@ -72,7 +74,11 @@ export const SidebarComponent = ({ options, location, history }: Props) => (
key={item.route}
onClick={() => (isActive ? {} : history.push(item.route))}
>
<Icon isActive={isActive} src={item.icon(isActive)} alt={`${item.route}`} />
<Icon
isActive={isActive}
src={item.icon(isActive)}
Alt={`${item.route}`}
/>
{item.label}
</StyledLink>
);

View File

@ -1,4 +1,5 @@
// @flow
import React, { Component } from 'react';
import styled, { keyframes } from 'styled-components';
import eres from 'eres';

View File

@ -17,7 +17,7 @@ import { DoczWrapper } from '../theme.js'
<Playground>
<DoczWrapper>
{() =>
{() =>
<StatusPill
progress={99.3}
type='syncing'
@ -30,7 +30,7 @@ import { DoczWrapper } from '../theme.js'
<Playground>
<DoczWrapper>
{() =>
{() =>
<StatusPill
progress={100.}
type='ready'
@ -44,7 +44,7 @@ import { DoczWrapper } from '../theme.js'
<Playground>
<DoczWrapper>
{() =>
{() =>
<StatusPill
progress={0.}
type='error'

View File

@ -1,4 +1,5 @@
// @flow
/* eslint-disable max-len */
import React from 'react';
import styled from 'styled-components';

View File

@ -1,4 +1,5 @@
// @flow
import React, { Fragment } from 'react';
import styled from 'styled-components';

View File

@ -1,4 +1,5 @@
// @flow
import React from 'react';
import styled from 'styled-components';
import dateFns from 'date-fns';
@ -143,13 +144,22 @@ export const TransactionDetailsComponent = ({
return (
<Wrapper>
<CloseIconWrapper>
<CloseIconImg src={CloseIcon} onClick={handleClose} />
<CloseIconImg
src={CloseIcon}
onClick={handleClose}
/>
</CloseIconWrapper>
<TitleWrapper>
<TextComponent value='Transaction Details' align='center' />
<TextComponent
value='Transaction Details'
align='center'
/>
</TitleWrapper>
<DetailsWrapper>
<Icon src={isReceived ? ReceivedIcon : SentIcon} alt='Transaction Type Icon' />
<Icon
src={isReceived ? ReceivedIcon : SentIcon}
alt='Transaction Type Icon'
/>
<TextComponent
isBold
size={2.625}
@ -171,10 +181,16 @@ export const TransactionDetailsComponent = ({
<InfoRow>
<ColumnComponent>
<Label value='DATE' />
<TextComponent value={dateFns.format(new Date(date), 'MMMM D, YYYY HH:MMA')} />
<TextComponent
value={dateFns.format(new Date(date), 'MMMM D, YYYY HH:MMA')}
/>
</ColumnComponent>
<ColumnComponent>
<TextComponent value='FEES' isBold color={theme.colors.transactionsDetailsLabel} />
<TextComponent
value='FEES'
isBold
color={theme.colors.transactionsDetailsLabel}
/>
<TextComponent
value={formatNumber({
value: new BigNumber(amount).times(0.1).toNumber(),
@ -187,7 +203,9 @@ export const TransactionDetailsComponent = ({
<InfoRow>
<ColumnComponent width='100%'>
<Label value='TRANSACTION ID' />
<TransactionId onClick={() => openExternal(ZCASH_EXPLORER_BASE_URL + transactionId)}>
<TransactionId
onClick={() => openExternal(ZCASH_EXPLORER_BASE_URL + transactionId)}
>
<Ellipsis value={transactionId} />
</TransactionId>
</ColumnComponent>

View File

@ -1,4 +1,5 @@
// @flow
import React from 'react';
import styled from 'styled-components';
import dateFns from 'date-fns';
@ -97,9 +98,16 @@ export const TransactionItemComponent = ({
>
<RowComponent alignItems='center'>
<RowComponent alignItems='center'>
<Icon src={isReceived ? ReceivedIcon : SentIcon} alt='Transaction Type Icon' />
<Icon
src={isReceived ? ReceivedIcon : SentIcon}
alt='Transaction Type Icon'
/>
<TransactionColumn>
<TransactionTypeLabel isReceived={isReceived} value={type} isBold />
<TransactionTypeLabel
isReceived={isReceived}
value={type}
isBold
/>
<TransactionTime value={transactionTime} />
</TransactionColumn>
</RowComponent>
@ -111,7 +119,10 @@ export const TransactionItemComponent = ({
value={transactionValueInZec}
color={isReceived ? theme.colors.transactionReceived : theme.colors.transactionSent}
/>
<TextComponent value={transactionValueInUsd} color={theme.colors.inactiveItem} />
<TextComponent
value={transactionValueInUsd}
color={theme.colors.inactiveItem}
/>
</ColumnComponent>
</Wrapper>
)}

View File

@ -1,4 +1,5 @@
// @flow
import React, { Component } from 'react';
import styled from 'styled-components';
@ -57,18 +58,9 @@ export class WalletAddress extends Component<Props, State> {
isVisible: false,
};
show = () => {
this.setState(
() => ({ isVisible: true }),
);
};
hide = () => {
this.setState(
() => ({ isVisible: false }),
);
};
show = () => this.setState(() => ({ isVisible: true }));
hide = () => this.setState(() => ({ isVisible: false }));
render() {
const { address } = this.props;
@ -90,13 +82,11 @@ export class WalletAddress extends Component<Props, State> {
variant='secondary'
/>
</AddressWrapper>
{isVisible
? (
<QRCodeWrapper>
<QRCode value={address} />
</QRCodeWrapper>
)
: null}
{!isVisible ? null : (
<QRCodeWrapper>
<QRCode value={address} />
</QRCodeWrapper>
)}
</ColumnComponent>
);
}

View File

@ -1,4 +1,5 @@
// @flow
import React from 'react';
import styled from 'styled-components';
@ -70,22 +71,34 @@ export const WalletSummaryComponent = ({
</ValueBox>
<RowComponent>
<ValueBox>
<ShieldedValue value='&#9679; SHIELDED' isBold size={theme.fontSize.small} />
<ShieldedValue
value='&#9679; SHIELDED'
isBold
size={theme.fontSize.small}
/>
<TextComponent
value={`ZEC ${formatNumber({ value: shielded })}`}
isBold
size={theme.fontSize.medium}
/>
<USDValue value={`USD $${formatNumber({ value: shielded * zecPrice })}`} />
<USDValue
value={`USD $${formatNumber({ value: shielded * zecPrice })}`}
/>
</ValueBox>
<ValueBox>
<Label value='&#9679; TRANSPARENT' isBold size={theme.fontSize.small} />
<Label
value='&#9679; TRANSPARENT'
isBold
size={theme.fontSize.small}
/>
<TextComponent
value={`ZEC ${formatNumber({ value: transparent })}`}
isBold
size={theme.fontSize.medium}
/>
<USDValue value={`USD $${formatNumber({ value: transparent * zecPrice })}`} />
<USDValue
value={`USD $${formatNumber({ value: transparent * zecPrice })}`}
/>
</ValueBox>
</RowComponent>
</Wrapper>

View File

@ -13,7 +13,7 @@ import { DoczWrapper } from '../theme.js'
<PropsTable of={WalletSummaryComponent} />
## Basic usage
## Basic Usage
<Playground>
<DoczWrapper>

View File

@ -1,4 +1,5 @@
// @flow
import React, { type ComponentType, Component } from 'react';
import { LoadingScreen } from './loading-screen';

View File

@ -2,7 +2,10 @@
import React from 'react';
export const ZcashLogo = () => (
<svg xmlns='http://www.w3.org/2000/svg' viewBox='-75 -10 175 175'>
<svg
xmlns='http://www.w3.org/2000/svg'
viewBox='-75 -10 175 175'
>
<defs>
<style>{'.a{ fill:#040508; }'}</style>
</defs>

View File

@ -1,4 +1,5 @@
// @flow
import isDev from 'electron-is-dev';
export const ZCASH_EXPLORER_BASE_URL = isDev

View File

@ -1,4 +1,5 @@
// @flow
import DashboardIcon from '../assets/images/dashboard_icon.svg';
import DashboardIconActive from '../assets/images/dashboard_icon_active.svg';
import ConsoleIcon from '../assets/images/console_icon.svg';

View File

@ -1,4 +1,5 @@
// @flow
import { connect } from 'react-redux';
import { closeErrorModal } from '../redux/modules/app';

View File

@ -1,4 +1,5 @@
// @flow
import eres from 'eres';
import { connect } from 'react-redux';

View File

@ -1,6 +1,7 @@
// @flow
import { connect } from 'react-redux';
import eres from 'eres';
import { connect } from 'react-redux';
import { BigNumber } from 'bignumber.js';
import store from '../../config/electron-store';
@ -22,7 +23,10 @@ import { filterObjectNullKeys } from '../utils/filter-object-null-keys';
import type { AppState } from '../types/app-state';
import type { Dispatch } from '../types/redux';
import { loadAddressesSuccess, loadAddressesError } from '../redux/modules/receive';
import {
loadAddressesSuccess,
loadAddressesError,
} from '../redux/modules/receive';
export type SendTransactionInput = {
from: string,

View File

@ -1,4 +1,5 @@
// @flow
import { connect } from 'react-redux';
import { SettingsView } from '../views/settings';

View File

@ -1,6 +1,7 @@
// @flow
import { connect } from 'react-redux';
import eres from 'eres';
import { connect } from 'react-redux';
import flow from 'lodash.flow';
import groupBy from 'lodash.groupby';
import dateFns from 'date-fns';

View File

@ -1,4 +1,5 @@
// @flow
import type { Action } from '../../types/redux';
// Actions

View File

@ -1,4 +1,5 @@
// @flow
import type { Action } from '../../types/redux';
// Actions

View File

@ -67,6 +67,7 @@ const initialState: State = {
isToAddressValid: false,
zecPrice: 0,
};
// eslint-disable-next-line
export default (state: State = initialState, action: Action): State => {
switch (action.type) {

View File

@ -1,4 +1,5 @@
// @flow
import type { Action } from '../../types/redux';
import type { Transaction } from '../../components/transaction-item';
@ -46,6 +47,7 @@ const initialState = {
error: null,
isLoading: false,
};
// eslint-disable-next-line
export default (state: State = initialState, action: Action) => {
switch (action.type) {

View File

@ -1,4 +1,5 @@
// @flow
import type { Action } from '../../types/redux';
import type { TransactionsList } from './transactions';
@ -65,6 +66,7 @@ const initialState = {
addresses: [],
transactions: [],
};
// eslint-disable-next-line
export default (state: State = initialState, action: Action) => {
switch (action.type) {

View File

@ -1,4 +1,5 @@
// @flow
import { compose } from 'redux';
import { withRouter } from 'react-router-dom';
import { RouterComponent } from './router';

View File

@ -55,17 +55,39 @@ export const RouterComponent = ({
<FullWrapper>
<HeaderComponent title={getTitle(location.pathname)} />
<ContentWrapper>
<SidebarContainer location={location} history={history} />
<SidebarContainer
location={location}
history={history}
/>
{/* $FlowFixMe */}
<LayoutComponent>
<ScrollTopComponent>
<Switch>
<Route exact path={DASHBOARD_ROUTE} component={DashboardContainer} />
<Route path={SEND_ROUTE} component={SendContainer} />
<Route path={RECEIVE_ROUTE} component={ReceiveContainer} />
<Route path={SETTINGS_ROUTE} component={SettingsContainer} />
<Route path={CONSOLE_ROUTE} component={ConsoleView} />
<Route path={TRANSACTIONS_ROUTE} component={TransactionsContainer} />
<Route
exact
path={DASHBOARD_ROUTE}
component={DashboardContainer}
/>
<Route
path={SEND_ROUTE}
component={SendContainer}
/>
<Route
path={RECEIVE_ROUTE}
component={ReceiveContainer}
/>
<Route
path={SETTINGS_ROUTE}
component={SettingsContainer}
/>
<Route
path={CONSOLE_ROUTE}
component={ConsoleView}
/>
<Route
path={TRANSACTIONS_ROUTE}
component={TransactionsContainer}
/>
<Route component={NotFoundView} />
</Switch>
</ScrollTopComponent>

View File

@ -1,4 +1,5 @@
// @flow
import React, { Fragment } from 'react';
import theme from 'styled-theming';
import { ThemeProvider, createGlobalStyle } from 'styled-components';

View File

@ -1,4 +1,5 @@
// @flow
export const filterObjectNullKeys = (obj: Object) => Object.keys(obj).reduce((acc, cur) => {
if (obj[cur] === null || obj[cur] === undefined || obj[cur] === '') {
return acc;

View File

@ -1,4 +1,5 @@
// @flow
// eslint-disable-next-line
import electron from 'electron';

View File

@ -1,4 +1,5 @@
// @flow
/* eslint-disable max-len */
// $FlowFixMe
export default <T>(field: string) => (arr: T[]): T[] => arr.sort((a, b) => (a[field] < b[field] ? 1 : -1));

View File

@ -38,7 +38,7 @@ const defaultState = `
Thank you for running a Zcash node!
You're helping to strengthen the network and contributing to a social good :)
In order to ensure you are adequately protecting your privacy when using Zcash, please see <https://z.cash/support/security/>.
Block height | 0
Connections | 0
Network solution rate | 0 Sol/s
@ -80,7 +80,10 @@ export class ConsoleView extends Component<Props, State> {
return (
<Wrapper id='console-wrapper'>
<Fragment>
<ConsoleImg src={ConsoleSymbol} alt='Zcashd' />
<ConsoleImg
src={ConsoleSymbol}
alt='Zcashd'
/>
{log.split('\n').map((item, idx) => (
<Fragment key={uuid()}>
<ConsoleText value={item} />

View File

@ -22,8 +22,8 @@ type Props = {
export class DashboardView extends PureComponent<Props> {
componentDidMount() {
/* eslint-disable-next-line */
this.props.getSummary();
const { getSummary } = this.props;
getSummary();
}
render() {

View File

@ -1,4 +1,5 @@
// @flow
import React, { PureComponent } from 'react';
import styled from 'styled-components';
import { Transition, animated } from 'react-spring';
@ -106,16 +107,33 @@ export class ReceiveView extends PureComponent<Props, State> {
<WalletAddress key={addr} address={addr} />
))}
<Row>
<ActionButton onClick={this.toggleAdditionalOptions} isActive={showAdditionalOptions}>
<ActionIcon isActive={showAdditionalOptions} src={MenuIcon} alt='More Options' />
<ActionButton
onClick={this.toggleAdditionalOptions}
isActive={showAdditionalOptions}
>
<ActionIcon
isActive={showAdditionalOptions}
src={MenuIcon}
alt='More Options'
/>
<TextComponent value={buttonText} />
</ActionButton>
<ActionButton onClick={() => this.generateNewAddress('shielded')}>
<ActionIcon src={PlusIcon} alt='New Shielded Address' />
<ActionButton
onClick={() => this.generateNewAddress('shielded')}
>
<ActionIcon
src={PlusIcon}
alt='New Shielded Address'
/>
<TextComponent value='New Shielded Address' />
</ActionButton>
<ActionButton onClick={() => this.generateNewAddress('transparent')}>
<ActionIcon src={PlusIcon} alt='New Transparent Address' />
<ActionButton
onClick={() => this.generateNewAddress('transparent')}
>
<ActionIcon
src={PlusIcon}
alt='New Transparent Address'
/>
<TextComponent value='New Transparent Address' />
</ActionButton>
</Row>
@ -134,10 +152,19 @@ export class ReceiveView extends PureComponent<Props, State> {
>
{show => show
&& (props => (
<animated.div style={{ ...props, width: '100%', height: 'auto' }}>
<animated.div
style={{
...props,
width: '100%',
height: 'auto',
}}
>
<Label value='Transparent Address (not private)' />
{transparentAddresses.map(addr => (
<WalletAddress key={addr} address={addr} />
<WalletAddress
key={addr}
address={addr}
/>
))}
</animated.div>
))

View File

@ -1,4 +1,5 @@
// @flow
import React, { Fragment, PureComponent } from 'react';
import styled, { keyframes } from 'styled-components';
import { BigNumber } from 'bignumber.js';

View File

@ -1,4 +1,5 @@
// @flow
/* eslint-disable import/no-extraneous-dependencies */
import fs from 'fs';
import { promisify } from 'util';

View File

@ -1,4 +1,5 @@
// @flow
import React, { PureComponent, Fragment } from 'react';
import { TransactionDailyComponent } from '../components/transaction-daily';

View File

@ -6,6 +6,7 @@ import cp from 'child_process';
import getBinariesPath from './get-binaries-path';
import log from './logger';
// eslint-disable-next-line
export default (): Promise<*> => new Promise((resolve, reject) => {
const processName = path.join(getBinariesPath(), 'zcash-fetch-params');

View File

@ -49,7 +49,10 @@ const FILES: Array<{ name: string, hash: string }> = [
];
// eslint-disable-next-line max-len
const checkSha256 = (pathToFile: string, expectedHash: string) => new Promise((resolve, reject) => {
const checkSha256 = (
pathToFile: string,
expectedHash: string,
) => new Promise((resolve, reject) => {
fs.readFile(pathToFile, (err, file) => {
if (err) return reject(new Error(err));
@ -60,7 +63,10 @@ const checkSha256 = (pathToFile: string, expectedHash: string) => new Promise((r
});
// eslint-disable-next-line max-len
const downloadFile = ({ file, pathToSave }): Promise<*> => new Promise((resolve, reject) => {
const downloadFile = ({
file,
pathToSave,
}): Promise<*> => new Promise((resolve, reject) => {
if (!mainWindow.isDestroyed()) mainWindow.webContents.send('zcashd-params-download', `Downloading ${file.name}...`);
log(`Downloading ${file.name}...`);
@ -84,6 +90,7 @@ const downloadFile = ({ file, pathToSave }): Promise<*> => new Promise((resolve,
let missingDownloadParam = false;
// eslint-disable-next-line
export default (): Promise<*> => new Promise((resolve, reject) => {
const firstRunProcess = cp.spawn(path.join(getBinariesPath(), 'win', 'first-run.bat'));
firstRunProcess.stdout.on('data', data => log(data.toString()));

View File

@ -1,10 +1,12 @@
// @flow
import path from 'path';
/* eslint-disable-next-line import/no-extraneous-dependencies */
import isDev from 'electron-is-dev';
/* eslint-disable operator-linebreak */
// eslint-disable-next-line
export default () => (isDev
? path.join(__dirname, '..', '..', './bin')
// eslint-disable-next-line
: // $FlowFixMe
path.join(process.resourcesPath, 'bin'));

View File

@ -2,4 +2,5 @@
import os from 'os';
// eslint-disable-next-line
export default () => (os.platform() === 'win32' ? 'zcashd.exe' : 'zcashd');

View File

@ -1,6 +1,8 @@
// @flow
import os from 'os';
// eslint-disable-next-line
export default () => {
if (os.platform() === 'darwin') {
return 'mac';

View File

@ -1,4 +1,5 @@
// @flow
import path from 'path';
import os from 'os';

View File

@ -1,4 +1,4 @@
// @flow
/* eslint-disable-next-line no-console */
// eslint-disable-next-line
export default (...message: Array<*>) => console.log('[Zcash Daemon]', ...message);

View File

@ -1,4 +1,5 @@
// @flow
import fs from 'fs';
import { locateZcashConf } from './locate-zcash-conf';

View File

@ -1,10 +1,12 @@
// @flow
import os from 'os';
import log from './logger';
import fetchWindowsParams from './fetch-windows-params';
import runUnixFetchParams from './fetch-unix-params';
// eslint-disable-next-line
export default (): Promise<*> => {
log('Fetching params');

View File

@ -1,4 +1,5 @@
// @flow
import cp from 'child_process';
import path from 'path';
import os from 'os';
@ -120,4 +121,5 @@ const runDaemon: () => Promise<?ChildProcess> = () => new Promise(async (resolve
}
});
// eslint-disable-next-line
export default runDaemon;

View File

@ -1,6 +1,8 @@
// @flow
import Store from 'electron-store';
// eslint-disable-next-line
export default new Store({
encryptionKey: 'afr58kk5xg6tz5o4kmvmw',
});

View File

@ -1,4 +1,5 @@
// @flow
import '@babel/polyfill';
import dotenv from 'dotenv';
@ -8,7 +9,6 @@ import path from 'path';
import { app, BrowserWindow, typeof BrowserWindow as BrowserWindowType } from 'electron';
import { autoUpdater } from 'electron-updater';
import isDev from 'electron-is-dev';
import eres from 'eres';
import { registerDebugShortcut } from '../utils/debug-shortcut';
import runDaemon from './daemon/zcashd-child-process';
import zcashLog from './daemon/logger';
@ -46,6 +46,7 @@ const createWindow = () => {
progress.transferred
}/${progress.total})`,
));
autoUpdater.on('update-downloaded', () => {
updateAvailable = true;
showStatus('Update downloaded');

View File

@ -1,3 +1,5 @@
// @flow
const path = require('path');
const mainWebpack = require('./webpack-main.config');

View File

@ -1,3 +1,5 @@
// @flow
const HtmlWebPackPlugin = require('html-webpack-plugin'); // eslint-disable-line
const TerserPlugin = require('terser-webpack-plugin'); // eslint-disable-line
const autoprefixer = require('autoprefixer');

View File

@ -1,3 +1,5 @@
// @flow
const path = require('path');
const mainWebpack = require('./webpack-main.config');

View File

@ -1,4 +1,5 @@
// @flow
import got from 'got';
/* eslint-disable-next-line */
import isDev from 'electron-is-dev';
@ -20,7 +21,6 @@ const client = got.extend({
auth: `${RPC.user}:${RPC.password}`,
});
// $FlowFixMe
const api: APIMethods = METHODS.reduce(
(obj, method) => ({
...obj,
@ -39,4 +39,5 @@ const api: APIMethods = METHODS.reduce(
{},
);
// eslint-disable-next-line
export default api;

View File

@ -1,4 +1,5 @@
// @flow
import React, { type ComponentType, Component } from 'react';
import eres from 'eres';
@ -55,8 +56,8 @@ export const withSyncStatus = <PassedProps: {}>(
}
render() {
const { type, progress} = this.state;
const { type, progress } = this.state;
return <WrappedComponent {...this.props} {...this.state} type={type} progress={progress} />;
}
};
};

View File

@ -1,4 +1,5 @@
// @flow
/* eslint-disable max-len */
export const METHODS = [

View File

@ -1,4 +1,5 @@
// @flow
/* eslint-disable import/no-extraneous-dependencies */
// $FlowFixMe
import { net } from 'electron';
@ -11,6 +12,7 @@ type Payload = {
WARNING:
Just a super fast way to get the zec price
*/
// eslint-disable-next-line
export default (currencies: string[] = ['USD']): Promise<Payload> => new Promise((resolve, reject) => {
const ENDPOINT = `https://min-api.cryptocompare.com/data/price?fsym=ZEC&tsyms=${currencies.join(
',',

View File

@ -6,6 +6,5 @@ import { globalShortcut, typeof BrowserWindow, typeof app as ElectronApp } from
export const registerDebugShortcut = (app: ElectronApp, mainWindow: BrowserWindow) => globalShortcut.register('CommandOrControl+Option+B', () => {
// $FlowFixMe
app.dock.show();
// $FlowFixMe
mainWindow.webContents.openDevTools();
});