Skip to content

Commit

Permalink
create EditMap page
Browse files Browse the repository at this point in the history
  • Loading branch information
caspg committed Dec 15, 2017
1 parent 80afda0 commit a334926
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 3 deletions.
2 changes: 2 additions & 0 deletions pages/editor/mapEditor/editMap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// the same component as mapEditor page
export { default } from '../../../src/pages/Editor/pages/MapEditor';
1 change: 1 addition & 0 deletions server/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ routes
.add('mapEditor', routesConfig.mapEditor, pagesConfig.mapEditor)
.add('upload', routesConfig.upload, pagesConfig.upload)
.add('editData', routesConfig.editData, pagesConfig.editData)
.add('editMap', routesConfig.editMap, pagesConfig.editMap)

module.exports = routes
1 change: 1 addition & 0 deletions src/config/pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ module.exports = {
mapEditor: '/editor/mapEditor',
upload: '/editor/mapEditor/upload',
editData: '/editor/mapEditor/editData',
editMap: '/editor/mapEditor/editMap',
}
6 changes: 6 additions & 0 deletions src/pages/Editor/pages/MapEditor/MapEditorSidebarSwitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import pages from '@src/config/pages'
import MapEditorInitiView from './components/MapEditorInitiView'
import Upload from './pages/Upload'
import EditData from './pages/EditData'
import EditMap from './pages/EditMap'

MapEditorSidebarSwitch.propTypes = {
pathname: PropTypes.string.isRequired,
Expand All @@ -23,6 +24,11 @@ function MapEditorSidebarSwitch(props) {
<EditData mapType={props.mapType} />
)

case pages.editMap:
return (
<EditMap mapType={props.mapType} />
)

default:
return (
<MapEditorInitiView mapType={props.mapType} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Map } from 'immutable'
import React, { PropTypes } from 'react'

import { grey300 } from '@src/styles/colors'
import { grey300, darkColor } from '@src/styles/colors'

const arrowH = '5px'

Expand Down Expand Up @@ -54,7 +54,7 @@ const SortableHeader = (props) => {
height: 0;
border-style: solid;
border-width: ${arrowH} ${arrowH} 0 ${arrowH};
border-color: dark transparent transparent transparent;
border-color: ${darkColor} transparent transparent transparent;
}
.SortableHeader__arrow-desc {
Expand All @@ -66,7 +66,7 @@ const SortableHeader = (props) => {
height: 0;
border-style: solid;
border-width: 0 ${arrowH} ${arrowH} ${arrowH};
border-color: transparent transparent dark transparent;
border-color: transparent transparent ${darkColor} transparent;
}
`}</style>
</th>
Expand Down
63 changes: 63 additions & 0 deletions src/pages/Editor/pages/MapEditor/pages/EditMap/EditMap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'

import { Link } from '@routes'
// import style from './EditMapView.css'
// import CommonEditor from '../CommonEditor'
// import LinearScaleEditor from '../LinearScaleEditor'
// import EquidistantScaleEditor from '../EquidistantScaleEditor'

const style = {}

class EditMap extends Component {
// renderEditor() {
// const dataClassification = this.props.mapUi.get('dataClassification')
// const linearEditor = <LinearScaleEditor />
// const equidistantEditor = <EquidistantScaleEditor />
// const editors = {
// linear: linearEditor,
// equidistant: equidistantEditor,
// }

// return editors[dataClassification]
// }

render() {
return (
<div className={style.container}>
<div className={style.wrapper}>
<Link prefetch route={`/editor/${this.props.mapType}/upload`}>
<a className={style.link}>
Upload new data
</a>
</Link>
<Link prefetch route={`/editor/${this.props.mapType}/edit-data`}>
<a className={style.link}>
Edit data
</a>
</Link>

<h1>EditMap</h1>

{/* <CommonEditor>
{this.renderEditor()}
</CommonEditor> */}
</div>
</div>
)
}
}

EditMap.propTypes = {
mapUi: PropTypes.object.isRequired,
mapType: PropTypes.string.isRequired,
}

function mapStateToProps(state) {
return {
mapUi: state.mapUi,
mapType: state.mapType,
}
}

export default connect(mapStateToProps)(EditMap)
1 change: 1 addition & 0 deletions src/pages/Editor/pages/MapEditor/pages/EditMap/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './EditMap';

0 comments on commit a334926

Please sign in to comment.