mirror of
https://github.com/urbit/shrub.git
synced 2024-12-14 20:02:51 +03:00
front end PM glyph display
This commit is contained in:
parent
4aa03de827
commit
3101e61227
@ -94,7 +94,7 @@ module.exports = recl
|
||||
stations:StationStore.getStations()
|
||||
configs:StationStore.getConfigs()
|
||||
typing:MessageStore.getTyping()
|
||||
glyph:StationStore.getGlyphMap()
|
||||
glyphs:StationStore.getGlyphMap()
|
||||
}
|
||||
|
||||
getInitialState: -> @stateFromStore()
|
||||
@ -198,10 +198,10 @@ module.exports = recl
|
||||
|
||||
div {id: "messages"}, _messages.map (_message,k) =>
|
||||
nowSaid = [_message.ship,_message.thought.audience]
|
||||
glyph = window.util.getGlyph @state.glyphs, _.keys _message.thought.audience
|
||||
{station} = @state
|
||||
mess = {
|
||||
station, @_handlePm, @_handleAudi,
|
||||
glyph: @state.glyph[(_.keys _message.thought.audience).join " "]
|
||||
glyph, station, @_handlePm, @_handleAudi,
|
||||
unseen: lastIndex and lastIndex is k
|
||||
sameAs: _.isEqual lastSaid, nowSaid
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ module.exports = recl({
|
||||
stations: StationStore.getStations(),
|
||||
configs: StationStore.getConfigs(),
|
||||
typing: MessageStore.getTyping(),
|
||||
glyph: StationStore.getGlyphMap()
|
||||
glyphs: StationStore.getGlyphMap()
|
||||
};
|
||||
},
|
||||
getInitialState: function() {
|
||||
@ -508,14 +508,15 @@ module.exports = recl({
|
||||
id: "messages"
|
||||
}, _messages.map((function(_this) {
|
||||
return function(_message, k) {
|
||||
var mess, nowSaid, ref4;
|
||||
var glyph, mess, nowSaid, ref4;
|
||||
nowSaid = [_message.ship, _message.thought.audience];
|
||||
glyph = window.util.getGlyph(_this.state.glyphs, _.keys(_message.thought.audience));
|
||||
station = _this.state.station;
|
||||
mess = {
|
||||
glyph: glyph,
|
||||
station: station,
|
||||
_handlePm: _this._handlePm,
|
||||
_handleAudi: _this._handleAudi,
|
||||
glyph: _this.state.glyph[(_.keys(_message.thought.audience)).join(" ")],
|
||||
unseen: lastIndex && lastIndex === k,
|
||||
sameAs: _.isEqual(lastSaid, nowSaid)
|
||||
};
|
||||
@ -6293,10 +6294,13 @@ if (!window.util) {
|
||||
_.merge(window.util, {
|
||||
mainStations: ["court", "floor", "porch"],
|
||||
mainStationPath: function(user) {
|
||||
if (user == null) {
|
||||
user = window.urb.user;
|
||||
}
|
||||
return "~" + user + "/" + (window.util.mainStation(user));
|
||||
},
|
||||
mainStation: function(user) {
|
||||
if (!user) {
|
||||
if (user == null) {
|
||||
user = window.urb.user;
|
||||
}
|
||||
switch (user.length) {
|
||||
@ -6308,10 +6312,22 @@ _.merge(window.util, {
|
||||
return "porch";
|
||||
}
|
||||
},
|
||||
getGlyph: function(glyphs, audi) {
|
||||
return glyphs[audi.join(" ")] || (function() {
|
||||
switch (false) {
|
||||
case !!_.contains(audi, window.util.mainStationPath()):
|
||||
return "*";
|
||||
case audi.length !== 1:
|
||||
return ":";
|
||||
default:
|
||||
return ";";
|
||||
}
|
||||
})();
|
||||
},
|
||||
clipAudi: function(audi) {
|
||||
var ms, regx;
|
||||
audi = audi.join(" ");
|
||||
ms = window.util.mainStationPath(window.urb.user);
|
||||
ms = window.util.mainStationPath();
|
||||
regx = new RegExp("/" + ms, "g");
|
||||
audi = audi.replace(regx, "");
|
||||
return audi.split(" ");
|
||||
@ -6319,7 +6335,7 @@ _.merge(window.util, {
|
||||
expandAudi: function(audi) {
|
||||
var ms;
|
||||
audi = audi.join(" ");
|
||||
ms = window.util.mainStationPath(window.urb.user);
|
||||
ms = window.util.mainStationPath();
|
||||
if (audi.indexOf(ms) === -1) {
|
||||
if (audi.length > 0) {
|
||||
audi += " ";
|
||||
|
@ -2,10 +2,10 @@ if not window.util then window.util = {}
|
||||
_.merge window.util,
|
||||
mainStations: ["court","floor","porch"]
|
||||
|
||||
mainStationPath: (user) -> "~#{user}/#{window.util.mainStation(user)}"
|
||||
mainStationPath: (user = window.urb.user) ->
|
||||
"~#{user}/#{window.util.mainStation(user)}"
|
||||
|
||||
mainStation: (user) ->
|
||||
if not user then user = window.urb.user
|
||||
mainStation: (user = window.urb.user) ->
|
||||
switch user.length
|
||||
when 3
|
||||
return "court"
|
||||
@ -14,16 +14,24 @@ _.merge window.util,
|
||||
when 13
|
||||
return "porch"
|
||||
|
||||
getGlyph: (glyphs, audi)->
|
||||
glyphs[audi.join " "] or switch
|
||||
when not _.contains audi, window.util.mainStationPath()
|
||||
"*"
|
||||
when audi.length is 1
|
||||
":"
|
||||
else ";"
|
||||
|
||||
clipAudi: (audi) ->
|
||||
audi = audi.join " "
|
||||
ms = window.util.mainStationPath window.urb.user
|
||||
ms = window.util.mainStationPath()
|
||||
regx = new RegExp "/#{ms}","g"
|
||||
audi = audi.replace regx,""
|
||||
audi.split " "
|
||||
|
||||
expandAudi: (audi) ->
|
||||
audi = audi.join " "
|
||||
ms = window.util.mainStationPath window.urb.user
|
||||
ms = window.util.mainStationPath()
|
||||
if audi.indexOf(ms) is -1
|
||||
if audi.length > 0
|
||||
audi += " "
|
||||
@ -82,4 +90,4 @@ _.merge window.util,
|
||||
if window.util.isScrolling()
|
||||
$('body').addClass 'scrolling'
|
||||
else
|
||||
$('body').removeClass 'scrolling'
|
||||
$('body').removeClass 'scrolling'
|
||||
|
Loading…
Reference in New Issue
Block a user