Merge pull request #54 from andrerfneves/feature/open-external
Feature/open external
This commit is contained in:
commit
0f6cf7fe71
|
@ -16,6 +16,7 @@
|
|||
"rules": {
|
||||
"jsx-quotes": ["error", "prefer-single"],
|
||||
"import/prefer-default-export": ["off"],
|
||||
"import/no-default-export": 1,
|
||||
"react/jsx-filename-extension": [1, { "extensions": [".js"] }],
|
||||
"jsx-a11y/anchor-is-valid": [
|
||||
"error",
|
||||
|
|
|
@ -11,13 +11,12 @@ import theme, { GlobalStyle } from './theme';
|
|||
|
||||
const store = configureStore({});
|
||||
|
||||
export default () => (
|
||||
export const App = () => (
|
||||
<ThemeProvider theme={theme}>
|
||||
<Fragment>
|
||||
<GlobalStyle />
|
||||
<Provider store={store}>
|
||||
<ConnectedRouter history={history}>
|
||||
{/* $FlowFixMe */}
|
||||
<Router />
|
||||
</ConnectedRouter>
|
||||
</Provider>
|
||||
|
|
|
@ -9,7 +9,7 @@ import ClickOutside from 'react-click-outside';
|
|||
|
||||
import { TextComponent } from './text';
|
||||
|
||||
import truncateAddress from '../utils/truncateAddress';
|
||||
import { truncateAddress } from '../utils/truncate-address';
|
||||
|
||||
/* eslint-disable max-len */
|
||||
const MenuWrapper = styled.div`
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import dateFns from 'date-fns';
|
||||
import { BigNumber } from 'bignumber.js';
|
||||
|
||||
import SentIcon from '../assets/images/transaction_sent_icon.svg';
|
||||
import ReceivedIcon from '../assets/images/transaction_received_icon.svg';
|
||||
|
@ -13,8 +14,8 @@ import { ColumnComponent } from './column';
|
|||
|
||||
import theme from '../theme';
|
||||
|
||||
import formatNumber from '../utils/formatNumber';
|
||||
import truncateAddress from '../utils/truncateAddress';
|
||||
import { formatNumber } from '../utils/format-number';
|
||||
import { truncateAddress } from '../utils/truncate-address';
|
||||
|
||||
const Wrapper = styled.div`
|
||||
width: 460px;
|
||||
|
@ -125,22 +126,13 @@ 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}
|
||||
|
@ -148,16 +140,12 @@ export const TransactionDetailsComponent = ({
|
|||
append: `${isReceived ? '+' : '-'}ZEC `,
|
||||
value: amount,
|
||||
})}
|
||||
color={
|
||||
isReceived
|
||||
? theme.colors.transactionReceived
|
||||
: theme.colors.transactionSent
|
||||
}
|
||||
color={isReceived ? theme.colors.transactionReceived : theme.colors.transactionSent}
|
||||
/>
|
||||
<TextComponent
|
||||
value={formatNumber({
|
||||
append: `${isReceived ? '+' : '-'}USD `,
|
||||
value: amount * zecPrice,
|
||||
value: new BigNumber(amount).times(zecPrice).toNumber(),
|
||||
})}
|
||||
size={1.5}
|
||||
color={theme.colors.transactionsDetailsLabel}
|
||||
|
@ -166,16 +154,15 @@ export const TransactionDetailsComponent = ({
|
|||
<InfoRow>
|
||||
<ColumnComponent>
|
||||
<Label value='DATE' />
|
||||
<TextComponent value={dateFns.format(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: amount * 0.1, append: 'ZEC ' })}
|
||||
value={formatNumber({
|
||||
value: new BigNumber(amount).times(0.1).toNumber(),
|
||||
append: 'ZEC ',
|
||||
})}
|
||||
/>
|
||||
</ColumnComponent>
|
||||
</InfoRow>
|
||||
|
|
|
@ -14,8 +14,8 @@ import { TransactionDetailsComponent } from './transaction-details';
|
|||
|
||||
import theme from '../theme';
|
||||
|
||||
import formatNumber from '../utils/formatNumber';
|
||||
import truncateAddress from '../utils/truncateAddress';
|
||||
import { formatNumber } from '../utils/format-number';
|
||||
import { truncateAddress } from '../utils/truncate-address';
|
||||
|
||||
const Wrapper = styled(RowComponent)`
|
||||
background-color: ${props => props.theme.colors.cardBackgroundColor};
|
||||
|
@ -32,12 +32,12 @@ const Icon = styled.img`
|
|||
height: 20px;
|
||||
`;
|
||||
|
||||
/* eslint-disable max-len */
|
||||
const TransactionTypeLabel = styled(TextComponent)`
|
||||
color: ${props => (props.isReceived
|
||||
? props.theme.colors.transactionReceived
|
||||
: props.theme.colors.transactionSent)};
|
||||
color: ${props => (props.isReceived ? props.theme.colors.transactionReceived : props.theme.colors.transactionSent)};
|
||||
text-transform: capitalize;
|
||||
`;
|
||||
/* eslint-enable max-len */
|
||||
|
||||
const TransactionAddress = styled(TextComponent)`
|
||||
color: #a7a7a7;
|
||||
|
@ -97,16 +97,9 @@ 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>
|
||||
|
@ -116,16 +109,9 @@ export const TransactionItemComponent = ({
|
|||
<TextComponent
|
||||
isBold
|
||||
value={transactionValueInZec}
|
||||
color={
|
||||
isReceived
|
||||
? theme.colors.transactionReceived
|
||||
: theme.colors.transactionSent
|
||||
}
|
||||
/>
|
||||
<TextComponent
|
||||
value={transactionValueInUsd}
|
||||
color={theme.colors.inactiveItem}
|
||||
color={isReceived ? theme.colors.transactionReceived : theme.colors.transactionSent}
|
||||
/>
|
||||
<TextComponent value={transactionValueInUsd} color={theme.colors.inactiveItem} />
|
||||
</ColumnComponent>
|
||||
</Wrapper>
|
||||
)}
|
||||
|
|
|
@ -7,7 +7,7 @@ import { ColumnComponent } from './column';
|
|||
import { Button } from './button';
|
||||
import { QRCode } from './qrcode';
|
||||
|
||||
import truncateAddress from '../utils/truncateAddress';
|
||||
import { truncateAddress } from '../utils/truncate-address';
|
||||
|
||||
import eyeIcon from '../assets/images/eye.png';
|
||||
|
||||
|
@ -35,12 +35,11 @@ const Input = styled.input`
|
|||
}
|
||||
`;
|
||||
|
||||
/* eslint-disable max-len */
|
||||
const Btn = styled(Button)`
|
||||
border-width: 1px;
|
||||
font-weight: ${props => props.theme.fontWeight.regular};
|
||||
border-color: ${props => (props.isVisible
|
||||
? props.theme.colors.primary : props.theme.colors.buttonBorderColor
|
||||
)};
|
||||
border-color: ${props => (props.isVisible ? props.theme.colors.primary : props.theme.colors.buttonBorderColor)};
|
||||
padding: 8px 10px;
|
||||
min-width: 260px;
|
||||
|
||||
|
@ -49,6 +48,7 @@ const Btn = styled(Button)`
|
|||
width: 20px;
|
||||
}
|
||||
`;
|
||||
/* eslint-enable max-len */
|
||||
|
||||
const QRCodeWrapper = styled.div`
|
||||
align-items: center;
|
||||
|
@ -89,7 +89,7 @@ type State = {
|
|||
export class WalletAddress extends PureComponent<Props, State> {
|
||||
static defaultProps = {
|
||||
isVisible: false,
|
||||
}
|
||||
};
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
|
@ -127,10 +127,12 @@ export class WalletAddress extends PureComponent<Props, State> {
|
|||
<Transition
|
||||
native
|
||||
items={isVisible}
|
||||
enter={[{
|
||||
height: 'auto',
|
||||
opacity: 1,
|
||||
}]}
|
||||
enter={[
|
||||
{
|
||||
height: 'auto',
|
||||
opacity: 1,
|
||||
},
|
||||
]}
|
||||
leave={{ height: 0, opacity: 0 }}
|
||||
from={{
|
||||
position: 'absolute',
|
||||
|
@ -139,13 +141,15 @@ export class WalletAddress extends PureComponent<Props, State> {
|
|||
height: 0,
|
||||
}}
|
||||
>
|
||||
{show => show && (props => (
|
||||
<animated.div style={props}>
|
||||
<QRCodeWrapper>
|
||||
<QRCode value={address} />
|
||||
</QRCodeWrapper>
|
||||
</animated.div>
|
||||
))}
|
||||
{show => show
|
||||
&& (props => (
|
||||
<animated.div style={props}>
|
||||
<QRCodeWrapper>
|
||||
<QRCode value={address} />
|
||||
</QRCodeWrapper>
|
||||
</animated.div>
|
||||
))
|
||||
}
|
||||
</Transition>
|
||||
</RevealsMain>
|
||||
</ColumnComponent>
|
||||
|
|
|
@ -5,7 +5,7 @@ import styled from 'styled-components';
|
|||
import { TextComponent } from './text';
|
||||
import { RowComponent } from './row';
|
||||
|
||||
import formatNumber from '../utils/formatNumber';
|
||||
import { formatNumber } from '../utils/format-number';
|
||||
|
||||
import theme from '../theme';
|
||||
|
||||
|
@ -53,16 +53,10 @@ type Props = {
|
|||
};
|
||||
|
||||
export const WalletSummaryComponent = ({
|
||||
total,
|
||||
shielded,
|
||||
transparent,
|
||||
zecPrice,
|
||||
total, shielded, transparent, zecPrice,
|
||||
}: Props) => (
|
||||
<Wrapper>
|
||||
<AllAddresses
|
||||
value='ALL ADDRESSES'
|
||||
isBold
|
||||
/>
|
||||
<AllAddresses value='ALL ADDRESSES' isBold />
|
||||
<ValueBox>
|
||||
<TextComponent
|
||||
size={theme.fontSize.medium * 2.5}
|
||||
|
@ -76,34 +70,22 @@ export const WalletSummaryComponent = ({
|
|||
</ValueBox>
|
||||
<RowComponent>
|
||||
<ValueBox>
|
||||
<ShieldedValue
|
||||
value='● SHIELDED'
|
||||
isBold
|
||||
size={theme.fontSize.small}
|
||||
/>
|
||||
<ShieldedValue value='● 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='● TRANSPARENT'
|
||||
isBold
|
||||
size={theme.fontSize.small}
|
||||
/>
|
||||
<Label value='● 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>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// @flow
|
||||
|
||||
export default {
|
||||
export const FEES = {
|
||||
LOW: 0.001,
|
||||
MEDIUM: 0.005,
|
||||
HIGH: 0.009,
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
loadWalletSummarySuccess,
|
||||
loadWalletSummaryError,
|
||||
} from '../redux/modules/wallet';
|
||||
import sortBy from '../utils/sortBy';
|
||||
import { sortBy } from '../utils/sort-by';
|
||||
|
||||
import type { AppState } from '../types/app-state';
|
||||
import type { Dispatch } from '../types/redux';
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
validateAddressError,
|
||||
} from '../redux/modules/send';
|
||||
|
||||
import filterObjectNullKeys from '../utils/filterObjectNullKeys';
|
||||
import { filterObjectNullKeys } from '../utils/filter-object-null-keys';
|
||||
|
||||
import type { AppState } from '../types/app-state';
|
||||
import type { Dispatch } from '../types/redux';
|
||||
|
|
|
@ -15,7 +15,7 @@ import {
|
|||
import rpc from '../../services/api';
|
||||
import store from '../../config/electron-store';
|
||||
|
||||
import sortBy from '../utils/sortBy';
|
||||
import { sortBy } from '../utils/sort-by';
|
||||
|
||||
import type { AppState } from '../types/app-state';
|
||||
import type { Dispatch } from '../types/redux';
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
import App from './app';
|
||||
import { App } from './app';
|
||||
|
||||
const el = document.getElementById('root');
|
||||
|
||||
|
|
|
@ -4,13 +4,13 @@ import { createStore, applyMiddleware, compose } from 'redux';
|
|||
import { routerMiddleware } from 'connected-react-router';
|
||||
import { createHashHistory } from 'history';
|
||||
import thunk from 'redux-thunk';
|
||||
import type { RouterHistory } from 'react-router-dom';
|
||||
|
||||
import { createRootReducer } from './modules/reducer';
|
||||
|
||||
export const history = createHashHistory();
|
||||
export const history: RouterHistory = createHashHistory();
|
||||
|
||||
const shouldEnableDevTools = (process.env.NODE_ENV !== 'production'
|
||||
|| process.env.NODE_ENV !== 'staging')
|
||||
const shouldEnableDevTools = (process.env.NODE_ENV !== 'production' || process.env.NODE_ENV !== 'staging')
|
||||
&& window.devToolsExtension;
|
||||
|
||||
export const configureStore = (initialState: Object) => {
|
||||
|
|
|
@ -5,11 +5,7 @@ import type { Action } from '../../types/redux';
|
|||
export const LOAD_ADDRESSES_SUCCESS = 'LOAD_ADDRESSES_SUCCESS';
|
||||
export const LOAD_ADDRESSES_ERROR = 'LOAD_ADDRESSES_ERROR';
|
||||
|
||||
export const loadAddressesSuccess = ({
|
||||
addresses,
|
||||
}: {
|
||||
addresses: string[],
|
||||
}) => ({
|
||||
export const loadAddressesSuccess = ({ addresses }: { addresses: string[] }) => ({
|
||||
type: LOAD_ADDRESSES_SUCCESS,
|
||||
payload: {
|
||||
addresses,
|
||||
|
@ -31,6 +27,7 @@ const initialState: State = {
|
|||
error: null,
|
||||
};
|
||||
|
||||
// eslint-disable-next-line
|
||||
export default (state: State = initialState, action: Action) => {
|
||||
switch (action.type) {
|
||||
case LOAD_ADDRESSES_SUCCESS:
|
||||
|
|
|
@ -14,11 +14,7 @@ export const sendTransaction = () => ({
|
|||
payload: {},
|
||||
});
|
||||
|
||||
export const sendTransactionSuccess = ({
|
||||
operationId,
|
||||
}: {
|
||||
operationId: string,
|
||||
}) => ({
|
||||
export const sendTransactionSuccess = ({ operationId }: { operationId: string }) => ({
|
||||
type: SEND_TRANSACTION_SUCCESS,
|
||||
payload: {
|
||||
operationId,
|
||||
|
@ -71,7 +67,7 @@ const initialState: State = {
|
|||
isToAddressValid: false,
|
||||
zecPrice: 0,
|
||||
};
|
||||
|
||||
// eslint-disable-next-line
|
||||
export default (state: State = initialState, action: Action): State => {
|
||||
switch (action.type) {
|
||||
case SEND_TRANSACTION:
|
||||
|
|
|
@ -46,7 +46,7 @@ const initialState = {
|
|||
error: null,
|
||||
isLoading: false,
|
||||
};
|
||||
|
||||
// eslint-disable-next-line
|
||||
export default (state: State = initialState, action: Action) => {
|
||||
switch (action.type) {
|
||||
case LOAD_TRANSACTIONS:
|
||||
|
|
|
@ -65,7 +65,7 @@ const initialState = {
|
|||
addresses: [],
|
||||
transactions: [],
|
||||
};
|
||||
|
||||
// eslint-disable-next-line
|
||||
export default (state: State = initialState, action: Action) => {
|
||||
switch (action.type) {
|
||||
case LOAD_WALLET_SUMMARY:
|
||||
|
|
|
@ -105,4 +105,5 @@ export const DoczWrapper = ({ children }) => (
|
|||
</ThemeProvider>
|
||||
);
|
||||
|
||||
// eslint-disable-next-line
|
||||
export default appTheme;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// @flow
|
||||
export default (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] === '') {
|
||||
return acc;
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
// @flow
|
||||
export const formatNumber = ({ value, append = '' }: { value: number | string, append?: string }) => `${append}${(value || 0).toLocaleString()}`;
|
|
@ -1,3 +0,0 @@
|
|||
// @flow
|
||||
|
||||
export default ({ value, append = '' }: { value: number, append?: string }) => `${append}${(value || 0).toLocaleString()}`;
|
|
@ -1,8 +0,0 @@
|
|||
// @flow
|
||||
|
||||
export default () => Math.random()
|
||||
.toString(36)
|
||||
.substring(2, 15)
|
||||
+ Math.random()
|
||||
.toString(36)
|
||||
.substring(2, 15);
|
|
@ -0,0 +1,5 @@
|
|||
// @flow
|
||||
// eslint-disable-next-line
|
||||
import electron from 'electron';
|
||||
|
||||
export const openExternal = (url: string) => electron.shell.openExternal(url);
|
|
@ -0,0 +1,4 @@
|
|||
// @flow
|
||||
/* eslint-disable max-len */
|
||||
// $FlowFixMe
|
||||
export const sortBy = <T>(field: string) => (arr: T[]): T[] => arr.sort((a, b) => (a[field] < b[field] ? 1 : -1));
|
|
@ -1,4 +0,0 @@
|
|||
// @flow
|
||||
/* eslint-disable max-len */
|
||||
// $FlowFixMe
|
||||
export default <T>(field: string) => (arr: T[]): T[] => arr.sort((a, b) => (a[field] < b[field] ? 1 : -1));
|
|
@ -0,0 +1,3 @@
|
|||
// @flow
|
||||
|
||||
export const truncateAddress = (address: string = '') => `${address.substr(0, 20)}...${address.substr(address.length - 10, address.length)}`;
|
|
@ -1,6 +0,0 @@
|
|||
// @flow
|
||||
|
||||
export default (address: string = '') => `${address.substr(0, 20)}...${address.substr(
|
||||
address.length - 10,
|
||||
address.length,
|
||||
)}`;
|
|
@ -4,7 +4,7 @@ import React, { Component, Fragment } from 'react';
|
|||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { ipcRenderer } from 'electron';
|
||||
import styled from 'styled-components';
|
||||
import generateRandomString from '../utils/generate-random-string';
|
||||
import uuid from 'uuid/v4';
|
||||
import { TextComponent } from '../components/text';
|
||||
|
||||
import ConsoleSymbol from '../assets/images/console_zcash.png';
|
||||
|
@ -82,7 +82,7 @@ export class ConsoleView extends Component<Props, State> {
|
|||
<Fragment>
|
||||
<ConsoleImg src={ConsoleSymbol} alt='Zcashd' />
|
||||
{log.split('\n').map((item, idx) => (
|
||||
<Fragment key={generateRandomString()}>
|
||||
<Fragment key={uuid()}>
|
||||
<ConsoleText value={item} />
|
||||
{breakpoints.includes(idx) ? <br /> : null}
|
||||
</Fragment>
|
||||
|
|
|
@ -4,7 +4,7 @@ import styled, { keyframes } from 'styled-components';
|
|||
import { BigNumber } from 'bignumber.js';
|
||||
import { Transition, animated } from 'react-spring';
|
||||
|
||||
import FEES from '../constants/fees';
|
||||
import { FEES } from '../constants/fees';
|
||||
|
||||
import { InputLabelComponent } from '../components/input-label';
|
||||
import { InputComponent } from '../components/input';
|
||||
|
@ -16,7 +16,7 @@ import { Divider } from '../components/divider';
|
|||
import { Button } from '../components/button';
|
||||
import { ConfirmDialogComponent } from '../components/confirm-dialog';
|
||||
|
||||
import formatNumber from '../utils/formatNumber';
|
||||
import { formatNumber } from '../utils/format-number';
|
||||
|
||||
import type { SendTransactionInput } from '../containers/send';
|
||||
import type { State as SendState } from '../redux/modules/send';
|
||||
|
@ -246,8 +246,7 @@ export class SendView extends PureComponent<Props, State> {
|
|||
|
||||
if (field === 'to') {
|
||||
// eslint-disable-next-line max-len
|
||||
this.setState(() => ({ [field]: value }),
|
||||
() => validateAddress({ address: value }));
|
||||
this.setState(() => ({ [field]: value }), () => validateAddress({ address: value }));
|
||||
} else {
|
||||
this.setState(() => ({ [field]: value }));
|
||||
}
|
||||
|
@ -307,6 +306,8 @@ export class SendView extends PureComponent<Props, State> {
|
|||
getFeeText = () => {
|
||||
const { fee } = this.state;
|
||||
|
||||
if (!fee) return '0.0';
|
||||
|
||||
const feeValue = new BigNumber(fee);
|
||||
|
||||
if (feeValue.isEqualTo(FEES.LOW)) return `Low ZEC ${feeValue.toString()}`;
|
||||
|
@ -323,18 +324,12 @@ export class SendView extends PureComponent<Props, State> {
|
|||
return isToAddressValid ? (
|
||||
<RowComponent alignItems='center'>
|
||||
<ValidateStatusIcon src={ValidIcon} />
|
||||
<ItemLabel
|
||||
value='VALID'
|
||||
color={theme.colors.transactionReceived}
|
||||
/>
|
||||
<ItemLabel value='VALID' color={theme.colors.transactionReceived} />
|
||||
</RowComponent>
|
||||
) : (
|
||||
<RowComponent alignItems='center'>
|
||||
<ValidateStatusIcon src={InvalidIcon} />
|
||||
<ItemLabel
|
||||
value='INVALID'
|
||||
color={theme.colors.transactionSent}
|
||||
/>
|
||||
<ItemLabel value='INVALID' color={theme.colors.transactionSent} />
|
||||
</RowComponent>
|
||||
);
|
||||
};
|
||||
|
@ -365,14 +360,8 @@ export class SendView extends PureComponent<Props, State> {
|
|||
|
||||
if (operationId) {
|
||||
return (
|
||||
<ColumnComponent
|
||||
width='100%'
|
||||
id='send-success-wrapper'
|
||||
>
|
||||
<TextComponent
|
||||
value={`Transaction ID: ${operationId}`}
|
||||
align='center'
|
||||
/>
|
||||
<ColumnComponent width='100%' id='send-success-wrapper'>
|
||||
<TextComponent value={`Transaction ID: ${operationId}`} align='center' />
|
||||
<button
|
||||
type='button'
|
||||
onClick={() => {
|
||||
|
@ -494,25 +483,23 @@ export class SendView extends PureComponent<Props, State> {
|
|||
id='send-show-additional-options-button'
|
||||
onClick={() => this.setState(state => ({
|
||||
showFee: !state.showFee,
|
||||
}))}
|
||||
}))
|
||||
}
|
||||
>
|
||||
<SeeMoreIcon
|
||||
src={MenuIcon}
|
||||
alt='Show more icon'
|
||||
/>
|
||||
<TextComponent
|
||||
value={`${showFee ? 'Hide' : 'Show'} Additional Options`}
|
||||
/>
|
||||
<SeeMoreIcon src={MenuIcon} alt='Show more icon' />
|
||||
<TextComponent value={`${showFee ? 'Hide' : 'Show'} Additional Options`} />
|
||||
</ShowFeeButton>
|
||||
<RevealsMain>
|
||||
<Transition
|
||||
native
|
||||
items={showFee}
|
||||
enter={[{
|
||||
height: 'auto',
|
||||
opacity: 1,
|
||||
overflow: 'visible',
|
||||
}]}
|
||||
enter={[
|
||||
{
|
||||
height: 'auto',
|
||||
opacity: 1,
|
||||
overflow: 'visible',
|
||||
},
|
||||
]}
|
||||
leave={{ height: 0, opacity: 0 }}
|
||||
from={{
|
||||
position: 'absolute',
|
||||
|
@ -521,40 +508,39 @@ export class SendView extends PureComponent<Props, State> {
|
|||
height: 0,
|
||||
}}
|
||||
>
|
||||
{show => show && (props => (
|
||||
<animated.div style={props}>
|
||||
<FeeWrapper id='send-fee-wrapper'>
|
||||
<RowComponent
|
||||
alignItems='flex-end'
|
||||
justifyContent='space-between'
|
||||
>
|
||||
<ColumnComponent width='74%'>
|
||||
<InputLabelComponent value='Fee' />
|
||||
<InputComponent
|
||||
type='number'
|
||||
onChange={this.handleChange('fee')}
|
||||
value={String(fee)}
|
||||
disabled={feeType !== FEES.CUSTOM}
|
||||
bgColor={theme.colors.blackTwo}
|
||||
name='fee'
|
||||
/>
|
||||
</ColumnComponent>
|
||||
<ColumnComponent width='25%'>
|
||||
<SelectComponent
|
||||
placement='top'
|
||||
value={String(feeType)}
|
||||
bgColor={theme.colors.blackTwo}
|
||||
onChange={this.handleChangeFeeType}
|
||||
options={Object.keys(FEES).map(cur => ({
|
||||
label: cur.toLowerCase(),
|
||||
value: String(FEES[cur]),
|
||||
}))}
|
||||
/>
|
||||
</ColumnComponent>
|
||||
</RowComponent>
|
||||
</FeeWrapper>
|
||||
</animated.div>
|
||||
))}
|
||||
{show => show
|
||||
&& (props => (
|
||||
<animated.div style={props}>
|
||||
<FeeWrapper id='send-fee-wrapper'>
|
||||
<RowComponent alignItems='flex-end' justifyContent='space-between'>
|
||||
<ColumnComponent width='74%'>
|
||||
<InputLabelComponent value='Fee' />
|
||||
<InputComponent
|
||||
type='number'
|
||||
onChange={this.handleChange('fee')}
|
||||
value={String(fee)}
|
||||
disabled={feeType !== FEES.CUSTOM}
|
||||
bgColor={theme.colors.blackTwo}
|
||||
name='fee'
|
||||
/>
|
||||
</ColumnComponent>
|
||||
<ColumnComponent width='25%'>
|
||||
<SelectComponent
|
||||
placement='top'
|
||||
value={String(feeType)}
|
||||
bgColor={theme.colors.blackTwo}
|
||||
onChange={this.handleChangeFeeType}
|
||||
options={Object.keys(FEES).map(cur => ({
|
||||
label: cur.toLowerCase(),
|
||||
value: String(FEES[cur]),
|
||||
}))}
|
||||
/>
|
||||
</ColumnComponent>
|
||||
</RowComponent>
|
||||
</FeeWrapper>
|
||||
</animated.div>
|
||||
))
|
||||
}
|
||||
</Transition>
|
||||
</RevealsMain>
|
||||
{feeType === FEES.CUSTOM && (
|
||||
|
@ -602,10 +588,7 @@ export class SendView extends PureComponent<Props, State> {
|
|||
</ModalContent>
|
||||
)}
|
||||
</ConfirmDialogComponent>
|
||||
<FormButton
|
||||
label='Cancel'
|
||||
variant='secondary'
|
||||
/>
|
||||
<FormButton label='Cancel' variant='secondary' />
|
||||
</SendWrapper>
|
||||
</RowComponent>
|
||||
);
|
||||
|
|
|
@ -7,6 +7,7 @@ import processExists from 'process-exists';
|
|||
import isDev from 'electron-is-dev';
|
||||
import type { ChildProcess } from 'child_process';
|
||||
import eres from 'eres';
|
||||
import uuid from 'uuid/v4';
|
||||
/* eslint-disable-next-line import/named */
|
||||
import { mainWindow } from '../electron';
|
||||
|
||||
|
@ -16,7 +17,6 @@ import getDaemonName from './get-daemon-name';
|
|||
import fetchParams from './run-fetch-params';
|
||||
import log from './logger';
|
||||
import store from '../electron-store';
|
||||
import generateRandomString from '../../app/utils/generate-random-string';
|
||||
|
||||
const getDaemonOptions = ({ username, password }) => {
|
||||
/*
|
||||
|
@ -38,20 +38,14 @@ const getDaemonOptions = ({ username, password }) => {
|
|||
'-testnet',
|
||||
'-addnode=testnet.z.cash',
|
||||
];
|
||||
return isDev
|
||||
? defaultOptions.concat(['-testnet', '-addnode=testnet.z.cash'])
|
||||
: defaultOptions;
|
||||
return isDev ? defaultOptions.concat(['-testnet', '-addnode=testnet.z.cash']) : defaultOptions;
|
||||
};
|
||||
|
||||
let resolved = false;
|
||||
|
||||
// eslint-disable-next-line
|
||||
const runDaemon: () => Promise<?ChildProcess> = () => new Promise(async (resolve, reject) => {
|
||||
const processName = path.join(
|
||||
getBinariesPath(),
|
||||
getOsFolder(),
|
||||
getDaemonName(),
|
||||
);
|
||||
const processName = path.join(getBinariesPath(), getOsFolder(), getDaemonName());
|
||||
|
||||
const [err] = await eres(fetchParams());
|
||||
|
||||
|
@ -77,8 +71,8 @@ const runDaemon: () => Promise<?ChildProcess> = () => new Promise(async (resolve
|
|||
password: store.get('rpcpassword'),
|
||||
}
|
||||
: {
|
||||
username: generateRandomString(),
|
||||
password: generateRandomString(),
|
||||
username: uuid(),
|
||||
password: uuid(),
|
||||
};
|
||||
|
||||
if (isDev) log('Rpc Credentials', rpcCredentials);
|
||||
|
@ -88,13 +82,9 @@ const runDaemon: () => Promise<?ChildProcess> = () => new Promise(async (resolve
|
|||
store.set('rpcpassword', rpcCredentials.password);
|
||||
}
|
||||
|
||||
const childProcess = cp.spawn(
|
||||
processName,
|
||||
getDaemonOptions(rpcCredentials),
|
||||
{
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
},
|
||||
);
|
||||
const childProcess = cp.spawn(processName, getDaemonOptions(rpcCredentials), {
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
});
|
||||
|
||||
childProcess.stdout.on('data', (data) => {
|
||||
if (mainWindow && mainWindow.webContents) mainWindow.webContents.send('zcashd-log', data.toString());
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
"flowCommandPath": "./node_modules/.bin/flow",
|
||||
"globIncludePatterns": ["app/**/*.js", "config/**/*.js", "services/**/*.js", "utils/**/*.js"],
|
||||
"threshold": 70,
|
||||
"reportTypes": ["html"]
|
||||
"reportTypes": ["html", "badge"]
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,591 @@
|
|||
/**
|
||||
* Flowtype definitions for date-f
|
||||
* Generated by Flowgen from a Typescript Definition
|
||||
* Flowgen v1.3.0
|
||||
* Author: [Joar Wilk](http://twitter.com/joarwilk)
|
||||
* Repo: http://github.com/joarwilk/flowgen
|
||||
*/
|
||||
|
||||
declare interface CurriedFn1<A, R> {
|
||||
(a: A): R;
|
||||
}
|
||||
declare interface CurriedFn2<A, B, R> {
|
||||
(a: A): CurriedFn1<B, R>;
|
||||
(a: A, b: B): R;
|
||||
}
|
||||
declare interface CurriedFn3<A, B, C, R> {
|
||||
(a: A): CurriedFn2<B, C, R>;
|
||||
(a: A, b: B): CurriedFn1<C, R>;
|
||||
(a: A, b: B, c: C): R;
|
||||
}
|
||||
declare interface CurriedFn4<A, B, C, D, R> {
|
||||
(a: A): CurriedFn3<B, C, D, R>;
|
||||
(a: A, b: B): CurriedFn2<C, D, R>;
|
||||
(a: A, b: B, c: C): CurriedFn1<D, R>;
|
||||
(a: A, b: B, c: C, d: D): R;
|
||||
}
|
||||
declare type Interval = {
|
||||
start: Date | number,
|
||||
end: Date | number,
|
||||
};
|
||||
declare type IntervalAliased = Interval;
|
||||
declare type Locale = {
|
||||
formatDistance: Function,
|
||||
formatRelative: Function,
|
||||
localize: {
|
||||
ordinalNumber: Function,
|
||||
era: Function,
|
||||
quarter: Function,
|
||||
month: Function,
|
||||
day: Function,
|
||||
dayPeriod: Function,
|
||||
},
|
||||
formatLong: Object,
|
||||
date: Function,
|
||||
time: Function,
|
||||
dateTime: Function,
|
||||
match: {
|
||||
ordinalNumber: Function,
|
||||
era: Function,
|
||||
quarter: Function,
|
||||
month: Function,
|
||||
day: Function,
|
||||
dayPeriod: Function,
|
||||
},
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
|
||||
},
|
||||
};
|
||||
declare type LocaleAliased = Locale;
|
||||
declare module 'date-fns' {
|
||||
declare type Interval = {
|
||||
start: Date | number,
|
||||
end: Date | number,
|
||||
};
|
||||
declare type Locale = {
|
||||
formatDistance: Function,
|
||||
formatRelative: Function,
|
||||
localize: {
|
||||
ordinalNumber: Function,
|
||||
era: Function,
|
||||
quarter: Function,
|
||||
month: Function,
|
||||
day: Function,
|
||||
dayPeriod: Function,
|
||||
},
|
||||
formatLong: Object,
|
||||
date: Function,
|
||||
time: Function,
|
||||
dateTime: Function,
|
||||
match: {
|
||||
ordinalNumber: Function,
|
||||
era: Function,
|
||||
quarter: Function,
|
||||
month: Function,
|
||||
day: Function,
|
||||
dayPeriod: Function,
|
||||
},
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
|
||||
},
|
||||
};
|
||||
declare function addDays(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function addHours(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function addISOWeekYears(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function addMilliseconds(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function addMinutes(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function addMonths(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function addQuarters(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function addSeconds(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function addWeeks(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function addYears(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function areIntervalsOverlapping(
|
||||
intervalLeft: Interval,
|
||||
intervalRight: Interval,
|
||||
): boolean;
|
||||
|
||||
declare function closestIndexTo(
|
||||
dateToCompare: Date | number,
|
||||
datesArray: (Date | number)[],
|
||||
): number;
|
||||
|
||||
declare function closestTo(dateToCompare: Date | number, datesArray: (Date | number)[]): Date;
|
||||
|
||||
declare function compareAsc(dateLeft: Date | number, dateRight: Date | number): number;
|
||||
|
||||
declare function compareDesc(dateLeft: Date | number, dateRight: Date | number): number;
|
||||
|
||||
declare function differenceInCalendarDays(
|
||||
dateLeft: Date | number,
|
||||
dateRight: Date | number,
|
||||
): number;
|
||||
|
||||
declare function differenceInCalendarISOWeeks(
|
||||
dateLeft: Date | number,
|
||||
dateRight: Date | number,
|
||||
): number;
|
||||
|
||||
declare function differenceInCalendarISOWeekYears(
|
||||
dateLeft: Date | number,
|
||||
dateRight: Date | number,
|
||||
): number;
|
||||
|
||||
declare function differenceInCalendarMonths(
|
||||
dateLeft: Date | number,
|
||||
dateRight: Date | number,
|
||||
): number;
|
||||
|
||||
declare function differenceInCalendarQuarters(
|
||||
dateLeft: Date | number,
|
||||
dateRight: Date | number,
|
||||
): number;
|
||||
|
||||
declare function differenceInCalendarWeeks(
|
||||
dateLeft: Date | number,
|
||||
dateRight: Date | number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
locale?: Locale,
|
||||
},
|
||||
): number;
|
||||
|
||||
declare function differenceInCalendarYears(
|
||||
dateLeft: Date | number,
|
||||
dateRight: Date | number,
|
||||
): number;
|
||||
|
||||
declare function differenceInDays(dateLeft: Date | number, dateRight: Date | number): number;
|
||||
|
||||
declare function differenceInHours(dateLeft: Date | number, dateRight: Date | number): number;
|
||||
|
||||
declare function differenceInISOWeekYears(
|
||||
dateLeft: Date | number,
|
||||
dateRight: Date | number,
|
||||
): number;
|
||||
|
||||
declare function differenceInMilliseconds(
|
||||
dateLeft: Date | number,
|
||||
dateRight: Date | number,
|
||||
): number;
|
||||
|
||||
declare function differenceInMinutes(dateLeft: Date | number, dateRight: Date | number): number;
|
||||
|
||||
declare function differenceInMonths(dateLeft: Date | number, dateRight: Date | number): number;
|
||||
|
||||
declare function differenceInQuarters(dateLeft: Date | number, dateRight: Date | number): number;
|
||||
|
||||
declare function differenceInSeconds(dateLeft: Date | number, dateRight: Date | number): number;
|
||||
|
||||
declare function differenceInWeeks(dateLeft: Date | number, dateRight: Date | number): number;
|
||||
|
||||
declare function differenceInYears(dateLeft: Date | number, dateRight: Date | number): number;
|
||||
|
||||
declare function eachDayOfInterval(
|
||||
interval: Interval,
|
||||
options?: {
|
||||
step?: number,
|
||||
},
|
||||
): Date[];
|
||||
|
||||
declare function eachWeekendOfInterval(interval: Interval): Date[];
|
||||
|
||||
declare function eachWeekendOfMonth(date: Date | number): Date[];
|
||||
|
||||
declare function eachWeekendOfYear(date: Date | number): Date[];
|
||||
|
||||
declare function eachWeekOfInterval(
|
||||
interval: Interval,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
},
|
||||
): Date[];
|
||||
|
||||
declare function endOfDay(date: Date | number): Date;
|
||||
|
||||
declare function endOfDecade(
|
||||
date: Date | number,
|
||||
options?: {
|
||||
additionalDigits?: 0 | 1 | 2,
|
||||
},
|
||||
): Date;
|
||||
|
||||
declare function endOfHour(date: Date | number): Date;
|
||||
|
||||
declare function endOfISOWeek(date: Date | number): Date;
|
||||
|
||||
declare function endOfISOWeekYear(date: Date | number): Date;
|
||||
|
||||
declare function endOfMinute(date: Date | number): Date;
|
||||
|
||||
declare function endOfMonth(date: Date | number): Date;
|
||||
|
||||
declare function endOfQuarter(date: Date | number): Date;
|
||||
|
||||
declare function endOfSecond(date: Date | number): Date;
|
||||
|
||||
declare function endOfWeek(
|
||||
date: Date | number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
locale?: Locale,
|
||||
},
|
||||
): Date;
|
||||
|
||||
declare function endOfYear(date: Date | number): Date;
|
||||
|
||||
declare function format(
|
||||
date: Date | number,
|
||||
format: string,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
firstWeekContainsDate?: number,
|
||||
locale?: Locale,
|
||||
awareOfUnicodeTokens?: boolean,
|
||||
},
|
||||
): string;
|
||||
|
||||
declare function formatDistance(
|
||||
date: Date | number,
|
||||
baseDate: Date | number,
|
||||
options?: {
|
||||
includeSeconds?: boolean,
|
||||
addSuffix?: boolean,
|
||||
locale?: Locale,
|
||||
},
|
||||
): string;
|
||||
|
||||
declare function formatDistanceStrict(
|
||||
date: Date | number,
|
||||
baseDate: Date | number,
|
||||
options?: {
|
||||
addSuffix?: boolean,
|
||||
unit?: 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year',
|
||||
roundingMethod?: 'floor' | 'ceil' | 'round',
|
||||
locale?: Locale,
|
||||
},
|
||||
): string;
|
||||
|
||||
declare function formatRelative(
|
||||
date: Date | number,
|
||||
baseDate: Date | number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
locale?: Locale,
|
||||
},
|
||||
): string;
|
||||
|
||||
declare function fromUnixTime(unixTime: number): Date;
|
||||
|
||||
declare function getDate(date: Date | number): number;
|
||||
|
||||
declare function getDay(date: Date | number): number;
|
||||
|
||||
declare function getDayOfYear(date: Date | number): number;
|
||||
|
||||
declare function getDaysInMonth(date: Date | number): number;
|
||||
|
||||
declare function getDaysInYear(date: Date | number): number;
|
||||
|
||||
declare function getDecade(date: Date | number): number;
|
||||
|
||||
declare function getHours(date: Date | number): number;
|
||||
|
||||
declare function getISODay(date: Date | number): number;
|
||||
|
||||
declare function getISOWeek(date: Date | number): number;
|
||||
|
||||
declare function getISOWeeksInYear(date: Date | number): number;
|
||||
|
||||
declare function getISOWeekYear(date: Date | number): number;
|
||||
|
||||
declare function getMilliseconds(date: Date | number): number;
|
||||
|
||||
declare function getMinutes(date: Date | number): number;
|
||||
|
||||
declare function getMonth(date: Date | number): number;
|
||||
|
||||
declare function getOverlappingDaysInIntervals(
|
||||
intervalLeft: Interval,
|
||||
intervalRight: Interval,
|
||||
): number;
|
||||
|
||||
declare function getQuarter(date: Date | number): number;
|
||||
|
||||
declare function getSeconds(date: Date | number): number;
|
||||
|
||||
declare function getTime(date: Date | number): number;
|
||||
|
||||
declare function getUnixTime(date: Date | number): number;
|
||||
|
||||
declare function getWeek(
|
||||
date: Date | number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
|
||||
},
|
||||
): number;
|
||||
|
||||
declare function getWeekOfMonth(
|
||||
date: Date | number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
},
|
||||
): number;
|
||||
|
||||
declare function getWeeksInMonth(
|
||||
date: Date | number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
locale?: Locale,
|
||||
},
|
||||
): number;
|
||||
|
||||
declare function getWeekYear(
|
||||
date: Date | number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
|
||||
},
|
||||
): number;
|
||||
|
||||
declare function getYear(date: Date | number): number;
|
||||
|
||||
declare function isAfter(date: Date | number, dateToCompare: Date | number): boolean;
|
||||
|
||||
declare function isBefore(date: Date | number, dateToCompare: Date | number): boolean;
|
||||
|
||||
declare function isDate(value: any): boolean;
|
||||
|
||||
declare function isEqual(dateLeft: Date | number, dateRight: Date | number): boolean;
|
||||
|
||||
declare function isFirstDayOfMonth(date: Date | number): boolean;
|
||||
|
||||
declare function isFriday(date: Date | number): boolean;
|
||||
|
||||
declare function isLastDayOfMonth(date: Date | number): boolean;
|
||||
|
||||
declare function isLeapYear(date: Date | number): boolean;
|
||||
|
||||
declare function isMonday(date: Date | number): boolean;
|
||||
|
||||
declare function isSameDay(dateLeft: Date | number, dateRight: Date | number): boolean;
|
||||
|
||||
declare function isSameHour(dateLeft: Date | number, dateRight: Date | number): boolean;
|
||||
|
||||
declare function isSameISOWeek(dateLeft: Date | number, dateRight: Date | number): boolean;
|
||||
|
||||
declare function isSameISOWeekYear(dateLeft: Date | number, dateRight: Date | number): boolean;
|
||||
|
||||
declare function isSameMinute(dateLeft: Date | number, dateRight: Date | number): boolean;
|
||||
|
||||
declare function isSameMonth(dateLeft: Date | number, dateRight: Date | number): boolean;
|
||||
|
||||
declare function isSameQuarter(dateLeft: Date | number, dateRight: Date | number): boolean;
|
||||
|
||||
declare function isSameSecond(dateLeft: Date | number, dateRight: Date | number): boolean;
|
||||
|
||||
declare function isSameWeek(
|
||||
dateLeft: Date | number,
|
||||
dateRight: Date | number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
locale?: Locale,
|
||||
},
|
||||
): boolean;
|
||||
|
||||
declare function isSameYear(dateLeft: Date | number, dateRight: Date | number): boolean;
|
||||
|
||||
declare function isSaturday(date: Date | number): boolean;
|
||||
|
||||
declare function isSunday(date: Date | number): boolean;
|
||||
|
||||
declare function isThursday(date: Date | number): boolean;
|
||||
|
||||
declare function isTuesday(date: Date | number): boolean;
|
||||
|
||||
declare function isValid(date: any): boolean;
|
||||
|
||||
declare function isWednesday(date: Date | number): boolean;
|
||||
|
||||
declare function isWeekend(date: Date | number): boolean;
|
||||
|
||||
declare function isWithinInterval(date: Date | number, interval: Interval): boolean;
|
||||
|
||||
declare function lastDayOfDecade(date: Date | number): Date;
|
||||
|
||||
declare function lastDayOfISOWeek(date: Date | number): Date;
|
||||
|
||||
declare function lastDayOfISOWeekYear(date: Date | number): Date;
|
||||
|
||||
declare function lastDayOfMonth(date: Date | number): Date;
|
||||
|
||||
declare function lastDayOfQuarter(
|
||||
date: Date | number,
|
||||
options?: {
|
||||
additionalDigits?: 0 | 1 | 2,
|
||||
},
|
||||
): Date;
|
||||
|
||||
declare function lastDayOfWeek(
|
||||
date: Date | number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
locale?: Locale,
|
||||
},
|
||||
): Date;
|
||||
|
||||
declare function lastDayOfYear(date: Date | number): Date;
|
||||
|
||||
declare function lightFormat(date: Date | number, format: string): string;
|
||||
|
||||
declare function max(datesArray: (Date | number)[]): Date;
|
||||
|
||||
declare function min(datesArray: (Date | number)[]): Date;
|
||||
|
||||
declare function parse(
|
||||
dateString: string,
|
||||
formatString: string,
|
||||
baseDate: Date | number,
|
||||
options?: {
|
||||
locale?: Locale,
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
|
||||
awareOfUnicodeTokens?: boolean,
|
||||
},
|
||||
): Date;
|
||||
|
||||
declare function parseISO(
|
||||
argument: string,
|
||||
options?: {
|
||||
additionalDigits?: 0 | 1 | 2,
|
||||
},
|
||||
): Date;
|
||||
|
||||
declare function roundToNearestMinutes(
|
||||
date: Date | number,
|
||||
options?: {
|
||||
nearestTo?: number,
|
||||
},
|
||||
): Date;
|
||||
|
||||
declare function setDate(date: Date | number, dayOfMonth: number): Date;
|
||||
|
||||
declare function setDay(
|
||||
date: Date | number,
|
||||
day: number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
locale?: Locale,
|
||||
},
|
||||
): Date;
|
||||
|
||||
declare function setDayOfYear(date: Date | number, dayOfYear: number): Date;
|
||||
|
||||
declare function setHours(date: Date | number, hours: number): Date;
|
||||
|
||||
declare function setISODay(date: Date | number, day: number): Date;
|
||||
|
||||
declare function setISOWeek(date: Date | number, isoWeek: number): Date;
|
||||
|
||||
declare function setISOWeekYear(date: Date | number, isoWeekYear: number): Date;
|
||||
|
||||
declare function setMilliseconds(date: Date | number, milliseconds: number): Date;
|
||||
|
||||
declare function setMinutes(date: Date | number, minutes: number): Date;
|
||||
|
||||
declare function setMonth(date: Date | number, month: number): Date;
|
||||
|
||||
declare function setQuarter(date: Date | number, quarter: number): Date;
|
||||
|
||||
declare function setSeconds(date: Date | number, seconds: number): Date;
|
||||
|
||||
declare function setWeek(
|
||||
date: Date | number,
|
||||
week: number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
|
||||
},
|
||||
): Date;
|
||||
|
||||
declare function setWeekYear(
|
||||
date: Date | number,
|
||||
weekYear: number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
|
||||
},
|
||||
): Date;
|
||||
|
||||
declare function setYear(date: Date | number, year: number): Date;
|
||||
|
||||
declare function startOfDay(date: Date | number): Date;
|
||||
|
||||
declare function startOfDecade(date: Date | number): Date;
|
||||
|
||||
declare function startOfHour(date: Date | number): Date;
|
||||
|
||||
declare function startOfISOWeek(date: Date | number): Date;
|
||||
|
||||
declare function startOfISOWeekYear(date: Date | number): Date;
|
||||
|
||||
declare function startOfMinute(date: Date | number): Date;
|
||||
|
||||
declare function startOfMonth(date: Date | number): Date;
|
||||
|
||||
declare function startOfQuarter(date: Date | number): Date;
|
||||
|
||||
declare function startOfSecond(date: Date | number): Date;
|
||||
|
||||
declare function startOfWeek(
|
||||
date: Date | number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
locale?: Locale,
|
||||
},
|
||||
): Date;
|
||||
|
||||
declare function startOfWeekYear(
|
||||
date: Date | number,
|
||||
options?: {
|
||||
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
firstWeekContainsDate?: 1 | 2 | 3 | 4 | 5 | 6 | 7,
|
||||
},
|
||||
): Date;
|
||||
|
||||
declare function startOfYear(date: Date | number): Date;
|
||||
|
||||
declare function subDays(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function subHours(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function subISOWeekYears(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function subMilliseconds(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function subMinutes(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function subMonths(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function subQuarters(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function subSeconds(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function subWeeks(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function subYears(date: Date | number, amount: number): Date;
|
||||
|
||||
declare function toDate(argument: Date | number): Date;
|
||||
}
|
|
@ -60,7 +60,7 @@
|
|||
"eslint": "^5.8.0",
|
||||
"eslint-config-airbnb": "^17.1.0",
|
||||
"eslint-plugin-flowtype": "^3.2.1",
|
||||
"eslint-plugin-import": "^2.14.0",
|
||||
"eslint-plugin-import": "^2.16.0",
|
||||
"eslint-plugin-jest": "^22.1.0",
|
||||
"eslint-plugin-jsx-a11y": "^6.0.3",
|
||||
"eslint-plugin-react": "^7.12.4",
|
||||
|
|
41
yarn.lock
41
yarn.lock
|
@ -6548,7 +6548,7 @@ eslint-config-airbnb@^17.1.0:
|
|||
object.assign "^4.1.0"
|
||||
object.entries "^1.0.4"
|
||||
|
||||
eslint-import-resolver-node@^0.3.1:
|
||||
eslint-import-resolver-node@^0.3.2:
|
||||
version "0.3.2"
|
||||
resolved "https://registry.yarnpkg.com/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz#58f15fb839b8d0576ca980413476aab2472db66a"
|
||||
integrity sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==
|
||||
|
@ -6556,13 +6556,13 @@ eslint-import-resolver-node@^0.3.1:
|
|||
debug "^2.6.9"
|
||||
resolve "^1.5.0"
|
||||
|
||||
eslint-module-utils@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz#b270362cd88b1a48ad308976ce7fa54e98411746"
|
||||
integrity sha1-snA2LNiLGkitMIl2zn+lTphBF0Y=
|
||||
eslint-module-utils@^2.3.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.3.0.tgz#546178dab5e046c8b562bbb50705e2456d7bda49"
|
||||
integrity sha512-lmDJgeOOjk8hObTysjqH7wyMi+nsHwwvfBykwfhjR1LNdd7C2uFJBvx4OpWYpXOw4df1yE1cDEVd1yLHitk34w==
|
||||
dependencies:
|
||||
debug "^2.6.8"
|
||||
pkg-dir "^1.0.0"
|
||||
pkg-dir "^2.0.0"
|
||||
|
||||
eslint-plugin-flowtype@^3.2.1:
|
||||
version "3.2.1"
|
||||
|
@ -6571,21 +6571,21 @@ eslint-plugin-flowtype@^3.2.1:
|
|||
dependencies:
|
||||
lodash "^4.17.10"
|
||||
|
||||
eslint-plugin-import@^2.14.0:
|
||||
version "2.14.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz#6b17626d2e3e6ad52cfce8807a845d15e22111a8"
|
||||
integrity sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g==
|
||||
eslint-plugin-import@^2.16.0:
|
||||
version "2.16.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.16.0.tgz#97ac3e75d0791c4fac0e15ef388510217be7f66f"
|
||||
integrity sha512-z6oqWlf1x5GkHIFgrSvtmudnqM6Q60KM4KvpWi5ubonMjycLjndvd5+8VAZIsTlHC03djdgJuyKG6XO577px6A==
|
||||
dependencies:
|
||||
contains-path "^0.1.0"
|
||||
debug "^2.6.8"
|
||||
debug "^2.6.9"
|
||||
doctrine "1.5.0"
|
||||
eslint-import-resolver-node "^0.3.1"
|
||||
eslint-module-utils "^2.2.0"
|
||||
has "^1.0.1"
|
||||
lodash "^4.17.4"
|
||||
minimatch "^3.0.3"
|
||||
eslint-import-resolver-node "^0.3.2"
|
||||
eslint-module-utils "^2.3.0"
|
||||
has "^1.0.3"
|
||||
lodash "^4.17.11"
|
||||
minimatch "^3.0.4"
|
||||
read-pkg-up "^2.0.0"
|
||||
resolve "^1.6.0"
|
||||
resolve "^1.9.0"
|
||||
|
||||
eslint-plugin-jest@^22.1.0:
|
||||
version "22.1.0"
|
||||
|
@ -12380,13 +12380,6 @@ pkg-conf@^2.1.0:
|
|||
find-up "^2.0.0"
|
||||
load-json-file "^4.0.0"
|
||||
|
||||
pkg-dir@^1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-1.0.0.tgz#7a4b508a8d5bb2d629d447056ff4e9c9314cf3d4"
|
||||
integrity sha1-ektQio1bstYp1EcFb/TpyTFM89Q=
|
||||
dependencies:
|
||||
find-up "^1.0.0"
|
||||
|
||||
pkg-dir@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-2.0.0.tgz#f6d5d1109e19d63edf428e0bd57e12777615334b"
|
||||
|
|
Loading…
Reference in New Issue