rewrite map instructions
This commit is contained in:
parent
dc33d5f687
commit
ac87fc0ed5
10 changed files with 47 additions and 52 deletions
|
@ -792,7 +792,6 @@
|
||||||
height: 80px;
|
height: 80px;
|
||||||
font-family: 'din-regular', helvetica, sans-serif;
|
font-family: 'din-regular', helvetica, sans-serif;
|
||||||
font-size: 32px;
|
font-size: 32px;
|
||||||
display: none;
|
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #999999;
|
color: #999999;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
|
|
|
@ -61,7 +61,7 @@ const Control = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DataModel.Topics.length === 0) {
|
if (DataModel.Topics.length === 0) {
|
||||||
GlobalUI.showDiv('#instructions')
|
Map.setHasLearnedTopicCreation(false)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deleteSelectedNodes: function() { // refers to deleting topics permanently
|
deleteSelectedNodes: function() { // refers to deleting topics permanently
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* global $, Hogan, Bloodhound */
|
/* global $, Hogan, Bloodhound */
|
||||||
|
|
||||||
import DataModel from './DataModel'
|
import DataModel from './DataModel'
|
||||||
|
import Map from './Map'
|
||||||
import Mouse from './Mouse'
|
import Mouse from './Mouse'
|
||||||
import Selected from './Selected'
|
import Selected from './Selected'
|
||||||
import Synapse from './Synapse'
|
import Synapse from './Synapse'
|
||||||
|
@ -270,7 +271,7 @@ const Create = {
|
||||||
})
|
})
|
||||||
Create.newTopic.beingCreated = true
|
Create.newTopic.beingCreated = true
|
||||||
Create.newTopic.name = ''
|
Create.newTopic.name = ''
|
||||||
GlobalUI.hideDiv('#instructions')
|
Map.setHasLearnedTopicCreation(true)
|
||||||
},
|
},
|
||||||
hide: function(force) {
|
hide: function(force) {
|
||||||
if (force || !Create.newTopic.pinned) {
|
if (force || !Create.newTopic.pinned) {
|
||||||
|
@ -281,7 +282,7 @@ const Create = {
|
||||||
Create.newTopic.pinned = false
|
Create.newTopic.pinned = false
|
||||||
}
|
}
|
||||||
if (DataModel.Topics.length === 0) {
|
if (DataModel.Topics.length === 0) {
|
||||||
GlobalUI.showDiv('#instructions')
|
Map.setHasLearnedTopicCreation(false)
|
||||||
}
|
}
|
||||||
Create.newTopic.beingCreated = false
|
Create.newTopic.beingCreated = false
|
||||||
},
|
},
|
||||||
|
|
|
@ -109,6 +109,7 @@ const ReactApp = {
|
||||||
return {
|
return {
|
||||||
mapId: self.mapId,
|
mapId: self.mapId,
|
||||||
map: Active.Map,
|
map: Active.Map,
|
||||||
|
hasLearnedTopicCreation: Map.hasLearnedTopicCreation,
|
||||||
userRequested: Map.userRequested,
|
userRequested: Map.userRequested,
|
||||||
requestAnswered: Map.requestAnswered,
|
requestAnswered: Map.requestAnswered,
|
||||||
requestApproved: Map.requestApproved,
|
requestApproved: Map.requestApproved,
|
||||||
|
|
|
@ -316,7 +316,7 @@ const Import = {
|
||||||
success: opts.success
|
success: opts.success
|
||||||
})
|
})
|
||||||
|
|
||||||
GlobalUI.hideDiv('#instructions')
|
Map.setHasLearnedTopicCreation(true)
|
||||||
},
|
},
|
||||||
|
|
||||||
createSynapseWithParameters: function(desc, category, permission,
|
createSynapseWithParameters: function(desc, category, permission,
|
||||||
|
|
|
@ -130,18 +130,11 @@ const JIT = {
|
||||||
if (DataModel.Mappings) DataModel.Mappings.remove(mapping)
|
if (DataModel.Mappings) DataModel.Mappings.remove(mapping)
|
||||||
})
|
})
|
||||||
|
|
||||||
// set up addTopic instructions in case they delete all the topics
|
|
||||||
// i.e. if there are 0 topics at any time, it should have instructions again
|
|
||||||
$('#instructions div').hide()
|
|
||||||
if (Active.Map && Active.Map.authorizeToEdit(Active.Mapper)) {
|
|
||||||
$('#instructions div.addTopic').show()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self.vizData.length === 0) {
|
if (self.vizData.length === 0) {
|
||||||
GlobalUI.showDiv('#instructions')
|
Map.setHasLearnedTopicCreation(false)
|
||||||
Visualize.loadLater = true
|
Visualize.loadLater = true
|
||||||
} else {
|
} else {
|
||||||
GlobalUI.hideDiv('#instructions')
|
Map.setHasLearnedTopicCreation(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
Visualize.render()
|
Visualize.render()
|
||||||
|
|
|
@ -31,6 +31,7 @@ const Map = {
|
||||||
userRequested: false,
|
userRequested: false,
|
||||||
requestAnswered: false,
|
requestAnswered: false,
|
||||||
requestApproved: false,
|
requestApproved: false,
|
||||||
|
hasLearnedTopicCreation: true,
|
||||||
init: function(serverData) {
|
init: function(serverData) {
|
||||||
var self = Map
|
var self = Map
|
||||||
self.mapIsStarred = serverData.mapIsStarred
|
self.mapIsStarred = serverData.mapIsStarred
|
||||||
|
@ -46,6 +47,11 @@ const Map = {
|
||||||
CheatSheet.init(serverData)
|
CheatSheet.init(serverData)
|
||||||
$(document).on(Map.events.editedByActiveMapper, self.editedByActiveMapper)
|
$(document).on(Map.events.editedByActiveMapper, self.editedByActiveMapper)
|
||||||
},
|
},
|
||||||
|
setHasLearnedTopicCreation: function(value) {
|
||||||
|
const self = Map
|
||||||
|
self.hasLearnedTopicCreation = value
|
||||||
|
ReactApp.render()
|
||||||
|
},
|
||||||
requestAccess: function() {
|
requestAccess: function() {
|
||||||
const self = Map
|
const self = Map
|
||||||
self.requests.push({
|
self.requests.push({
|
||||||
|
@ -140,6 +146,8 @@ const Map = {
|
||||||
Filter.close()
|
Filter.close()
|
||||||
InfoBox.close()
|
InfoBox.close()
|
||||||
Realtime.endActiveMap()
|
Realtime.endActiveMap()
|
||||||
|
self.requests = []
|
||||||
|
self.hasLearnedTopicCreation = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
star: function() {
|
star: function() {
|
||||||
|
|
|
@ -291,8 +291,7 @@ const Topic = {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// hide the 'double-click to add a topic' message
|
Map.setHasLearnedTopicCreation(true)
|
||||||
GlobalUI.hideDiv('#instructions')
|
|
||||||
|
|
||||||
$(document).trigger(Map.events.editedByActiveMapper)
|
$(document).trigger(Map.events.editedByActiveMapper)
|
||||||
|
|
||||||
|
@ -325,8 +324,7 @@ const Topic = {
|
||||||
getTopicFromAutocomplete: function(id) {
|
getTopicFromAutocomplete: function(id) {
|
||||||
var self = Topic
|
var self = Topic
|
||||||
|
|
||||||
// hide the 'double-click to add a topic' message
|
Map.setHasLearnedTopicCreation(true)
|
||||||
GlobalUI.hideDiv('#instructions')
|
|
||||||
|
|
||||||
$(document).trigger(Map.events.editedByActiveMapper)
|
$(document).trigger(Map.events.editedByActiveMapper)
|
||||||
|
|
||||||
|
|
23
frontend/src/components/MapView/Instructions.js
Normal file
23
frontend/src/components/MapView/Instructions.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import React, { Component, PropTypes } from 'react'
|
||||||
|
|
||||||
|
class Instructions extends Component {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
mobile: PropTypes.bool,
|
||||||
|
hasLearnedTopicCreation: PropTypes.bool
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { hasLearnedTopicCreation, mobile } = this.props
|
||||||
|
return hasLearnedTopicCreation ? null : <div id="instructions">
|
||||||
|
{!mobile && <div className="addTopic">
|
||||||
|
Double-click to<br/>add a topic
|
||||||
|
</div>}
|
||||||
|
{mobile && <div className="addTopic">
|
||||||
|
Double-tap to<br/>add a topic
|
||||||
|
</div>}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Instructions
|
|
@ -3,6 +3,7 @@ import React, { Component, PropTypes } from 'react'
|
||||||
import DataVis from './DataVis'
|
import DataVis from './DataVis'
|
||||||
import MapButtons from './MapButtons'
|
import MapButtons from './MapButtons'
|
||||||
import InfoAndHelp from './InfoAndHelp'
|
import InfoAndHelp from './InfoAndHelp'
|
||||||
|
import Instructions from './Instructions'
|
||||||
import MapControls from './MapControls'
|
import MapControls from './MapControls'
|
||||||
import MapChat from './MapChat'
|
import MapChat from './MapChat'
|
||||||
import TopicCard from '../TopicCard'
|
import TopicCard from '../TopicCard'
|
||||||
|
@ -28,7 +29,8 @@ class MapView extends Component {
|
||||||
openHelpLightbox: PropTypes.func,
|
openHelpLightbox: PropTypes.func,
|
||||||
onZoomExtents: PropTypes.func,
|
onZoomExtents: PropTypes.func,
|
||||||
onZoomIn: PropTypes.func,
|
onZoomIn: PropTypes.func,
|
||||||
onZoomOut: PropTypes.func
|
onZoomOut: PropTypes.func,
|
||||||
|
hasLearnedTopicCreation: PropTypes.bool
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -58,11 +60,11 @@ class MapView extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render = () => {
|
render = () => {
|
||||||
const { map, currentUser, onOpen, onClose,
|
const { mobile, map, currentUser, onOpen, onClose,
|
||||||
toggleMapInfoBox, toggleFilterBox, infoBoxHtml, filterBoxHtml,
|
toggleMapInfoBox, toggleFilterBox, infoBoxHtml, filterBoxHtml,
|
||||||
openImportLightbox, forkMap, openHelpLightbox,
|
openImportLightbox, forkMap, openHelpLightbox,
|
||||||
mapIsStarred, onMapStar, onMapUnstar,
|
mapIsStarred, onMapStar, onMapUnstar,
|
||||||
onZoomExtents, onZoomIn, onZoomOut } = this.props
|
onZoomExtents, onZoomIn, onZoomOut, hasLearnedTopicCreation } = this.props
|
||||||
const { chatOpen } = this.state
|
const { chatOpen } = this.state
|
||||||
const onChatOpen = () => {
|
const onChatOpen = () => {
|
||||||
this.setState({chatOpen: true})
|
this.setState({chatOpen: true})
|
||||||
|
@ -83,6 +85,7 @@ class MapView extends Component {
|
||||||
filterBoxHtml={filterBoxHtml} />
|
filterBoxHtml={filterBoxHtml} />
|
||||||
<DataVis />
|
<DataVis />
|
||||||
<TopicCard {...this.props} />
|
<TopicCard {...this.props} />
|
||||||
|
{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}
|
<MapControls onClickZoomExtents={onZoomExtents}
|
||||||
onClickZoomIn={onZoomIn}
|
onClickZoomIn={onZoomIn}
|
||||||
|
@ -100,34 +103,3 @@ class MapView extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MapView
|
export default MapView
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
<% if authenticated? %>
|
|
||||||
<% # for creating and pulling in topics and synapses %>
|
|
||||||
<% if controller_name == 'maps' && action_name == "conversation" %>
|
|
||||||
<%= render :partial => 'maps/newtopicsecret' %>
|
|
||||||
<% else %>
|
|
||||||
<%= render :partial => 'maps/newtopic' %>
|
|
||||||
<% end %>
|
|
||||||
<%= render :partial => 'maps/newsynapse' %>
|
|
||||||
<% # for populating the change metacode list on the topic card %>
|
|
||||||
<%= render :partial => 'shared/metacodeoptions' %>
|
|
||||||
<% end %>
|
|
||||||
<%= render :partial => 'layouts/lowermapelements' %>
|
|
||||||
|
|
||||||
<div id="loading"></div>
|
|
||||||
|
|
||||||
<div id="instructions">
|
|
||||||
<div className="addTopic">
|
|
||||||
Double-click to<br>add a topic
|
|
||||||
</div>
|
|
||||||
<div className="tabKey">
|
|
||||||
Use Tab & Shift+Tab to select a metacode
|
|
||||||
</div>
|
|
||||||
<div className="enterKey">
|
|
||||||
Press Enter to add the topic
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue