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

feat(dac): add DAC voting app #185

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "host-react",
"version": "1.0.0",
"scripts": {
"build": "PUBLIC_PATH=https://suite.camino.network/ EXPLORER_PATH=https://suite.camino.network/explorer/ WALLET_PATH=https://suite.camino.network/wallet/ webpack --config webpack.prod.js",
"build:dev": "PUBLIC_PATH=https://dev.suite.camino.network/ EXPLORER_PATH=https://dev.suite.camino.network/explorer/ WALLET_PATH=https://dev.suite.camino.network/wallet/ webpack --config webpack.dev.js",
"build:stage": "PUBLIC_PATH=https://stage.suite.camino.network/ EXPLORER_PATH=https://stage.suite.camino.network/explorer/ WALLET_PATH=https://stage.suite.camino.network/wallet/ webpack --config webpack.prod.js",
"build": "PUBLIC_PATH=https://suite.camino.network/ EXPLORER_PATH=https://suite.camino.network/explorer/ WALLET_PATH=https://suite.camino.network/wallet/ DAC_PATH=https://suite.camino.network/dac/ webpack --config webpack.prod.js",
"build:dev": "PUBLIC_PATH=https://dev.suite.camino.network/ EXPLORER_PATH=https://dev.suite.camino.network/explorer/ WALLET_PATH=https://dev.suite.camino.network/wallet/ DAC_PATH=https://dev.suite.camino.network/dac/ webpack --config webpack.dev.js",
"build:stage": "PUBLIC_PATH=https://stage.suite.camino.network/ EXPLORER_PATH=https://stage.suite.camino.network/explorer/ WALLET_PATH=https://stage.suite.camino.network/wallet/ DAC_PATH=https://stage.suite.camino.network/dac/ webpack --config webpack.prod.js",
"build:start": "cd dist && PORT=5001 npx serve",
"start": "webpack-dev-server --config webpack.local.js",
"start:live": "webpack-dev-server --open --config webpack.local.js --live-reload",
Expand Down
6 changes: 6 additions & 0 deletions src/constants/apps-consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ export const APPS_CONSTS = [
url: '/explorer',
private: false,
},
{
name: 'DAC',
subText: 'Decentralized Autonomous Consortium',
url: '/dac',
private: false,
},
{
name: 'Foundation',
subText: 'Tools for foundation members.',
Expand Down
2 changes: 2 additions & 0 deletions src/layout/RenderApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ import React from 'react'
import { RootState } from '../redux/store'
import Wallet from './WalletApp'
import { useAppSelector } from '../hooks/reduxHooks'
import VoteApp from '../views/vote/VoteApp'

const RenderApp = () => {
const activeApp = useAppSelector((state: RootState) => state.appConfig.activeApp)
if (activeApp === 'Explorer') return <ExplorerApp />
else if (activeApp === 'Wallet') return <Wallet />
else if (activeApp === 'DAC') return <VoteApp />
return <div>Not Yet Implemented</div>
}

Expand Down
4 changes: 4 additions & 0 deletions src/layout/RoutesSuite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import CreatedOffers from '../views/partners/CreatedOffers'
import Foundation from '../views/partners/Foundation'
import MultisigWallet from '../views/settings/MultisigWallet'
import Settings from '../views/settings/index'
import VoteApp from '../views/vote/VoteApp'
import Wallet from '../views/wallet/WalletApp'
import CreateDepositsLayout from './CreateDepositLayout'
import PartnersLayout from './PartnersLayout'
Expand Down Expand Up @@ -91,6 +92,9 @@ export default function RoutesSuite() {
path="/explorer"
element={<Navigate to={`/explorer/${networkAliasToUrl}`} />}
/>

<Route path={`/dac/*`} element={<VoteApp />} />
<Route path={`/dac`} element={<Navigate to="/dac/active" />} />
</>
) : null}
<Route element={<Protected />}>
Expand Down
14 changes: 14 additions & 0 deletions src/views/vote/VoteApp.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import React from 'react'
import useNetwork from '../../hooks/useNetwork'
const Vote = React.lazy(() => import('DAC/dac'))

const VoteApp = () => {
const { activeNetwork } = useNetwork()
return (
<React.Suspense fallback={<div>Loading...</div>}>
<Vote network={activeNetwork} />
</React.Suspense>
)
}

export default VoteApp
2 changes: 2 additions & 0 deletions webpack.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const deps = require('./package.json').dependencies
const publicPath = process.env.PUBLIC_PATH
const explorerPath = process.env.EXPLORER_PATH
const walletPath = process.env.WALLET_PATH
const dacPath = process.env.DAC_PATH

module.exports = merge(common, {
mode: 'development',
Expand All @@ -24,6 +25,7 @@ module.exports = merge(common, {
remotes: {
Explorer: 'Explorer@' + explorerPath + 'remoteEntry.js',
wallet: 'wallet@' + walletPath + 'remoteEntry.js',
DAC: 'dac@' + dacPath + 'remoteEntry.js',
},
exposes: {},
shared: {
Expand Down
1 change: 1 addition & 0 deletions webpack.local.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = merge(common, {
remotes: {
Explorer: 'Explorer@http://localhost:5002/remoteEntry.js',
wallet: 'wallet@http://localhost:5003/remoteEntry.js',
DAC: 'dac@http://localhost:5005/remoteEntry.js',
},
exposes: {},
shared: {
Expand Down
2 changes: 2 additions & 0 deletions webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const deps = require('./package.json').dependencies
const publicPath = process.env.PUBLIC_PATH
const explorerPath = process.env.EXPLORER_PATH
const walletPath = process.env.WALLET_PATH
const dacPath = process.env.DAC_PATH

module.exports = merge(common, {
mode: 'production',
Expand All @@ -23,6 +24,7 @@ module.exports = merge(common, {
remotes: {
Explorer: 'Explorer@' + explorerPath + 'remoteEntry.js',
wallet: 'wallet@' + walletPath + 'remoteEntry.js',
DAC: 'dac@' + dacPath + 'remoteEntry.js',
},
exposes: {},
shared: {
Expand Down
Loading