1
0
mirror of https://github.com/kremalicious/blowfish.git synced 2025-02-14 21:10:35 +01:00

package updates

This commit is contained in:
Matthias Kretschmann 2020-03-22 00:49:10 +01:00
parent 06e7fdff79
commit 8072712687
Signed by: m
GPG Key ID: 606EEEF3C479A91F
16 changed files with 43 additions and 47 deletions

View File

@ -1,7 +1,6 @@
{ {
"extends": [ "plugins": ["stylelint-prettier"],
"stylelint-config-standard", "rules": {
"stylelint-config-css-modules", "prettier/prettier": true
"./node_modules/prettier-stylelint/config.js" }
]
} }

View File

@ -17,8 +17,7 @@
"dist": "./scripts/release-prepare.sh", "dist": "./scripts/release-prepare.sh",
"release": "release-it --non-interactive", "release": "release-it --non-interactive",
"changelog": "auto-changelog -p", "changelog": "auto-changelog -p",
"format": "prettier --write --ignore-path .gitignore 'src/**/*.{js,jsx,json}' && npm run format:css", "format": "prettier --write --ignore-path .gitignore 'src/**/*.{js,jsx,json,css,scss}'"
"format:css": "prettier-stylelint --write --ignore-path .gitignore --quiet 'src/**/*.{css,scss}'"
}, },
"repository": "https://github.com/kremalicious/blowfish.git", "repository": "https://github.com/kremalicious/blowfish.git",
"homepage": "https://github.com/kremalicious/blowfish", "homepage": "https://github.com/kremalicious/blowfish",
@ -42,8 +41,8 @@
"shortid": "^2.2.15" "shortid": "^2.2.15"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.8.7", "@babel/core": "^7.9.0",
"@babel/preset-env": "^7.8.7", "@babel/preset-env": "^7.9.0",
"@jest-runner/electron": "^2.0.3", "@jest-runner/electron": "^2.0.3",
"@react-mock/state": "^0.1.8", "@react-mock/state": "^0.1.8",
"@svgr/webpack": "^5.2.0", "@svgr/webpack": "^5.2.0",
@ -56,23 +55,21 @@
"cross-env": "^7.0.2", "cross-env": "^7.0.2",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"electron": "^8.1.1", "electron": "^8.1.1",
"electron-builder": "^22.4.0", "electron-builder": "^22.4.1",
"electron-devtools-installer": "^2.2.4", "electron-devtools-installer": "^2.2.4",
"eslint": "^6.8.0", "eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.0", "eslint-config-prettier": "^6.10.0",
"eslint-plugin-react": "^7.19.0", "eslint-plugin-react": "^7.19.0",
"identity-obj-proxy": "^3.0.0", "identity-obj-proxy": "^3.0.0",
"jest": "^25.1.0", "jest": "^25.1.0",
"next": "^9.3.0", "next": "^9.3.1",
"prettier": "^1.19.1", "prettier": "^2.0.0",
"prettier-stylelint": "^0.4.2", "react": "^16.13.1",
"react": "^16.13.0", "react-dom": "^16.13.1",
"react-dom": "^16.13.0",
"react-pose": "^4.0.10", "react-pose": "^4.0.10",
"release-it": "^13.0.0", "release-it": "^13.1.2",
"stylelint": "^13.2.1", "stylelint": "^13.2.1",
"stylelint-config-css-modules": "^2.2.0", "stylelint-prettier": "^1.1.2"
"stylelint-config-standard": "^20.0.0"
}, },
"browserslist": "electron >= 8.0", "browserslist": "electron >= 8.0",
"build": { "build": {

View File

@ -111,7 +111,7 @@ app.on('activate', () => {
} }
}) })
const installDevTools = async mainWindow => { const installDevTools = async (mainWindow) => {
if (isDev) { if (isDev) {
const { const {
default: installExtension, default: installExtension,
@ -134,7 +134,7 @@ const installDevTools = async mainWindow => {
} }
} }
const createWindowEvents = mainWindow => { const createWindowEvents = (mainWindow) => {
mainWindow.on('enter-full-screen', () => mainWindow.on('enter-full-screen', () =>
mainWindow.webContents.executeJavaScript( mainWindow.webContents.executeJavaScript(
'document.getElementsByTagName("html")[0].classList.add("fullscreen")' 'document.getElementsByTagName("html")[0].classList.add("fullscreen")'

View File

@ -2,7 +2,7 @@ const { app, Menu } = require('electron')
const { openUrl } = require('../utils') const { openUrl } = require('../utils')
const { homepage } = require('../../package.json') const { homepage } = require('../../package.json')
const buildMenu = mainWindow => { const buildMenu = (mainWindow) => {
const template = [ const template = [
{ {
label: 'Edit', label: 'Edit',

View File

@ -21,7 +21,7 @@ const buildTouchbar = (mainWindow, accentColor) => {
const touchBar = new TouchBar({ const touchBar = new TouchBar({
items: [ items: [
createButton(1, 'ocean', mainWindow, accentColor), createButton(1, 'ocean', mainWindow, accentColor),
...conversions.map(key => createButton(0, key, mainWindow, accentColor)) ...conversions.map((key) => createButton(0, key, mainWindow, accentColor))
] ]
}) })
@ -34,7 +34,7 @@ const updateTouchbar = (
accentColor, accentColor,
currentCurrency = 'ocean' currentCurrency = 'ocean'
) => { ) => {
const items = pricesNew.map(item => { const items = pricesNew.map((item) => {
return createButton( return createButton(
item[1], item[1],
item[0], item[0],

View File

@ -55,7 +55,7 @@ const Items = () => {
)) ))
} }
const Ticker = props => ( const Ticker = (props) => (
<footer className={styles.ticker} {...props}> <footer className={styles.ticker} {...props}>
<div className={stylesIndex.balancewrap}> <div className={stylesIndex.balancewrap}>
<PoseGroup animateOnMount> <PoseGroup animateOnMount>

View File

@ -23,7 +23,7 @@ const Total = () => {
const { accounts } = useContext(AppContext) const { accounts } = useContext(AppContext)
const conversionsBalance = Object.assign( const conversionsBalance = Object.assign(
...conversions.map(key => ({ ...conversions.map((key) => ({
[key]: calculateTotalBalance(accounts, key) [key]: calculateTotalBalance(accounts, key)
})) }))
) )

View File

@ -14,13 +14,13 @@ export default function New({
type="text" type="text"
placeholder="0xxxxxxxx" placeholder="0xxxxxxxx"
value={input} value={input}
onChange={e => handleInputChange(e)} onChange={(e) => handleInputChange(e)}
className={styles.input} className={styles.input}
/> />
<button <button
className={styles.button} className={styles.button}
onClick={e => handleSave(e)} onClick={(e) => handleSave(e)}
style={{ color: accentColor }} style={{ color: accentColor }}
> >
Add Add

View File

@ -10,7 +10,7 @@ export default function Saved({ accounts, handleDelete }) {
return ( return (
<PoseGroup> <PoseGroup>
{accounts.map(account => { {accounts.map((account) => {
const identicon = toDataUrl(account) const identicon = toDataUrl(account)
return ( return (
@ -26,7 +26,7 @@ export default function Saved({ accounts, handleDelete }) {
<button <button
className={styles.delete} className={styles.delete}
onClick={e => handleDelete(e, account)} onClick={(e) => handleDelete(e, account)}
title="Remove account" title="Remove account"
> >
&times; &times;

View File

@ -19,11 +19,11 @@ export default class AccountsList extends PureComponent {
} }
} }
handleInputChange = e => { handleInputChange = (e) => {
this.setState({ input: e.target.value }) this.setState({ input: e.target.value })
} }
handleSave = e => { handleSave = (e) => {
e.preventDefault() e.preventDefault()
const { accounts, input } = this.state const { accounts, input } = this.state
@ -56,7 +56,7 @@ export default class AccountsList extends PureComponent {
e.preventDefault() e.preventDefault()
let array = this.state.accounts let array = this.state.accounts
array = array.filter(item => account !== item) array = array.filter((item) => account !== item)
const index = array.indexOf(account) const index = array.indexOf(account)
if (index > -1) { if (index > -1) {

View File

@ -26,7 +26,7 @@ const withSvgr = (nextConfig = {}) => {
const withElectron = (nextConfig = {}) => { const withElectron = (nextConfig = {}) => {
return Object.assign({}, nextConfig, { return Object.assign({}, nextConfig, {
webpack: config => { webpack: (config) => {
config.target = 'electron-renderer' config.target = 'electron-renderer'
return config return config
} }

View File

@ -57,7 +57,7 @@ export default function AppProvider({ children }) {
const oceanBalance = await getBalance(account) const oceanBalance = await getBalance(account)
const conversionsBalance = Object.assign( const conversionsBalance = Object.assign(
...conversions.map(key => ({ ...conversions.map((key) => ({
[key]: oceanBalance * prices.get(key) || 0 [key]: oceanBalance * prices.get(key) || 0
})) }))
) )

View File

@ -10,12 +10,12 @@ export default function PriceProvider({ children }) {
// order for Ticker and Touchbar // order for Ticker and Touchbar
let pricesMap = new Map() let pricesMap = new Map()
pricesMap.set('ocean', 1) pricesMap.set('ocean', 1)
conversions.map(key => pricesMap.set(key, 0)) conversions.map((key) => pricesMap.set(key, 0))
const [prices, setPrices] = useState(pricesMap) const [prices, setPrices] = useState(pricesMap)
const [priceChanges, setPriceChanges] = useState( const [priceChanges, setPriceChanges] = useState(
Object.assign( Object.assign(
...conversions.map(key => ({ ...conversions.map((key) => ({
[key]: 0 [key]: 0
})) }))
) )

View File

@ -11,10 +11,10 @@ export async function fetchAndSetPrices(prices) {
) )
let newPrices = new Map(prices) // make a shallow copy of the Map let newPrices = new Map(prices) // make a shallow copy of the Map
conversions.map(key => newPrices.set(key, json['ocean-protocol'][key])) // modify the copy conversions.map((key) => newPrices.set(key, json['ocean-protocol'][key])) // modify the copy
const newPriceChanges = await Object.assign( const newPriceChanges = await Object.assign(
...conversions.map(key => ({ ...conversions.map((key) => ({
[key]: json['ocean-protocol'][key + '_24h_change'] [key]: json['ocean-protocol'][key + '_24h_change']
})) }))
) )

View File

@ -2,7 +2,7 @@ const { app, shell } = require('electron')
const { formatCurrency } = require('@coingecko/cryptoformat') const { formatCurrency } = require('@coingecko/cryptoformat')
const axios = require('axios') const axios = require('axios')
const fetchData = async url => { const fetchData = async (url) => {
try { try {
const response = await axios(url) const response = await axios(url)
@ -16,13 +16,13 @@ const fetchData = async url => {
} }
} }
const isFiat = currency => currency === 'eur' || currency === 'usd' const isFiat = (currency) => currency === 'eur' || currency === 'usd'
const openUrl = url => { const openUrl = (url) => {
shell.openExternal(url) shell.openExternal(url)
} }
const rgbaToHex = color => { const rgbaToHex = (color) => {
const r = color.substr(0, 2) const r = color.substr(0, 2)
const g = color.substr(2, 2) const g = color.substr(2, 2)
const b = color.substr(4, 2) const b = color.substr(4, 2)
@ -35,13 +35,13 @@ const locale =
typeof navigator !== 'undefined' ? navigator.language : () => app.getLocale() typeof navigator !== 'undefined' ? navigator.language : () => app.getLocale()
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat
const numberFormatter = value => const numberFormatter = (value) =>
new Intl.NumberFormat(locale, { new Intl.NumberFormat(locale, {
minimumFractionDigits: 0, minimumFractionDigits: 0,
maximumFractionDigits: 4 maximumFractionDigits: 4
}).format(value) }).format(value)
const formatOcean = value => { const formatOcean = (value) => {
const numberformatted = new Intl.NumberFormat(locale, { const numberformatted = new Intl.NumberFormat(locale, {
minimumFractionDigits: 0, minimumFractionDigits: 0,
maximumFractionDigits: 4, maximumFractionDigits: 4,

View File

@ -1,9 +1,9 @@
import React from 'react' import React from 'react'
import { import {
render, render,
waitForElement,
waitForElementToBeRemoved, waitForElementToBeRemoved,
fireEvent fireEvent,
wait
} from '@testing-library/react' } from '@testing-library/react'
import AppProvider from '../src/renderer/store/AppProvider' import AppProvider from '../src/renderer/store/AppProvider'
import PriceProvider from '../src/renderer/store/PriceProvider' import PriceProvider from '../src/renderer/store/PriceProvider'
@ -38,7 +38,7 @@ describe('Providers', () => {
</AppProvider> </AppProvider>
</PriceContext.Provider> </PriceContext.Provider>
) )
await waitForElement(() => getByText('Click')) await wait(() => getByText('Click'))
expect(getByText('Click')).toBeInTheDocument() expect(getByText('Click')).toBeInTheDocument()
fireEvent.click(getByText('Click')) fireEvent.click(getByText('Click'))