Browse Source

Merge pull request #198 from loeck/master

Fix build size
master
Loëck Vézien 7 years ago
committed by GitHub
parent
commit
4be9896e35
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      electron-builder.yml
  2. 5
      package.json
  3. 18
      src/components/BalanceSummary/index.js
  4. 2
      src/components/DevTools.js
  5. 38
      src/components/base/Chart/index.js
  6. 16
      yarn.lock

24
electron-builder.yml

@ -43,7 +43,23 @@ nsis:
files: files:
- dist/internals - dist/internals
- "!node_modules/jsqr/test-data${/*}" - "!node_modules/7zip-bin-linux"
- "!node_modules/ledger-test-library/deps/djinni${/*}" - "!node_modules/7zip-bin-mac"
- "!node_modules/ledger-test-library/deps/gyp${/*}" - "!node_modules/7zip-bin-win"
- "!node_modules/raven-js/dist${/*}" - "!node_modules/app-builder-bin-linux"
- "!node_modules/app-builder-bin-mac"
- "!node_modules/app-builder-bin-win"
- "!node_modules/app-builder-util"
- "!node_modules/builder-util"
- "!node_modules/dmg-builder"
- "!node_modules/electron-builder-lib"
- "!node_modules/electron-rebuild"
- "!node_modules/electron"
- "!node_modules/jsqr/test-data"
- "!node_modules/ledger-test-library/deps/djinni"
- "!node_modules/ledger-test-library/deps/gyp"
- "!node_modules/node-gyp"
- "!node_modules/opencollective"
- "!node_modules/raven-js/dist"
- "!node_modules/rxjs"
- "!node_modules/victory-pie"

5
package.json

@ -49,7 +49,7 @@
"@fortawesome/fontawesome-free-solid": "^5.0.7", "@fortawesome/fontawesome-free-solid": "^5.0.7",
"@fortawesome/react-fontawesome": "^0.0.17", "@fortawesome/react-fontawesome": "^0.0.17",
"@ledgerhq/common": "^4.2.0", "@ledgerhq/common": "^4.2.0",
"@ledgerhq/currencies": "^4.3.0-beta.f8165b69", "@ledgerhq/currencies": "^4.5.0",
"@ledgerhq/hw-app-btc": "^4.2.2", "@ledgerhq/hw-app-btc": "^4.2.2",
"@ledgerhq/hw-app-eth": "^4.2.0", "@ledgerhq/hw-app-eth": "^4.2.0",
"@ledgerhq/hw-transport": "^4.2.0", "@ledgerhq/hw-transport": "^4.2.0",
@ -107,7 +107,7 @@
"@storybook/react": "^3.3.14", "@storybook/react": "^3.3.14",
"babel-core": "^6.26.0", "babel-core": "^6.26.0",
"babel-eslint": "^8.2.1", "babel-eslint": "^8.2.1",
"babel-loader": "^7.1.3", "babel-loader": "^7.1.4",
"babel-plugin-module-resolver": "^3.1.0", "babel-plugin-module-resolver": "^3.1.0",
"babel-plugin-styled-components": "^1.5.0", "babel-plugin-styled-components": "^1.5.0",
"babel-preset-env": "^1.6.1", "babel-preset-env": "^1.6.1",
@ -121,7 +121,6 @@
"electron": "1.8.3", "electron": "1.8.3",
"electron-builder": "^20.2.0", "electron-builder": "^20.2.0",
"electron-devtools-installer": "^2.2.3", "electron-devtools-installer": "^2.2.3",
"electron-rebuild": "^1.7.3",
"electron-webpack": "1.13.0", "electron-webpack": "1.13.0",
"eslint": "^4.18.1", "eslint": "^4.18.1",
"eslint-config-airbnb": "^16.1.0", "eslint-config-airbnb": "^16.1.0",

18
src/components/BalanceSummary/index.js

@ -3,7 +3,7 @@
import React, { Fragment } from 'react' import React, { Fragment } from 'react'
import moment from 'moment' import moment from 'moment'
import { formatShort, formatCurrencyUnit, getFiatUnit } from '@ledgerhq/currencies' import { formatShort, getFiatUnit } from '@ledgerhq/currencies'
import type { Accounts } from 'types/common' import type { Accounts } from 'types/common'
@ -12,6 +12,7 @@ import { space } from 'styles/theme'
import { AreaChart } from 'components/base/Chart' import { AreaChart } from 'components/base/Chart'
import Box, { Card } from 'components/base/Box' import Box, { Card } from 'components/base/Box'
import CalculateBalance from 'components/CalculateBalance' import CalculateBalance from 'components/CalculateBalance'
import FormattedVal from 'components/base/FormattedVal'
function getTickCountX(selectedTime) { function getTickCountX(selectedTime) {
switch (selectedTime) { switch (selectedTime) {
@ -88,11 +89,16 @@ const BalanceSummary = ({
right: space[6], right: space[6],
}} }}
strokeWidth={2} strokeWidth={2}
renderLabels={d => renderLabels={d => d.y}
formatCurrencyUnit(unit, d.y * 100, { renderTooltip={d => (
showCode: true, <FormattedVal
}) alwaysShowSign={false}
} color="white"
showCode
fiat={counterValue}
val={d}
/>
)}
renderTickX={renderTickX(selectedTime)} renderTickX={renderTickX(selectedTime)}
renderTickY={t => formatShort(unit, t)} renderTickY={t => formatShort(unit, t)}
tickCountX={getTickCountX(selectedTime)} tickCountX={getTickCountX(selectedTime)}

2
src/components/DevTools.js

@ -5,7 +5,7 @@
import React, { PureComponent } from 'react' import React, { PureComponent } from 'react'
import { remote, ipcRenderer } from 'electron' import { remote, ipcRenderer } from 'electron'
import { translate } from 'react-i18next' import { translate } from 'react-i18next'
import { VictoryArea } from 'victory' import VictoryArea from 'victory-chart/lib/components/victory-area/victory-area'
import styled from 'styled-components' import styled from 'styled-components'
import color from 'color' import color from 'color'
import fs from 'fs' import fs from 'fs'

38
src/components/base/Chart/index.js

@ -3,17 +3,17 @@
/* eslint-disable react/no-multi-comp */ /* eslint-disable react/no-multi-comp */
import React, { Fragment, Component, PureComponent } from 'react' import React, { Fragment, Component, PureComponent } from 'react'
import {
VictoryChart, import VictoryChart from 'victory-chart/lib/components/victory-chart/victory-chart'
VictoryArea, import VictoryArea from 'victory-chart/lib/components/victory-area/victory-area'
VictoryAxis, import VictoryAxis from 'victory-chart/lib/components/victory-axis/victory-axis'
VictoryTooltip, import VictoryTooltip from 'victory-core/lib/victory-tooltip/victory-tooltip'
VictoryVoronoiContainer, import VictoryVoronoiContainer from 'victory-chart/lib/components/containers/victory-voronoi-container'
} from 'victory'
import { space, colors, fontSizes } from 'styles/theme' import { space, colors, fontSizes } from 'styles/theme'
import Box from 'components/base/Box' import Box from 'components/base/Box'
import Text from 'components/base/Text'
import { TooltipContainer } from 'components/base/Tooltip' import { TooltipContainer } from 'components/base/Tooltip'
const ANIMATION_DURATION = 600 const ANIMATION_DURATION = 600
@ -122,7 +122,7 @@ class CustomTooltip extends Component<Object> {
} }
render() { render() {
const { x, y, active, text, datum } = this.props const { x, y, active, text, datum, renderer } = this.props
if (!active) { if (!active) {
return null return null
@ -134,7 +134,7 @@ class CustomTooltip extends Component<Object> {
mt={-space[1]} mt={-space[1]}
style={{ position: 'absolute', top: y, left: x, transform: `translate3d(-50%, 0, 0)` }} style={{ position: 'absolute', top: y, left: x, transform: `translate3d(-50%, 0, 0)` }}
> >
{text(datum)} <Text style={{ lineHeight: 1 }}>{renderer(text(datum))}</Text>
</TooltipContainer> </TooltipContainer>
</foreignObject> </foreignObject>
) )
@ -152,13 +152,6 @@ type GenericChart = {
color: string, color: string,
data: Array<Object>, data: Array<Object>,
} }
type Chart = GenericChart & {
renderLabels: Function,
renderTickX: Function,
renderTickY: Function,
tickCountX: number,
tickCountY: number,
}
export const SimpleAreaChart = ({ export const SimpleAreaChart = ({
linearGradient, linearGradient,
@ -209,7 +202,14 @@ SimpleAreaChart.defaultProps = {
...DEFAULT_PROPS, ...DEFAULT_PROPS,
} }
const areaChartTooltip = <CustomTooltip /> type Chart = GenericChart & {
renderLabels: Function,
renderTickX: Function,
renderTickY: Function,
renderTooltip: Function,
tickCountX: number,
tickCountY: number,
}
const AreaChartContainer = <VictoryVoronoiContainer voronoiDimension="x" /> const AreaChartContainer = <VictoryVoronoiContainer voronoiDimension="x" />
@ -225,6 +225,8 @@ export class AreaChart extends PureComponent<Chart> {
...DEFAULT_PROPS, ...DEFAULT_PROPS,
} }
_tooltip = <CustomTooltip renderer={this.props.renderTooltip} />
render() { render() {
const { const {
color, color,
@ -303,7 +305,7 @@ export class AreaChart extends PureComponent<Chart> {
data={data} data={data}
x="name" x="name"
y="value" y="value"
labelComponent={areaChartTooltip} labelComponent={this._tooltip}
labels={renderLabels} labels={renderLabels}
style={{ style={{
data: { data: {

16
yarn.lock

@ -165,9 +165,9 @@
redux "^3.7.2" redux "^3.7.2"
redux-thunk "^2.2.0" redux-thunk "^2.2.0"
"@ledgerhq/currencies@^4.3.0-beta.f8165b69": "@ledgerhq/currencies@^4.5.0":
version "4.3.0" version "4.5.0"
resolved "https://registry.yarnpkg.com/@ledgerhq/currencies/-/currencies-4.3.0.tgz#d06d82030b374e72c237d0fb065d1fc175399c9e" resolved "https://registry.yarnpkg.com/@ledgerhq/currencies/-/currencies-4.5.0.tgz#b54650049be6e2452e3b9f869edd6ea5deb45169"
dependencies: dependencies:
lodash "^4.17.5" lodash "^4.17.5"
numeral "^2.0.6" numeral "^2.0.6"
@ -1091,7 +1091,7 @@ babel-jest@^22.4.1:
babel-plugin-istanbul "^4.1.5" babel-plugin-istanbul "^4.1.5"
babel-preset-jest "^22.4.1" babel-preset-jest "^22.4.1"
babel-loader@^7.1.2, babel-loader@^7.1.3: babel-loader@^7.1.2:
version "7.1.3" version "7.1.3"
resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-7.1.3.tgz#ff5b440da716e9153abb946251a9ab7670037b16" resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-7.1.3.tgz#ff5b440da716e9153abb946251a9ab7670037b16"
dependencies: dependencies:
@ -1099,6 +1099,14 @@ babel-loader@^7.1.2, babel-loader@^7.1.3:
loader-utils "^1.0.2" loader-utils "^1.0.2"
mkdirp "^0.5.1" mkdirp "^0.5.1"
babel-loader@^7.1.4:
version "7.1.4"
resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-7.1.4.tgz#e3463938bd4e6d55d1c174c5485d406a188ed015"
dependencies:
find-cache-dir "^1.0.0"
loader-utils "^1.0.2"
mkdirp "^0.5.1"
babel-messages@^6.23.0: babel-messages@^6.23.0:
version "6.23.0" version "6.23.0"
resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e"

Loading…
Cancel
Save