Updated chat and weather apps to latest

This commit is contained in:
Logan Allen 2019-06-26 10:31:49 -07:00 committed by Isaac Visintainer
parent 3312ce0771
commit a0838d8f96
7 changed files with 436 additions and 311 deletions

View File

@ -50,6 +50,7 @@
++ prep
|= old=(unit state)
^- (quip move _this)
=/ launchnoun [%noun [%chat /chattile '/~chat/js/tile.js']]
?~ old
=/ inboxpat /circle/inbox/config/group
=/ circlespat /circles/[(scot %p our.bol)]
@ -62,9 +63,9 @@
[ost.bol %peer circlespat [our.bol %hall] circlespat]
[ost.bol %connect / [~ /'~chat'] %chat]
[ost.bol %poke /chat [our.bol %hall] inboxi]
[ost.bol %poke /chat [our.bol %launch] [%noun [%chat /chattile '/~chat/js/tile.js']]]
[ost.bol %poke /chat [our.bol %launch] launchnoun]
==
:- [ost.bol %poke /chat [our.bol %launch] [%noun [%chat /chattile '/~chat/js/tile.js']]]~
:- [ost.bol %poke /chat [our.bol %launch] launchnoun]~
this(sta u.old)
::
::
@ -79,7 +80,7 @@
?~ lis
[cir 0]
=/ last (snag (dec (lent lis)) `(list envelope:hall)`lis)
[cir num.last]
[cir (add num.last 1)]
=/ maptjson *(map @t json)
=. maptjson
(~(put by maptjson) 'config' (config-to-json str))
@ -425,11 +426,35 @@
::
configs (~(del by configs.str.sta) affectedcir)
==
=/ fakecir/circle:hall
:- our.bol
%- crip
%+ weld (trip 'hall-internal-') (trip nom.affectedcir)
::
?~ (~(get by configs.str) fakecir)
:: just forward the delete to our clients
::
:_ this(str.sta str)
%+ weld
[ost.bol %pull newwir [hos.affectedcir %hall] ~]~
%+ weld
(send-chat-update [[%inbox newinbox] str])
(send-chat-update [[%delete affectedcir] str])
:: if we get a delete from another ship, delete our fake circle copy
::
~& %deletefake
=/ deletefake/poke
:- %hall-action
[%delete nom.fakecir ~]
:_ this(str.sta str)
%+ weld
[ost.bol %pull newwir [hos.affectedcir %hall] ~]~
%+ weld
[ost.bol %poke /fake [our.bol %hall] deletefake]~
%+ weld
(send-chat-update [[%inbox newinbox] str])
(send-chat-update [[%delete affectedcir] str])
::
:_ this(str.sta str)
%+ weld
[ost.bol %pull newwir [hos.affectedcir %hall] ~]~
(send-chat-update [[%inbox newinbox] str])
==
:: end of branching on dif.sto type
==

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -19331,46 +19331,45 @@
if (state.numbers && state.configs) {
let numbers = {};
state.numbers.forEach((num) => {
for (let i = 0; i < state.numbers.length; i++) {
let num = state.numbers[i];
numbers[num.circle] = num.length;
if (num.circle === inviteCircle) {
inviteNum = inviteNum + num.length;
} else {
msgNum = msgNum + num.length;
}
});
}
Object.keys(state.configs).forEach((key) => {
let configs = Object.keys(state.configs);
for (let i = 0; i < configs.length; i++) {
let key = configs[i];
let host = key.split('/')[0];
if (host !== `~${window.ship}`) { return; }
if (!state.configs[key]) { return; }
let red = state.configs[key].red;
if (key === inviteCircle) {
inviteNum = inviteNum - red;
} else {
msgNum = msgNum - red;
}
});
}
if (inviteNum === -1) {
inviteNum = 0;
if (!state.configs[key]) { break; }
let red = state.configs[key].red;
console.log(key, red, numbers[key]);
if (key === inviteCircle) {
inviteNum = inviteNum - red + numbers[key];
} else if (host === `~${window.ship}`) {
msgNum = msgNum - red + numbers[key];
} else {
msgNum = msgNum + numbers[key];
}
}
}
return (
react.createElement('div', { className: "w-100 h-100 relative" , style: { background: '#1a1a1a' }, __self: this, __source: {fileName: _jsxFileName, lineNumber: 70}}
, react.createElement('a', { className: "w-100 h-100 db pa2 no-underline" , href: "/~chat", __self: this, __source: {fileName: _jsxFileName, lineNumber: 71}}
react.createElement('div', { className: "w-100 h-100 relative" , style: { background: '#1a1a1a' }, __self: this, __source: {fileName: _jsxFileName, lineNumber: 69}}
, react.createElement('a', { className: "w-100 h-100 db pa2 no-underline" , href: "/~chat", __self: this, __source: {fileName: _jsxFileName, lineNumber: 70}}
, react.createElement('p', { className: "gray", style: {
fontWeight: 'bold',
fontSize: 14,
lineHeight: '24px'
}, __self: this, __source: {fileName: _jsxFileName, lineNumber: 72}}, "Chat")
}, __self: this, __source: {fileName: _jsxFileName, lineNumber: 71}}, "Chat")
, react.createElement('img', {
className: "absolute",
style: { left: 68, top: 65 },
src: "/~chat/img/Tile.png",
width: 106,
height: 98, __self: this, __source: {fileName: _jsxFileName, lineNumber: 77}} )
height: 98, __self: this, __source: {fileName: _jsxFileName, lineNumber: 76}} )
, react.createElement('p', {
className: "absolute white" ,
style: {
@ -19378,7 +19377,7 @@
fontWeight: 600,
fontSize: 16,
lineHeight: '20px'
}, __self: this, __source: {fileName: _jsxFileName, lineNumber: 83}}, inviteNum, " invites" )
}, __self: this, __source: {fileName: _jsxFileName, lineNumber: 82}}, inviteNum, " invites" )
, react.createElement('p', {
className: "absolute white" ,
style: {
@ -19386,7 +19385,7 @@
fontWeight: 600,
fontSize: 16,
lineHeight: '20px'
}, __self: this, __source: {fileName: _jsxFileName, lineNumber: 91}}, msgNum, " new messages" )
}, __self: this, __source: {fileName: _jsxFileName, lineNumber: 90}}, msgNum, " new messages" )
)
)
);

View File

@ -148,14 +148,14 @@
[~ this]
::
++ wake
|= [wir=wire ~]
|= [wir=wire err=(unit tang)]
^- (quip move _this)
=/ req/request:http (request-darksky location)
=/ lismov/(list move)
`(list move)`[ost.bol %request /[(scot %da now.bol)] req *outbound-config:http-client]~
?~ timer
:- (weld lismov `(list move)`[ost.bol %wait /timer (add now.bol ~d1)]~)
this(timer `(add now.bol ~d1))
:- (weld lismov `(list move)`[ost.bol %wait /timer (add now.bol ~h3)]~)
this(timer `(add now.bol ~h3))
[lismov this]
::
--

View File

@ -56,6 +56,7 @@
[%config cir=circle:hall con=config:hall]
[%circles cir=(set name:hall)]
[%peers cir=circle:hall per=(set @p)]
[%delete cir=circle:hall]
==
::
+$ action [%actions lis=(list action:hall)]

View File

@ -75,6 +75,15 @@
[%peers [%a (turn ~(tap in per.upd) ship:enjs:format)]]
==
::
:: %delete
?: =(%delete -.upd)
?> ?=(%delete -.upd)
:- %delete
%- pairs
:~
[%circle (circ:enjs:hall-json cir.upd)]
==
::
:: %noop
[*@t *^json]
==