mirror of
https://github.com/urbit/shrub.git
synced 2025-01-07 05:26:56 +03:00
Updated chat and weather apps to latest
This commit is contained in:
parent
3312ce0771
commit
a0838d8f96
@ -50,6 +50,7 @@
|
|||||||
++ prep
|
++ prep
|
||||||
|= old=(unit state)
|
|= old=(unit state)
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
|
=/ launchnoun [%noun [%chat /chattile '/~chat/js/tile.js']]
|
||||||
?~ old
|
?~ old
|
||||||
=/ inboxpat /circle/inbox/config/group
|
=/ inboxpat /circle/inbox/config/group
|
||||||
=/ circlespat /circles/[(scot %p our.bol)]
|
=/ circlespat /circles/[(scot %p our.bol)]
|
||||||
@ -62,9 +63,9 @@
|
|||||||
[ost.bol %peer circlespat [our.bol %hall] circlespat]
|
[ost.bol %peer circlespat [our.bol %hall] circlespat]
|
||||||
[ost.bol %connect / [~ /'~chat'] %chat]
|
[ost.bol %connect / [~ /'~chat'] %chat]
|
||||||
[ost.bol %poke /chat [our.bol %hall] inboxi]
|
[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)
|
this(sta u.old)
|
||||||
::
|
::
|
||||||
::
|
::
|
||||||
@ -79,7 +80,7 @@
|
|||||||
?~ lis
|
?~ lis
|
||||||
[cir 0]
|
[cir 0]
|
||||||
=/ last (snag (dec (lent lis)) `(list envelope:hall)`lis)
|
=/ last (snag (dec (lent lis)) `(list envelope:hall)`lis)
|
||||||
[cir num.last]
|
[cir (add num.last 1)]
|
||||||
=/ maptjson *(map @t json)
|
=/ maptjson *(map @t json)
|
||||||
=. maptjson
|
=. maptjson
|
||||||
(~(put by maptjson) 'config' (config-to-json str))
|
(~(put by maptjson) 'config' (config-to-json str))
|
||||||
@ -425,11 +426,35 @@
|
|||||||
::
|
::
|
||||||
configs (~(del by configs.str.sta) affectedcir)
|
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
|
:: 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
@ -19331,46 +19331,45 @@
|
|||||||
if (state.numbers && state.configs) {
|
if (state.numbers && state.configs) {
|
||||||
let numbers = {};
|
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;
|
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];
|
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) {
|
if (!state.configs[key]) { break; }
|
||||||
inviteNum = 0;
|
|
||||||
|
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 (
|
return (
|
||||||
react.createElement('div', { className: "w-100 h-100 relative" , style: { background: '#1a1a1a' }, __self: this, __source: {fileName: _jsxFileName, lineNumber: 70}}
|
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: 71}}
|
, 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: {
|
, react.createElement('p', { className: "gray", style: {
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
lineHeight: '24px'
|
lineHeight: '24px'
|
||||||
}, __self: this, __source: {fileName: _jsxFileName, lineNumber: 72}}, "Chat")
|
}, __self: this, __source: {fileName: _jsxFileName, lineNumber: 71}}, "Chat")
|
||||||
, react.createElement('img', {
|
, react.createElement('img', {
|
||||||
className: "absolute",
|
className: "absolute",
|
||||||
style: { left: 68, top: 65 },
|
style: { left: 68, top: 65 },
|
||||||
src: "/~chat/img/Tile.png",
|
src: "/~chat/img/Tile.png",
|
||||||
width: 106,
|
width: 106,
|
||||||
height: 98, __self: this, __source: {fileName: _jsxFileName, lineNumber: 77}} )
|
height: 98, __self: this, __source: {fileName: _jsxFileName, lineNumber: 76}} )
|
||||||
, react.createElement('p', {
|
, react.createElement('p', {
|
||||||
className: "absolute white" ,
|
className: "absolute white" ,
|
||||||
style: {
|
style: {
|
||||||
@ -19378,7 +19377,7 @@
|
|||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
lineHeight: '20px'
|
lineHeight: '20px'
|
||||||
}, __self: this, __source: {fileName: _jsxFileName, lineNumber: 83}}, inviteNum, " invites" )
|
}, __self: this, __source: {fileName: _jsxFileName, lineNumber: 82}}, inviteNum, " invites" )
|
||||||
, react.createElement('p', {
|
, react.createElement('p', {
|
||||||
className: "absolute white" ,
|
className: "absolute white" ,
|
||||||
style: {
|
style: {
|
||||||
@ -19386,7 +19385,7 @@
|
|||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
lineHeight: '20px'
|
lineHeight: '20px'
|
||||||
}, __self: this, __source: {fileName: _jsxFileName, lineNumber: 91}}, msgNum, " new messages" )
|
}, __self: this, __source: {fileName: _jsxFileName, lineNumber: 90}}, msgNum, " new messages" )
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@ -148,14 +148,14 @@
|
|||||||
[~ this]
|
[~ this]
|
||||||
::
|
::
|
||||||
++ wake
|
++ wake
|
||||||
|= [wir=wire ~]
|
|= [wir=wire err=(unit tang)]
|
||||||
^- (quip move _this)
|
^- (quip move _this)
|
||||||
=/ req/request:http (request-darksky location)
|
=/ req/request:http (request-darksky location)
|
||||||
=/ lismov/(list move)
|
=/ lismov/(list move)
|
||||||
`(list move)`[ost.bol %request /[(scot %da now.bol)] req *outbound-config:http-client]~
|
`(list move)`[ost.bol %request /[(scot %da now.bol)] req *outbound-config:http-client]~
|
||||||
?~ timer
|
?~ timer
|
||||||
:- (weld lismov `(list move)`[ost.bol %wait /timer (add now.bol ~d1)]~)
|
:- (weld lismov `(list move)`[ost.bol %wait /timer (add now.bol ~h3)]~)
|
||||||
this(timer `(add now.bol ~d1))
|
this(timer `(add now.bol ~h3))
|
||||||
[lismov this]
|
[lismov this]
|
||||||
::
|
::
|
||||||
--
|
--
|
||||||
|
@ -56,6 +56,7 @@
|
|||||||
[%config cir=circle:hall con=config:hall]
|
[%config cir=circle:hall con=config:hall]
|
||||||
[%circles cir=(set name:hall)]
|
[%circles cir=(set name:hall)]
|
||||||
[%peers cir=circle:hall per=(set @p)]
|
[%peers cir=circle:hall per=(set @p)]
|
||||||
|
[%delete cir=circle:hall]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
+$ action [%actions lis=(list action:hall)]
|
+$ action [%actions lis=(list action:hall)]
|
||||||
|
@ -75,6 +75,15 @@
|
|||||||
[%peers [%a (turn ~(tap in per.upd) ship:enjs:format)]]
|
[%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
|
:: %noop
|
||||||
[*@t *^json]
|
[*@t *^json]
|
||||||
==
|
==
|
||||||
|
Loading…
Reference in New Issue
Block a user