talk reorg

This commit is contained in:
Galen Wolfe-Pauly 2015-03-05 19:58:23 -08:00
parent bda5010311
commit 91ebe88f6d
8 changed files with 158 additions and 121 deletions

View File

@ -1989,7 +1989,7 @@ try to get the aeon referred to by the starting case. If it doesn't
exist yet, then we can't do anything interesting with this subscription,
so we move on to the next one.
Otherwise, we try to get the aeon referrred to by the ending case. If it
Otherwise, we try to get the aeon referred to by the ending case. If it
doesn't exist yet, then we produce all the information we can. We call
`++lobes-at-path` at the given aeon and path to see if the requested
path has actually changed. If it hasn't, then we don't produce anything;

View File

@ -70,6 +70,18 @@
font-weight: 500;
font-style: normal;
}
@font-face {
font-family: "scp";
src: url("http://storage.googleapis.com/urbit-extra/scp-bold.woff");
font-weight: 600;
font-style: normal;
}
@font-face {
font-family: "scp";
src: url("http://storage.googleapis.com/urbit-extra/scp-black.woff");
font-weight: 700;
font-style: normal;
}
.iden,
.audi,
.time,
@ -124,22 +136,9 @@ body {
margin-left: -12rem;
font-size: 4rem;
}
#station-container {
position: fixed;
top: 0;
left: 50%;
width: 28rem;
max-height: 2.6rem;
overflow: hidden;
margin-left: -14rem;
#station #station-container {
display: block;
padding-top: 1rem;
background-color: #f5f5f5;
border-bottom: 3px solid #ededed;
transition: max-height 0.15s ease-out;
}
#station-container:hover {
max-height: 12rem;
transition: max-height 0.25s ease-in;
}
#stations-container,
#messages-container {
@ -149,8 +148,8 @@ body {
position: absolute;
top: 4rem;
left: 50%;
width: 24rem;
margin-left: -12rem;
width: 66rem;
margin-left: -46rem;
margin-bottom: 4rem;
}
#station > div {
@ -161,9 +160,14 @@ body {
margin-bottom: 1rem;
}
#sources-container {
width: 6rem;
float: right;
margin: 1rem -6rem 0 0;
position: fixed;
top: 0;
left: 50%;
margin-left: -35rem;
text-align: right;
background-color: #000;
color: #fff;
padding: 1rem;
}
#members {
margin-left: 2rem;
@ -172,8 +176,6 @@ body {
display: block;
}
.station {
display: inline-block;
width: 9rem;
margin-bottom: 0.3rem;
cursor: pointer;
font-weight: 200;
@ -245,9 +247,6 @@ body {
#messages .message:hover .time {
opacity: 1;
}
.time {
margin-right: 0.6rem;
}
.member {
width: 12rem;
margin: 0.3rem 0.6rem 0.3rem 0;
@ -271,20 +270,21 @@ body {
vertical-align: top;
}
.attr {
color: #d7d7d7;
text-align: right;
display: inline-block;
margin-right: 0.3rem;
min-width: 30rem;
}
.attr .iden {
color: #000;
}
.attr > div {
margin-right: 0.3rem;
width: 6rem;
}
.mess {
font-size: 0.9rem;
line-height: 1.6rem;
letter-spacing: 0.03rem;
word-wrap: break-word;
max-width: 31rem;
max-width: 30rem;
margin-left: 0.3rem;
}
.ship {
font-weight: 600;
@ -303,7 +303,6 @@ body {
#writing-container {
bottom: 4rem;
margin-bottom: 1rem;
float: left;
}
.writing {
padding-top: 0.3rem;
@ -313,14 +312,20 @@ body {
margin-left: 1rem;
margin-top: 1.2rem;
}
#audi {
background-color: #eee;
padding: 0.3rem;
margin-top: -0.3rem;
outline: none;
}
#writing {
font-size: 0.9rem;
min-height: 1.6rem;
line-height: 1.6rem;
min-width: 1.3rem;
padding: 0;
outline: none;
background-color: #eee;
margin-left: 0.3rem;
}
#writing:focus {
background-color: #fff;
@ -333,8 +338,9 @@ body {
text-transform: lowercase;
}
input.join {
text-align: right;
font-size: 4rem;
background-color: #fff;
background-color: transparent;
outline: none;
width: 24rem;
}
@ -345,10 +351,10 @@ input.join {
width: 12rem;
}
input.join::-webkit-input-placeholder {
color: #0003ff;
color: #fff;
}
input.join:focus::-webkit-input-placeholder {
color: #fff;
color: #000;
}
.pending {
color: #ccc;

View File

@ -54,22 +54,9 @@ body
margin-left -12rem
font-size 4rem
#station-container
position fixed
top 0
left 50%
width 28rem
max-height 2.6rem
overflow hidden
margin-left -14rem
#station #station-container
display block
padding-top 1rem
background-color #f5f5f5
border-bottom 3px solid #ededed
transition max-height 0.15s ease-out
#station-container:hover
max-height 12rem
transition max-height 0.25s ease-in
#stations-container
#messages-container
@ -79,8 +66,8 @@ body
position absolute
top 4rem
left 50%
width 24rem
margin-left -12rem
width 66rem
margin-left -46rem
margin-bottom 4rem
#station > div
@ -91,9 +78,14 @@ body
margin-bottom 1rem
#sources-container
width 6rem
float right
margin 1rem -6rem 0 0
position fixed
top 0
left 50%
margin-left -35rem
text-align right
background-color #000
color #fff
padding 1rem
#members
margin-left 2rem
@ -102,8 +94,6 @@ body
display block
.station
display inline-block
width 9rem
margin-bottom .3rem
cursor pointer
font-weight 200
@ -176,9 +166,6 @@ body
#messages .message:hover .time
opacity 1
.time
margin-right .6rem
.member
width 12rem
margin .3rem .6rem .3rem 0
@ -205,18 +192,18 @@ body
text-align right
display inline-block
margin-right .3rem
min-width 30rem
.attr .iden
color #000
.attr > div
margin-right .3rem
width 6rem
.mess
font-size .9rem
letter-spacing .03rem
word-wrap break-word
max-width 31rem
max-width 30rem
margin-left .3rem
.ship
font-weight 600
@ -235,7 +222,6 @@ body
#writing-container
bottom 4rem
margin-bottom 1rem
float left
.writing
padding-top .3rem
@ -245,14 +231,20 @@ body
margin-left 1rem
margin-top 1.2rem
#audi
background-color #eee
padding .3rem
margin-top -.3rem
outline none
#writing
font-size .9rem
min-height 1.6rem
line-height 1.6rem
min-width 1.3rem
padding 0
outline none
background-color #eee
margin-left .3rem
#writing:focus
background-color #fff
@ -265,8 +257,9 @@ body
text-transform lowercase
input.join
text-align right
font-size 4rem
background-color #fff
background-color transparent
outline none
width 24rem
@ -277,10 +270,10 @@ input.join
width 12rem
input.join::-webkit-input-placeholder
color #0003FF
color #fff
input.join:focus::-webkit-input-placeholder
color #fff
color #000
.pending
color #ccc

View File

@ -3,11 +3,11 @@ moment = require 'moment-timezone'
recl = React.createClass
[div,br,input,textarea] = [React.DOM.div,React.DOM.br,React.DOM.input,React.DOM.textarea]
MessageStore = require '../stores/MessageStore.coffee'
StationStore = require '../stores/StationStore.coffee'
MessageActions = require '../actions/MessageActions.coffee'
MessageStore = require '../stores/MessageStore.coffee'
StationActions = require '../actions/StationActions.coffee'
Member = require './MemberComponent.coffee'
StationStore = require '../stores/StationStore.coffee'
Member = require './MemberComponent.coffee'
Message = recl
lz: (n) -> if n<10 then "0#{n}" else "#{n}"

View File

@ -35,10 +35,6 @@ module.exports = recl
componentWillUnmount: ->
StationStore.removeChangeListener @_onChangeStore
_toggleAudi: (e) ->
$e = $(e.target).closest('.station')
station = $e.find('.path').text()
StationActions.toggleAudience station
_onChangeStore: ->
@setState @stateFromStore()
@ -77,12 +73,8 @@ module.exports = recl
if @state.station and @state.configs[@state.station]
_remove = @_remove
_sources = _.clone @state.configs[@state.station].sources
_sources.push "twitter/hoontap"
sources = _.map _sources,(source) =>
toggleClass = "toggle "
if @state.audi.indexOf(source) isnt -1 then toggleClass += "active"
(div {className:"station",onClick:@_toggleAudi}, [
(div {className:toggleClass})
(div {className:"station"}, [
(div {className:"path"}, source),
(div {className:"remove",onClick:_remove,"data-station":source},"×")
])

View File

@ -1,10 +1,11 @@
recl = React.createClass
[div,input,textarea] = [React.DOM.div,React.DOM.input,React.DOM.textarea]
[div,br,input,textarea] = [React.DOM.div,React.DOM.br,React.DOM.input,React.DOM.textarea]
MessageActions = require '../actions/MessageActions.coffee'
MessageStore = require '../stores/MessageStore.coffee'
StationActions = require '../actions/StationActions.coffee'
StationStore = require '../stores/StationStore.coffee'
Member = require './MemberComponent.coffee'
StationStore = require '../stores/StationStore.coffee'
Member = require './MemberComponent.coffee'
module.exports = recl
set: ->
@ -14,9 +15,10 @@ module.exports = recl
if window.localStorage then window.localStorage.getItem 'writing'
stateFromStore: -> {
audi:["~zod/court"]
audi:StationStore.getAudience()
members:StationStore.getMembers()
typing:StationStore.getTyping()
ludi:MessageStore.getLastAudience()
}
getInitialState: -> @stateFromStore()
@ -66,6 +68,17 @@ module.exports = recl
_setFocus: -> @$writing.focus()
_commitAudi: ->
_checkAudi()
$('#writing').focus()
_checkAudi: ->
v = $('#audi').text()
v = v.split ","
for a in v
a = a.trim()
StationActions.setAudience v
getTime: ->
d = new Date()
seconds = d.getSeconds()
@ -84,6 +97,7 @@ module.exports = recl
componentDidMount: ->
window.util.sendMessage = @sendMessage
StationStore.addChangeListener @_onChangeStore
MessageStore.addChangeListener @_onChangeStore
@$el = $ @getDOMNode()
@$length = $('#length')
@$writing = $('#writing')
@ -107,17 +121,25 @@ module.exports = recl
ship = if iden then iden.ship else user
name = if iden then iden.name else ""
audi = @state.audi
if audi.length is 0
audi = @state.ludi
k = "writing"
div {className:k}, [
(div {className:"attr"}, [
(div {
id:"audi"
className:"audi"
contentEditable:true
onBlur:@_checkAudi
onKeyDown:@_commitAudi
}, audi.join(","))
(Member iden, "")
(br {},"")
(div {className:"time"}, @getTime())
])
(div {
id:"audi"
contentEditable:true
}, "~zod/court")
(div {
id:"writing"
contentEditable:true

View File

@ -204,14 +204,14 @@ recl = React.createClass;
ref = [React.DOM.div, React.DOM.br, React.DOM.input, React.DOM.textarea], div = ref[0], br = ref[1], input = ref[2], textarea = ref[3];
MessageStore = require('../stores/MessageStore.coffee');
StationStore = require('../stores/StationStore.coffee');
MessageActions = require('../actions/MessageActions.coffee');
MessageStore = require('../stores/MessageStore.coffee');
StationActions = require('../actions/StationActions.coffee');
StationStore = require('../stores/StationStore.coffee');
Member = require('./MemberComponent.coffee');
Message = recl({
@ -403,12 +403,6 @@ module.exports = recl({
componentWillUnmount: function() {
return StationStore.removeChangeListener(this._onChangeStore);
},
_toggleAudi: function(e) {
var $e, station;
$e = $(e.target).closest('.station');
station = $e.find('.path').text();
return StationActions.toggleAudience(station);
},
_onChangeStore: function() {
return this.setState(this.stateFromStore());
},
@ -461,21 +455,12 @@ module.exports = recl({
if (this.state.station && this.state.configs[this.state.station]) {
_remove = this._remove;
_sources = _.clone(this.state.configs[this.state.station].sources);
_sources.push("twitter/hoontap");
sources = _.map(_sources, (function(_this) {
return function(source) {
var toggleClass;
toggleClass = "toggle ";
if (_this.state.audi.indexOf(source) !== -1) {
toggleClass += "active";
}
return div({
className: "station",
onClick: _this._toggleAudi
className: "station"
}, [
div({
className: toggleClass
}), div({
className: "path"
}, source), div({
className: "remove",
@ -615,14 +600,16 @@ module.exports = recl({
},{"../actions/StationActions.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/actions/StationActions.coffee","../stores/StationStore.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/stores/StationStore.coffee"}],"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/components/WritingComponent.coffee":[function(require,module,exports){
var Member, MessageActions, StationActions, StationStore, div, input, recl, ref, textarea;
var Member, MessageActions, MessageStore, StationActions, StationStore, br, div, input, recl, ref, textarea;
recl = React.createClass;
ref = [React.DOM.div, React.DOM.input, React.DOM.textarea], div = ref[0], input = ref[1], textarea = ref[2];
ref = [React.DOM.div, React.DOM.br, React.DOM.input, React.DOM.textarea], div = ref[0], br = ref[1], input = ref[2], textarea = ref[3];
MessageActions = require('../actions/MessageActions.coffee');
MessageStore = require('../stores/MessageStore.coffee');
StationActions = require('../actions/StationActions.coffee');
StationStore = require('../stores/StationStore.coffee');
@ -642,9 +629,10 @@ module.exports = recl({
},
stateFromStore: function() {
return {
audi: ["~zod/court"],
audi: StationStore.getAudience(),
members: StationStore.getMembers(),
typing: StationStore.getTyping()
typing: StationStore.getTyping(),
ludi: MessageStore.getLastAudience()
};
},
getInitialState: function() {
@ -705,6 +693,20 @@ module.exports = recl({
_setFocus: function() {
return this.$writing.focus();
},
_commitAudi: function() {
_checkAudi();
return $('#writing').focus();
},
_checkAudi: function() {
var a, i, len, v;
v = $('#audi').text();
v = v.split(",");
for (i = 0, len = v.length; i < len; i++) {
a = v[i];
a = a.trim();
}
return StationActions.setAudience(v);
},
getTime: function() {
var d, seconds;
d = new Date();
@ -726,6 +728,7 @@ module.exports = recl({
componentDidMount: function() {
window.util.sendMessage = this.sendMessage;
StationStore.addChangeListener(this._onChangeStore);
MessageStore.addChangeListener(this._onChangeStore);
this.$el = $(this.getDOMNode());
this.$length = $('#length');
this.$writing = $('#writing');
@ -748,11 +751,15 @@ module.exports = recl({
return this.setState(this.stateFromStore());
},
render: function() {
var iden, k, name, ship, user;
var audi, iden, k, name, ship, user;
user = "~" + window.urb.user;
iden = StationStore.getMember(user);
ship = iden ? iden.ship : user;
name = iden ? iden.name : "";
audi = this.state.audi;
if (audi.length === 0) {
audi = this.state.ludi;
}
k = "writing";
return div({
className: k
@ -760,13 +767,16 @@ module.exports = recl({
div({
className: "attr"
}, [
Member(iden, ""), div({
div({
id: "audi",
className: "audi",
contentEditable: true,
onBlur: this._checkAudi,
onKeyDown: this._commitAudi
}, audi.join(",")), Member(iden, ""), br({}, ""), div({
className: "time"
}, this.getTime())
]), div({
id: "audi",
contentEditable: true
}, "~zod/court"), div({
id: "writing",
contentEditable: true,
onFocus: this._focus,
@ -784,7 +794,7 @@ module.exports = recl({
},{"../actions/MessageActions.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/actions/MessageActions.coffee","../actions/StationActions.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/actions/StationActions.coffee","../stores/StationStore.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/stores/StationStore.coffee","./MemberComponent.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/components/MemberComponent.coffee"}],"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/dispatcher/Dispatcher.coffee":[function(require,module,exports){
},{"../actions/MessageActions.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/actions/MessageActions.coffee","../actions/StationActions.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/actions/StationActions.coffee","../stores/MessageStore.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/stores/MessageStore.coffee","../stores/StationStore.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/stores/StationStore.coffee","./MemberComponent.coffee":"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/components/MemberComponent.coffee"}],"/Users/galen/Documents/src/urbit-test/urb/zod/main/pub/talk/src/js/dispatcher/Dispatcher.coffee":[function(require,module,exports){
var Dispatcher;
Dispatcher = require('flux').Dispatcher;
@ -5501,6 +5511,15 @@ MessageStore = _.merge(new EventEmitter, {
getTyping: function() {
return _typing;
},
getLastAudience: function() {
if (_.keys(_messages).length === 0) {
return [];
}
_messages = _.sortBy(_messages, function(_message) {
return _message.thought.statement.time;
});
return _.keys(_messages[_messages.length - 1].thought.audience);
},
setTyping: function(state) {
return _typing = state;
},

View File

@ -33,6 +33,11 @@ MessageStore = _.merge new EventEmitter,{
getTyping: -> _typing
getLastAudience: ->
if _.keys(_messages).length is 0 then return []
_messages = _.sortBy _messages, (_message) -> _message.thought.statement.time
_.keys _messages[_messages.length-1].thought.audience
setTyping: (state) -> _typing = state
setListening: (station) ->