mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-08 08:08:35 +03:00
membership
This commit is contained in:
parent
7373c47237
commit
7c846667e0
@ -137,8 +137,9 @@ body {
|
|||||||
font-size: 4rem;
|
font-size: 4rem;
|
||||||
}
|
}
|
||||||
#station #station-container {
|
#station #station-container {
|
||||||
display: block;
|
|
||||||
padding-top: 1rem;
|
padding-top: 1rem;
|
||||||
|
min-width: 30rem;
|
||||||
|
text-align: right;
|
||||||
}
|
}
|
||||||
#stations-container,
|
#stations-container,
|
||||||
#messages-container {
|
#messages-container {
|
||||||
@ -155,9 +156,13 @@ body {
|
|||||||
#station > div {
|
#station > div {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
#station-meta {
|
#station-meta .audi,
|
||||||
margin-right: 1rem;
|
#station-meta .iden {
|
||||||
margin-bottom: 1rem;
|
display: inline-block;
|
||||||
|
}
|
||||||
|
#station-meta .iden {
|
||||||
|
width: 6rem;
|
||||||
|
margin-left: 0.3rem;
|
||||||
}
|
}
|
||||||
#sources-container {
|
#sources-container {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
@ -172,9 +177,6 @@ body {
|
|||||||
#members {
|
#members {
|
||||||
margin-left: 2rem;
|
margin-left: 2rem;
|
||||||
}
|
}
|
||||||
#station .iden {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
.station {
|
.station {
|
||||||
margin-bottom: 0.3rem;
|
margin-bottom: 0.3rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
@ -247,6 +249,9 @@ body {
|
|||||||
#messages .message:hover .time {
|
#messages .message:hover .time {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
#messages .message .ship {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
.member {
|
.member {
|
||||||
width: 12rem;
|
width: 12rem;
|
||||||
margin: 0.3rem 0.6rem 0.3rem 0;
|
margin: 0.3rem 0.6rem 0.3rem 0;
|
||||||
@ -278,6 +283,7 @@ body {
|
|||||||
.attr .iden {
|
.attr .iden {
|
||||||
color: #000;
|
color: #000;
|
||||||
width: 6rem;
|
width: 6rem;
|
||||||
|
margin-left: 0.3rem;
|
||||||
}
|
}
|
||||||
.mess {
|
.mess {
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
@ -317,6 +323,7 @@ body {
|
|||||||
padding: 0.3rem;
|
padding: 0.3rem;
|
||||||
margin-top: -0.3rem;
|
margin-top: -0.3rem;
|
||||||
outline: none;
|
outline: none;
|
||||||
|
margin-right: -0.3rem;
|
||||||
}
|
}
|
||||||
#audi.valid-false {
|
#audi.valid-false {
|
||||||
color: #ff2f2f;
|
color: #ff2f2f;
|
||||||
|
@ -55,8 +55,9 @@ body
|
|||||||
font-size 4rem
|
font-size 4rem
|
||||||
|
|
||||||
#station #station-container
|
#station #station-container
|
||||||
display block
|
|
||||||
padding-top 1rem
|
padding-top 1rem
|
||||||
|
min-width 30rem
|
||||||
|
text-align right
|
||||||
|
|
||||||
#stations-container
|
#stations-container
|
||||||
#messages-container
|
#messages-container
|
||||||
@ -73,9 +74,13 @@ body
|
|||||||
#station > div
|
#station > div
|
||||||
display inline-block
|
display inline-block
|
||||||
|
|
||||||
#station-meta
|
#station-meta .audi
|
||||||
margin-right 1rem
|
#station-meta .iden
|
||||||
margin-bottom 1rem
|
display inline-block
|
||||||
|
|
||||||
|
#station-meta .iden
|
||||||
|
width 6rem
|
||||||
|
margin-left .3rem
|
||||||
|
|
||||||
#sources-container
|
#sources-container
|
||||||
position fixed
|
position fixed
|
||||||
@ -90,9 +95,6 @@ body
|
|||||||
#members
|
#members
|
||||||
margin-left 2rem
|
margin-left 2rem
|
||||||
|
|
||||||
#station .iden
|
|
||||||
display block
|
|
||||||
|
|
||||||
.station
|
.station
|
||||||
margin-bottom .3rem
|
margin-bottom .3rem
|
||||||
cursor pointer
|
cursor pointer
|
||||||
@ -166,6 +168,9 @@ body
|
|||||||
#messages .message:hover .time
|
#messages .message:hover .time
|
||||||
opacity 1
|
opacity 1
|
||||||
|
|
||||||
|
#messages .message .ship
|
||||||
|
cursor pointer
|
||||||
|
|
||||||
.member
|
.member
|
||||||
width 12rem
|
width 12rem
|
||||||
margin .3rem .6rem .3rem 0
|
margin .3rem .6rem .3rem 0
|
||||||
@ -197,6 +202,7 @@ body
|
|||||||
.attr .iden
|
.attr .iden
|
||||||
color #000
|
color #000
|
||||||
width 6rem
|
width 6rem
|
||||||
|
margin-left .3rem
|
||||||
|
|
||||||
.mess
|
.mess
|
||||||
font-size .9rem
|
font-size .9rem
|
||||||
@ -236,6 +242,7 @@ body
|
|||||||
padding .3rem
|
padding .3rem
|
||||||
margin-top -.3rem
|
margin-top -.3rem
|
||||||
outline none
|
outline none
|
||||||
|
margin-right -.3rem
|
||||||
|
|
||||||
#audi.valid-false
|
#audi.valid-false
|
||||||
color #ff2f2f
|
color #ff2f2f
|
||||||
|
@ -58,11 +58,10 @@ module.exports =
|
|||||||
type:"stations-load"
|
type:"stations-load"
|
||||||
stations:stations
|
stations:stations
|
||||||
|
|
||||||
loadMembers: (station,members) ->
|
loadMembers: (members) ->
|
||||||
StationDispatcher.handleServerAction
|
StationDispatcher.handleServerAction
|
||||||
type:"members-load"
|
type:"members-load"
|
||||||
members:members
|
members:members
|
||||||
station:station
|
|
||||||
|
|
||||||
createStation: (station) ->
|
createStation: (station) ->
|
||||||
StationDispatcher.handleViewAction
|
StationDispatcher.handleViewAction
|
||||||
|
@ -20,19 +20,15 @@ Message = recl
|
|||||||
"~#{h}.#{m}.#{s}"
|
"~#{h}.#{m}.#{s}"
|
||||||
|
|
||||||
_handlePm: (e) ->
|
_handlePm: (e) ->
|
||||||
$t = $(e.target).closest('.iden')
|
return if not @props._handlePm
|
||||||
console.log 'pm'
|
user = $(e.target).closest('.iden').text().slice(1)
|
||||||
console.log window.util.mainStation $t.text().slice(1)
|
@props._handlePm user
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
# pendingClass = if @props.pending isnt "received" then "pending" else ""
|
# pendingClass = if @props.pending isnt "received" then "pending" else ""
|
||||||
delivery = _.uniq _.pluck @props.thought.audience, "delivery"
|
delivery = _.uniq _.pluck @props.thought.audience, "delivery"
|
||||||
pendingClass = if delivery.indexOf("received") isnt -1 then "received" else "pending"
|
pendingClass = if delivery.indexOf("received") isnt -1 then "received" else "pending"
|
||||||
|
|
||||||
if pendingClass is "pending"
|
|
||||||
console.log @props.thought
|
|
||||||
console.log delivery
|
|
||||||
|
|
||||||
name = if @props.name then @props.name else ""
|
name = if @props.name then @props.name else ""
|
||||||
audi = _.keys(@props.thought.audience)
|
audi = _.keys(@props.thought.audience)
|
||||||
audi = audi.join " "
|
audi = audi.join " "
|
||||||
@ -40,7 +36,7 @@ Message = recl
|
|||||||
div {className:"message "+pendingClass}, [
|
div {className:"message "+pendingClass}, [
|
||||||
(div {className:"attr"}, [
|
(div {className:"attr"}, [
|
||||||
div {className:"audi"}, "#{audi}"
|
div {className:"audi"}, "#{audi}"
|
||||||
(Member {onClick:@_handlePm,ship:@props.ship}, "")
|
(div {onClick:@_handlePm}, (Member {ship:@props.ship}, ""))
|
||||||
(br {},"")
|
(br {},"")
|
||||||
div {className:"time"}, @convTime @props.thought.statement.date
|
div {className:"time"}, @convTime @props.thought.statement.date
|
||||||
])
|
])
|
||||||
@ -106,6 +102,13 @@ module.exports = recl
|
|||||||
|
|
||||||
_onChangeStore: -> @setState @stateFromStore()
|
_onChangeStore: -> @setState @stateFromStore()
|
||||||
|
|
||||||
|
_handlePm: (user) ->
|
||||||
|
audi = [
|
||||||
|
window.util.mainStationPath(user)
|
||||||
|
window.util.mainStationPath(window.urb.user)
|
||||||
|
]
|
||||||
|
StationActions.setAudience audi
|
||||||
|
|
||||||
render: ->
|
render: ->
|
||||||
station = @state.station
|
station = @state.station
|
||||||
_station = "~"+window.urb.ship+"/"+station
|
_station = "~"+window.urb.ship+"/"+station
|
||||||
@ -128,5 +131,6 @@ module.exports = recl
|
|||||||
|
|
||||||
messages = _messages.map (_message) =>
|
messages = _messages.map (_message) =>
|
||||||
_message.station = @state.station
|
_message.station = @state.station
|
||||||
|
_message._handlePm = @_handlePm
|
||||||
Message _message, ""
|
Message _message, ""
|
||||||
div {id: "messages"}, messages
|
div {id: "messages"}, messages
|
@ -60,9 +60,10 @@ module.exports = recl
|
|||||||
parts = []
|
parts = []
|
||||||
members = []
|
members = []
|
||||||
|
|
||||||
if @state.station and @state.members[@state.station]
|
if @state.station and @state.members
|
||||||
members = _.map @state.members[@state.station], (state,member) ->
|
members = _.map @state.members, (stations,member) ->
|
||||||
Member {ship:member,presence:state.presence}
|
audi = _.map stations,(presence,station) -> (div {className:"audi"}, station)
|
||||||
|
(div {}, [audi,Member {ship:member}])
|
||||||
else
|
else
|
||||||
members = ""
|
members = ""
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ module.exports = recl
|
|||||||
valid
|
valid
|
||||||
|
|
||||||
_setAudi: ->
|
_setAudi: ->
|
||||||
valid = _validateAudi()
|
valid = @_validateAudi()
|
||||||
StationActions.setValidAudience valid
|
StationActions.setValidAudience valid
|
||||||
if valid is true
|
if valid is true
|
||||||
v = $('#audi').text()
|
v = $('#audi').text()
|
||||||
|
@ -8,7 +8,8 @@ $(() ->
|
|||||||
window.chat.StationPersistence = require './persistence/StationPersistence.coffee'
|
window.chat.StationPersistence = require './persistence/StationPersistence.coffee'
|
||||||
|
|
||||||
window.util =
|
window.util =
|
||||||
mainStation (user): ->
|
mainStationPath: (user) -> "~#{user}/#{window.util.mainStation(user)}"
|
||||||
|
mainStation: (user) ->
|
||||||
if not user then user = window.urb.user
|
if not user then user = window.urb.user
|
||||||
switch user.length
|
switch user.length
|
||||||
when 3
|
when 3
|
||||||
|
@ -154,11 +154,10 @@ module.exports = {
|
|||||||
stations: stations
|
stations: stations
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
loadMembers: function(station, members) {
|
loadMembers: function(members) {
|
||||||
return StationDispatcher.handleServerAction({
|
return StationDispatcher.handleServerAction({
|
||||||
type: "members-load",
|
type: "members-load",
|
||||||
members: members,
|
members: members
|
||||||
station: station
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
createStation: function(station) {
|
createStation: function(station) {
|
||||||
@ -237,19 +236,17 @@ Message = recl({
|
|||||||
return "~" + h + "." + m + "." + s;
|
return "~" + h + "." + m + "." + s;
|
||||||
},
|
},
|
||||||
_handlePm: function(e) {
|
_handlePm: function(e) {
|
||||||
var $t;
|
var user;
|
||||||
$t = $(e.target).closest('.iden');
|
if (!this.props._handlePm) {
|
||||||
console.log('pm');
|
return;
|
||||||
return console.log(window.util.mainStation($t.text().slice(1)));
|
}
|
||||||
|
user = $(e.target).closest('.iden').text().slice(1);
|
||||||
|
return this.props._handlePm(user);
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
var audi, delivery, name, pendingClass;
|
var audi, delivery, name, pendingClass;
|
||||||
delivery = _.uniq(_.pluck(this.props.thought.audience, "delivery"));
|
delivery = _.uniq(_.pluck(this.props.thought.audience, "delivery"));
|
||||||
pendingClass = delivery.indexOf("received") !== -1 ? "received" : "pending";
|
pendingClass = delivery.indexOf("received") !== -1 ? "received" : "pending";
|
||||||
if (pendingClass === "pending") {
|
|
||||||
console.log(this.props.thought);
|
|
||||||
console.log(delivery);
|
|
||||||
}
|
|
||||||
name = this.props.name ? this.props.name : "";
|
name = this.props.name ? this.props.name : "";
|
||||||
audi = _.keys(this.props.thought.audience);
|
audi = _.keys(this.props.thought.audience);
|
||||||
audi = audi.join(" ");
|
audi = audi.join(" ");
|
||||||
@ -344,6 +341,11 @@ module.exports = recl({
|
|||||||
_onChangeStore: function() {
|
_onChangeStore: function() {
|
||||||
return this.setState(this.stateFromStore());
|
return this.setState(this.stateFromStore());
|
||||||
},
|
},
|
||||||
|
_handlePm: function(user) {
|
||||||
|
var audi;
|
||||||
|
audi = [window.util.mainStationPath(user), window.util.mainStationPath(window.urb.user)];
|
||||||
|
return StationActions.setAudience(audi);
|
||||||
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
var _messages, _station, messages, ref1, ref2, sources, station;
|
var _messages, _station, messages, ref1, ref2, sources, station;
|
||||||
station = this.state.station;
|
station = this.state.station;
|
||||||
@ -367,6 +369,7 @@ module.exports = recl({
|
|||||||
messages = _messages.map((function(_this) {
|
messages = _messages.map((function(_this) {
|
||||||
return function(_message) {
|
return function(_message) {
|
||||||
_message.station = _this.state.station;
|
_message.station = _this.state.station;
|
||||||
|
_message._handlePm = _this._handlePm;
|
||||||
return Message(_message, "");
|
return Message(_message, "");
|
||||||
};
|
};
|
||||||
})(this));
|
})(this));
|
||||||
@ -445,12 +448,19 @@ module.exports = recl({
|
|||||||
var _remove, _sources, members, parts, sourceCtrl, sourceInput, sources, station;
|
var _remove, _sources, members, parts, sourceCtrl, sourceInput, sources, station;
|
||||||
parts = [];
|
parts = [];
|
||||||
members = [];
|
members = [];
|
||||||
if (this.state.station && this.state.members[this.state.station]) {
|
if (this.state.station && this.state.members) {
|
||||||
members = _.map(this.state.members[this.state.station], function(state, member) {
|
members = _.map(this.state.members, function(stations, member) {
|
||||||
return Member({
|
var audi;
|
||||||
ship: member,
|
audi = _.map(stations, function(presence, station) {
|
||||||
presence: state.presence
|
return div({
|
||||||
|
className: "audi"
|
||||||
|
}, station);
|
||||||
});
|
});
|
||||||
|
return div({}, [
|
||||||
|
audi, Member({
|
||||||
|
ship: member
|
||||||
|
})
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
members = "";
|
members = "";
|
||||||
@ -749,7 +759,7 @@ module.exports = recl({
|
|||||||
},
|
},
|
||||||
_setAudi: function() {
|
_setAudi: function() {
|
||||||
var a, i, len, v, valid;
|
var a, i, len, v, valid;
|
||||||
valid = _validateAudi();
|
valid = this._validateAudi();
|
||||||
StationActions.setValidAudience(valid);
|
StationActions.setValidAudience(valid);
|
||||||
if (valid === true) {
|
if (valid === true) {
|
||||||
v = $('#audi').text();
|
v = $('#audi').text();
|
||||||
@ -875,8 +885,14 @@ $(function() {
|
|||||||
window.chat.MessagePersistence = require('./persistence/MessagePersistence.coffee');
|
window.chat.MessagePersistence = require('./persistence/MessagePersistence.coffee');
|
||||||
window.chat.StationPersistence = require('./persistence/StationPersistence.coffee');
|
window.chat.StationPersistence = require('./persistence/StationPersistence.coffee');
|
||||||
window.util = {
|
window.util = {
|
||||||
mainStation: function() {
|
mainStationPath: function(user) {
|
||||||
switch (window.urb.user.length) {
|
return "~" + user + "/" + (window.util.mainStation(user));
|
||||||
|
},
|
||||||
|
mainStation: function(user) {
|
||||||
|
if (!user) {
|
||||||
|
user = window.urb.user;
|
||||||
|
}
|
||||||
|
switch (user.length) {
|
||||||
case 3:
|
case 3:
|
||||||
return "court";
|
return "court";
|
||||||
case 6:
|
case 6:
|
||||||
@ -5496,8 +5512,8 @@ module.exports = {
|
|||||||
if (res.data.ok === true) {
|
if (res.data.ok === true) {
|
||||||
StationActions.listeningStation(station);
|
StationActions.listeningStation(station);
|
||||||
}
|
}
|
||||||
if ((ref = res.data.group) != null ? ref.local : void 0) {
|
if ((ref = res.data.group) != null ? ref.global : void 0) {
|
||||||
StationActions.loadMembers(station, res.data.group.local);
|
StationActions.loadMembers(res.data.group.global);
|
||||||
}
|
}
|
||||||
if (res.data.config) {
|
if (res.data.config) {
|
||||||
return StationActions.loadConfig(station, res.data.config);
|
return StationActions.loadConfig(station, res.data.config);
|
||||||
@ -5720,21 +5736,26 @@ StationStore = _.merge(new EventEmitter, {
|
|||||||
ship: ship
|
ship: ship
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
changeMember: function(dir, name, ship) {
|
loadMembers: function(members) {
|
||||||
if (dir === "out") {
|
var list, member, presence, results, station;
|
||||||
_members = _.filter(_members, function(_member) {
|
_members = {};
|
||||||
return _member.ship !== ship;
|
results = [];
|
||||||
});
|
for (station in members) {
|
||||||
|
list = members[station];
|
||||||
|
results.push((function() {
|
||||||
|
var results1;
|
||||||
|
results1 = [];
|
||||||
|
for (member in list) {
|
||||||
|
presence = list[member];
|
||||||
|
if (!_members[member]) {
|
||||||
|
_members[member] = {};
|
||||||
}
|
}
|
||||||
if (dir === "in") {
|
results1.push(_members[member][station] = presence);
|
||||||
return _members.push({
|
|
||||||
name: name,
|
|
||||||
ship: ship
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
return results1;
|
||||||
loadMembers: function(station, members) {
|
})());
|
||||||
return _members[station] = members;
|
}
|
||||||
|
return results;
|
||||||
},
|
},
|
||||||
getMembers: function() {
|
getMembers: function() {
|
||||||
return _members;
|
return _members;
|
||||||
@ -5835,7 +5856,7 @@ StationStore.dispatchToken = StationDispatcher.register(function(payload) {
|
|||||||
StationStore.emitChange();
|
StationStore.emitChange();
|
||||||
break;
|
break;
|
||||||
case "members-load":
|
case "members-load":
|
||||||
StationStore.loadMembers(action.station, action.members);
|
StationStore.loadMembers(action.members);
|
||||||
StationStore.emitChange();
|
StationStore.emitChange();
|
||||||
break;
|
break;
|
||||||
case "typing-set":
|
case "typing-set":
|
||||||
|
@ -68,7 +68,7 @@ module.exports =
|
|||||||
console.log(res.data)
|
console.log(res.data)
|
||||||
if res.data.ok is true
|
if res.data.ok is true
|
||||||
StationActions.listeningStation station
|
StationActions.listeningStation station
|
||||||
if res.data.group?.local
|
if res.data.group?.global
|
||||||
StationActions.loadMembers station,res.data.group.local
|
StationActions.loadMembers res.data.group.global
|
||||||
if res.data.config
|
if res.data.config
|
||||||
StationActions.loadConfig station,res.data.config
|
StationActions.loadConfig station,res.data.config
|
@ -41,14 +41,12 @@ StationStore = _.merge new EventEmitter,{
|
|||||||
|
|
||||||
getMember: (ship) -> {ship:ship}
|
getMember: (ship) -> {ship:ship}
|
||||||
|
|
||||||
changeMember: (dir,name,ship) ->
|
loadMembers: (members) ->
|
||||||
if dir is "out"
|
_members = {}
|
||||||
_members = _.filter _members, (_member) ->
|
for station,list of members
|
||||||
return (_member.ship isnt ship)
|
for member,presence of list
|
||||||
if dir is "in"
|
_members[member] = {} if not _members[member]
|
||||||
_members.push {name:name, ship:ship}
|
_members[member][station] = presence
|
||||||
|
|
||||||
loadMembers: (station,members) -> _members[station] = members
|
|
||||||
|
|
||||||
getMembers: -> _members
|
getMembers: -> _members
|
||||||
|
|
||||||
@ -131,7 +129,7 @@ StationStore.dispatchToken = StationDispatcher.register (payload) ->
|
|||||||
StationStore.emitChange()
|
StationStore.emitChange()
|
||||||
break
|
break
|
||||||
when "members-load"
|
when "members-load"
|
||||||
StationStore.loadMembers action.station,action.members
|
StationStore.loadMembers action.members
|
||||||
StationStore.emitChange()
|
StationStore.emitChange()
|
||||||
break
|
break
|
||||||
when "typing-set"
|
when "typing-set"
|
||||||
|
Loading…
Reference in New Issue
Block a user