1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-17 19:51:42 +00:00

use ConfigManager

This commit is contained in:
Rokt33r
2016-05-14 12:27:28 +09:00
parent be2897806a
commit 4d3d416ecb
2 changed files with 17 additions and 12 deletions

View File

@@ -5,6 +5,7 @@ import { openModal } from 'browser/lib/modal'
import Preferences from '../modals/Preferences' import Preferences from '../modals/Preferences'
import RepositorySection from './RepositorySection' import RepositorySection from './RepositorySection'
import NewRepositoryModal from '../modals/NewRepositoryModal' import NewRepositoryModal from '../modals/NewRepositoryModal'
import ConfigManager from 'browser/main/lib/ConfigManager'
const electron = require('electron') const electron = require('electron')
const { remote } = electron const { remote } = electron
@@ -46,17 +47,19 @@ class SideNav extends React.Component {
} }
handleToggleButtonClick (e) { handleToggleButtonClick (e) {
let { dispatch } = this.props let { dispatch, config } = this.props
ConfigManager.set({isSideNavFolded: !config.isSideNavFolded})
dispatch({ dispatch({
type: 'TOGGLE_SIDENAV' type: 'SET_IS_SIDENAV_FOLDED',
isFolded: !config.isSideNavFolded
}) })
} }
render () { render () {
let { repositories, dispatch, location, status } = this.props let { repositories, dispatch, location, config } = this.props
let isFolded = !status.sideNavExpand let isFolded = config.isSideNavFolded
let isHomeActive = location.pathname.match(/^\/home$/) let isHomeActive = location.pathname.match(/^\/home$/)
let isStarredActive = location.pathname.match(/^\/starred$/) let isStarredActive = location.pathname.match(/^\/starred$/)

View File

@@ -1,6 +1,7 @@
import { combineReducers, createStore } from 'redux' import { combineReducers, createStore } from 'redux'
import _ from 'lodash' import _ from 'lodash'
import { syncHistoryWithStore, routerReducer } from 'react-router-redux' import { routerReducer } from 'react-router-redux'
import ConfigManager from 'browser/main/lib/ConfigManager'
/** /**
* Repositories * Repositories
@@ -110,14 +111,15 @@ function repositories (state = initialRepositories, action) {
return state return state
} }
const defaultStatus = { const defaultConfig = ConfigManager.get()
sideNavExpand: false
}
function status (state = defaultStatus, action) { function config (state = defaultConfig, action) {
switch (action.type) { switch (action.type) {
case 'TOGGLE_SIDENAV': case 'SET_IS_SIDENAV_FOLDED':
state.sideNavExpand = !state.sideNavExpand state.isSideNavFolded = action.isFolded
return Object.assign({}, state)
case 'SET_ZOOM':
state.zoom = action.zoom
return Object.assign({}, state) return Object.assign({}, state)
} }
return state return state
@@ -125,7 +127,7 @@ function status (state = defaultStatus, action) {
let reducer = combineReducers({ let reducer = combineReducers({
repositories, repositories,
status, config,
routing: routerReducer routing: routerReducer
}) })