reenable topic view in react
This commit is contained in:
parent
38baeee994
commit
20c9f989e1
12 changed files with 183 additions and 98 deletions
|
@ -61,7 +61,7 @@ const CreateMap = {
|
||||||
if (GlobalUI.lightbox === 'forkmap') {
|
if (GlobalUI.lightbox === 'forkmap') {
|
||||||
self.newMap.set('topicsToMap', self.topicsToMap)
|
self.newMap.set('topicsToMap', self.topicsToMap)
|
||||||
self.newMap.set('synapsesToMap', self.synapsesToMap)
|
self.newMap.set('synapsesToMap', self.synapsesToMap)
|
||||||
self.newMap.set('source_id', Active.Map.id)
|
if (Active.Map) self.newMap.set('source_id', Active.Map.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
var formId = GlobalUI.lightbox === 'forkmap' ? '#fork_map' : '#new_map'
|
var formId = GlobalUI.lightbox === 'forkmap' ? '#fork_map' : '#new_map'
|
||||||
|
|
|
@ -28,6 +28,7 @@ const MAX_COLUMNS = 4
|
||||||
|
|
||||||
const ReactApp = {
|
const ReactApp = {
|
||||||
mapId: null,
|
mapId: null,
|
||||||
|
topicId: null,
|
||||||
unreadNotificationsCount: 0,
|
unreadNotificationsCount: 0,
|
||||||
mapsWidth: 0,
|
mapsWidth: 0,
|
||||||
toast: '',
|
toast: '',
|
||||||
|
@ -60,15 +61,21 @@ const ReactApp = {
|
||||||
$('#yield').hide()
|
$('#yield').hide()
|
||||||
ExploreMaps.updateFromPath(pathname)
|
ExploreMaps.updateFromPath(pathname)
|
||||||
self.mapId = null
|
self.mapId = null
|
||||||
|
self.topicId = null
|
||||||
Active.Map = null
|
Active.Map = null
|
||||||
Active.Topic = null
|
Active.Topic = null
|
||||||
break
|
break
|
||||||
case 'topics':
|
case 'topics':
|
||||||
$('#yield').hide()
|
$('#yield').hide()
|
||||||
|
Active.Map = null
|
||||||
|
self.mapId = null
|
||||||
|
self.topicId = pathname.split('/')[2]
|
||||||
break
|
break
|
||||||
case 'maps':
|
case 'maps':
|
||||||
if (!pathname.includes('request_access')) {
|
if (!pathname.includes('request_access')) {
|
||||||
$('#yield').hide()
|
$('#yield').hide()
|
||||||
|
Active.Topic = null
|
||||||
|
self.topicId = null
|
||||||
self.mapId = pathname.split('/')[2]
|
self.mapId = pathname.split('/')[2]
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
@ -101,6 +108,7 @@ const ReactApp = {
|
||||||
self.getMapProps(),
|
self.getMapProps(),
|
||||||
self.getTopicProps(),
|
self.getTopicProps(),
|
||||||
self.getFilterProps(),
|
self.getFilterProps(),
|
||||||
|
self.getCommonProps(),
|
||||||
self.getMapsProps(),
|
self.getMapsProps(),
|
||||||
self.getTopicCardProps(),
|
self.getTopicCardProps(),
|
||||||
self.getChatProps())
|
self.getChatProps())
|
||||||
|
@ -122,9 +130,14 @@ const ReactApp = {
|
||||||
infoBoxHtml: InfoBox.html,
|
infoBoxHtml: InfoBox.html,
|
||||||
openImportLightbox: () => ImportDialog.show(),
|
openImportLightbox: () => ImportDialog.show(),
|
||||||
forkMap: Map.fork,
|
forkMap: Map.fork,
|
||||||
openHelpLightbox: () => self.openLightbox('cheatsheet'),
|
|
||||||
onMapStar: Map.star,
|
onMapStar: Map.star,
|
||||||
onMapUnstar: Map.unstar,
|
onMapUnstar: Map.unstar
|
||||||
|
}
|
||||||
|
},
|
||||||
|
getCommonProps: function() {
|
||||||
|
const self = ReactApp
|
||||||
|
return {
|
||||||
|
openHelpLightbox: () => self.openLightbox('cheatsheet'),
|
||||||
onZoomExtents: event => JIT.zoomExtents(event, Visualize.mGraph.canvas),
|
onZoomExtents: event => JIT.zoomExtents(event, Visualize.mGraph.canvas),
|
||||||
onZoomIn: JIT.zoomIn,
|
onZoomIn: JIT.zoomIn,
|
||||||
onZoomOut: JIT.zoomOut
|
onZoomOut: JIT.zoomOut
|
||||||
|
@ -143,7 +156,10 @@ const ReactApp = {
|
||||||
getTopicProps: function() {
|
getTopicProps: function() {
|
||||||
const self = ReactApp
|
const self = ReactApp
|
||||||
return {
|
return {
|
||||||
topic: Active.Topic
|
topicId: self.topicId,
|
||||||
|
topic: Active.Topic,
|
||||||
|
endActiveTopic: Topic.end,
|
||||||
|
launchNewTopic: Topic.launch
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getMapsProps: function() {
|
getMapsProps: function() {
|
||||||
|
|
|
@ -94,9 +94,9 @@ const Map = {
|
||||||
Map.setAccessRequest()
|
Map.setAccessRequest()
|
||||||
Visualize.type = 'ForceDirected'
|
Visualize.type = 'ForceDirected'
|
||||||
JIT.prepareVizData()
|
JIT.prepareVizData()
|
||||||
Filter.reset()
|
|
||||||
Selected.reset()
|
Selected.reset()
|
||||||
InfoBox.load()
|
InfoBox.load()
|
||||||
|
Filter.reset()
|
||||||
Filter.checkMetacodes()
|
Filter.checkMetacodes()
|
||||||
Filter.checkSynapses()
|
Filter.checkSynapses()
|
||||||
Filter.checkMappers()
|
Filter.checkMappers()
|
||||||
|
@ -110,7 +110,7 @@ const Map = {
|
||||||
if (InfoBox.generateBoxHTML) start()
|
if (InfoBox.generateBoxHTML) start()
|
||||||
else setTimeout(() => isLoaded(), 50)
|
else setTimeout(() => isLoaded(), 50)
|
||||||
}
|
}
|
||||||
if (Active.Map && Active.Map.id == id) {
|
if (Active.Map && Active.Map.id === id) {
|
||||||
isLoaded()
|
isLoaded()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -7,8 +7,9 @@ import AutoLayout from './AutoLayout'
|
||||||
import Create from './Create'
|
import Create from './Create'
|
||||||
import DataModel from './DataModel'
|
import DataModel from './DataModel'
|
||||||
import Filter from './Filter'
|
import Filter from './Filter'
|
||||||
import GlobalUI from './GlobalUI'
|
import GlobalUI, { ReactApp } from './GlobalUI'
|
||||||
import JIT from './JIT'
|
import JIT from './JIT'
|
||||||
|
import Loading from './Loading'
|
||||||
import Map from './Map'
|
import Map from './Map'
|
||||||
import Selected from './Selected'
|
import Selected from './Selected'
|
||||||
import Settings from './Settings'
|
import Settings from './Settings'
|
||||||
|
@ -35,41 +36,35 @@ const Topic = {
|
||||||
} else callback(DataModel.Topics.get(id))
|
} else callback(DataModel.Topics.get(id))
|
||||||
},
|
},
|
||||||
launch: function(id) {
|
launch: function(id) {
|
||||||
var start = function(data) {
|
var start = function() {
|
||||||
|
Visualize.type = 'RGraph'
|
||||||
|
JIT.prepareVizData()
|
||||||
|
Selected.reset()
|
||||||
|
Filter.reset()
|
||||||
|
Filter.checkMetacodes()
|
||||||
|
Filter.checkSynapses()
|
||||||
|
Filter.checkMappers()
|
||||||
|
document.title = Active.Topic.get('name') + ' | Metamaps'
|
||||||
|
ReactApp.mobileTitle = Active.Topic.get('name')
|
||||||
|
ReactApp.render()
|
||||||
|
}
|
||||||
|
if (Active.Topic && Active.Topic.id === id) {
|
||||||
|
start()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Loading.show()
|
||||||
|
$.ajax({
|
||||||
|
url: '/topics/' + id + '/network.json',
|
||||||
|
success: function(data) {
|
||||||
Active.Topic = new DataModel.Topic(data.topic)
|
Active.Topic = new DataModel.Topic(data.topic)
|
||||||
DataModel.Creators = new DataModel.MapperCollection(data.creators)
|
DataModel.Creators = new DataModel.MapperCollection(data.creators)
|
||||||
DataModel.Topics = new DataModel.TopicCollection([data.topic].concat(data.relatives))
|
DataModel.Topics = new DataModel.TopicCollection([data.topic].concat(data.relatives))
|
||||||
DataModel.Synapses = new DataModel.SynapseCollection(data.synapses)
|
DataModel.Synapses = new DataModel.SynapseCollection(data.synapses)
|
||||||
DataModel.attachCollectionEvents()
|
DataModel.attachCollectionEvents()
|
||||||
|
start()
|
||||||
document.title = Active.Topic.get('name') + ' | Metamaps'
|
|
||||||
|
|
||||||
// set filter mapper H3 text
|
|
||||||
$('#filter_by_mapper h3').html('CREATORS')
|
|
||||||
|
|
||||||
// build and render the visualization
|
|
||||||
Visualize.type = 'RGraph'
|
|
||||||
JIT.prepareVizData()
|
|
||||||
|
|
||||||
// update filters
|
|
||||||
Filter.reset()
|
|
||||||
|
|
||||||
// reset selected arrays
|
|
||||||
Selected.reset()
|
|
||||||
|
|
||||||
// these three update the actual filter box with the right list items
|
|
||||||
Filter.checkMetacodes()
|
|
||||||
Filter.checkSynapses()
|
|
||||||
Filter.checkMappers()
|
|
||||||
|
|
||||||
// for mobile
|
|
||||||
$('#header_content').html(Active.Topic.get('name'))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '/topics/' + id + '/network.json',
|
|
||||||
success: start
|
|
||||||
})
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
end: function() {
|
end: function() {
|
||||||
if (Active.Topic) {
|
if (Active.Topic) {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import React, { Component, PropTypes } from 'react'
|
import React, { Component, PropTypes } from 'react'
|
||||||
|
|
||||||
import DataVis from './DataVis'
|
import DataVis from '../common/DataVis'
|
||||||
import MapButtons from './MapButtons'
|
import UpperOptions from '../common/UpperOptions'
|
||||||
import InfoAndHelp from './InfoAndHelp'
|
import InfoAndHelp from '../common/InfoAndHelp'
|
||||||
import Instructions from './Instructions'
|
import Instructions from './Instructions'
|
||||||
import MapControls from './MapControls'
|
import VisualizationControls from '../common/VisualizationControls'
|
||||||
import MapChat from './MapChat'
|
import MapChat from './MapChat'
|
||||||
import TopicCard from '../TopicCard'
|
import TopicCard from '../TopicCard'
|
||||||
|
|
||||||
class MapView extends Component {
|
export default class MapView extends Component {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
mobile: PropTypes.bool,
|
mobile: PropTypes.bool,
|
||||||
|
@ -52,7 +52,7 @@ class MapView extends Component {
|
||||||
chatOpen: false
|
chatOpen: false
|
||||||
})
|
})
|
||||||
this.mapChat.reset()
|
this.mapChat.reset()
|
||||||
this.mapButtons.reset()
|
this.upperOptions.reset()
|
||||||
this.props.endActiveMap()
|
this.props.endActiveMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,8 @@ class MapView extends Component {
|
||||||
const canEditMap = map && map.authorizeToEdit(currentUser)
|
const canEditMap = map && map.authorizeToEdit(currentUser)
|
||||||
// TODO: stop using {...this.props} and make explicit
|
// TODO: stop using {...this.props} and make explicit
|
||||||
return <div className="mapWrapper">
|
return <div className="mapWrapper">
|
||||||
<MapButtons ref={x => this.mapButtons = x}
|
<UpperOptions ref={x => this.upperOptions = x}
|
||||||
|
map={map}
|
||||||
currentUser={currentUser}
|
currentUser={currentUser}
|
||||||
onImportClick={openImportLightbox}
|
onImportClick={openImportLightbox}
|
||||||
onForkClick={forkMap}
|
onForkClick={forkMap}
|
||||||
|
@ -105,7 +106,8 @@ class MapView extends Component {
|
||||||
<TopicCard {...this.props} />
|
<TopicCard {...this.props} />
|
||||||
{currentUser && <Instructions mobile={mobile} hasLearnedTopicCreation={hasLearnedTopicCreation} />}
|
{currentUser && <Instructions mobile={mobile} hasLearnedTopicCreation={hasLearnedTopicCreation} />}
|
||||||
{currentUser && <MapChat {...this.props} onOpen={onChatOpen} onClose={onChatClose} chatOpen={chatOpen} ref={x => this.mapChat = x} />}
|
{currentUser && <MapChat {...this.props} onOpen={onChatOpen} onClose={onChatClose} chatOpen={chatOpen} ref={x => this.mapChat = x} />}
|
||||||
<MapControls onClickZoomExtents={onZoomExtents}
|
<VisualizationControls map={map}
|
||||||
|
onClickZoomExtents={onZoomExtents}
|
||||||
onClickZoomIn={onZoomIn}
|
onClickZoomIn={onZoomIn}
|
||||||
onClickZoomOut={onZoomOut} />
|
onClickZoomOut={onZoomOut} />
|
||||||
<InfoAndHelp mapIsStarred={mapIsStarred}
|
<InfoAndHelp mapIsStarred={mapIsStarred}
|
||||||
|
@ -119,5 +121,3 @@ class MapView extends Component {
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MapView
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* global $ */
|
/* global $ */
|
||||||
|
|
||||||
import React, { PropTypes, Component } from 'react'
|
import React, { PropTypes, Component } from 'react'
|
||||||
|
import { Link } from 'react-router'
|
||||||
|
|
||||||
import MetacodeSelect from '../MetacodeSelect'
|
import MetacodeSelect from '../MetacodeSelect'
|
||||||
import Permission from './Permission'
|
import Permission from './Permission'
|
||||||
|
@ -54,13 +55,13 @@ class Links extends Component {
|
||||||
let output = []
|
let output = []
|
||||||
|
|
||||||
firstFiveLinks.forEach(obj => {
|
firstFiveLinks.forEach(obj => {
|
||||||
output.push(<li key={obj.mapId}><a href={`/maps/${obj.mapId}`}>{obj.mapName}</a></li>)
|
output.push(<li key={obj.mapId}><Link to={`/maps/${obj.mapId}`}>{obj.mapName}</Link></li>)
|
||||||
})
|
})
|
||||||
|
|
||||||
if (extraLinks.length > 0) {
|
if (extraLinks.length > 0) {
|
||||||
if (this.state.showMoreMaps) {
|
if (this.state.showMoreMaps) {
|
||||||
extraLinks.forEach(obj => {
|
extraLinks.forEach(obj => {
|
||||||
output.push(<li key={obj.mapId} className="hideExtra extraText"><a href={`/maps/${obj.mapId}`}>{obj.mapName}</a></li>)
|
output.push(<li key={obj.mapId} className="hideExtra extraText"><Link to={`/maps/${obj.mapId}`}>{obj.mapName}</Link></li>)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
const text = this.state.showMoreMaps ? 'See less...' : `See ${extraLinks.length} more...`
|
const text = this.state.showMoreMaps ? 'See less...' : `See ${extraLinks.length} more...`
|
||||||
|
|
|
@ -1,9 +1,77 @@
|
||||||
import React, { PropTypes, Component } from 'react'
|
import React, { Component, PropTypes } from 'react'
|
||||||
|
|
||||||
class TopicView extends Component {
|
import DataVis from '../common/DataVis'
|
||||||
render() {
|
import UpperOptions from '../common/UpperOptions'
|
||||||
return null
|
import InfoAndHelp from '../common/InfoAndHelp'
|
||||||
|
import VisualizationControls from '../common/VisualizationControls'
|
||||||
|
import TopicCard from '../TopicCard'
|
||||||
|
|
||||||
|
export default class TopicView extends Component {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
mobile: PropTypes.bool,
|
||||||
|
topicId: PropTypes.string,
|
||||||
|
topic: PropTypes.object,
|
||||||
|
filterData: PropTypes.object,
|
||||||
|
allForFiltering: PropTypes.object,
|
||||||
|
visibleForFiltering: PropTypes.object,
|
||||||
|
toggleMetacode: PropTypes.func,
|
||||||
|
toggleMapper: PropTypes.func,
|
||||||
|
toggleSynapse: PropTypes.func,
|
||||||
|
filterAllMetacodes: PropTypes.func,
|
||||||
|
filterAllMappers: PropTypes.func,
|
||||||
|
filterAllSynapses: PropTypes.func,
|
||||||
|
currentUser: PropTypes.object,
|
||||||
|
endActiveTopic: PropTypes.func,
|
||||||
|
launchNewTopic: PropTypes.func,
|
||||||
|
openHelpLightbox: PropTypes.func,
|
||||||
|
forkMap: PropTypes.func,
|
||||||
|
onZoomIn: PropTypes.func,
|
||||||
|
onZoomOut: PropTypes.func
|
||||||
|
}
|
||||||
|
|
||||||
|
endTopic() {
|
||||||
|
this.upperOptions.reset()
|
||||||
|
this.props.endActiveTopic()
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidUpdate(prevProps) {
|
||||||
|
const oldTopicId = prevProps.topicId
|
||||||
|
const { topicId, launchNewTopic } = this.props
|
||||||
|
if (!oldTopicId && topicId) launchNewTopic(topicId)
|
||||||
|
else if (oldTopicId && topicId && oldTopicId !== topicId) {
|
||||||
|
this.endTopic()
|
||||||
|
launchNewTopic(topicId)
|
||||||
|
}
|
||||||
|
else if (oldTopicId && !topicId) this.endTopic()
|
||||||
|
}
|
||||||
|
|
||||||
|
render = () => {
|
||||||
|
const { mobile, topic, currentUser, allForFiltering, visibleForFiltering,
|
||||||
|
toggleMetacode, toggleMapper, toggleSynapse, filterAllMetacodes,
|
||||||
|
filterAllMappers, filterAllSynapses, filterData, forkMap,
|
||||||
|
openHelpLightbox, onZoomIn, onZoomOut } = this.props
|
||||||
|
// TODO: stop using {...this.props} and make explicit
|
||||||
|
return <div className="topicWrapper">
|
||||||
|
<UpperOptions ref={x => 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} />
|
||||||
|
<DataVis />
|
||||||
|
<TopicCard {...this.props} />
|
||||||
|
<VisualizationControls onClickZoomIn={onZoomIn}
|
||||||
|
onClickZoomOut={onZoomOut} />
|
||||||
|
<InfoAndHelp topic={topic}
|
||||||
|
onHelpClick={openHelpLightbox} />
|
||||||
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default TopicView
|
|
||||||
|
|
|
@ -4,6 +4,8 @@ import onClickOutsideAddon from 'react-onclickoutside'
|
||||||
|
|
||||||
class FilterBox extends Component {
|
class FilterBox extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
topic: PropTypes.object,
|
||||||
|
map: PropTypes.object,
|
||||||
filterData: PropTypes.object,
|
filterData: PropTypes.object,
|
||||||
allForFiltering: PropTypes.object,
|
allForFiltering: PropTypes.object,
|
||||||
visibleForFiltering: PropTypes.object,
|
visibleForFiltering: PropTypes.object,
|
||||||
|
@ -21,8 +23,9 @@ class FilterBox extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { filterData, allForFiltering, visibleForFiltering, toggleMetacode, toggleMapper, toggleSynapse,
|
const { topic, map, filterData, allForFiltering, visibleForFiltering, toggleMetacode,
|
||||||
filterAllMetacodes, filterAllMappers, filterAllSynapses } = this.props
|
toggleMapper, toggleSynapse, filterAllMetacodes,
|
||||||
|
filterAllMappers, filterAllSynapses } = this.props
|
||||||
const style = {
|
const style = {
|
||||||
maxHeight: document.body.clientHeight - 108 + 'px'
|
maxHeight: document.body.clientHeight - 108 + 'px'
|
||||||
}
|
}
|
||||||
|
@ -42,7 +45,8 @@ class FilterBox extends Component {
|
||||||
<div className="filterBox">
|
<div className="filterBox">
|
||||||
<h2>FILTER BY</h2>
|
<h2>FILTER BY</h2>
|
||||||
<div id="filter_by_mapper" className="filterBySection">
|
<div id="filter_by_mapper" className="filterBySection">
|
||||||
<h3>MAPPERS</h3>
|
{map && <h3>MAPPERS</h3>}
|
||||||
|
{topic && <h3>CREATORS</h3>}
|
||||||
<span className={mapperNoneClass} onClick={() => filterAllMappers()}>NONE</span>
|
<span className={mapperNoneClass} onClick={() => filterAllMappers()}>NONE</span>
|
||||||
<span className={mapperAllClass} onClick={() => filterAllMappers(true)}>ALL</span>
|
<span className={mapperAllClass} onClick={() => filterAllMappers(true)}>ALL</span>
|
||||||
<div className="clearfloat"></div>
|
<div className="clearfloat"></div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { Component, PropTypes } from 'react'
|
import React, { Component, PropTypes } from 'react'
|
||||||
|
|
||||||
import MapInfoBox from './MapInfoBox'
|
import MapInfoBox from '../MapView/MapInfoBox'
|
||||||
|
|
||||||
class InfoAndHelp extends Component {
|
class InfoAndHelp extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
@ -20,13 +20,13 @@ class InfoAndHelp extends Component {
|
||||||
const tooltip = mapIsStarred ? 'Unstar' : 'Star'
|
const tooltip = mapIsStarred ? 'Unstar' : 'Star'
|
||||||
const onStarClick = mapIsStarred ? onMapUnstar : onMapStar
|
const onStarClick = mapIsStarred ? onMapUnstar : onMapStar
|
||||||
return <div className="infoAndHelp">
|
return <div className="infoAndHelp">
|
||||||
<MapInfoBox map={map} currentUser={currentUser} infoBoxHtml={infoBoxHtml} />
|
{map && <MapInfoBox map={map} currentUser={currentUser} infoBoxHtml={infoBoxHtml} />}
|
||||||
{currentUser && <div className={`starMap infoElement mapElement ${starclassName}`} onClick={onStarClick}>
|
{map && currentUser && <div className={`starMap infoElement mapElement ${starclassName}`} onClick={onStarClick}>
|
||||||
<div className="tooltipsAbove">{tooltip}</div>
|
<div className="tooltipsAbove">{tooltip}</div>
|
||||||
</div>}
|
</div>}
|
||||||
<div className="mapInfoIcon infoElement mapElement" onClick={onInfoClick}>
|
{map && <div className="mapInfoIcon infoElement mapElement" onClick={onInfoClick}>
|
||||||
<div className="tooltipsAbove">Map Info</div>
|
<div className="tooltipsAbove">Map Info</div>
|
||||||
</div>
|
</div>}
|
||||||
<div className="openCheatsheet infoElement mapElement" onClick={onHelpClick}>
|
<div className="openCheatsheet infoElement mapElement" onClick={onHelpClick}>
|
||||||
<div className="tooltipsAbove">Help</div>
|
<div className="tooltipsAbove">Help</div>
|
||||||
</div>
|
</div>
|
|
@ -2,9 +2,11 @@ import React, { Component, PropTypes } from 'react'
|
||||||
|
|
||||||
import FilterBox from '../common/FilterBox'
|
import FilterBox from '../common/FilterBox'
|
||||||
|
|
||||||
class MapButtons extends Component {
|
export default class UpperOptions extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
currentUser: PropTypes.object,
|
currentUser: PropTypes.object,
|
||||||
|
map: PropTypes.object,
|
||||||
|
topic: PropTypes.object,
|
||||||
canEditMap: PropTypes.bool,
|
canEditMap: PropTypes.bool,
|
||||||
onImportClick: PropTypes.func,
|
onImportClick: PropTypes.func,
|
||||||
onForkClick: PropTypes.func,
|
onForkClick: PropTypes.func,
|
||||||
|
@ -33,12 +35,12 @@ class MapButtons extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { currentUser, canEditMap, filterBoxHtml, onFilterClick, onImportClick, onForkClick,
|
const { currentUser, map, topic, canEditMap, filterBoxHtml, onFilterClick, onImportClick, onForkClick,
|
||||||
filterData, allForFiltering, visibleForFiltering, toggleMetacode, toggleMapper, toggleSynapse,
|
filterData, allForFiltering, visibleForFiltering, toggleMetacode, toggleMapper, toggleSynapse,
|
||||||
filterAllMetacodes, filterAllMappers, filterAllSynapses } = this.props
|
filterAllMetacodes, filterAllMappers, filterAllSynapses } = this.props
|
||||||
const { filterBoxOpen } = this.state
|
const { filterBoxOpen } = this.state
|
||||||
return <div className="mapElement upperRightEl upperRightMapButtons upperRightUI">
|
return <div className="mapElement upperRightEl upperRightMapButtons upperRightUI">
|
||||||
{canEditMap && <div className="importDialog upperRightEl upperRightIcon mapElement" onClick={onImportClick}>
|
{map && canEditMap && <div className="importDialog upperRightEl upperRightIcon mapElement" onClick={onImportClick}>
|
||||||
<div className="tooltipsUnder">
|
<div className="tooltipsUnder">
|
||||||
Import Data
|
Import Data
|
||||||
</div>
|
</div>
|
||||||
|
@ -48,6 +50,8 @@ class MapButtons extends Component {
|
||||||
<div className="tooltipsUnder">Filter</div>
|
<div className="tooltipsUnder">Filter</div>
|
||||||
</div>
|
</div>
|
||||||
{filterBoxOpen && <FilterBox filterData={filterData}
|
{filterBoxOpen && <FilterBox filterData={filterData}
|
||||||
|
map={map}
|
||||||
|
topic={topic}
|
||||||
allForFiltering={allForFiltering}
|
allForFiltering={allForFiltering}
|
||||||
visibleForFiltering={visibleForFiltering}
|
visibleForFiltering={visibleForFiltering}
|
||||||
toggleMetacode={toggleMetacode}
|
toggleMetacode={toggleMetacode}
|
||||||
|
@ -67,5 +71,3 @@ class MapButtons extends Component {
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MapButtons
|
|
|
@ -1,18 +1,19 @@
|
||||||
import React, { Component, PropTypes } from 'react'
|
import React, { Component, PropTypes } from 'react'
|
||||||
|
|
||||||
class MapControls extends Component {
|
export default class VisualizationControls extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
map: PropTypes.object,
|
||||||
onClickZoomExtents: PropTypes.func,
|
onClickZoomExtents: PropTypes.func,
|
||||||
onClickZoomIn: PropTypes.func,
|
onClickZoomIn: PropTypes.func,
|
||||||
onClickZoomOut: PropTypes.func
|
onClickZoomOut: PropTypes.func
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { onClickZoomExtents, onClickZoomIn, onClickZoomOut } = this.props
|
const { map, onClickZoomExtents, onClickZoomIn, onClickZoomOut } = this.props
|
||||||
return <div className="mapControls mapElement">
|
return <div className="mapControls mapElement">
|
||||||
<div className="zoomExtents mapControl" onClick={onClickZoomExtents}>
|
{map && <div className="zoomExtents mapControl" onClick={onClickZoomExtents}>
|
||||||
<div className="tooltips">Center View</div>
|
<div className="tooltips">Center View</div>
|
||||||
</div>
|
</div>}
|
||||||
<div className="zoomIn mapControl" onClick={onClickZoomIn}>
|
<div className="zoomIn mapControl" onClick={onClickZoomIn}>
|
||||||
<div className="tooltips">Zoom In</div>
|
<div className="tooltips">Zoom In</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,5 +23,3 @@ class MapControls extends Component {
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MapControls
|
|
Loading…
Add table
Reference in a new issue