Skip to content

Commit

Permalink
web
Browse files Browse the repository at this point in the history
  • Loading branch information
qftgtr committed Sep 17, 2020
1 parent 4a319d8 commit e59a42a
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 45 deletions.
2 changes: 1 addition & 1 deletion src.main/init.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { IpcChannel } = require('@obsidians/ipc')
const KeypairManager = require('@obsidians/keypair')
const { AutoUpdate } = require('@obsidians/conflux-welcome')
const { AutoUpdate } = require('@obsidians/global')
const CompilerManager = require('@obsidians/conflux-compiler')
const { InstanceManager } = require('@obsidians/conflux-instances')
const ProjectChannel = require('@obsidians/conflux-project')
Expand Down
7 changes: 4 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import React, { Suspense, lazy } from 'react'
import { HashRouter, Route } from 'react-router-dom'
import { BrowserRouter, HashRouter, Route } from 'react-router-dom'

import { LoadingScreen } from '@obsidians/ui-components'

const Router = window.require ? HashRouter : BrowserRouter
const ReduxApp = lazy(() => import('./ReduxApp' /* webpackChunkName: "components" */))

export default function App () {
return (
<HashRouter>
<Router>
<Suspense fallback={<LoadingScreen />}>
<Route component={ReduxApp} />
</Suspense>
</HashRouter>
</Router>
)
}
3 changes: 2 additions & 1 deletion src/ReduxApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import React, { Component, Suspense, lazy } from 'react'

import fileOps from '@obsidians/file-ops'
import { NotificationSystem } from '@obsidians/notification'
import Welcome, { checkDependencies, GlobalModals, autoUpdater } from '@obsidians/welcome'
import Welcome, { checkDependencies } from '@obsidians/welcome'
import { GlobalModals, autoUpdater } from '@obsidians/global'
import { LoadingScreen } from '@obsidians/ui-components'
import redux, { Provider } from '@obsidians/redux'

Expand Down
5 changes: 4 additions & 1 deletion src/components/Header.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import React, { PureComponent } from 'react'

import { connect } from '@obsidians/redux'
import redux, { connect } from '@obsidians/redux'
import headerActions, { networks, Header, NavGuard } from '@obsidians/header'
import { actions } from '@obsidians/project'

class HeaderWithRedux extends PureComponent {
componentDidMount () {
actions.history = this.props.history
headerActions.history = this.props.history
if (!this.props.network) {
redux.dispatch('SELECT_NETWORK', networks.getIn([0, 'id']))
}
this.navGuard = new NavGuard(this.props.history)
}

Expand Down
8 changes: 5 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import './scss/index.scss'
import * as serviceWorker from './serviceWorker'
import App from './App'

fileOps.fsType = 'electron'

window.fileOps = fileOps
if (window.require) {
fileOps.fsType = 'electron'
} else {
fileOps.fsType = 'web'
}

import('./scss/fonts/open_sans.css')
import('./scss/fonts/hack.css')
Expand Down
26 changes: 14 additions & 12 deletions src/lib/menu.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
import get from 'lodash/get'

import { globalModalManager } from '@obsidians/welcome'
import { globalModalManager } from '@obsidians/global'

const { ipcRenderer } = window.require('electron')
const handlers = {}
if (window.require) {
const { ipcRenderer } = window.require('electron')

const handlers = {
about: () => globalModalManager.openAboutModal(),
handlers.about = () => globalModalManager.openAboutModal()

ipcRenderer.on('menu-click', (event, action) => {
const handler = get(handlers, action)
if (handler) {
handler()
} else {
console.warn(new Error(`No handler for menu click: ${action}`))
}
})
}

ipcRenderer.on('menu-click', (event, action) => {
const handler = get(handlers, action)
if (handler) {
handler()
} else {
console.warn(new Error(`No handler for menu click: ${action}`))
}
})

export default handlers
2 changes: 1 addition & 1 deletion src/lib/redux/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const accounts = {
}

export const network = {
default: 'dev',
default: '',
persist: false,
actions: {
SELECT_NETWORK: {
Expand Down
68 changes: 45 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2753,12 +2753,10 @@
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-6.2.0.tgz#d688d574400d96c5b0114968705366f431831e1a"
integrity sha512-1OzrNb4RuAzIT7wHSsgZRlMBlNsJl+do6UblR7JMW4oB7bbR+uBEYtUh7gEc/jM84GGilh68lSOokyM/zNUlBA==

"@types/semver@^7.1.0":
version "7.2.0"
resolved "https://registry.yarnpkg.com/@types%2fsemver/-/semver-7.2.0.tgz#0d72066965e910531e1db4621c15d0ca36b8d83b"
integrity sha512-TbB0A8ACUWZt3Y6bQPstW9QNbhNeebdgLX4T/ZfkrswAfUzRiXrgd9seol+X379Wa589Pu4UEx9Uok0D4RjRCQ==
dependencies:
"@types/node" "*"
"@types/semver@^7.3.1":
version "7.3.4"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.4.tgz#43d7168fec6fa0988bb1a513a697b29296721afb"
integrity sha512-+nVsLKlcUCeMzD2ufHEYuJ9a2ovstb6Dp52A5VsoKxDXgvE051XgHI/33I1EymwkRGQkwnA0LkhnUzituGs4EQ==

"@types/stack-utils@^1.0.1":
version "1.0.1"
Expand Down Expand Up @@ -3969,10 +3967,10 @@ builder-util-runtime@8.4.0:
debug "^4.1.1"
sax "^1.2.4"

builder-util-runtime@8.7.0:
version "8.7.0"
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.7.0.tgz#e48ad004835c8284662e8eaf47a53468c66e8e8d"
integrity sha512-G1AqqVM2vYTrSFR982c1NNzwXKrGLQjVjaZaWQdn4O6Z3YKjdMDofw88aD9jpyK9ZXkrCxR0tI3Qe9wNbyTlXg==
builder-util-runtime@8.7.2:
version "8.7.2"
resolved "https://registry.yarnpkg.com/builder-util-runtime/-/builder-util-runtime-8.7.2.tgz#d93afc71428a12789b437e13850e1fa7da956d72"
integrity sha512-xBqv+8bg6cfnzAQK1k3OGpfaHg+QkPgIgpEkXNhouZ0WiUkyZCftuRc2LYzQrLucFywpa14Xbc6+hTbpq83yRA==
dependencies:
debug "^4.1.1"
sax "^1.2.4"
Expand Down Expand Up @@ -5730,18 +5728,18 @@ electron-updater@^4.1.2:
pako "^1.0.10"
semver "^6.3.0"

electron-updater@^4.2.5:
version "4.3.1"
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.3.1.tgz#9d485b6262bc56fcf7ee62b1dc1b3b105a3e96a7"
integrity sha512-UDC5AHCgeiHJYDYWZG/rsl1vdAFKqI/Lm7whN57LKAk8EfhTewhcEHzheRcncLgikMcQL8gFo1KeX51tf5a5Wg==
electron-updater@^4.3.4:
version "4.3.5"
resolved "https://registry.yarnpkg.com/electron-updater/-/electron-updater-4.3.5.tgz#4fb36f593a031c87ea07ee141c9f064d5deffb15"
integrity sha512-5jjN7ebvfj1cLI0VZMdCnJk6aC4bP+dy7ryBf21vArR0JzpRVk0OZHA2QBD+H5rm6ZSeDYHOY6+8PrMEqJ4wlQ==
dependencies:
"@types/semver" "^7.1.0"
builder-util-runtime "8.7.0"
fs-extra "^9.0.0"
js-yaml "^3.13.1"
"@types/semver" "^7.3.1"
builder-util-runtime "8.7.2"
fs-extra "^9.0.1"
js-yaml "^3.14.0"
lazy-val "^1.0.4"
lodash.isequal "^4.5.0"
semver "^7.1.3"
semver "^7.3.2"

electron@8.3.4:
version "8.3.4"
Expand Down Expand Up @@ -6830,10 +6828,10 @@ fs-extra@^8.1.0:
jsonfile "^4.0.0"
universalify "^0.1.0"

fs-extra@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.0.tgz#b6afc31036e247b2466dc99c29ae797d5d4580a3"
integrity sha512-pmEYSk3vYsG/bF651KPUXZ+hvjpgWYw/Gc7W9NFUe3ZVLczKKWIij3IKpOrQcdw4TILtibFslZ0UmR8Vvzig4g==
fs-extra@^9.0.1:
version "9.0.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-9.0.1.tgz#910da0062437ba4c39fedd863f1675ccfefcb9fc"
integrity sha512-h2iAoN838FqAFJY2/qVpzFXy+EBxfVE220PalAqQLDVsFOHLJrZvut5puAbCdNv6WJk+B8ihI+k0c7JK5erwqQ==
dependencies:
at-least-node "^1.0.0"
graceful-fs "^4.2.0"
Expand Down Expand Up @@ -8714,6 +8712,14 @@ js-yaml@^3.13.1:
argparse "^1.0.7"
esprima "^4.0.0"

js-yaml@^3.14.0:
version "3.14.0"
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.14.0.tgz#a7a34170f26a21bb162424d8adacb4113a69e482"
integrity sha512-/4IbIeHcD9VMHFqDR/gQ7EdZdLimOvW2DdcxFjdyyZ9NsbS+ccrXqVWDtab/lRl5AlUqmpBx8EhPaWR+OtY17A==
dependencies:
argparse "^1.0.7"
esprima "^4.0.0"

jsan@^3.1.13:
version "3.1.13"
resolved "https://registry.yarnpkg.com/jsan/-/jsan-3.1.13.tgz#4de8c7bf8d1cfcd020c313d438f930cec4b91d86"
Expand Down Expand Up @@ -10638,6 +10644,11 @@ path-browserify@0.0.1:
resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-0.0.1.tgz#e6c4ddd7ed3aa27c68a20cc4e50e1a4ee83bbc4a"
integrity sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==

path-browserify@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/path-browserify/-/path-browserify-1.0.1.tgz#d98454a9c3753d5790860f16f68867b9e46be1fd"
integrity sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==

path-dirname@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/path-dirname/-/path-dirname-1.0.2.tgz#cc33d24d525e099a5388c0336c6e32b9160609e0"
Expand Down Expand Up @@ -12256,6 +12267,17 @@ reactstrap@^8.4.1:
react-popper "^1.3.6"
react-transition-group "^2.3.1"

reactstrap@^8.5.1:
version "8.5.1"
resolved "https://registry.yarnpkg.com/reactstrap/-/reactstrap-8.5.1.tgz#dde43539602117888a138042b53703b7621c4318"
integrity sha512-igpdw8DiW48ZtwGOo2unwlsILFlF7deiqFUAqc3wrsX/0H0OkvmezJdkjJx2X9jaHfjGdPpm0vu5VN/kk7tv+A==
dependencies:
"@babel/runtime" "^7.2.0"
classnames "^2.2.3"
prop-types "^15.5.8"
react-popper "^1.3.6"
react-transition-group "^2.3.1"

read-config-file@5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/read-config-file/-/read-config-file-5.0.0.tgz#1487c983fae9c1b672d3acda5cac899a2d451f02"
Expand Down

0 comments on commit e59a42a

Please sign in to comment.