diff --git a/frontend/src/Metamaps/GlobalUI/ImportDialog.js b/frontend/src/Metamaps/GlobalUI/ImportDialog.js index c253512d..391a9213 100644 --- a/frontend/src/Metamaps/GlobalUI/ImportDialog.js +++ b/frontend/src/Metamaps/GlobalUI/ImportDialog.js @@ -4,7 +4,7 @@ import React from 'react' import ReactDOM from 'react-dom' import outdent from 'outdent' -import ImportDialogBox from '../../routes/MapView/ImportDialogBox' +import ImportDialogBox from '../../components/ImportDialogBox' import PasteInput from '../PasteInput' import Map from '../Map' diff --git a/frontend/src/routes/MapView/ImportDialogBox.js b/frontend/src/components/ImportDialogBox.js similarity index 100% rename from frontend/src/routes/MapView/ImportDialogBox.js rename to frontend/src/components/ImportDialogBox.js diff --git a/frontend/src/components/InfoAndHelp.js b/frontend/src/components/InfoAndHelp.js index e6bc01d8..d7202dcb 100644 --- a/frontend/src/components/InfoAndHelp.js +++ b/frontend/src/components/InfoAndHelp.js @@ -1,7 +1,7 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' -import MapInfoBox from '../routes/MapView/MapInfoBox' +import MapInfoBox from './MapInfoBox' class InfoAndHelp extends Component { static propTypes = { diff --git a/frontend/src/routes/MapView/Instructions.js b/frontend/src/components/Instructions.js similarity index 100% rename from frontend/src/routes/MapView/Instructions.js rename to frontend/src/components/Instructions.js diff --git a/frontend/src/routes/MapView/MapChat/Message.js b/frontend/src/components/MapChat/Message.js similarity index 96% rename from frontend/src/routes/MapView/MapChat/Message.js rename to frontend/src/components/MapChat/Message.js index e4caf3ce..7cfe9ff2 100644 --- a/frontend/src/routes/MapView/MapChat/Message.js +++ b/frontend/src/components/MapChat/Message.js @@ -1,6 +1,6 @@ import React from 'react' import Autolinker from 'autolinker' -import Util from '../../../Metamaps/Util' +import Util from '../../Metamaps/Util' const linker = new Autolinker({ newWindow: true, truncate: 50, email: false, phone: false }) diff --git a/frontend/src/routes/MapView/MapChat/NewMessage.js b/frontend/src/components/MapChat/NewMessage.js similarity index 100% rename from frontend/src/routes/MapView/MapChat/NewMessage.js rename to frontend/src/components/MapChat/NewMessage.js diff --git a/frontend/src/routes/MapView/MapChat/Participant.js b/frontend/src/components/MapChat/Participant.js similarity index 100% rename from frontend/src/routes/MapView/MapChat/Participant.js rename to frontend/src/components/MapChat/Participant.js diff --git a/frontend/src/routes/MapView/MapChat/Unread.js b/frontend/src/components/MapChat/Unread.js similarity index 100% rename from frontend/src/routes/MapView/MapChat/Unread.js rename to frontend/src/components/MapChat/Unread.js diff --git a/frontend/src/routes/MapView/MapChat/index.js b/frontend/src/components/MapChat/index.js similarity index 99% rename from frontend/src/routes/MapView/MapChat/index.js rename to frontend/src/components/MapChat/index.js index 1334d479..408f5d25 100644 --- a/frontend/src/routes/MapView/MapChat/index.js +++ b/frontend/src/components/MapChat/index.js @@ -4,7 +4,7 @@ import Unread from './Unread' import Participant from './Participant' import Message from './Message' import NewMessage from './NewMessage' -import Util from '../../../Metamaps/Util' +import Util from '../../Metamaps/Util' function makeList(messages) { let currentHeader diff --git a/frontend/src/routes/MapView/MapInfoBox.js b/frontend/src/components/MapInfoBox.js similarity index 100% rename from frontend/src/routes/MapView/MapInfoBox.js rename to frontend/src/components/MapInfoBox.js diff --git a/frontend/src/containers/ContextMenu.js b/frontend/src/containers/ContextMenu.js new file mode 100644 index 00000000..9b60189d --- /dev/null +++ b/frontend/src/containers/ContextMenu.js @@ -0,0 +1,5 @@ +import { connect } from 'react-redux' +import { mapStateToProps, mapDispatchToProps } from './UpperOptions.store' +import UpperOptions from '../components/UpperOptions' + +export default connect(mapStateToProps, mapDispatchToProps)(UpperOptions) diff --git a/frontend/src/containers/ContextMenu.store.js b/frontend/src/containers/ContextMenu.store.js new file mode 100644 index 00000000..0f89d1e6 --- /dev/null +++ b/frontend/src/containers/ContextMenu.store.js @@ -0,0 +1,24 @@ +// import { } from '../actions' + +export const mapStateToProps = (state, ownProps) => { + return { + map: ownProps.map, + currentUser: ownProps.currentUser, + openImportLightbox: ownProps.openImportLightbox, + forkMap: ownProps.forkMap, + canEditMap: ownProps.canEditMap, + filterData: ownProps.filterData, + allForFiltering: ownProps.allForFiltering, + visibleForFiltering: ownProps.visibleForFiltering, + toggleMetacode: ownProps.toggleMetacode, + toggleMapper: ownProps.toggleMapper, + toggleSynapse: ownProps.toggleSynapse, + filterAllMetacodes: ownProps.filterAllMetacodes, + filterAllMappers: ownProps.filterAllMappers, + filterAllSynapses: ownProps.filterAllSynapses + } +} + +export const mapDispatchToProps = (dispatch, ownProps) => { + return {} +} diff --git a/frontend/src/containers/InfoAndHelp.js b/frontend/src/containers/InfoAndHelp.js new file mode 100644 index 00000000..79dd9401 --- /dev/null +++ b/frontend/src/containers/InfoAndHelp.js @@ -0,0 +1,5 @@ +import { connect } from 'react-redux' +import { mapStateToProps, mapDispatchToProps } from './InfoAndHelp.store' +import InfoAndHelp from '../components/InfoAndHelp' + +export default connect(mapStateToProps, mapDispatchToProps)(InfoAndHelp) diff --git a/frontend/src/containers/InfoAndHelp.store.js b/frontend/src/containers/InfoAndHelp.store.js new file mode 100644 index 00000000..f317fe9d --- /dev/null +++ b/frontend/src/containers/InfoAndHelp.store.js @@ -0,0 +1,18 @@ +// import { } from '../actions' + +export const mapStateToProps = (state, ownProps) => { + return { + mapIsStarred: ownProps.mapIsStarred, + currentUser: ownProps.currentUser, + map: ownProps.map, + onInfoClick: ownProps.toggleMapInfoBox, + onMapStar: ownProps.onMapStar, + onMapUnstar: ownProps.onMapUnstar, + onHelpClick: ownProps.openHelpLightbox, + infoBoxHtml: ownProps.infoBoxHtml + } +} + +export const mapDispatchToProps = (dispatch, ownProps) => { + return {} +} diff --git a/frontend/src/containers/TopicCard.js b/frontend/src/containers/TopicCard.js new file mode 100644 index 00000000..95f94c67 --- /dev/null +++ b/frontend/src/containers/TopicCard.js @@ -0,0 +1,5 @@ +import { connect } from 'react-redux' +import { mapStateToProps, mapDispatchToProps } from './TopicCard.store' +import TopicCard from '../components/TopicCard' + +export default connect(mapStateToProps, mapDispatchToProps)(TopicCard) diff --git a/frontend/src/containers/TopicCard.store.js b/frontend/src/containers/TopicCard.store.js new file mode 100644 index 00000000..0f89d1e6 --- /dev/null +++ b/frontend/src/containers/TopicCard.store.js @@ -0,0 +1,24 @@ +// import { } from '../actions' + +export const mapStateToProps = (state, ownProps) => { + return { + map: ownProps.map, + currentUser: ownProps.currentUser, + openImportLightbox: ownProps.openImportLightbox, + forkMap: ownProps.forkMap, + canEditMap: ownProps.canEditMap, + filterData: ownProps.filterData, + allForFiltering: ownProps.allForFiltering, + visibleForFiltering: ownProps.visibleForFiltering, + toggleMetacode: ownProps.toggleMetacode, + toggleMapper: ownProps.toggleMapper, + toggleSynapse: ownProps.toggleSynapse, + filterAllMetacodes: ownProps.filterAllMetacodes, + filterAllMappers: ownProps.filterAllMappers, + filterAllSynapses: ownProps.filterAllSynapses + } +} + +export const mapDispatchToProps = (dispatch, ownProps) => { + return {} +} diff --git a/frontend/src/containers/UpperOptions.js b/frontend/src/containers/UpperOptions.js new file mode 100644 index 00000000..9b60189d --- /dev/null +++ b/frontend/src/containers/UpperOptions.js @@ -0,0 +1,5 @@ +import { connect } from 'react-redux' +import { mapStateToProps, mapDispatchToProps } from './UpperOptions.store' +import UpperOptions from '../components/UpperOptions' + +export default connect(mapStateToProps, mapDispatchToProps)(UpperOptions) diff --git a/frontend/src/containers/UpperOptions.store.js b/frontend/src/containers/UpperOptions.store.js new file mode 100644 index 00000000..0f89d1e6 --- /dev/null +++ b/frontend/src/containers/UpperOptions.store.js @@ -0,0 +1,24 @@ +// import { } from '../actions' + +export const mapStateToProps = (state, ownProps) => { + return { + map: ownProps.map, + currentUser: ownProps.currentUser, + openImportLightbox: ownProps.openImportLightbox, + forkMap: ownProps.forkMap, + canEditMap: ownProps.canEditMap, + filterData: ownProps.filterData, + allForFiltering: ownProps.allForFiltering, + visibleForFiltering: ownProps.visibleForFiltering, + toggleMetacode: ownProps.toggleMetacode, + toggleMapper: ownProps.toggleMapper, + toggleSynapse: ownProps.toggleSynapse, + filterAllMetacodes: ownProps.filterAllMetacodes, + filterAllMappers: ownProps.filterAllMappers, + filterAllSynapses: ownProps.filterAllSynapses + } +} + +export const mapDispatchToProps = (dispatch, ownProps) => { + return {} +} diff --git a/frontend/src/containers/VisualizationControls.js b/frontend/src/containers/VisualizationControls.js new file mode 100644 index 00000000..546eaa13 --- /dev/null +++ b/frontend/src/containers/VisualizationControls.js @@ -0,0 +1,5 @@ +import { connect } from 'react-redux' +import { mapStateToProps, mapDispatchToProps } from './VisualizationControls.store' +import VisualizationControls from '../components/VisualizationControls' + +export default connect(mapStateToProps, mapDispatchToProps)(VisualizationControls) diff --git a/frontend/src/containers/VisualizationControls.store.js b/frontend/src/containers/VisualizationControls.store.js new file mode 100644 index 00000000..5699f564 --- /dev/null +++ b/frontend/src/containers/VisualizationControls.store.js @@ -0,0 +1,15 @@ +// import { } from '../actions' + +export const mapStateToProps = (state, ownProps) => { + return { + topic: ownProps.topic, + map: ownProps.map, + onClickZoomExtents: ownProps.onZoomExtents, + onClickZoomIn: ownProps.onZoomIn, + onClickZoomOut: ownProps.onZoomOut + } +} + +export const mapDispatchToProps = (dispatch, ownProps) => { + return {} +} diff --git a/frontend/src/routes/MapView/MapView.js b/frontend/src/routes/MapView/MapView.js index 1c477e5e..4db46981 100644 --- a/frontend/src/routes/MapView/MapView.js +++ b/frontend/src/routes/MapView/MapView.js @@ -1,14 +1,15 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' -import ContextMenu from '../../components/ContextMenu' +import UpperOptions from '../../containers/UpperOptions' +import InfoAndHelp from '../../containers/InfoAndHelp' +import VisualizationControls from '../../containers/VisualizationControls' +import ContextMenu from '../../containers/ContextMenu' +import TopicCard from '../../containers/TopicCard' + +import Instructions from '../../components/Instructions' +import MapChat from '../../components/MapChat' import MapVis from '../../components/MapVis' -import UpperOptions from '../../components/UpperOptions' -import InfoAndHelp from '../../components/InfoAndHelp' -import Instructions from './Instructions' -import VisualizationControls from '../../components/VisualizationControls' -import MapChat from './MapChat' -import TopicCard from '../../components/TopicCard' export default class MapView extends Component { @@ -53,6 +54,7 @@ export default class MapView extends Component { endMap() { this.props.closeChat() this.mapChat.reset() + // TODO: fix upperOptions ref this.upperOptions.reset() this.props.endActiveMap() } @@ -80,38 +82,14 @@ export default class MapView extends Component { const canEditMap = map && map.authorizeToEdit(currentUser) // TODO: stop using {...this.props} and make explicit return
- this.upperOptions = x} - map={map} - currentUser={currentUser} - onImportClick={openImportLightbox} - onForkClick={forkMap} - canEditMap={canEditMap} - filterData={filterData} - allForFiltering={allForFiltering} - visibleForFiltering={visibleForFiltering} - toggleMetacode={toggleMetacode} - toggleMapper={toggleMapper} - toggleSynapse={toggleSynapse} - filterAllMetacodes={filterAllMetacodes} - filterAllMappers={filterAllMappers} - filterAllSynapses={filterAllSynapses} /> + this.upperOptions = x} {...this.props} /> {openTopic && } {contextMenu && } {currentUser && } {currentUser && this.mapChat = x} />} - - + +
} } diff --git a/frontend/src/routes/MapView/store.js b/frontend/src/routes/MapView/MapView.store.js similarity index 100% rename from frontend/src/routes/MapView/store.js rename to frontend/src/routes/MapView/MapView.store.js diff --git a/frontend/src/routes/MapView/index.js b/frontend/src/routes/MapView/index.js index 9905327a..8bef953c 100644 --- a/frontend/src/routes/MapView/index.js +++ b/frontend/src/routes/MapView/index.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux' -import { mapStateToProps, mapDispatchToProps } from './store' +import { mapStateToProps, mapDispatchToProps } from './MapView.store' import MapView from './MapView' export default connect(mapStateToProps, mapDispatchToProps)(MapView) diff --git a/frontend/src/routes/TopicView.js b/frontend/src/routes/TopicView.js index 577a877e..b9cfeb06 100644 --- a/frontend/src/routes/TopicView.js +++ b/frontend/src/routes/TopicView.js @@ -1,12 +1,13 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' -import ContextMenu from '../components/ContextMenu' +import ContextMenu from '../containers/ContextMenu' +import UpperOptions from '../containers/UpperOptions' +import InfoAndHelp from '../containers/InfoAndHelp' +import VisualizationControls from '../containers/VisualizationControls' +import TopicCard from '../containers/TopicCard' + import TopicVis from '../components/TopicVis' -import UpperOptions from '../components/UpperOptions' -import InfoAndHelp from '../components/InfoAndHelp' -import VisualizationControls from '../components/VisualizationControls' -import TopicCard from '../components/TopicCard' export default class TopicView extends Component { @@ -38,6 +39,7 @@ export default class TopicView extends Component { } endTopic() { + // TODO: fix upperOptions ref this.upperOptions.reset() this.props.endActiveTopic() } @@ -60,26 +62,12 @@ export default class TopicView extends Component { openHelpLightbox, onZoomIn, onZoomOut, contextMenu } = this.props // TODO: stop using {...this.props} and make explicit return
- this.upperOptions = x} - currentUser={currentUser} - topic={topic} - onForkClick={forkMap} - filterData={filterData} - allForFiltering={allForFiltering} - visibleForFiltering={visibleForFiltering} - toggleMetacode={toggleMetacode} - toggleMapper={toggleMapper} - toggleSynapse={toggleSynapse} - filterAllMetacodes={filterAllMetacodes} - filterAllMappers={filterAllMappers} - filterAllSynapses={filterAllSynapses} /> + this.upperOptions = x} {...this.props} /> {contextMenu && } - - + +
} }