Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Feat: Adding Sentry #765

Draft
wants to merge 10 commits into
base: staging
Choose a base branch
from
Next Next commit
fix: disable prettier and fix eslint on 2 files
kamikazebr committed Dec 28, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit d8af0639ec2ec54b67e61facf573bde96164887a
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ module.exports = {
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:prettier/recommended',
// 'plugin:prettier/recommended',
'plugin:react/recommended',
],
plugins: ['react-hooks'],
38 changes: 20 additions & 18 deletions src/components/Garden/Preferences/EVMExecutor.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* eslint-disable no-unexpected-multiline */
import React, { useCallback, useMemo, useState } from 'react'

import { utils } from 'ethers'

import {
@@ -11,20 +13,21 @@ import {
TextInput,
} from '@1hive/1hive-ui'

import CreateDecisionScreens from '../ModalFlows/CreateDecisionScreens/CreateDecisionScreens'
import MultiModal from '@components/MultiModal/MultiModal'

import { useConnectedGarden } from '@providers/ConnectedGarden'
import { useGardenState } from '@/providers/GardenState'
import { useWallet } from '@/providers/Wallet'

import { SHORTENED_APPS_NAMES } from '@utils/app-utils'

import env from '@/environment'
import { getAppByName } from '@utils/data-utils'

import actions from '@/actions/garden-action-types'
import radspec from '@/radspec'
import { TERMINAL_EXECUTOR_MESSAGE } from '@/constants'
import env from '@/environment'
import { useGardenState } from '@/providers/GardenState'
import { useWallet } from '@/providers/Wallet'
import radspec from '@/radspec'

import CreateDecisionScreens from '../ModalFlows/CreateDecisionScreens/CreateDecisionScreens'

const INTERACTION_TYPES = ['Internal', 'External', 'Terminal']

@@ -37,9 +40,8 @@ function EVMExecutor({ evmcrispr }) {
const gardenState = useGardenState()

const connectedGarden = useConnectedGarden()
const [createDecisionModalVisible, setCreateDecisionModalVisible] = useState(
false
)
const [createDecisionModalVisible, setCreateDecisionModalVisible] =
useState(false)
const [abi, setAbi] = useState()
const [externalContractAddress, setExternalContractAddress] = useState(null)
const [formattedAbi, setFormattedAbi] = useState(null)
@@ -71,7 +73,7 @@ function EVMExecutor({ evmcrispr }) {
return evmcrispr.apps()
}, [evmcrispr])

const shortenedAppsNames = installedApps.map(appName => {
const shortenedAppsNames = installedApps.map((appName) => {
const dotIndex = appName.indexOf('.')
return (
SHORTENED_APPS_NAMES.get(
@@ -92,7 +94,7 @@ function EVMExecutor({ evmcrispr }) {
appFunctions = evmcrispr.appMethods(appName)
}
if (interactionType === EXTERNAL_INDEX && formattedAbi) {
appFunctions = formattedAbi.map(item => {
appFunctions = formattedAbi.map((item) => {
if (item.type === 'function' && item.stateMutability !== 'view') {
return item.name
}
@@ -126,7 +128,7 @@ function EVMExecutor({ evmcrispr }) {
})
}
if (interactionType === EXTERNAL_INDEX && formattedAbi) {
return formattedAbi[selectedFunction].inputs.map(parameter => {
return formattedAbi[selectedFunction].inputs.map((parameter) => {
return [parameter.name, parameter.type]
})
}
@@ -160,7 +162,7 @@ function EVMExecutor({ evmcrispr }) {

const handleOnChangeParameters = useCallback((index, event) => {
const newValue = event.target.value
setParameters(prevState => {
setParameters((prevState) => {
const newArray = [...prevState]
newArray[index] = newValue
return newArray
@@ -229,12 +231,12 @@ function EVMExecutor({ evmcrispr }) {
code,
])

const handleOnContractAddressChange = useCallback(event => {
const handleOnContractAddressChange = useCallback((event) => {
const value = event.target.value
setExternalContractAddress(value)
}, [])

const handleOnAbiChange = useCallback(event => {
const handleOnAbiChange = useCallback((event) => {
const value = event.target.value
setAbi(value)
let iface
@@ -243,7 +245,7 @@ function EVMExecutor({ evmcrispr }) {
iface = new utils.Interface(value)
formattedAbi = iface.format(utils.FormatTypes.json)
setFormattedAbi(
JSON.parse(formattedAbi).filter(item => {
JSON.parse(formattedAbi).filter((item) => {
if (item.type === 'function' && item.stateMutability !== 'view') {
return item.name
}
@@ -262,7 +264,7 @@ function EVMExecutor({ evmcrispr }) {
setCreateDecisionModalVisible(false)
}, [])

const handleOnSetCode = useCallback(event => {
const handleOnSetCode = useCallback((event) => {
const value = event.target.value
setCode(value)
}, [])
@@ -342,7 +344,7 @@ function EVMExecutor({ evmcrispr }) {
return (
<TextInput
key={index}
onChange={event => handleOnChangeParameters(index, event)}
onChange={(event) => handleOnChangeParameters(index, event)}
placeholder={`${parameter[0].toString()} : ${parameter[1].toString()}`}
wide
css={`
37 changes: 21 additions & 16 deletions src/components/SingleDatePicker/DatePicker.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
/* eslint-disable no-unexpected-multiline */
import React, { useState } from 'react'

import PropTypes from 'prop-types'
import { eachDayOfInterval, GU } from '@1hive/1hive-ui'

import { GU, eachDayOfInterval } from '@1hive/1hive-ui'

import { dayjs } from '@utils/date-utils'

import MonthDay from './MonthDay'
import { Selector } from './components'
import { dayjs } from '@utils/date-utils'

function DatePicker({
initialDate,
@@ -20,22 +25,22 @@ function DatePicker({
}) {
const [selectedDate, setSelectedDate] = useState(initialDate)

const setDate = ({ year, add }) => event => {
setSelectedDate(
dayjs(selectedDate)
.startOf('month')
[add ? 'add' : 'subtract'](1, year ? 'year' : 'month')
.toDate()
)
}
const setDate =
({ year, add }) =>
(event) => {
setSelectedDate(
dayjs(selectedDate)
.startOf('month')
[add ? 'add' : 'subtract'](1, year ? 'year' : 'month')
.toDate()
)
}

const today = dayjs()
.startOf('day')
.toDate()
const today = dayjs().startOf('day').toDate()

const selectedDayjs = dayjs(selectedDate || today)

const isSelected = day => {
const isSelected = (day) => {
if (initialDate) {
return day.isSame(initialDate, 'day')
}
@@ -81,7 +86,7 @@ function DatePicker({
eachDayOfInterval({
start: selectedDayjs.startOf('week'),
end: selectedDayjs.endOf('week'),
}).map(day => {
}).map((day) => {
const dayJs = dayjs(day)
return (
<MonthDay key={dayJs.format('dd')} weekDay>
@@ -93,7 +98,7 @@ function DatePicker({
{eachDayOfInterval({
start: selectedDayjs.startOf('month').startOf('week'),
end: selectedDayjs.endOf('month').endOf('week'),
}).map(day => {
}).map((day) => {
const dayJs = dayjs(day)
return (
<MonthDay