From 2edbef81e4e00d98470b34e7ad774375ea1d04cb Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 16 Oct 2018 16:43:54 -0400 Subject: [PATCH] conflict in constants --- embark-ui/package.json | 2 +- embark-ui/src/components/ContractOverview.js | 4 ++-- embark-ui/src/components/Layout.js | 9 ++++---- embark-ui/src/constants.js | 4 +++- embark-ui/src/containers/AppContainer.js | 22 ++++++++++++-------- embark-ui/src/index.js | 6 +++++- embark-ui/src/reducers/index.js | 6 +++--- 7 files changed, 32 insertions(+), 21 deletions(-) diff --git a/embark-ui/package.json b/embark-ui/package.json index b3e6ad1b3..afd62918e 100644 --- a/embark-ui/package.json +++ b/embark-ui/package.json @@ -78,7 +78,7 @@ "start": "npm-run-all --parallel css-compile react-start watch-css", "build": "npm run css-compile && node scripts/build.js", "test": "node scripts/test.js --env=jsdom", - "css-compile": "node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 src/dark-theme/coreui.scss src/css/coreui.css", + "css-compile": "node-sass --output-style expanded --source-map true --source-map-contents true --precision 6 src/dark-theme/coreui.scss src/css/coreui-dark.css", "watch-css": "nodemon --ignore dist/ -e scss -x \"npm run css-compile\"" }, "homepage": "http://localhost:8000/embark", diff --git a/embark-ui/src/components/ContractOverview.js b/embark-ui/src/components/ContractOverview.js index fb4adbb76..a2e10f881 100644 --- a/embark-ui/src/components/ContractOverview.js +++ b/embark-ui/src/components/ContractOverview.js @@ -4,7 +4,7 @@ import {Row, Col, Table} from "reactstrap"; import JSONTree from 'react-json-tree'; import {formatContractForDisplay} from '../utils/presentation'; -const Contract = ({contract, match}) => { +const Contract = ({contract}) => { const contractDisplay = formatContractForDisplay(contract); return ( @@ -43,7 +43,7 @@ const Contract = ({contract, match}) => { }; Contract.propTypes = { - contract: PropTypes.object, + contract: PropTypes.object }; export default Contract; diff --git a/embark-ui/src/components/Layout.js b/embark-ui/src/components/Layout.js index 772ec8d4c..00d00f9c8 100644 --- a/embark-ui/src/components/Layout.js +++ b/embark-ui/src/components/Layout.js @@ -1,6 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import { UncontrolledDropdown, DropdownItem, DropdownMenu, DropdownToggle, Nav, Container } from 'reactstrap'; +import {LIGHT_THEME, DARK_THEME} from '../constants'; import { AppAside, @@ -27,7 +28,7 @@ const sidebarNavItems = {items: [ {url: "/embark/explorer/overview", icon: "fa fa-signal", name: "Overview"}, {url: "/embark/explorer/accounts", icon: "fa fa-users", name: "Accounts"}, {url: "/embark/explorer/blocks", icon: "fa fa-stop", name: "Blocks"}, - {url: "/embark/explorer/transactions", icon: "fa fa-tree", name: "Transactions"}, + {url: "/embark/explorer/transactions", icon: "fa fa-tree", name: "Transactions"} ]}, {name: "Fiddle", url: "/embark/fiddle", icon: "fa fa-codepen"}, {name: "Documentation", url: "/embark/documentation", icon: "fa fa-book"}, @@ -35,7 +36,7 @@ const sidebarNavItems = {items: [ {url: "/embark/utilities/converter", icon: "fa fa-plug", name: "Converter"}, {url: "/embark/utilities/communication", icon: "fa fa-phone", name: "Communication"}, {url: "/embark/utilities/ens", icon: "fa fa-circle", name: "ENS"} - ]}, + ]} ]}; const Layout = ({children, logout, credentials, location, changeTheme}) => ( @@ -80,8 +81,8 @@ const Layout = ({children, logout, credentials, location, changeTheme}) => ( Theme - changeTheme('dark')}>Dark - changeTheme('light')}>Light + changeTheme(DARK_THEME)}>Dark + changeTheme(LIGHT_THEME)}>Light diff --git a/embark-ui/src/constants.js b/embark-ui/src/constants.js index 3e934af9b..fd25bbcd5 100644 --- a/embark-ui/src/constants.js +++ b/embark-ui/src/constants.js @@ -1,2 +1,4 @@ export const EMBARK_PROCESS_NAME = 'embark'; -export const LOG_LIMIT = 50; \ No newline at end of file +export const LOG_LIMIT = 50; +export const DARK_THEME = 'dark'; +export const LIGHT_THEME = 'light'; diff --git a/embark-ui/src/containers/AppContainer.js b/embark-ui/src/containers/AppContainer.js index d9e9b2d7c..5d4f71318 100644 --- a/embark-ui/src/containers/AppContainer.js +++ b/embark-ui/src/containers/AppContainer.js @@ -66,15 +66,18 @@ class AppContainer extends Component { } render() { + let content; + if (this.shouldRenderLogin()) { + content = ; + } else { + content = this.changeTheme(v)}> + {routes} + ; + } + return ( -
- {this.shouldRenderLogin() ? - - : - this.changeTheme(v)}> - {routes} - - } +
+ {content}
); } @@ -93,7 +96,8 @@ AppContainer.propTypes = { fetchVersions: PropTypes.func, location: PropTypes.object, theme: PropTypes.string, - changeTheme: PropTypes.func + changeTheme: PropTypes.func, + fetchTheme: PropTypes.func }; function mapStateToProps(state) { diff --git a/embark-ui/src/index.js b/embark-ui/src/index.js index 005b6bf90..016d5e476 100644 --- a/embark-ui/src/index.js +++ b/embark-ui/src/index.js @@ -3,9 +3,13 @@ import React from 'react'; import ReactDOM from 'react-dom'; import {Provider} from 'react-redux'; +// Icons import 'font-awesome/css/font-awesome.min.css'; +// Light theme import '@coreui/coreui/dist/css/coreui.min.css'; -import './css/coreui.css'; +// Dark theme +import './css/coreui-dark.css'; +// Custom style import './index.css'; import AppContainer from './containers/AppContainer'; diff --git a/embark-ui/src/reducers/index.js b/embark-ui/src/reducers/index.js index a7d38503b..592eb9bb0 100644 --- a/embark-ui/src/reducers/index.js +++ b/embark-ui/src/reducers/index.js @@ -1,7 +1,7 @@ import {combineReducers} from 'redux'; import {REQUEST, SUCCESS, FAILURE, CONTRACT_COMPILE, FILES, LOGOUT, AUTHENTICATE, FETCH_CREDENTIALS, UPDATE_BASE_ETHER, CHANGE_THEME, FETCH_THEME} from "../actions"; -import {EMBARK_PROCESS_NAME} from '../constants'; +import {EMBARK_PROCESS_NAME, DARK_THEME} from '../constants'; const BN_FACTOR = 10000; const VOID_ADDRESS = '0x0000000000000000000000000000000000000000'; @@ -223,8 +223,8 @@ function baseEther(state = '1', action) { return state; } -function theme(state='dark', action) { - if (action.type === CHANGE_THEME[REQUEST] || action.type === FETCH_THEME[SUCCESS]) { +function theme(state=DARK_THEME, action) { + if (action.type === CHANGE_THEME[REQUEST] || (action.type === FETCH_THEME[SUCCESS] && action.theme)) { return action.theme; } return state;