Skip to content

Commit 8cc8d9f

Browse files
committed
chore: repair stubbed environment
1 parent 439cdc5 commit 8cc8d9f

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

app/api-react.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ const initialState = process.env.NODE_ENV !== 'production' && {
1111
isSyncing: false,
1212
votes: [
1313
{
14-
app: '0xbaB65A7D8a8F67D38cD26af113b95279fA3E7616',
14+
appAddress: '0xbaB65A7D8a8F67D38cD26af113b95279fA3E7616',
1515
description: 'Mint 1 ETH for 0xE7F5Fd82F861343Fbe794E4796dC3Ff8999B0Ee4',
1616
id: '0',
1717
nay: '0',
1818
status: VOTING_STATUS_PENDING_ENACTMENT,
1919
yea: '1000000000000000000',
2020
},
2121
{
22-
app: '0x978f4De6B4833e956a366A441B277deB7A7C0d4c',
22+
appAddress: '0x978f4De6B4833e956a366A441B277deB7A7C0d4c',
2323
description: 'Mint 19 ETH for 0xE7F5Fd82F861343Fbe794E4796dC3Ff8999B0Ee4',
2424
id: '1',
2525
nay: '1000000000000000000',
@@ -30,33 +30,33 @@ const initialState = process.env.NODE_ENV !== 'production' && {
3030
widgets: [
3131
{
3232
data: '# Title for Markdown test 🐈',
33-
id: 0,
33+
id: '0',
3434
layout: { primary: true },
3535
type: TYPE_MARKDOWN,
3636
},
3737
{
3838
data: {
3939
},
40-
id: 1,
40+
id: '1',
4141
layout: { primary: false },
4242
type: TYPE_VOTES,
4343
},
4444
{
4545
data: '# hello, `WORLD`! 🌐👽',
46-
id: 2,
46+
id: '2',
4747
layout: { primary: true },
4848
type: TYPE_MARKDOWN,
4949
},
5050
{
5151
data: {
5252
},
53-
id: 3,
53+
id: '3',
5454
layout: { primary: true },
5555
type: TYPE_VOTES,
5656
},
5757
{
5858
data: 'Unicorns exist 🦄',
59-
id: 4,
59+
id: '4',
6060
layout: { primary: true },
6161
type: TYPE_MARKDOWN,
6262
},

app/components/LocalIdentityBadge/LocalLabelAppBadge.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import { useInstalledApps, useNetwork } from '@aragon/api-react'
2+
import { useInstalledApps, useNetwork } from '../../api-react'
33
import { AppBadge } from '@aragon/ui'
44
import PropTypes from 'prop-types'
55
import { useIdentity } from '../../utils/identity-manager'

app/components/Widget/Votes/Votes.js

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const Votes = () => {
2929
const installedApps = useInstalledApps()
3030
const kernel = installedApps.find(app => app.name === 'Kernel').appAddress
3131
const voting = installedApps.find(app => app.name === 'Voting').appAddress
32-
console.log('Network: ', network)
3332
const voteUrl = network.type === 'private'
3433
? `http://localhost:3000/#/${kernel}/${voting}/vote`
3534
: `https://${network.type}.aragon.org/#/${kernel}/${voting}/vote`

app/utils/api-react/index.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
import {
22
AragonApi,
3-
useAppState,
43
useGuiStyle,
5-
useInstalledApps,
64
usePath,
75
useAragonApi as useProductionApi,
6+
useAppState as useProductionAppState,
7+
useInstalledApps as useProductionInstalledApps,
88
useNetwork as useProductionNetwork,
99
} from '@aragon/api-react'
1010

1111
export default ({ initialState = {}, functions = (() => {}) }) => {
12+
let useAppState = useProductionAppState
1213
let useAragonApi = useProductionApi
14+
let useInstalledApps = useProductionInstalledApps
1315
let useNetwork = useProductionNetwork
1416

1517
if (process.env.NODE_ENV !== 'production') {
@@ -23,6 +25,11 @@ export default ({ initialState = {}, functions = (() => {}) }) => {
2325

2426
if (!inIframe()) {
2527
useAragonApi = require('./useStubbedApi')({ functions, initialState })
28+
useAppState = () => {
29+
const { appState } = useAragonApi()
30+
return appState
31+
}
32+
useInstalledApps = require('./useStubbedInstalledApps')
2633
useNetwork = require('./useStubbedNetwork')
2734
}
2835
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// eslint-disable-next-line import/no-unused-modules
2+
module.exports = () => ([
3+
{ appAddress: '0x123', icon: function() {return null}, name: 'Kernel' },
4+
{ appAddress: '0xbaB65A7D8a8F67D38cD26af113b95279fA3E7616', icon: function() {return null}, name: 'Voting' },
5+
{ appAddress: '0x978f4De6B4833e956a366A441B277deB7A7C0d4c', icon: function() {return null}, name: 'Voting' },
6+
])

0 commit comments

Comments
 (0)