diff --git a/app/api-react.js b/app/api-react.js index f0e9251..474f65f 100644 --- a/app/api-react.js +++ b/app/api-react.js @@ -11,7 +11,7 @@ const initialState = process.env.NODE_ENV !== 'production' && { isSyncing: false, votes: [ { - app: '0xbaB65A7D8a8F67D38cD26af113b95279fA3E7616', + appAddress: '0xbaB65A7D8a8F67D38cD26af113b95279fA3E7616', description: 'Mint 1 ETH for 0xE7F5Fd82F861343Fbe794E4796dC3Ff8999B0Ee4', id: '0', nay: '0', @@ -19,7 +19,7 @@ const initialState = process.env.NODE_ENV !== 'production' && { yea: '1000000000000000000', }, { - app: '0x978f4De6B4833e956a366A441B277deB7A7C0d4c', + appAddress: '0x978f4De6B4833e956a366A441B277deB7A7C0d4c', description: 'Mint 19 ETH for 0xE7F5Fd82F861343Fbe794E4796dC3Ff8999B0Ee4', id: '1', nay: '1000000000000000000', @@ -30,33 +30,33 @@ const initialState = process.env.NODE_ENV !== 'production' && { widgets: [ { data: '# Title for Markdown test 🐈', - id: 0, + id: '0', layout: { primary: true }, type: TYPE_MARKDOWN, }, { data: { }, - id: 1, + id: '1', layout: { primary: false }, type: TYPE_VOTES, }, { data: '# hello, `WORLD`! 🌐👽', - id: 2, + id: '2', layout: { primary: true }, type: TYPE_MARKDOWN, }, { data: { }, - id: 3, + id: '3', layout: { primary: true }, type: TYPE_VOTES, }, { data: 'Unicorns exist 🦄', - id: 4, + id: '4', layout: { primary: true }, type: TYPE_MARKDOWN, }, diff --git a/app/components/LocalIdentityBadge/LocalLabelAppBadge.js b/app/components/LocalIdentityBadge/LocalLabelAppBadge.js index fe7d5e5..82eb429 100644 --- a/app/components/LocalIdentityBadge/LocalLabelAppBadge.js +++ b/app/components/LocalIdentityBadge/LocalLabelAppBadge.js @@ -1,5 +1,5 @@ import React from 'react' -import { useInstalledApps, useNetwork } from '@aragon/api-react' +import { useInstalledApps, useNetwork } from '../../api-react' import { AppBadge } from '@aragon/ui' import PropTypes from 'prop-types' import { useIdentity } from '../../utils/identity-manager' diff --git a/app/components/Widget/Votes/Votes.js b/app/components/Widget/Votes/Votes.js index b649de7..c6bd356 100644 --- a/app/components/Widget/Votes/Votes.js +++ b/app/components/Widget/Votes/Votes.js @@ -29,7 +29,6 @@ const Votes = () => { const installedApps = useInstalledApps() const kernel = installedApps.find(app => app.name === 'Kernel').appAddress const voting = installedApps.find(app => app.name === 'Voting').appAddress - console.log('Network: ', network) const voteUrl = network.type === 'private' ? `http://localhost:3000/#/${kernel}/${voting}/vote` : `https://${network.type}.aragon.org/#/${kernel}/${voting}/vote` diff --git a/app/utils/api-react/index.js b/app/utils/api-react/index.js index e94e0f4..dce8595 100644 --- a/app/utils/api-react/index.js +++ b/app/utils/api-react/index.js @@ -1,15 +1,17 @@ import { AragonApi, - useAppState, useGuiStyle, - useInstalledApps, usePath, useAragonApi as useProductionApi, + useAppState as useProductionAppState, + useInstalledApps as useProductionInstalledApps, useNetwork as useProductionNetwork, } from '@aragon/api-react' export default ({ initialState = {}, functions = (() => {}) }) => { + let useAppState = useProductionAppState let useAragonApi = useProductionApi + let useInstalledApps = useProductionInstalledApps let useNetwork = useProductionNetwork if (process.env.NODE_ENV !== 'production') { @@ -23,6 +25,11 @@ export default ({ initialState = {}, functions = (() => {}) }) => { if (!inIframe()) { useAragonApi = require('./useStubbedApi')({ functions, initialState }) + useAppState = () => { + const { appState } = useAragonApi() + return appState + } + useInstalledApps = require('./useStubbedInstalledApps') useNetwork = require('./useStubbedNetwork') } } diff --git a/app/utils/api-react/useStubbedInstalledApps.js b/app/utils/api-react/useStubbedInstalledApps.js new file mode 100644 index 0000000..52be9a5 --- /dev/null +++ b/app/utils/api-react/useStubbedInstalledApps.js @@ -0,0 +1,6 @@ +// eslint-disable-next-line import/no-unused-modules +module.exports = () => ([ + { appAddress: '0x123', icon: function() {return null}, name: 'Kernel' }, + { appAddress: '0xbaB65A7D8a8F67D38cD26af113b95279fA3E7616', icon: function() {return null}, name: 'Voting' }, + { appAddress: '0x978f4De6B4833e956a366A441B277deB7A7C0d4c', icon: function() {return null}, name: 'Voting' }, +])