From eeb546139db0be7410db85621b665ae0c5b669cc Mon Sep 17 00:00:00 2001 From: Anton Dyudin Date: Tue, 3 Nov 2015 10:55:08 -0800 Subject: [PATCH] offline "banner" --- pub/talk/src/css/main.css | 3 + pub/talk/src/css/main.styl | 7 ++ .../src/js/components/StationComponent.coffee | 43 +++++------- pub/talk/src/js/main.js | 69 ++++++++----------- 4 files changed, 58 insertions(+), 64 deletions(-) diff --git a/pub/talk/src/css/main.css b/pub/talk/src/css/main.css index ff5ff9e54..7690f1b08 100644 --- a/pub/talk/src/css/main.css +++ b/pub/talk/src/css/main.css @@ -591,6 +591,9 @@ a { font-size: 0.8rem; text-transform: uppercase; } +body:not(.offline) #offline { + display: none; +} @media only screen and (min-width: 1024px) { #station-container:hover { max-height: 30rem; diff --git a/pub/talk/src/css/main.styl b/pub/talk/src/css/main.styl index fca4bde7f..49fe15367 100644 --- a/pub/talk/src/css/main.styl +++ b/pub/talk/src/css/main.styl @@ -549,4 +549,11 @@ a font-size .8rem text-transform uppercase +// +// offline +// + +body:not(.offline) #offline + display none + @import 'mobile' diff --git a/pub/talk/src/js/components/StationComponent.coffee b/pub/talk/src/js/components/StationComponent.coffee index e2487dc62..44753bc55 100644 --- a/pub/talk/src/js/components/StationComponent.coffee +++ b/pub/talk/src/js/components/StationComponent.coffee @@ -1,17 +1,12 @@ recl = React.createClass -[div,input,textarea,h1,a] = [ - React.DOM.div, - React.DOM.input, - React.DOM.textarea, - React.DOM.h1, - React.DOM.a -] +{div,style,input,textarea,h1,a} = React.DOM StationStore = require '../stores/StationStore.coffee' StationActions = require '../actions/StationActions.coffee' Member = require './MemberComponent.coffee' module.exports = recl + displayName: "Station" stateFromStore: -> { audi:StationStore.getAudience() members:StationStore.getMembers() @@ -88,7 +83,7 @@ module.exports = recl else members = "" - sourceInput = [(input {className:"join",onKeyUp:@_keyUp,placeholder:"+"}, "")] + sourceInput = [(input {className:"join",onKeyUp:@_keyUp,placeholder:"+"})] sourceCtrl = div {className:"sour-ctrl"},sourceInput sources = [] @@ -103,21 +98,19 @@ module.exports = recl else sources = "" - head = (div {id:"head"}, - [ (div {id:"who"},[ - (div {className:"sig"},"") - (div {className:"ship"},"#{window.urb.user}") - ]) - (div {id:"where"},[ - (div {className:"slat"},"talk") - (div {className:"path"},"") #window.util.mainStation(window.urb.user)) - (div {className:"caret"},"") - ]) - ] + (div {id:"station",onClick:@_toggleOpen}, + (div {id:"head"}, + (div {id:"who"}, + div {className:"sig"} + div {className:"ship"},"#{window.urb.user}" + ) + (div {id:"where"}, + div {className:"slat"},"talk" + div {className:"path"} #, window.util.mainStation(window.urb.user)) + div {className:"caret"} + ) + div {id:"offline"}, "Warning: no connection server." ) - - parts.push head - parts.push (div {id:"stations"}, [(h1 {}, "Listening to"),(div {},sources),sourceCtrl]) - parts.push (div {id:"audience"}, (div {},[(h1 {}, "Talking to"),(div {id:"members"},members)])) - - div {id:"station",onClick:@_toggleOpen},parts + div {id:"stations"}, (h1 {}, "Listening to"),(div {},sources),sourceCtrl + div {id:"audience"}, div {}, (h1 {}, "Talking to"),(div {id:"members"},members) + ) diff --git a/pub/talk/src/js/main.js b/pub/talk/src/js/main.js index 9d933b93d..77dcdd260 100644 --- a/pub/talk/src/js/main.js +++ b/pub/talk/src/js/main.js @@ -532,11 +532,11 @@ module.exports = recl({ },{"../actions/MessageActions.coffee":1,"../actions/StationActions.coffee":2,"../stores/MessageStore.coffee":20,"../stores/StationStore.coffee":21,"./MemberComponent.coffee":3,"classnames":10,"moment-timezone":15}],5:[function(require,module,exports){ -var Member, StationActions, StationStore, a, div, h1, input, recl, ref, textarea; +var Member, StationActions, StationStore, a, div, h1, input, recl, ref, style, textarea; recl = React.createClass; -ref = [React.DOM.div, React.DOM.input, React.DOM.textarea, React.DOM.h1, React.DOM.a], div = ref[0], input = ref[1], textarea = ref[2], h1 = ref[3], a = ref[4]; +ref = React.DOM, div = ref.div, style = ref.style, input = ref.input, textarea = ref.textarea, h1 = ref.h1, a = ref.a; StationStore = require('../stores/StationStore.coffee'); @@ -545,6 +545,7 @@ StationActions = require('../actions/StationActions.coffee'); Member = require('./MemberComponent.coffee'); module.exports = recl({ + displayName: "Station", stateFromStore: function() { return { audi: StationStore.getAudience(), @@ -623,7 +624,7 @@ module.exports = recl({ return StationActions.setSources(this.state.station, _sources); }, render: function() { - var _remove, _sources, head, members, parts, sourceCtrl, sourceInput, sources; + var _remove, _sources, members, parts, sourceCtrl, sourceInput, sources; parts = []; members = []; if (this.state.station && this.state.members) { @@ -648,7 +649,7 @@ module.exports = recl({ className: "join", onKeyUp: this._keyUp, placeholder: "+" - }, "") + }) ]; sourceCtrl = div({ className: "sour-ctrl" @@ -675,44 +676,34 @@ module.exports = recl({ } else { sources = ""; } - head = div({ - id: "head" - }, [ - div({ - id: "who" - }, [ - div({ - className: "sig" - }, ""), div({ - className: "ship" - }, "" + window.urb.user) - ]), div({ - id: "where" - }, [ - div({ - className: "slat" - }, "talk"), div({ - className: "path" - }, ""), div({ - className: "caret" - }, "") - ]) - ]); - parts.push(head); - parts.push(div({ - id: "stations" - }, [h1({}, "Listening to"), div({}, sources), sourceCtrl])); - parts.push(div({ - id: "audience" - }, div({}, [ - h1({}, "Talking to"), div({ - id: "members" - }, members) - ]))); return div({ id: "station", onClick: this._toggleOpen - }, parts); + }, div({ + id: "head" + }, div({ + id: "who" + }, div({ + className: "sig" + }), div({ + className: "ship" + }, "" + window.urb.user)), div({ + id: "where" + }, div({ + className: "slat" + }, "talk"), div({ + className: "path" + }), div({ + className: "caret" + })), div({ + id: "offline" + }, "Warning: no connection server.")), div({ + id: "stations" + }, h1({}, "Listening to"), div({}, sources), sourceCtrl), div({ + id: "audience" + }, div({}, h1({}, "Talking to"), div({ + id: "members" + }, members)))); } });