chore: general code cleanup
This commit is contained in:
parent
b99db4e7cf
commit
0726c8bdd2
|
@ -18,7 +18,7 @@ describe('Receive Actions', () => {
|
||||||
const payload = {
|
const payload = {
|
||||||
addresses: [
|
addresses: [
|
||||||
'tm0a9si0ds09gj02jj',
|
'tm0a9si0ds09gj02jj',
|
||||||
'smas098gk02jf0kskk'
|
'smas098gk02jf0kskk',
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ describe('Send Actions', () => {
|
||||||
|
|
||||||
test('should create an action to send transaction with success', () => {
|
test('should create an action to send transaction with success', () => {
|
||||||
const payload = {
|
const payload = {
|
||||||
operationId: '0b9ii4590ab-1d012klfo'
|
operationId: '0b9ii4590ab-1d012klfo',
|
||||||
};
|
};
|
||||||
|
|
||||||
store.dispatch(sendTransactionSuccess(payload));
|
store.dispatch(sendTransactionSuccess(payload));
|
||||||
|
@ -76,7 +76,7 @@ describe('Send Actions', () => {
|
||||||
|
|
||||||
test('should validate a address with success', () => {
|
test('should validate a address with success', () => {
|
||||||
const payload = {
|
const payload = {
|
||||||
isValid: true
|
isValid: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
store.dispatch(validateAddressSuccess(payload));
|
store.dispatch(validateAddressSuccess(payload));
|
||||||
|
@ -101,7 +101,7 @@ describe('Send Actions', () => {
|
||||||
|
|
||||||
test('should load ZEC price', () => {
|
test('should load ZEC price', () => {
|
||||||
const payload = {
|
const payload = {
|
||||||
value: 1.35
|
value: 1.35,
|
||||||
};
|
};
|
||||||
|
|
||||||
store.dispatch(loadZECPrice(payload));
|
store.dispatch(loadZECPrice(payload));
|
||||||
|
@ -109,7 +109,7 @@ describe('Send Actions', () => {
|
||||||
expect(store.getActions()[0]).toEqual(
|
expect(store.getActions()[0]).toEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
type: LOAD_ZEC_PRICE,
|
type: LOAD_ZEC_PRICE,
|
||||||
payload
|
payload,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,10 +16,10 @@ describe('<Button />', () => {
|
||||||
<ThemeProvider theme={appTheme}>
|
<ThemeProvider theme={appTheme}>
|
||||||
<Button
|
<Button
|
||||||
label='Click me!'
|
label='Click me!'
|
||||||
onClick={() => alert('Clicked')}
|
onClick={() => alert('Clicked')} // eslint-disable-line
|
||||||
variant='primary'
|
variant='primary'
|
||||||
/>
|
/>
|
||||||
</ThemeProvider>
|
</ThemeProvider>,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(queryByTestId('PrimaryButton')).toBeInTheDocument();
|
expect(queryByTestId('PrimaryButton')).toBeInTheDocument();
|
||||||
|
@ -30,13 +30,12 @@ describe('<Button />', () => {
|
||||||
<ThemeProvider theme={appTheme}>
|
<ThemeProvider theme={appTheme}>
|
||||||
<Button
|
<Button
|
||||||
label='Click me!'
|
label='Click me!'
|
||||||
onClick={() => alert('Clicked')}
|
onClick={() => alert('Clicked')} // eslint-disable-line
|
||||||
variant='secondary'
|
variant='secondary'
|
||||||
/>
|
/>
|
||||||
</ThemeProvider>
|
</ThemeProvider>,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(queryByTestId('SecondaryButton')).toBeInTheDocument();
|
expect(queryByTestId('SecondaryButton')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -30,5 +30,4 @@ describe('<Clipboard />', () => {
|
||||||
|
|
||||||
expect(queryByTestId('PrimaryButton')).toBeInTheDocument();
|
expect(queryByTestId('PrimaryButton')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,11 +12,18 @@ describe('<ConfirmDialogComponent />', () => {
|
||||||
test('should render confirm dialog correctly', () => {
|
test('should render confirm dialog correctly', () => {
|
||||||
const { container } = render(
|
const { container } = render(
|
||||||
<ConfirmDialogComponent
|
<ConfirmDialogComponent
|
||||||
title="Confirm example"
|
title='Confirm example'
|
||||||
onConfirm={() => alert('Confirm')}
|
onConfirm={() => alert('Confirm')} // eslint-disable-line
|
||||||
renderTrigger={toggle => <button onClick={toggle}> Open! </button>}
|
renderTrigger={toggle => (
|
||||||
|
<button
|
||||||
|
onClick={toggle}
|
||||||
|
type='button'
|
||||||
|
>
|
||||||
|
Open!
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{toggle => <div>Confirm content</div>}
|
{(/* toggle */) => <div>Confirm content</div>}
|
||||||
</ConfirmDialogComponent>,
|
</ConfirmDialogComponent>,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -26,11 +33,19 @@ describe('<ConfirmDialogComponent />', () => {
|
||||||
test('should render confirm dialog trigger', () => {
|
test('should render confirm dialog trigger', () => {
|
||||||
const { queryByTestId } = render(
|
const { queryByTestId } = render(
|
||||||
<ConfirmDialogComponent
|
<ConfirmDialogComponent
|
||||||
title="Confirm example"
|
title='Confirm example'
|
||||||
onConfirm={() => alert('Confirm')}
|
onConfirm={() => alert('Confirm')} // eslint-disable-line
|
||||||
renderTrigger={toggle => <button data-testid='ConfirmDialogTrigger' onClick={toggle}> Open! </button>}
|
renderTrigger={toggle => (
|
||||||
|
<button
|
||||||
|
data-testid='ConfirmDialogTrigger'
|
||||||
|
onClick={toggle}
|
||||||
|
type='button'
|
||||||
|
>
|
||||||
|
Open!
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{toggle => <div>Confirm content</div>}
|
{(/* toggle */) => <div>Confirm content</div>}
|
||||||
</ConfirmDialogComponent>,
|
</ConfirmDialogComponent>,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,10 @@ describe('<DropdownComponent />', () => {
|
||||||
test('should render dropdown correctly', () => {
|
test('should render dropdown correctly', () => {
|
||||||
const { queryByTestId } = render(
|
const { queryByTestId } = render(
|
||||||
<ThemeProvider theme={appTheme}>
|
<ThemeProvider theme={appTheme}>
|
||||||
<div style={{ height: '500px' }} data-testid='DropdownWrapper'>
|
<div
|
||||||
|
style={{ height: '500px' }}
|
||||||
|
data-testid='DropdownWrapper'
|
||||||
|
>
|
||||||
<DropdownComponent
|
<DropdownComponent
|
||||||
label='Addresses'
|
label='Addresses'
|
||||||
renderTrigger={toggleVisibility => (
|
renderTrigger={toggleVisibility => (
|
||||||
|
@ -60,5 +63,4 @@ describe('<DropdownComponent />', () => {
|
||||||
|
|
||||||
expect(queryByTestId('PrimaryButton')).toBeInTheDocument();
|
expect(queryByTestId('PrimaryButton')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe('<InputLabelComponent />', () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
const label = container.querySelector('p');
|
const label = container.querySelector('p');
|
||||||
|
|
||||||
expect(label).toBeVisible();
|
expect(label).toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,9 @@ describe('<InputComponent />', () => {
|
||||||
<InputComponent
|
<InputComponent
|
||||||
inputType='input'
|
inputType='input'
|
||||||
value='Hello World!'
|
value='Hello World!'
|
||||||
onChange={console.log}
|
onChange={console.log} // eslint-disable-line
|
||||||
/>
|
/>
|
||||||
</ThemeProvider>
|
</ThemeProvider>,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(queryByTestId('Input')).toBeInTheDocument();
|
expect(queryByTestId('Input')).toBeInTheDocument();
|
||||||
|
@ -31,10 +31,10 @@ describe('<InputComponent />', () => {
|
||||||
<InputComponent
|
<InputComponent
|
||||||
inputType='textarea'
|
inputType='textarea'
|
||||||
value='I am Zcash Electron Wallet'
|
value='I am Zcash Electron Wallet'
|
||||||
onChange={console.log}
|
onChange={console.log} // eslint-disable-line
|
||||||
rows={10}
|
rows={10}
|
||||||
/>
|
/>
|
||||||
</ThemeProvider>
|
</ThemeProvider>,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(queryByTestId('Textarea')).toBeInTheDocument();
|
expect(queryByTestId('Textarea')).toBeInTheDocument();
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe('<LoadingScreen />', () => {
|
||||||
test('should render status pill correctly', () => {
|
test('should render status pill correctly', () => {
|
||||||
const { queryByTestId } = render(
|
const { queryByTestId } = render(
|
||||||
<ThemeProvider theme={appTheme}>
|
<ThemeProvider theme={appTheme}>
|
||||||
<LoadingScreen progress={83.} />
|
<LoadingScreen progress={83.0} />
|
||||||
</ThemeProvider>,
|
</ThemeProvider>,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,11 @@ describe('<ModalComponent />', () => {
|
||||||
const { queryByTestId } = render(
|
const { queryByTestId } = render(
|
||||||
<ModalComponent
|
<ModalComponent
|
||||||
renderTrigger={toggleVisibility => (
|
renderTrigger={toggleVisibility => (
|
||||||
<button type="button" data-testid='ModalTrigger' onClick={toggleVisibility}>
|
<button
|
||||||
|
type='button'
|
||||||
|
data-testid='ModalTrigger'
|
||||||
|
onClick={toggleVisibility}
|
||||||
|
>
|
||||||
Open Modal
|
Open Modal
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
@ -21,7 +25,10 @@ describe('<ModalComponent />', () => {
|
||||||
{toggleVisibility => (
|
{toggleVisibility => (
|
||||||
<div style={{ padding: '50px', backgroundColor: 'white' }}>
|
<div style={{ padding: '50px', backgroundColor: 'white' }}>
|
||||||
Modal Content
|
Modal Content
|
||||||
<button type="button" onClick={toggleVisibility}>
|
<button
|
||||||
|
type='button'
|
||||||
|
onClick={toggleVisibility}
|
||||||
|
>
|
||||||
Close Modal
|
Close Modal
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,5 +38,4 @@ describe('<ModalComponent />', () => {
|
||||||
|
|
||||||
expect(queryByTestId('ModalTrigger')).toBeInTheDocument();
|
expect(queryByTestId('ModalTrigger')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,7 +15,7 @@ describe('<SelectComponent />', () => {
|
||||||
const { container } = render(
|
const { container } = render(
|
||||||
<ThemeProvider theme={appTheme}>
|
<ThemeProvider theme={appTheme}>
|
||||||
<SelectComponent
|
<SelectComponent
|
||||||
onChange={console.log}
|
onChange={console.log} // eslint-disable-line
|
||||||
value='asbh1yeasbdh23848asdasd'
|
value='asbh1yeasbdh23848asdasd'
|
||||||
placeholder='Select a address'
|
placeholder='Select a address'
|
||||||
options={[
|
options={[
|
||||||
|
|
|
@ -22,10 +22,9 @@ describe('<TransactionItem />', () => {
|
||||||
date={new Date().toISOString()}
|
date={new Date().toISOString()}
|
||||||
zecPrice={2.94}
|
zecPrice={2.94}
|
||||||
/>
|
/>
|
||||||
</ThemeProvider>
|
</ThemeProvider>,
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(container).toMatchSnapshot();
|
expect(container).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React from 'react';
|
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 { ThemeProvider } from 'styled-components';
|
||||||
import 'jest-dom/extend-expect';
|
import 'jest-dom/extend-expect';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { getApp } from '../setup/utils';
|
import { getApp } from '../setup/utils';
|
||||||
|
|
||||||
const app = getApp();
|
const app = getApp();
|
||||||
|
@ -8,6 +9,7 @@ beforeAll(async () => {
|
||||||
await app.client.waitUntilWindowLoaded();
|
await app.client.waitUntilWindowLoaded();
|
||||||
await app.client.waitUntilTextExists('#sidebar', 'Console');
|
await app.client.waitUntilTextExists('#sidebar', 'Console');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(() => app.stop());
|
afterAll(() => app.stop());
|
||||||
|
|
||||||
describe('Console', () => {
|
describe('Console', () => {
|
||||||
|
@ -16,8 +18,10 @@ describe('Console', () => {
|
||||||
|
|
||||||
expect(app.client.getText('#header p:first-child')).resolves.toEqual('Console');
|
expect(app.client.getText('#header p:first-child')).resolves.toEqual('Console');
|
||||||
|
|
||||||
expect(app.client.element('#console-wrapper img').getAttribute('src')).resolves.toEqual(
|
expect(app.client.element('#console-wrapper img')
|
||||||
expect.stringContaining('/assets/console_zcash.png'),
|
.getAttribute('src'))
|
||||||
);
|
.resolves.toEqual(
|
||||||
|
expect.stringContaining('/assets/console_zcash.png'),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { getApp } from '../setup/utils';
|
import { getApp } from '../setup/utils';
|
||||||
|
|
||||||
const app = getApp();
|
const app = getApp();
|
||||||
|
@ -9,29 +10,28 @@ beforeEach(async () => {
|
||||||
await app.client.waitUntilTextExists('#sidebar', 'Send');
|
await app.client.waitUntilTextExists('#sidebar', 'Send');
|
||||||
await app.client.element('#sidebar a:nth-child(2)').click();
|
await app.client.element('#sidebar a:nth-child(2)').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => app.stop());
|
afterEach(() => app.stop());
|
||||||
|
|
||||||
describe('Send', () => {
|
describe('Send', () => {
|
||||||
test('should load "Send Page"', async () => {
|
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 () => {
|
test('should show Additional Options click', async () => {
|
||||||
expect(app.client.element('#send-wrapper #send-fee-wrapper').isVisible()).resolves.toEqual(
|
expect(app.client.element('#send-wrapper #send-fee-wrapper')
|
||||||
false,
|
.isVisible()).resolves.toEqual(false);
|
||||||
);
|
|
||||||
|
|
||||||
await app.client.element('#send-show-additional-options-button').click();
|
await app.client.element('#send-show-additional-options-button').click();
|
||||||
|
|
||||||
expect(app.client.element('#send-wrapper #send-fee-wrapper').isVisible()).resolves.toEqual(
|
expect(app.client.element('#send-wrapper #send-fee-wrapper')
|
||||||
true,
|
.isVisible()).resolves.toEqual(true);
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should disable send button if required fields are empty', async () => {
|
test('should disable send button if required fields are empty', async () => {
|
||||||
expect(app.client.element('#send-submit-button').getAttribute('disabled')).resolves.toEqual(
|
expect(app.client.element('#send-submit-button')
|
||||||
true,
|
.getAttribute('disabled')).resolves.toEqual(true);
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should enable send button if required fields are filled', async () => {
|
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();
|
await app.client.element('#send-submit-button').click();
|
||||||
|
|
||||||
expect(app.client.element('#send-confirm-transaction-modal').isVisible()).resolves.toEqual(
|
expect(app.client.element('#send-confirm-transaction-modal')
|
||||||
true,
|
.isVisible()).resolves.toEqual(true);
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should display a load indicator while the transaction is processed', async () => {
|
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('#send-submit-button').click();
|
||||||
await app.client.element('#confirm-modal-button').click();
|
await app.client.element('#confirm-modal-button').click();
|
||||||
|
|
||||||
expect(app.client.getAttribute('#send-confirm-transaction-modal img', 'src')).resolves.toEqual(
|
expect(app.client.getAttribute('#send-confirm-transaction-modal img', 'src')).resolves.toEqual(
|
||||||
expect.stringContaining('/assets/sync_icon.png'),
|
expect.stringContaining('/assets/sync_icon.png'),
|
||||||
);
|
);
|
||||||
expect(app.client.getText('#send-confirm-transaction-modal p')).resolves.toEqual(
|
expect(app.client.getText('#send-confirm-transaction-modal p'))
|
||||||
'Processing transaction...',
|
.resolves.toEqual('Processing transaction...');
|
||||||
);
|
expect(app.client.element('#confirm-modal-button')
|
||||||
expect(app.client.element('#confirm-modal-button').isVisible()).resolves.toEqual(false);
|
.isVisible()).resolves.toEqual(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('should show an error in invalid transaction', async () => {
|
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(1)').click();
|
||||||
await app.client.element('#sidebar a:nth-child(2)').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 () => {
|
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(1)').click();
|
||||||
await app.client.element('#sidebar a:nth-child(2)').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');
|
await app.client.waitUntilTextExists('#transaction-item-operation-id-1', 'Send');
|
||||||
|
|
||||||
expect(await app.client.element('#transaction-item-operation-id-1 img').isVisible()).toEqual(
|
expect(await app.client.element('#transaction-item-operation-id-1 img')
|
||||||
true,
|
.isVisible()).toEqual(true);
|
||||||
);
|
|
||||||
expect(
|
expect(
|
||||||
await app.client.element('#transaction-item-operation-id-1 img').getAttribute('src'),
|
await app.client.element('#transaction-item-operation-id-1 img').getAttribute('src'),
|
||||||
).toEndWith('/assets/transaction_sent_icon.svg');
|
).toEndWith('/assets/transaction_sent_icon.svg');
|
||||||
|
|
|
@ -9,6 +9,7 @@ beforeAll(async () => {
|
||||||
await app.client.waitUntilWindowLoaded();
|
await app.client.waitUntilWindowLoaded();
|
||||||
await app.client.waitUntilTextExists('#sidebar', 'Dashboard');
|
await app.client.waitUntilTextExists('#sidebar', 'Dashboard');
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(() => app.stop());
|
afterAll(() => app.stop());
|
||||||
|
|
||||||
describe('Sidebar', () => {
|
describe('Sidebar', () => {
|
||||||
|
@ -17,9 +18,8 @@ describe('Sidebar', () => {
|
||||||
|
|
||||||
expect(await app.client.getUrl()).toEndWith('/');
|
expect(await app.client.getUrl()).toEndWith('/');
|
||||||
|
|
||||||
expect(await app.client.element('#sidebar a:nth-child(1)').getHTML()).toEqual(
|
expect(await app.client.element('#sidebar a:nth-child(1)')
|
||||||
expect.stringContaining('Dashboard'),
|
.getHTML()).toEqual(expect.stringContaining('Dashboard'));
|
||||||
);
|
|
||||||
|
|
||||||
expect(await app.client.element('#sidebar a:nth-child(1) img').getAttribute('src')).toEqual(
|
expect(await app.client.element('#sidebar a:nth-child(1) img').getAttribute('src')).toEqual(
|
||||||
expect.stringContaining('/assets/dashboard_icon_active.svg'),
|
expect.stringContaining('/assets/dashboard_icon_active.svg'),
|
||||||
|
@ -31,11 +31,11 @@ describe('Sidebar', () => {
|
||||||
|
|
||||||
expect(await app.client.getUrl()).toEndWith('/send');
|
expect(await app.client.getUrl()).toEndWith('/send');
|
||||||
|
|
||||||
expect(await app.client.element('#sidebar a:nth-child(2)').getHTML()).toEqual(
|
expect(await app.client.element('#sidebar a:nth-child(2)')
|
||||||
expect.stringContaining('Send'),
|
.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'),
|
expect.stringContaining('/assets/send_icon_active.svg'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -45,11 +45,11 @@ describe('Sidebar', () => {
|
||||||
|
|
||||||
expect(await app.client.getUrl()).toEndWith('/receive');
|
expect(await app.client.getUrl()).toEndWith('/receive');
|
||||||
|
|
||||||
expect(await app.client.element('#sidebar a:nth-child(3)').getHTML()).toEqual(
|
expect(await app.client.element('#sidebar a:nth-child(3)')
|
||||||
expect.stringContaining('Receive'),
|
.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'),
|
expect.stringContaining('/assets/receive_icon_active.svg'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -59,11 +59,11 @@ describe('Sidebar', () => {
|
||||||
|
|
||||||
expect(await app.client.getUrl()).toEndWith('/transactions');
|
expect(await app.client.getUrl()).toEndWith('/transactions');
|
||||||
|
|
||||||
expect(await app.client.element('#sidebar a:nth-child(4)').getHTML()).toEqual(
|
expect(await app.client.element('#sidebar a:nth-child(4)')
|
||||||
expect.stringContaining('Transactions'),
|
.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'),
|
expect.stringContaining('/assets/transactions_icon_active.svg'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -73,11 +73,11 @@ describe('Sidebar', () => {
|
||||||
|
|
||||||
expect(await app.client.getUrl()).toEndWith('/settings');
|
expect(await app.client.getUrl()).toEndWith('/settings');
|
||||||
|
|
||||||
expect(await app.client.element('#sidebar a:nth-child(5)').getHTML()).toEqual(
|
expect(await app.client.element('#sidebar a:nth-child(5)')
|
||||||
expect.stringContaining('Settings'),
|
.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'),
|
expect.stringContaining('/assets/settings_icon_active.svg'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -87,11 +87,11 @@ describe('Sidebar', () => {
|
||||||
|
|
||||||
expect(await app.client.getUrl()).toEndWith('/console');
|
expect(await app.client.getUrl()).toEndWith('/console');
|
||||||
|
|
||||||
expect(await app.client.element('#sidebar a:nth-child(6)').getHTML()).toEqual(
|
expect(await app.client.element('#sidebar a:nth-child(6)')
|
||||||
expect.stringContaining('Console'),
|
.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'),
|
expect.stringContaining('/assets/console_icon_active.svg'),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,6 +8,7 @@ beforeAll(async () => {
|
||||||
await app.start();
|
await app.start();
|
||||||
await app.client.waitUntilWindowLoaded();
|
await app.client.waitUntilWindowLoaded();
|
||||||
});
|
});
|
||||||
|
|
||||||
afterAll(() => app.stop());
|
afterAll(() => app.stop());
|
||||||
|
|
||||||
describe('Startup', () => {
|
describe('Startup', () => {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { getApp } from '../setup/utils';
|
import { getApp } from '../setup/utils';
|
||||||
|
|
||||||
const app = getApp();
|
const app = getApp();
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import walletSummaryReducer, {
|
import walletSummaryReducer, {
|
||||||
LOAD_WALLET_SUMMARY,
|
LOAD_WALLET_SUMMARY,
|
||||||
LOAD_WALLET_SUMMARY_SUCCESS,
|
LOAD_WALLET_SUMMARY_SUCCESS,
|
||||||
|
@ -80,9 +81,9 @@ describe('WalletSummary Reducer', () => {
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
addresses: [],
|
addresses: [],
|
||||||
transactions: [],
|
transactions: [],
|
||||||
zecPrice: 0
|
zecPrice: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(walletSummaryReducer(undefined, action)).toEqual(expectedState);
|
expect(walletSummaryReducer(undefined, action)).toEqual(expectedState);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
process(filename) {
|
process(filename: any) {
|
||||||
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
|
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-unresolved
|
// eslint-disable-next-line import/no-unresolved
|
||||||
require('jest-extended');
|
require('jest-extended');
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||||
import 'babel-polyfill';
|
import 'babel-polyfill';
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ const sleep = (time: number) => new Promise(resolve => setTimeout(resolve, time)
|
||||||
createTestServer({
|
createTestServer({
|
||||||
httpPort: '18232',
|
httpPort: '18232',
|
||||||
}).then(async (server) => {
|
}).then(async (server) => {
|
||||||
console.log('[MOCK RPC API]', server.url);
|
console.log('[MOCK RPC API]', server.url); // eslint-disable-line
|
||||||
|
|
||||||
server.get('/', (req, res) => {
|
server.get('/', (req, res) => {
|
||||||
res.send('Zcash RPC');
|
res.send('Zcash RPC');
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
/* eslint-disable import/no-extraneous-dependencies */
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
import electron from 'electron';
|
import electron from 'electron';
|
||||||
import { Application } from 'spectron';
|
import { Application } from 'spectron';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import 'jest-dom/extend-expect';
|
import 'jest-dom/extend-expect';
|
||||||
|
|
||||||
import { filterObjectNullKeys } from '../../app/utils/filter-object-null-keys';
|
import { filterObjectNullKeys } from '../../app/utils/filter-object-null-keys';
|
||||||
|
@ -18,5 +19,5 @@ describe('filterObjectNullKeys', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
expect(filterObjectNullKeys(initialState)).toEqual(expectedState);
|
expect(filterObjectNullKeys(initialState)).toEqual(expectedState);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { BigNumber } from 'bignumber.js';
|
import { BigNumber } from 'bignumber.js';
|
||||||
import 'jest-dom/extend-expect';
|
import 'jest-dom/extend-expect';
|
||||||
|
|
||||||
|
@ -34,4 +35,4 @@ describe('formatNumber', () => {
|
||||||
|
|
||||||
expect(myBalanceInUsd).toEqual(expectedState);
|
expect(myBalanceInUsd).toEqual(expectedState);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import 'jest-dom/extend-expect';
|
import 'jest-dom/extend-expect';
|
||||||
|
|
||||||
import { getTimestamp } from '../../app/utils/timestamp';
|
import { getTimestamp } from '../../app/utils/timestamp';
|
||||||
|
@ -8,6 +9,5 @@ describe('generate timestamp', () => {
|
||||||
const now = getTimestamp();
|
const now = getTimestamp();
|
||||||
|
|
||||||
expect(now).toEqual(expect.any(Number));
|
expect(now).toEqual(expect.any(Number));
|
||||||
|
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import 'jest-dom/extend-expect';
|
import 'jest-dom/extend-expect';
|
||||||
|
|
||||||
import { truncateAddress } from '../../app/utils/truncate-address';
|
import { truncateAddress } from '../../app/utils/truncate-address';
|
||||||
|
@ -11,4 +12,4 @@ describe('truncateAddress', () => {
|
||||||
|
|
||||||
expect(myAddress).toEqual(expectedState);
|
expect(myAddress).toEqual(expectedState);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React from 'react';
|
import React, { type ElementProps } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
/* eslint-disable import/no-extraneous-dependencies */
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
import { darken } from 'polished';
|
import { darken } from 'polished';
|
||||||
import type { ElementProps } from 'react';
|
|
||||||
|
|
||||||
const DefaultButton = styled.button`
|
const DefaultButton = styled.button`
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -102,12 +101,18 @@ export const Button = ({
|
||||||
const buttonLabel = isLoading ? 'Loading...' : label;
|
const buttonLabel = isLoading ? 'Loading...' : label;
|
||||||
|
|
||||||
const component = variant === 'primary' ? (
|
const component = variant === 'primary' ? (
|
||||||
<Primary {...props} data-testid='PrimaryButton'>
|
<Primary
|
||||||
|
{...props}
|
||||||
|
data-testid='PrimaryButton'
|
||||||
|
>
|
||||||
{icon ? <Icon src={icon} /> : null}
|
{icon ? <Icon src={icon} /> : null}
|
||||||
{buttonLabel}
|
{buttonLabel}
|
||||||
</Primary>
|
</Primary>
|
||||||
) : (
|
) : (
|
||||||
<Secondary {...props} data-testid='SecondaryButton'>
|
<Secondary
|
||||||
|
{...props}
|
||||||
|
data-testid='SecondaryButton'
|
||||||
|
>
|
||||||
{icon ? <Icon src={icon} /> : null}
|
{icon ? <Icon src={icon} /> : null}
|
||||||
{buttonLabel}
|
{buttonLabel}
|
||||||
</Secondary>
|
</Secondary>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
|
|
||||||
import { Button } from './button';
|
import { Button } from './button';
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React, { type Element } from 'react';
|
|
||||||
|
import React, { Fragment, type Element } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { TextComponent } from './text';
|
import { TextComponent } from './text';
|
||||||
|
@ -82,15 +83,21 @@ export const ConfirmDialogComponent = ({
|
||||||
{toggle => (
|
{toggle => (
|
||||||
<Wrapper width={Number(width)}>
|
<Wrapper width={Number(width)}>
|
||||||
<CloseIconWrapper>
|
<CloseIconWrapper>
|
||||||
<CloseIconImg src={CloseIcon} onClick={handleClose(toggle)} />
|
<CloseIconImg
|
||||||
|
src={CloseIcon}
|
||||||
|
onClick={handleClose(toggle)}
|
||||||
|
/>
|
||||||
</CloseIconWrapper>
|
</CloseIconWrapper>
|
||||||
<TitleWrapper>
|
<TitleWrapper>
|
||||||
<TextComponent value={title} align='center' />
|
<TextComponent
|
||||||
|
value={title}
|
||||||
|
align='center'
|
||||||
|
/>
|
||||||
</TitleWrapper>
|
</TitleWrapper>
|
||||||
<Divider opacity={0.3} />
|
<Divider opacity={0.3} />
|
||||||
{children(handleClose(toggle))}
|
{children(handleClose(toggle))}
|
||||||
{showButtons && (
|
{showButtons && (
|
||||||
<>
|
<Fragment>
|
||||||
<Btn
|
<Btn
|
||||||
id='confirm-modal-button'
|
id='confirm-modal-button'
|
||||||
label='Confirm'
|
label='Confirm'
|
||||||
|
@ -103,7 +110,7 @@ export const ConfirmDialogComponent = ({
|
||||||
variant='secondary'
|
variant='secondary'
|
||||||
disabled={isLoading}
|
disabled={isLoading}
|
||||||
/>
|
/>
|
||||||
</>
|
</Fragment>
|
||||||
)}
|
)}
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
export const Divider = styled.div`
|
export const Divider = styled.div`
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { type Node, Component } from 'react';
|
import React, { type Node, Component } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
/* eslint-disable import/no-extraneous-dependencies */
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
|
@ -99,16 +100,30 @@ export class DropdownComponent extends Component<Props, State> {
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const body = [
|
const body = [
|
||||||
<ClickOutside onClickOutside={() => this.setState(() => ({ isOpen: false }))}>
|
<ClickOutside
|
||||||
|
onClickOutside={() => this.setState(() => ({ isOpen: false }))}
|
||||||
|
>
|
||||||
<MenuWrapper>
|
<MenuWrapper>
|
||||||
{label && (
|
{label && (
|
||||||
<MenuItem disabled isGroupLabel>
|
<MenuItem
|
||||||
<TextComponent value={label} isBold />
|
disabled
|
||||||
|
isGroupLabel
|
||||||
|
>
|
||||||
|
<TextComponent
|
||||||
|
value={label}
|
||||||
|
isBold
|
||||||
|
/>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
{options.map(({ label: optionLabel, onClick }) => (
|
{options.map(({ label: optionLabel, onClick }) => (
|
||||||
<OptionItem onClick={onClick} key={optionLabel} data-testid='DropdownOption'>
|
<OptionItem
|
||||||
<Option value={truncate ? truncateAddress(optionLabel) : optionLabel} />
|
onClick={onClick}
|
||||||
|
key={optionLabel}
|
||||||
|
data-testid='DropdownOption'
|
||||||
|
>
|
||||||
|
<Option
|
||||||
|
value={truncate ? truncateAddress(optionLabel) : optionLabel}
|
||||||
|
/>
|
||||||
</OptionItem>
|
</OptionItem>
|
||||||
))}
|
))}
|
||||||
</MenuWrapper>
|
</MenuWrapper>
|
||||||
|
@ -123,7 +138,9 @@ export class DropdownComponent extends Component<Props, State> {
|
||||||
tipSize={7}
|
tipSize={7}
|
||||||
body={body}
|
body={body}
|
||||||
>
|
>
|
||||||
{renderTrigger(() => this.setState(state => ({ isOpen: !state.isOpen })), isOpen)}
|
{renderTrigger(() => this.setState(state => ({
|
||||||
|
isOpen: !state.isOpen,
|
||||||
|
})), isOpen)}
|
||||||
</PopoverWithStyle>
|
</PopoverWithStyle>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
@ -78,17 +79,21 @@ export class ErrorModalComponent extends PureComponent<Props> {
|
||||||
render() {
|
render() {
|
||||||
const { isVisible, message, onRequestClose } = this.props;
|
const { isVisible, message, onRequestClose } = this.props;
|
||||||
|
|
||||||
return isVisible
|
return !isVisible ? null : createPortal(
|
||||||
? createPortal(
|
<ModalWrapper id='error-modal-portal-wrapper'>
|
||||||
<ModalWrapper id='error-modal-portal-wrapper'>
|
<ChildrenWrapper>
|
||||||
<ChildrenWrapper>
|
<ErrorImage
|
||||||
<ErrorImage src={ErrorIcon} alt='Error Icon' />
|
src={ErrorIcon}
|
||||||
<Message value={message} />
|
alt='Error Icon'
|
||||||
<Button label='Ok!' onClick={onRequestClose} />
|
/>
|
||||||
</ChildrenWrapper>
|
<Message value={message} />
|
||||||
</ModalWrapper>,
|
<Button
|
||||||
this.element,
|
label='Ok!'
|
||||||
)
|
onClick={onRequestClose}
|
||||||
: null;
|
/>
|
||||||
|
</ChildrenWrapper>
|
||||||
|
</ModalWrapper>,
|
||||||
|
this.element,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
|
||||||
|
|
||||||
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { ZcashLogo } from './zcash-logo';
|
import { ZcashLogo } from './zcash-logo';
|
||||||
|
@ -69,9 +69,15 @@ export const HeaderComponent = ({ title }: Props) => (
|
||||||
<ZcashLogo />
|
<ZcashLogo />
|
||||||
</LogoWrapper>
|
</LogoWrapper>
|
||||||
<TitleWrapper>
|
<TitleWrapper>
|
||||||
<TitleRow alignItems='center' justifyContent='space-around'>
|
<TitleRow
|
||||||
|
alignItems='center'
|
||||||
|
justifyContent='space-around'
|
||||||
|
>
|
||||||
<Title value={title} />
|
<Title value={title} />
|
||||||
<Status type='syncing' progress={0} />
|
<Status
|
||||||
|
type='syncing'
|
||||||
|
progress={0}
|
||||||
|
/>
|
||||||
</TitleRow>
|
</TitleRow>
|
||||||
<Divider opacity={0.1} />
|
<Divider opacity={0.1} />
|
||||||
</TitleWrapper>
|
</TitleWrapper>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
import { TextComponent } from './text';
|
import { TextComponent } from './text';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { type Element } from 'react';
|
import React, { type Element } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
@ -55,7 +56,6 @@ export const InputComponent = ({
|
||||||
...props
|
...props
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const rightElement = renderRight();
|
const rightElement = renderRight();
|
||||||
|
|
||||||
const inputTypes = {
|
const inputTypes = {
|
||||||
input: () => (
|
input: () => (
|
||||||
<Input
|
<Input
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { type Element } from 'react';
|
import React, { type Element } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Transition, animated } from 'react-spring';
|
import { Transition, animated } from 'react-spring';
|
||||||
|
@ -86,6 +87,7 @@ export class LoadingScreen extends PureComponent<Props, State> {
|
||||||
>
|
>
|
||||||
{() => props => (
|
{() => props => (
|
||||||
<animated.div
|
<animated.div
|
||||||
|
id='loading-screen'
|
||||||
style={{
|
style={{
|
||||||
...props,
|
...props,
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
|
@ -93,13 +95,15 @@ export class LoadingScreen extends PureComponent<Props, State> {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
}}
|
}}
|
||||||
id='loading-screen'
|
|
||||||
>
|
>
|
||||||
<CircleWrapper>
|
<CircleWrapper>
|
||||||
<Logo src={zcashLogo} alt='Zcash logo' />
|
<Logo
|
||||||
|
src={zcashLogo}
|
||||||
|
alt='Zcash Logo'
|
||||||
|
/>
|
||||||
<CircleProgressComponent
|
<CircleProgressComponent
|
||||||
progress={progress}
|
progress={progress}
|
||||||
s
|
s // TODO: check if this has any effect
|
||||||
responsive
|
responsive
|
||||||
showPercentage={false}
|
showPercentage={false}
|
||||||
progressColor={theme.colors.activeItem}
|
progressColor={theme.colors.activeItem}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { PureComponent, Fragment, type Element } from 'react';
|
import React, { PureComponent, Fragment, type Element } from 'react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
@ -69,23 +70,19 @@ export class ModalComponent extends PureComponent<Props, State> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
open = () => {
|
open = () => this.setState(
|
||||||
this.setState(
|
() => ({ isVisible: true }),
|
||||||
() => ({ isVisible: true }),
|
() => {
|
||||||
() => {
|
if (modalRoot) modalRoot.appendChild(this.element);
|
||||||
if (modalRoot) modalRoot.appendChild(this.element);
|
},
|
||||||
},
|
);
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
close = () => {
|
close = () => this.setState(
|
||||||
this.setState(
|
() => ({ isVisible: false }),
|
||||||
() => ({ isVisible: false }),
|
() => {
|
||||||
() => {
|
if (modalRoot) modalRoot.removeChild(this.element);
|
||||||
if (modalRoot) modalRoot.removeChild(this.element);
|
},
|
||||||
},
|
);
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { renderTrigger, children, closeOnBackdropClick } = this.props;
|
const { renderTrigger, children, closeOnBackdropClick } = this.props;
|
||||||
|
@ -95,23 +92,21 @@ export class ModalComponent extends PureComponent<Props, State> {
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
{renderTrigger(toggleVisibility)}
|
{renderTrigger(toggleVisibility)}
|
||||||
{isVisible
|
{!isVisible ? null : createPortal(
|
||||||
? createPortal(
|
<ModalWrapper
|
||||||
<ModalWrapper
|
id='modal-portal-wrapper'
|
||||||
id='modal-portal-wrapper'
|
data-testid='Modal'
|
||||||
data-testid='Modal'
|
onClick={(event) => {
|
||||||
onClick={(event) => {
|
if (
|
||||||
if (
|
closeOnBackdropClick
|
||||||
closeOnBackdropClick
|
&& event.target.id === 'modal-portal-wrapper'
|
||||||
&& event.target.id === 'modal-portal-wrapper'
|
) this.close();
|
||||||
) this.close();
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<ChildrenWrapper>{children(toggleVisibility)}</ChildrenWrapper>
|
||||||
<ChildrenWrapper>{children(toggleVisibility)}</ChildrenWrapper>
|
</ModalWrapper>,
|
||||||
</ModalWrapper>,
|
this.element,
|
||||||
this.element,
|
)}
|
||||||
)
|
|
||||||
: null}
|
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,15 @@ import { ModalComponent } from './modal.js'
|
||||||
|
|
||||||
<PropsTable of={ModalComponent} />
|
<PropsTable of={ModalComponent} />
|
||||||
|
|
||||||
## Basic usage
|
## Basic Usage
|
||||||
|
|
||||||
<Playground>
|
<Playground>
|
||||||
<ModalComponent
|
<ModalComponent
|
||||||
renderTrigger={toggleVisibility => (
|
renderTrigger={toggleVisibility => (
|
||||||
<button type="button" onClick={toggleVisibility}>
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={toggleVisibility}
|
||||||
|
>
|
||||||
Open Modal
|
Open Modal
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
@ -25,7 +28,10 @@ import { ModalComponent } from './modal.js'
|
||||||
{toggleVisibility => (
|
{toggleVisibility => (
|
||||||
<div style={{ padding: '50px', backgroundColor: 'white' }}>
|
<div style={{ padding: '50px', backgroundColor: 'white' }}>
|
||||||
Modal Content
|
Modal Content
|
||||||
<button type="button" onClick={toggleVisibility}>
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={toggleVisibility}
|
||||||
|
>
|
||||||
Close Modal
|
Close Modal
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -40,7 +46,10 @@ import { ModalComponent } from './modal.js'
|
||||||
closeOnEsc={false}
|
closeOnEsc={false}
|
||||||
closeOnBackdropClick={false}
|
closeOnBackdropClick={false}
|
||||||
renderTrigger={toggleVisibility => (
|
renderTrigger={toggleVisibility => (
|
||||||
<button type="button" onClick={toggleVisibility}>
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={toggleVisibility}
|
||||||
|
>
|
||||||
Open Modal
|
Open Modal
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
@ -48,7 +57,10 @@ import { ModalComponent } from './modal.js'
|
||||||
{toggleVisibility => (
|
{toggleVisibility => (
|
||||||
<div style={{ padding: '50px', backgroundColor: 'white' }}>
|
<div style={{ padding: '50px', backgroundColor: 'white' }}>
|
||||||
Modal Content
|
Modal Content
|
||||||
<button type="button" onClick={toggleVisibility}>
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={toggleVisibility}
|
||||||
|
>
|
||||||
Close Modal
|
Close Modal
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,7 +9,11 @@ type Props = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const QRCode = ({ value, size }: 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 = {
|
QRCode.defaultProps = {
|
||||||
|
|
|
@ -12,13 +12,13 @@ import { QRCode } from './qrcode.js'
|
||||||
|
|
||||||
<PropsTable of={QRCode} />
|
<PropsTable of={QRCode} />
|
||||||
|
|
||||||
## Basic usage
|
## Basic Usage
|
||||||
|
|
||||||
<Playground>
|
<Playground>
|
||||||
<QRCode value='https://z.cash.foundation' />
|
<QRCode value='https://z.cash.foundation' />
|
||||||
</Playground>
|
</Playground>
|
||||||
|
|
||||||
## Custom size
|
## Custom Size
|
||||||
|
|
||||||
<Playground>
|
<Playground>
|
||||||
<QRCode
|
<QRCode
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ const SelectMenuButtonWrapper = styled.div`
|
||||||
padding: 13px;
|
padding: 13px;
|
||||||
border-left: ${props => `1px solid ${props.theme.colors.background}`};
|
border-left: ${props => `1px solid ${props.theme.colors.background}`};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
const SelectMenuButton = styled.button`
|
const SelectMenuButton = styled.button`
|
||||||
padding: 3px 7px;
|
padding: 3px 7px;
|
||||||
|
@ -100,6 +102,7 @@ type Props = {
|
||||||
placement?: 'top' | 'bottom',
|
placement?: 'top' | 'bottom',
|
||||||
bgColor?: string,
|
bgColor?: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
isOpen: boolean,
|
isOpen: boolean,
|
||||||
};
|
};
|
||||||
|
@ -123,7 +126,10 @@ export class SelectComponent extends PureComponent<Props, State> {
|
||||||
|
|
||||||
handleClickOutside = (event: Object) => {
|
handleClickOutside = (event: Object) => {
|
||||||
const { isOpen } = this.state;
|
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) => {
|
getSelectedLabel = (value: string) => {
|
||||||
|
@ -145,10 +151,10 @@ export class SelectComponent extends PureComponent<Props, State> {
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { isOpen } = this.state;
|
||||||
const {
|
const {
|
||||||
value, options, placeholder, placement, bgColor,
|
value, options, placeholder, placement, bgColor,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
const { isOpen } = this.state;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SelectWrapper
|
<SelectWrapper
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
@ -15,6 +16,7 @@ const Wrapper = styled.div`
|
||||||
padding-top: 15px;
|
padding-top: 15px;
|
||||||
position: relative;
|
position: relative;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
const StyledLink = styled.a`
|
const StyledLink = styled.a`
|
||||||
color: ${props => (props.isActive ? props.theme.colors.sidebarItemActive : props.theme.colors.sidebarItem)};
|
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}
|
key={item.route}
|
||||||
onClick={() => (isActive ? {} : history.push(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}
|
{item.label}
|
||||||
</StyledLink>
|
</StyledLink>
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import styled, { keyframes } from 'styled-components';
|
import styled, { keyframes } from 'styled-components';
|
||||||
import eres from 'eres';
|
import eres from 'eres';
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { DoczWrapper } from '../theme.js'
|
||||||
|
|
||||||
<Playground>
|
<Playground>
|
||||||
<DoczWrapper>
|
<DoczWrapper>
|
||||||
{() =>
|
{() =>
|
||||||
<StatusPill
|
<StatusPill
|
||||||
progress={99.3}
|
progress={99.3}
|
||||||
type='syncing'
|
type='syncing'
|
||||||
|
@ -30,7 +30,7 @@ import { DoczWrapper } from '../theme.js'
|
||||||
|
|
||||||
<Playground>
|
<Playground>
|
||||||
<DoczWrapper>
|
<DoczWrapper>
|
||||||
{() =>
|
{() =>
|
||||||
<StatusPill
|
<StatusPill
|
||||||
progress={100.}
|
progress={100.}
|
||||||
type='ready'
|
type='ready'
|
||||||
|
@ -44,7 +44,7 @@ import { DoczWrapper } from '../theme.js'
|
||||||
|
|
||||||
<Playground>
|
<Playground>
|
||||||
<DoczWrapper>
|
<DoczWrapper>
|
||||||
{() =>
|
{() =>
|
||||||
<StatusPill
|
<StatusPill
|
||||||
progress={0.}
|
progress={0.}
|
||||||
type='error'
|
type='error'
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import dateFns from 'date-fns';
|
import dateFns from 'date-fns';
|
||||||
|
@ -143,13 +144,22 @@ export const TransactionDetailsComponent = ({
|
||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<CloseIconWrapper>
|
<CloseIconWrapper>
|
||||||
<CloseIconImg src={CloseIcon} onClick={handleClose} />
|
<CloseIconImg
|
||||||
|
src={CloseIcon}
|
||||||
|
onClick={handleClose}
|
||||||
|
/>
|
||||||
</CloseIconWrapper>
|
</CloseIconWrapper>
|
||||||
<TitleWrapper>
|
<TitleWrapper>
|
||||||
<TextComponent value='Transaction Details' align='center' />
|
<TextComponent
|
||||||
|
value='Transaction Details'
|
||||||
|
align='center'
|
||||||
|
/>
|
||||||
</TitleWrapper>
|
</TitleWrapper>
|
||||||
<DetailsWrapper>
|
<DetailsWrapper>
|
||||||
<Icon src={isReceived ? ReceivedIcon : SentIcon} alt='Transaction Type Icon' />
|
<Icon
|
||||||
|
src={isReceived ? ReceivedIcon : SentIcon}
|
||||||
|
alt='Transaction Type Icon'
|
||||||
|
/>
|
||||||
<TextComponent
|
<TextComponent
|
||||||
isBold
|
isBold
|
||||||
size={2.625}
|
size={2.625}
|
||||||
|
@ -171,10 +181,16 @@ export const TransactionDetailsComponent = ({
|
||||||
<InfoRow>
|
<InfoRow>
|
||||||
<ColumnComponent>
|
<ColumnComponent>
|
||||||
<Label value='DATE' />
|
<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>
|
||||||
<ColumnComponent>
|
<ColumnComponent>
|
||||||
<TextComponent value='FEES' isBold color={theme.colors.transactionsDetailsLabel} />
|
<TextComponent
|
||||||
|
value='FEES'
|
||||||
|
isBold
|
||||||
|
color={theme.colors.transactionsDetailsLabel}
|
||||||
|
/>
|
||||||
<TextComponent
|
<TextComponent
|
||||||
value={formatNumber({
|
value={formatNumber({
|
||||||
value: new BigNumber(amount).times(0.1).toNumber(),
|
value: new BigNumber(amount).times(0.1).toNumber(),
|
||||||
|
@ -187,7 +203,9 @@ export const TransactionDetailsComponent = ({
|
||||||
<InfoRow>
|
<InfoRow>
|
||||||
<ColumnComponent width='100%'>
|
<ColumnComponent width='100%'>
|
||||||
<Label value='TRANSACTION ID' />
|
<Label value='TRANSACTION ID' />
|
||||||
<TransactionId onClick={() => openExternal(ZCASH_EXPLORER_BASE_URL + transactionId)}>
|
<TransactionId
|
||||||
|
onClick={() => openExternal(ZCASH_EXPLORER_BASE_URL + transactionId)}
|
||||||
|
>
|
||||||
<Ellipsis value={transactionId} />
|
<Ellipsis value={transactionId} />
|
||||||
</TransactionId>
|
</TransactionId>
|
||||||
</ColumnComponent>
|
</ColumnComponent>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import dateFns from 'date-fns';
|
import dateFns from 'date-fns';
|
||||||
|
@ -97,9 +98,16 @@ export const TransactionItemComponent = ({
|
||||||
>
|
>
|
||||||
<RowComponent alignItems='center'>
|
<RowComponent alignItems='center'>
|
||||||
<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>
|
<TransactionColumn>
|
||||||
<TransactionTypeLabel isReceived={isReceived} value={type} isBold />
|
<TransactionTypeLabel
|
||||||
|
isReceived={isReceived}
|
||||||
|
value={type}
|
||||||
|
isBold
|
||||||
|
/>
|
||||||
<TransactionTime value={transactionTime} />
|
<TransactionTime value={transactionTime} />
|
||||||
</TransactionColumn>
|
</TransactionColumn>
|
||||||
</RowComponent>
|
</RowComponent>
|
||||||
|
@ -111,7 +119,10 @@ export const TransactionItemComponent = ({
|
||||||
value={transactionValueInZec}
|
value={transactionValueInZec}
|
||||||
color={isReceived ? theme.colors.transactionReceived : theme.colors.transactionSent}
|
color={isReceived ? theme.colors.transactionReceived : theme.colors.transactionSent}
|
||||||
/>
|
/>
|
||||||
<TextComponent value={transactionValueInUsd} color={theme.colors.inactiveItem} />
|
<TextComponent
|
||||||
|
value={transactionValueInUsd}
|
||||||
|
color={theme.colors.inactiveItem}
|
||||||
|
/>
|
||||||
</ColumnComponent>
|
</ColumnComponent>
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
@ -57,18 +58,9 @@ export class WalletAddress extends Component<Props, State> {
|
||||||
isVisible: false,
|
isVisible: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
show = () => {
|
show = () => this.setState(() => ({ isVisible: true }));
|
||||||
this.setState(
|
|
||||||
() => ({ isVisible: true }),
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
hide = () => {
|
|
||||||
this.setState(
|
|
||||||
() => ({ isVisible: false }),
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
hide = () => this.setState(() => ({ isVisible: false }));
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { address } = this.props;
|
const { address } = this.props;
|
||||||
|
@ -90,13 +82,11 @@ export class WalletAddress extends Component<Props, State> {
|
||||||
variant='secondary'
|
variant='secondary'
|
||||||
/>
|
/>
|
||||||
</AddressWrapper>
|
</AddressWrapper>
|
||||||
{isVisible
|
{!isVisible ? null : (
|
||||||
? (
|
<QRCodeWrapper>
|
||||||
<QRCodeWrapper>
|
<QRCode value={address} />
|
||||||
<QRCode value={address} />
|
</QRCodeWrapper>
|
||||||
</QRCodeWrapper>
|
)}
|
||||||
)
|
|
||||||
: null}
|
|
||||||
</ColumnComponent>
|
</ColumnComponent>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
|
||||||
|
@ -70,22 +71,34 @@ export const WalletSummaryComponent = ({
|
||||||
</ValueBox>
|
</ValueBox>
|
||||||
<RowComponent>
|
<RowComponent>
|
||||||
<ValueBox>
|
<ValueBox>
|
||||||
<ShieldedValue value='● SHIELDED' isBold size={theme.fontSize.small} />
|
<ShieldedValue
|
||||||
|
value='● SHIELDED'
|
||||||
|
isBold
|
||||||
|
size={theme.fontSize.small}
|
||||||
|
/>
|
||||||
<TextComponent
|
<TextComponent
|
||||||
value={`ZEC ${formatNumber({ value: shielded })}`}
|
value={`ZEC ${formatNumber({ value: shielded })}`}
|
||||||
isBold
|
isBold
|
||||||
size={theme.fontSize.medium}
|
size={theme.fontSize.medium}
|
||||||
/>
|
/>
|
||||||
<USDValue value={`USD $${formatNumber({ value: shielded * zecPrice })}`} />
|
<USDValue
|
||||||
|
value={`USD $${formatNumber({ value: shielded * zecPrice })}`}
|
||||||
|
/>
|
||||||
</ValueBox>
|
</ValueBox>
|
||||||
<ValueBox>
|
<ValueBox>
|
||||||
<Label value='● TRANSPARENT' isBold size={theme.fontSize.small} />
|
<Label
|
||||||
|
value='● TRANSPARENT'
|
||||||
|
isBold
|
||||||
|
size={theme.fontSize.small}
|
||||||
|
/>
|
||||||
<TextComponent
|
<TextComponent
|
||||||
value={`ZEC ${formatNumber({ value: transparent })}`}
|
value={`ZEC ${formatNumber({ value: transparent })}`}
|
||||||
isBold
|
isBold
|
||||||
size={theme.fontSize.medium}
|
size={theme.fontSize.medium}
|
||||||
/>
|
/>
|
||||||
<USDValue value={`USD $${formatNumber({ value: transparent * zecPrice })}`} />
|
<USDValue
|
||||||
|
value={`USD $${formatNumber({ value: transparent * zecPrice })}`}
|
||||||
|
/>
|
||||||
</ValueBox>
|
</ValueBox>
|
||||||
</RowComponent>
|
</RowComponent>
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
|
|
|
@ -13,7 +13,7 @@ import { DoczWrapper } from '../theme.js'
|
||||||
|
|
||||||
<PropsTable of={WalletSummaryComponent} />
|
<PropsTable of={WalletSummaryComponent} />
|
||||||
|
|
||||||
## Basic usage
|
## Basic Usage
|
||||||
|
|
||||||
<Playground>
|
<Playground>
|
||||||
<DoczWrapper>
|
<DoczWrapper>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { type ComponentType, Component } from 'react';
|
import React, { type ComponentType, Component } from 'react';
|
||||||
|
|
||||||
import { LoadingScreen } from './loading-screen';
|
import { LoadingScreen } from './loading-screen';
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
export const ZcashLogo = () => (
|
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>
|
<defs>
|
||||||
<style>{'.a{ fill:#040508; }'}</style>
|
<style>{'.a{ fill:#040508; }'}</style>
|
||||||
</defs>
|
</defs>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import isDev from 'electron-is-dev';
|
import isDev from 'electron-is-dev';
|
||||||
|
|
||||||
export const ZCASH_EXPLORER_BASE_URL = isDev
|
export const ZCASH_EXPLORER_BASE_URL = isDev
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import DashboardIcon from '../assets/images/dashboard_icon.svg';
|
import DashboardIcon from '../assets/images/dashboard_icon.svg';
|
||||||
import DashboardIconActive from '../assets/images/dashboard_icon_active.svg';
|
import DashboardIconActive from '../assets/images/dashboard_icon_active.svg';
|
||||||
import ConsoleIcon from '../assets/images/console_icon.svg';
|
import ConsoleIcon from '../assets/images/console_icon.svg';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { closeErrorModal } from '../redux/modules/app';
|
import { closeErrorModal } from '../redux/modules/app';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import eres from 'eres';
|
import eres from 'eres';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import eres from 'eres';
|
import eres from 'eres';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
import { BigNumber } from 'bignumber.js';
|
import { BigNumber } from 'bignumber.js';
|
||||||
|
|
||||||
import store from '../../config/electron-store';
|
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 { AppState } from '../types/app-state';
|
||||||
import type { Dispatch } from '../types/redux';
|
import type { Dispatch } from '../types/redux';
|
||||||
|
|
||||||
import { loadAddressesSuccess, loadAddressesError } from '../redux/modules/receive';
|
import {
|
||||||
|
loadAddressesSuccess,
|
||||||
|
loadAddressesError,
|
||||||
|
} from '../redux/modules/receive';
|
||||||
|
|
||||||
export type SendTransactionInput = {
|
export type SendTransactionInput = {
|
||||||
from: string,
|
from: string,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
import { SettingsView } from '../views/settings';
|
import { SettingsView } from '../views/settings';
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import eres from 'eres';
|
import eres from 'eres';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
import flow from 'lodash.flow';
|
import flow from 'lodash.flow';
|
||||||
import groupBy from 'lodash.groupby';
|
import groupBy from 'lodash.groupby';
|
||||||
import dateFns from 'date-fns';
|
import dateFns from 'date-fns';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import type { Action } from '../../types/redux';
|
import type { Action } from '../../types/redux';
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import type { Action } from '../../types/redux';
|
import type { Action } from '../../types/redux';
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|
|
@ -67,6 +67,7 @@ const initialState: State = {
|
||||||
isToAddressValid: false,
|
isToAddressValid: false,
|
||||||
zecPrice: 0,
|
zecPrice: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
export default (state: State = initialState, action: Action): State => {
|
export default (state: State = initialState, action: Action): State => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import type { Action } from '../../types/redux';
|
import type { Action } from '../../types/redux';
|
||||||
import type { Transaction } from '../../components/transaction-item';
|
import type { Transaction } from '../../components/transaction-item';
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ const initialState = {
|
||||||
error: null,
|
error: null,
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
export default (state: State = initialState, action: Action) => {
|
export default (state: State = initialState, action: Action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import type { Action } from '../../types/redux';
|
import type { Action } from '../../types/redux';
|
||||||
import type { TransactionsList } from './transactions';
|
import type { TransactionsList } from './transactions';
|
||||||
|
|
||||||
|
@ -65,6 +66,7 @@ const initialState = {
|
||||||
addresses: [],
|
addresses: [],
|
||||||
transactions: [],
|
transactions: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
export default (state: State = initialState, action: Action) => {
|
export default (state: State = initialState, action: Action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import { compose } from 'redux';
|
import { compose } from 'redux';
|
||||||
import { withRouter } from 'react-router-dom';
|
import { withRouter } from 'react-router-dom';
|
||||||
import { RouterComponent } from './router';
|
import { RouterComponent } from './router';
|
||||||
|
|
|
@ -55,17 +55,39 @@ export const RouterComponent = ({
|
||||||
<FullWrapper>
|
<FullWrapper>
|
||||||
<HeaderComponent title={getTitle(location.pathname)} />
|
<HeaderComponent title={getTitle(location.pathname)} />
|
||||||
<ContentWrapper>
|
<ContentWrapper>
|
||||||
<SidebarContainer location={location} history={history} />
|
<SidebarContainer
|
||||||
|
location={location}
|
||||||
|
history={history}
|
||||||
|
/>
|
||||||
{/* $FlowFixMe */}
|
{/* $FlowFixMe */}
|
||||||
<LayoutComponent>
|
<LayoutComponent>
|
||||||
<ScrollTopComponent>
|
<ScrollTopComponent>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route exact path={DASHBOARD_ROUTE} component={DashboardContainer} />
|
<Route
|
||||||
<Route path={SEND_ROUTE} component={SendContainer} />
|
exact
|
||||||
<Route path={RECEIVE_ROUTE} component={ReceiveContainer} />
|
path={DASHBOARD_ROUTE}
|
||||||
<Route path={SETTINGS_ROUTE} component={SettingsContainer} />
|
component={DashboardContainer}
|
||||||
<Route path={CONSOLE_ROUTE} component={ConsoleView} />
|
/>
|
||||||
<Route path={TRANSACTIONS_ROUTE} component={TransactionsContainer} />
|
<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} />
|
<Route component={NotFoundView} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</ScrollTopComponent>
|
</ScrollTopComponent>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import theme from 'styled-theming';
|
import theme from 'styled-theming';
|
||||||
import { ThemeProvider, createGlobalStyle } from 'styled-components';
|
import { ThemeProvider, createGlobalStyle } from 'styled-components';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
export const filterObjectNullKeys = (obj: Object) => Object.keys(obj).reduce((acc, cur) => {
|
export const filterObjectNullKeys = (obj: Object) => Object.keys(obj).reduce((acc, cur) => {
|
||||||
if (obj[cur] === null || obj[cur] === undefined || obj[cur] === '') {
|
if (obj[cur] === null || obj[cur] === undefined || obj[cur] === '') {
|
||||||
return acc;
|
return acc;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
import electron from 'electron';
|
import electron from 'electron';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
export default <T>(field: string) => (arr: T[]): T[] => arr.sort((a, b) => (a[field] < b[field] ? 1 : -1));
|
export default <T>(field: string) => (arr: T[]): T[] => arr.sort((a, b) => (a[field] < b[field] ? 1 : -1));
|
||||||
|
|
|
@ -38,7 +38,7 @@ const defaultState = `
|
||||||
Thank you for running a Zcash node!
|
Thank you for running a Zcash node!
|
||||||
You're helping to strengthen the network and contributing to a social good :)
|
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/>.
|
In order to ensure you are adequately protecting your privacy when using Zcash, please see <https://z.cash/support/security/>.
|
||||||
|
|
||||||
Block height | 0
|
Block height | 0
|
||||||
Connections | 0
|
Connections | 0
|
||||||
Network solution rate | 0 Sol/s
|
Network solution rate | 0 Sol/s
|
||||||
|
@ -80,7 +80,10 @@ export class ConsoleView extends Component<Props, State> {
|
||||||
return (
|
return (
|
||||||
<Wrapper id='console-wrapper'>
|
<Wrapper id='console-wrapper'>
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<ConsoleImg src={ConsoleSymbol} alt='Zcashd' />
|
<ConsoleImg
|
||||||
|
src={ConsoleSymbol}
|
||||||
|
alt='Zcashd'
|
||||||
|
/>
|
||||||
{log.split('\n').map((item, idx) => (
|
{log.split('\n').map((item, idx) => (
|
||||||
<Fragment key={uuid()}>
|
<Fragment key={uuid()}>
|
||||||
<ConsoleText value={item} />
|
<ConsoleText value={item} />
|
||||||
|
|
|
@ -22,8 +22,8 @@ type Props = {
|
||||||
|
|
||||||
export class DashboardView extends PureComponent<Props> {
|
export class DashboardView extends PureComponent<Props> {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
/* eslint-disable-next-line */
|
const { getSummary } = this.props;
|
||||||
this.props.getSummary();
|
getSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Transition, animated } from 'react-spring';
|
import { Transition, animated } from 'react-spring';
|
||||||
|
@ -106,16 +107,33 @@ export class ReceiveView extends PureComponent<Props, State> {
|
||||||
<WalletAddress key={addr} address={addr} />
|
<WalletAddress key={addr} address={addr} />
|
||||||
))}
|
))}
|
||||||
<Row>
|
<Row>
|
||||||
<ActionButton onClick={this.toggleAdditionalOptions} isActive={showAdditionalOptions}>
|
<ActionButton
|
||||||
<ActionIcon isActive={showAdditionalOptions} src={MenuIcon} alt='More Options' />
|
onClick={this.toggleAdditionalOptions}
|
||||||
|
isActive={showAdditionalOptions}
|
||||||
|
>
|
||||||
|
<ActionIcon
|
||||||
|
isActive={showAdditionalOptions}
|
||||||
|
src={MenuIcon}
|
||||||
|
alt='More Options'
|
||||||
|
/>
|
||||||
<TextComponent value={buttonText} />
|
<TextComponent value={buttonText} />
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
<ActionButton onClick={() => this.generateNewAddress('shielded')}>
|
<ActionButton
|
||||||
<ActionIcon src={PlusIcon} alt='New Shielded Address' />
|
onClick={() => this.generateNewAddress('shielded')}
|
||||||
|
>
|
||||||
|
<ActionIcon
|
||||||
|
src={PlusIcon}
|
||||||
|
alt='New Shielded Address'
|
||||||
|
/>
|
||||||
<TextComponent value='New Shielded Address' />
|
<TextComponent value='New Shielded Address' />
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
<ActionButton onClick={() => this.generateNewAddress('transparent')}>
|
<ActionButton
|
||||||
<ActionIcon src={PlusIcon} alt='New Transparent Address' />
|
onClick={() => this.generateNewAddress('transparent')}
|
||||||
|
>
|
||||||
|
<ActionIcon
|
||||||
|
src={PlusIcon}
|
||||||
|
alt='New Transparent Address'
|
||||||
|
/>
|
||||||
<TextComponent value='New Transparent Address' />
|
<TextComponent value='New Transparent Address' />
|
||||||
</ActionButton>
|
</ActionButton>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -134,10 +152,19 @@ export class ReceiveView extends PureComponent<Props, State> {
|
||||||
>
|
>
|
||||||
{show => show
|
{show => show
|
||||||
&& (props => (
|
&& (props => (
|
||||||
<animated.div style={{ ...props, width: '100%', height: 'auto' }}>
|
<animated.div
|
||||||
|
style={{
|
||||||
|
...props,
|
||||||
|
width: '100%',
|
||||||
|
height: 'auto',
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Label value='Transparent Address (not private)' />
|
<Label value='Transparent Address (not private)' />
|
||||||
{transparentAddresses.map(addr => (
|
{transparentAddresses.map(addr => (
|
||||||
<WalletAddress key={addr} address={addr} />
|
<WalletAddress
|
||||||
|
key={addr}
|
||||||
|
address={addr}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</animated.div>
|
</animated.div>
|
||||||
))
|
))
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { Fragment, PureComponent } from 'react';
|
import React, { Fragment, PureComponent } from 'react';
|
||||||
import styled, { keyframes } from 'styled-components';
|
import styled, { keyframes } from 'styled-components';
|
||||||
import { BigNumber } from 'bignumber.js';
|
import { BigNumber } from 'bignumber.js';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
/* eslint-disable import/no-extraneous-dependencies */
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { promisify } from 'util';
|
import { promisify } from 'util';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { PureComponent, Fragment } from 'react';
|
import React, { PureComponent, Fragment } from 'react';
|
||||||
|
|
||||||
import { TransactionDailyComponent } from '../components/transaction-daily';
|
import { TransactionDailyComponent } from '../components/transaction-daily';
|
||||||
|
|
|
@ -6,6 +6,7 @@ import cp from 'child_process';
|
||||||
import getBinariesPath from './get-binaries-path';
|
import getBinariesPath from './get-binaries-path';
|
||||||
import log from './logger';
|
import log from './logger';
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
export default (): Promise<*> => new Promise((resolve, reject) => {
|
export default (): Promise<*> => new Promise((resolve, reject) => {
|
||||||
const processName = path.join(getBinariesPath(), 'zcash-fetch-params');
|
const processName = path.join(getBinariesPath(), 'zcash-fetch-params');
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,10 @@ const FILES: Array<{ name: string, hash: string }> = [
|
||||||
];
|
];
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
// 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) => {
|
fs.readFile(pathToFile, (err, file) => {
|
||||||
if (err) return reject(new Error(err));
|
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
|
// 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}...`);
|
if (!mainWindow.isDestroyed()) mainWindow.webContents.send('zcashd-params-download', `Downloading ${file.name}...`);
|
||||||
log(`Downloading ${file.name}...`);
|
log(`Downloading ${file.name}...`);
|
||||||
|
|
||||||
|
@ -84,6 +90,7 @@ const downloadFile = ({ file, pathToSave }): Promise<*> => new Promise((resolve,
|
||||||
|
|
||||||
let missingDownloadParam = false;
|
let missingDownloadParam = false;
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
export default (): Promise<*> => new Promise((resolve, reject) => {
|
export default (): Promise<*> => new Promise((resolve, reject) => {
|
||||||
const firstRunProcess = cp.spawn(path.join(getBinariesPath(), 'win', 'first-run.bat'));
|
const firstRunProcess = cp.spawn(path.join(getBinariesPath(), 'win', 'first-run.bat'));
|
||||||
firstRunProcess.stdout.on('data', data => log(data.toString()));
|
firstRunProcess.stdout.on('data', data => log(data.toString()));
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
/* eslint-disable-next-line import/no-extraneous-dependencies */
|
/* eslint-disable-next-line import/no-extraneous-dependencies */
|
||||||
import isDev from 'electron-is-dev';
|
import isDev from 'electron-is-dev';
|
||||||
|
|
||||||
/* eslint-disable operator-linebreak */
|
// eslint-disable-next-line
|
||||||
export default () => (isDev
|
export default () => (isDev
|
||||||
? path.join(__dirname, '..', '..', './bin')
|
? path.join(__dirname, '..', '..', './bin')
|
||||||
|
// eslint-disable-next-line
|
||||||
: // $FlowFixMe
|
: // $FlowFixMe
|
||||||
path.join(process.resourcesPath, 'bin'));
|
path.join(process.resourcesPath, 'bin'));
|
||||||
|
|
|
@ -2,4 +2,5 @@
|
||||||
|
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
export default () => (os.platform() === 'win32' ? 'zcashd.exe' : 'zcashd');
|
export default () => (os.platform() === 'win32' ? 'zcashd.exe' : 'zcashd');
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
export default () => {
|
export default () => {
|
||||||
if (os.platform() === 'darwin') {
|
if (os.platform() === 'darwin') {
|
||||||
return 'mac';
|
return 'mac';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
/* eslint-disable-next-line no-console */
|
// eslint-disable-next-line
|
||||||
export default (...message: Array<*>) => console.log('[Zcash Daemon]', ...message);
|
export default (...message: Array<*>) => console.log('[Zcash Daemon]', ...message);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
import { locateZcashConf } from './locate-zcash-conf';
|
import { locateZcashConf } from './locate-zcash-conf';
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|
||||||
import log from './logger';
|
import log from './logger';
|
||||||
import fetchWindowsParams from './fetch-windows-params';
|
import fetchWindowsParams from './fetch-windows-params';
|
||||||
import runUnixFetchParams from './fetch-unix-params';
|
import runUnixFetchParams from './fetch-unix-params';
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
export default (): Promise<*> => {
|
export default (): Promise<*> => {
|
||||||
log('Fetching params');
|
log('Fetching params');
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import cp from 'child_process';
|
import cp from 'child_process';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
@ -120,4 +121,5 @@ const runDaemon: () => Promise<?ChildProcess> = () => new Promise(async (resolve
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
export default runDaemon;
|
export default runDaemon;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import Store from 'electron-store';
|
import Store from 'electron-store';
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
export default new Store({
|
export default new Store({
|
||||||
encryptionKey: 'afr58kk5xg6tz5o4kmvmw',
|
encryptionKey: 'afr58kk5xg6tz5o4kmvmw',
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import '@babel/polyfill';
|
import '@babel/polyfill';
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
|
|
||||||
|
@ -8,7 +9,6 @@ import path from 'path';
|
||||||
import { app, BrowserWindow, typeof BrowserWindow as BrowserWindowType } from 'electron';
|
import { app, BrowserWindow, typeof BrowserWindow as BrowserWindowType } from 'electron';
|
||||||
import { autoUpdater } from 'electron-updater';
|
import { autoUpdater } from 'electron-updater';
|
||||||
import isDev from 'electron-is-dev';
|
import isDev from 'electron-is-dev';
|
||||||
import eres from 'eres';
|
|
||||||
import { registerDebugShortcut } from '../utils/debug-shortcut';
|
import { registerDebugShortcut } from '../utils/debug-shortcut';
|
||||||
import runDaemon from './daemon/zcashd-child-process';
|
import runDaemon from './daemon/zcashd-child-process';
|
||||||
import zcashLog from './daemon/logger';
|
import zcashLog from './daemon/logger';
|
||||||
|
@ -46,6 +46,7 @@ const createWindow = () => {
|
||||||
progress.transferred
|
progress.transferred
|
||||||
}/${progress.total})`,
|
}/${progress.total})`,
|
||||||
));
|
));
|
||||||
|
|
||||||
autoUpdater.on('update-downloaded', () => {
|
autoUpdater.on('update-downloaded', () => {
|
||||||
updateAvailable = true;
|
updateAvailable = true;
|
||||||
showStatus('Update downloaded');
|
showStatus('Update downloaded');
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const mainWebpack = require('./webpack-main.config');
|
const mainWebpack = require('./webpack-main.config');
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
const HtmlWebPackPlugin = require('html-webpack-plugin'); // eslint-disable-line
|
const HtmlWebPackPlugin = require('html-webpack-plugin'); // eslint-disable-line
|
||||||
const TerserPlugin = require('terser-webpack-plugin'); // eslint-disable-line
|
const TerserPlugin = require('terser-webpack-plugin'); // eslint-disable-line
|
||||||
const autoprefixer = require('autoprefixer');
|
const autoprefixer = require('autoprefixer');
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
// @flow
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const mainWebpack = require('./webpack-main.config');
|
const mainWebpack = require('./webpack-main.config');
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import got from 'got';
|
import got from 'got';
|
||||||
/* eslint-disable-next-line */
|
/* eslint-disable-next-line */
|
||||||
import isDev from 'electron-is-dev';
|
import isDev from 'electron-is-dev';
|
||||||
|
@ -20,7 +21,6 @@ const client = got.extend({
|
||||||
auth: `${RPC.user}:${RPC.password}`,
|
auth: `${RPC.user}:${RPC.password}`,
|
||||||
});
|
});
|
||||||
|
|
||||||
// $FlowFixMe
|
|
||||||
const api: APIMethods = METHODS.reduce(
|
const api: APIMethods = METHODS.reduce(
|
||||||
(obj, method) => ({
|
(obj, method) => ({
|
||||||
...obj,
|
...obj,
|
||||||
|
@ -39,4 +39,5 @@ const api: APIMethods = METHODS.reduce(
|
||||||
{},
|
{},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
export default api;
|
export default api;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import React, { type ComponentType, Component } from 'react';
|
import React, { type ComponentType, Component } from 'react';
|
||||||
import eres from 'eres';
|
import eres from 'eres';
|
||||||
|
|
||||||
|
@ -55,8 +56,8 @@ export const withSyncStatus = <PassedProps: {}>(
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { type, progress} = this.state;
|
const { type, progress } = this.state;
|
||||||
|
|
||||||
return <WrappedComponent {...this.props} {...this.state} type={type} progress={progress} />;
|
return <WrappedComponent {...this.props} {...this.state} type={type} progress={progress} />;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
/* eslint-disable max-len */
|
/* eslint-disable max-len */
|
||||||
|
|
||||||
export const METHODS = [
|
export const METHODS = [
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
/* eslint-disable import/no-extraneous-dependencies */
|
/* eslint-disable import/no-extraneous-dependencies */
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
import { net } from 'electron';
|
import { net } from 'electron';
|
||||||
|
@ -11,6 +12,7 @@ type Payload = {
|
||||||
WARNING:
|
WARNING:
|
||||||
Just a super fast way to get the zec price
|
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) => {
|
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(
|
const ENDPOINT = `https://min-api.cryptocompare.com/data/price?fsym=ZEC&tsyms=${currencies.join(
|
||||||
',',
|
',',
|
||||||
|
|
|
@ -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', () => {
|
export const registerDebugShortcut = (app: ElectronApp, mainWindow: BrowserWindow) => globalShortcut.register('CommandOrControl+Option+B', () => {
|
||||||
// $FlowFixMe
|
// $FlowFixMe
|
||||||
app.dock.show();
|
app.dock.show();
|
||||||
// $FlowFixMe
|
|
||||||
mainWindow.webContents.openDevTools();
|
mainWindow.webContents.openDevTools();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue