Merge branch '189-cookie-banner' of https://github.com/gnosis/safe-react into 189-cookie-banner

This commit is contained in:
apane 2019-11-26 10:37:19 -03:00
commit 36251352f9
12 changed files with 133 additions and 73 deletions

View File

@ -52,6 +52,7 @@
"material-ui-search-bar": "^1.0.0-beta.13", "material-ui-search-bar": "^1.0.0-beta.13",
"notistack": "https://github.com/gnosis/notistack.git#v0.9.4", "notistack": "https://github.com/gnosis/notistack.git#v0.9.4",
"optimize-css-assets-webpack-plugin": "5.0.3", "optimize-css-assets-webpack-plugin": "5.0.3",
"polish": "^0.2.3",
"qrcode.react": "1.0.0", "qrcode.react": "1.0.0",
"react": "16.12.0", "react": "16.12.0",
"react-dom": "16.12.0", "react-dom": "16.12.0",

View File

@ -126,6 +126,7 @@ We use cookies to give you the best
<div className={classes.formItem}> <div className={classes.formItem}>
<FormControlLabel <FormControlLabel
checked={localNecessary} checked={localNecessary}
disabled
label="Necessary" label="Necessary"
name="Necessary" name="Necessary"
onChange={() => setLocalNecessary((prev) => !prev)} onChange={() => setLocalNecessary((prev) => !prev)}

View File

@ -11,7 +11,6 @@ import Loader from '../Loader'
import { history, store } from '~/store' import { history, store } from '~/store'
import theme from '~/theme/mui' import theme from '~/theme/mui'
import AppRoutes from '~/routes' import AppRoutes from '~/routes'
import './index.scss' import './index.scss'
const Root = () => ( const Root = () => (

View File

@ -1,3 +1,7 @@
* {
box-sizing: border-box;
}
html, html,
body { body {
height: 100%; height: 100%;
@ -9,32 +13,34 @@ body {
font-style: normal; font-style: normal;
font-weight: 400; font-weight: 400;
font-display: swap; font-display: swap;
src: local("Averta-Regular"), url(../../assets/fonts/Averta-normal.woff2) format('woff2'); src: local("Averta-Regular"),
url(../../assets/fonts/Averta-normal.woff2) format("woff2");
} }
@font-face { @font-face {
font-family: 'Averta'; font-family: "Averta";
font-style: normal; font-style: normal;
font-weight: 800; font-weight: 800;
font-display: swap; font-display: swap;
src: local("Averta-Extrabold"), url(../../assets/fonts/Averta-ExtraBold.woff2) format('woff2'); src: local("Averta-Extrabold"),
url(../../assets/fonts/Averta-ExtraBold.woff2) format("woff2");
} }
body { body {
position: absolute;
bottom: 0;
top: 0;
left: 0;
right: 0;
overflow-x: hidden;
color: $fontColor;
font-family: 'Averta', monospace;
font-size: $mediumFontSize;
margin: 0;
background-color: $background;
text-rendering: geometricPrecision;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; -moz-osx-font-smoothing: grayscale;
-webkit-font-smoothing: antialiased;
background-color: $background;
bottom: 0;
color: $fontColor;
font-family: "Averta", monospace;
font-size: $mediumFontSize;
left: 0;
margin: 0;
overflow-x: hidden;
position: absolute;
right: 0;
text-rendering: geometricPrecision;
top: 0;
} }
body > div:first-child { body > div:first-child {

View File

@ -1,14 +1,13 @@
// @flow // @flow
import 'babel-polyfill' import 'babel-polyfill'
import React from 'react' import React from 'react'
import ReactDOM from 'react-dom' import ReactDOM from 'react-dom'
import Root from '~/components/Root' import Root from '~/components/Root'
import { store } from '~/store'
import loadSafesFromStorage from '~/routes/safe/store/actions/loadSafesFromStorage'
import loadActiveTokens from '~/logic/tokens/store/actions/loadActiveTokens' import loadActiveTokens from '~/logic/tokens/store/actions/loadActiveTokens'
import loadDefaultSafe from '~/routes/safe/store/actions/loadDefaultSafe'
import loadCookiesFromStorage from '~/logic/cookies/store/actions/loadCookiesFromStorage' import loadCookiesFromStorage from '~/logic/cookies/store/actions/loadCookiesFromStorage'
import loadDefaultSafe from '~/routes/safe/store/actions/loadDefaultSafe'
import loadSafesFromStorage from '~/routes/safe/store/actions/loadSafesFromStorage'
import { store } from '~/store'
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line // eslint-disable-next-line

View File

@ -68,7 +68,18 @@ export const getExecutionTransaction = async (
const web3 = getWeb3() const web3 = getWeb3()
const contract = new web3.eth.Contract(GnosisSafeSol.abi, safeInstance.address) const contract = new web3.eth.Contract(GnosisSafeSol.abi, safeInstance.address)
return contract.methods.execTransaction(to, valueInWei, data, operation, safeTxGas, baseGas, gasPrice, gasToken, refundReceiver, sigs) return contract.methods.execTransaction(
to,
valueInWei,
data,
operation,
safeTxGas,
baseGas,
gasPrice,
gasToken,
refundReceiver,
sigs,
)
} catch (err) { } catch (err) {
console.error(`Error while creating transaction: ${err}`) console.error(`Error while creating transaction: ${err}`)

View File

@ -55,13 +55,35 @@ const createTransaction = (
try { try {
if (isExecution) { if (isExecution) {
tx = await getExecutionTransaction( tx = await getExecutionTransaction(
safeInstance, to, valueInWei, txData, CALL, nonce, safeInstance,
0, 0, 0, ZERO_ADDRESS, ZERO_ADDRESS, from, sigs to,
valueInWei,
txData,
CALL,
nonce,
0,
0,
0,
ZERO_ADDRESS,
ZERO_ADDRESS,
from,
sigs,
) )
} else { } else {
tx = await getApprovalTransaction( tx = await getApprovalTransaction(
safeInstance, to, valueInWei, txData, CALL, nonce, safeInstance,
0, 0, 0, ZERO_ADDRESS, ZERO_ADDRESS, from, sigs to,
valueInWei,
txData,
CALL,
nonce,
0,
0,
0,
ZERO_ADDRESS,
ZERO_ADDRESS,
from,
sigs,
) )
} }

View File

@ -43,9 +43,7 @@ const getLocalSafe = async (safeAddress: string) => {
return storedSafes[safeAddress] return storedSafes[safeAddress]
} }
export const checkAndUpdateSafeOwners = (safeAddress: string) => async ( export const checkAndUpdateSafeOwners = (safeAddress: string) => async (dispatch: ReduxDispatch<GlobalState>) => {
dispatch: ReduxDispatch<GlobalState>,
) => {
// Check if the owner's safe did change and update them // Check if the owner's safe did change and update them
const [gnosisSafe, localSafe] = await Promise.all([getGnosisSafeInstanceAt(safeAddress), getLocalSafe(safeAddress)]) const [gnosisSafe, localSafe] = await Promise.all([getGnosisSafeInstanceAt(safeAddress), getLocalSafe(safeAddress)])
const remoteOwners = await gnosisSafe.getOwners() const remoteOwners = await gnosisSafe.getOwners()

View File

@ -36,18 +36,20 @@ export const generateSignaturesFromTxConfirmations = (
} }
let sigs = '0x' let sigs = '0x'
Object.keys(confirmationsMap).sort().forEach((addr) => { Object.keys(confirmationsMap)
const conf = confirmationsMap[addr] .sort()
if (conf.signature) { .forEach((addr) => {
sigs += conf.signature.slice(2) const conf = confirmationsMap[addr]
} else { if (conf.signature) {
// https://gnosis-safe.readthedocs.io/en/latest/contracts/signatures.html#pre-validated-signatures sigs += conf.signature.slice(2)
sigs += `000000000000000000000000${addr.replace( } else {
'0x', // https://gnosis-safe.readthedocs.io/en/latest/contracts/signatures.html#pre-validated-signatures
'', sigs += `000000000000000000000000${addr.replace(
)}000000000000000000000000000000000000000000000000000000000000000001` '0x',
} '',
}) )}000000000000000000000000000000000000000000000000000000000000000001`
}
})
return sigs return sigs
} }

View File

@ -1,23 +1,26 @@
// @flow // @flow
import { createMuiTheme } from '@material-ui/core/styles' import { createMuiTheme } from '@material-ui/core/styles'
import { rgba } from 'polished'
import { import {
extraSmallFontSize,
mediumFontSize,
smallFontSize,
disabled,
primary,
secondary,
error,
sm,
md,
lg,
bolderFont,
regularFont,
boldFont, boldFont,
bolderFont,
buttonLargeFontSize, buttonLargeFontSize,
disabled,
error,
extraSmallFontSize,
largeFontSize, largeFontSize,
xs, lg,
mainFontFamily,
md,
mediumFontSize,
primary,
regularFont,
secondary,
secondaryFontFamily,
secondaryText, secondaryText,
sm,
smallFontSize,
xs,
} from './variables' } from './variables'
export type WithStyles = { export type WithStyles = {
@ -42,7 +45,7 @@ const palette = {
// see https://github.com/mui-org/material-ui/blob/v1-beta/src/styles/createMuiTheme.js // see https://github.com/mui-org/material-ui/blob/v1-beta/src/styles/createMuiTheme.js
export default createMuiTheme({ export default createMuiTheme({
typography: { typography: {
fontFamily: 'Averta,sans-serif', fontFamily: mainFontFamily,
useNextVariants: true, useNextVariants: true,
}, },
overrides: { overrides: {
@ -53,7 +56,7 @@ export default createMuiTheme({
fontWeight: regularFont, fontWeight: regularFont,
}, },
root: { root: {
fontFamily: 'Averta, monospace', fontFamily: secondaryFontFamily,
letterSpacing: '0.9px', letterSpacing: '0.9px',
'&$disabled': { '&$disabled': {
color: disabled, color: disabled,
@ -109,7 +112,7 @@ export default createMuiTheme({
}, },
MuiChip: { MuiChip: {
root: { root: {
fontFamily: 'Averta, monospace', fontFamily: secondaryFontFamily,
}, },
}, },
MuiStepIcon: { MuiStepIcon: {
@ -132,30 +135,30 @@ export default createMuiTheme({
}, },
MuiTypography: { MuiTypography: {
body1: { body1: {
fontFamily: 'Averta, monospace', fontFamily: secondaryFontFamily,
letterSpacing: '-0.5px', letterSpacing: '-0.5px',
fontSize: mediumFontSize, fontSize: mediumFontSize,
}, },
body2: { body2: {
fontFamily: 'Averta, monospace', fontFamily: secondaryFontFamily,
}, },
}, },
MuiFormHelperText: { MuiFormHelperText: {
root: { root: {
fontFamily: 'Averta, monospace', color: secondary,
fontFamily: secondaryFontFamily,
fontSize: '12px', fontSize: '12px',
marginTop: '0px',
order: 0,
padding: `0 0 0 ${md}`, padding: `0 0 0 ${md}`,
position: 'absolute', position: 'absolute',
top: '5px', top: '5px',
color: secondary,
order: 0,
marginTop: '0px',
zIndex: 1, // for firefox zIndex: 1, // for firefox
}, },
}, },
MuiInput: { MuiInput: {
root: { root: {
fontFamily: 'Averta, monospace', fontFamily: secondaryFontFamily,
color: primary, color: primary,
fontSize: mediumFontSize, fontSize: mediumFontSize,
lineHeight: '56px', lineHeight: '56px',
@ -222,7 +225,7 @@ export default createMuiTheme({
}, },
MuiTab: { MuiTab: {
root: { root: {
fontFamily: 'Averta, monospace', fontFamily: secondaryFontFamily,
fontWeight: 'normal', fontWeight: 'normal',
fontSize: extraSmallFontSize, fontSize: extraSmallFontSize,
'&$selected': { '&$selected': {
@ -244,7 +247,7 @@ export default createMuiTheme({
top: '0px', top: '0px',
}, },
caption: { caption: {
fontFamily: 'Averta, monospace', fontFamily: secondaryFontFamily,
fontSize: mediumFontSize, fontSize: mediumFontSize,
order: 2, order: 2,
color: disabled, color: disabled,
@ -270,7 +273,7 @@ export default createMuiTheme({
}, },
MuiTableCell: { MuiTableCell: {
root: { root: {
fontFamily: 'Averta, monospace', fontFamily: secondaryFontFamily,
fontSize: mediumFontSize, fontSize: mediumFontSize,
borderBottomWidth: '2px', borderBottomWidth: '2px',
}, },
@ -298,7 +301,7 @@ export default createMuiTheme({
}, },
MuiMenuItem: { MuiMenuItem: {
root: { root: {
fontFamily: 'Averta, monospace', fontFamily: secondaryFontFamily,
}, },
}, },
MuiListItemIcon: { MuiListItemIcon: {
@ -308,17 +311,31 @@ export default createMuiTheme({
}, },
MuiListItemText: { MuiListItemText: {
primary: { primary: {
fontFamily: 'Averta, monospace', fontFamily: secondaryFontFamily,
fontSize: mediumFontSize, fontSize: mediumFontSize,
fontWeight: bolderFont, fontWeight: bolderFont,
color: primary, color: primary,
}, },
secondary: { secondary: {
fontFamily: 'Averta, monospace', fontFamily: secondaryFontFamily,
fontSize: smallFontSize, fontSize: smallFontSize,
color: disabled, color: disabled,
}, },
}, },
MuiCheckbox: {
colorSecondary: {
'&$disabled': {
color: rgba(secondary, 0.5),
},
},
},
MuiFormControlLabel: {
label: {
'&$disabled': {
color: primary,
},
},
},
}, },
palette, palette,
}) })

View File

@ -8,7 +8,6 @@ const fancyColor = '#f02525'
const fontColor = '#001428' const fontColor = '#001428'
const headerHeight = '53px' const headerHeight = '53px'
const lg = '24px' const lg = '24px'
const mainFontFamily = 'Averta, sans-serif'
const marginButtonImg = '12px' const marginButtonImg = '12px'
const md = '16px' const md = '16px'
const primary = '#001428' const primary = '#001428'
@ -42,7 +41,7 @@ module.exports = {
largeFontSize: '16px', largeFontSize: '16px',
lg, lg,
lightFont: 300, lightFont: 300,
mainFontFamily, mainFontFamily: 'Averta, sans-serif',
marginButtonImg, marginButtonImg,
md, md,
mediumFontSize: '14px', mediumFontSize: '14px',
@ -56,6 +55,7 @@ module.exports = {
screenXs: 480, screenXs: 480,
screenXsMax: 767, screenXsMax: 767,
secondary, secondary,
secondaryFontFamily: 'Averta, monospace',
secondaryText: secondaryTextOrSvg, secondaryText: secondaryTextOrSvg,
sm, sm,
smallFontSize: '12px', smallFontSize: '12px',

View File

@ -13881,6 +13881,11 @@ pocket-js-core@0.0.3:
dependencies: dependencies:
axios "^0.18.0" axios "^0.18.0"
polish@^0.2.3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/polish/-/polish-0.2.3.tgz#4a95296b5501dd10d3b25b8e6ed8339ef4deb147"
integrity sha1-SpUpa1UB3RDTsluObtgznvTesUc=
polished@^3.3.1: polished@^3.3.1:
version "3.4.2" version "3.4.2"
resolved "https://registry.yarnpkg.com/polished/-/polished-3.4.2.tgz#b4780dad81d64df55615fbfc77acb52fd17d88cd" resolved "https://registry.yarnpkg.com/polished/-/polished-3.4.2.tgz#b4780dad81d64df55615fbfc77acb52fd17d88cd"
@ -19731,7 +19736,6 @@ websocket@1.0.29, "websocket@github:web3-js/WebSocket-Node#polyfill/globalThis":
dependencies: dependencies:
debug "^2.2.0" debug "^2.2.0"
es5-ext "^0.10.50" es5-ext "^0.10.50"
gulp "^4.0.2"
nan "^2.14.0" nan "^2.14.0"
typedarray-to-buffer "^3.1.5" typedarray-to-buffer "^3.1.5"
yaeti "^0.0.6" yaeti "^0.0.6"