mirror of
https://github.com/urbit/shrub.git
synced 2024-12-14 11:08:45 +03:00
Merge branch 'master' of https://github.com/urbit/interface
This commit is contained in:
commit
e90774a677
@ -13,7 +13,7 @@ class UrbitApi {
|
||||
bind(path, method, ship = this.authTokens.ship, appl = "hall", success, fail) {
|
||||
this.bindPaths = _.uniq([...this.bindPaths, path]);
|
||||
|
||||
window.urb.subscribe(ship, appl, path,
|
||||
window.subscriptionId = window.urb.subscribe(ship, appl, path,
|
||||
(err) => {
|
||||
fail(err);
|
||||
},
|
||||
|
@ -48,10 +48,13 @@ export class ChatInput extends Component {
|
||||
});
|
||||
}
|
||||
|
||||
setTimeout(closure, 1000);
|
||||
//setTimeout(closure, 2000);
|
||||
setTimeout(() => {
|
||||
window.location.reload(false);
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
//closure();
|
||||
//setTimeout(closure, 2000);
|
||||
|
||||
|
||||
this.state = {
|
||||
|
@ -39,6 +39,11 @@ export class Message extends Component {
|
||||
render() {
|
||||
let pending = !!this.props.msg.pending ? ' o-80' : '';
|
||||
|
||||
let timestamp = moment.unix(this.props.msg.wen / 1000).format('hh:mm');
|
||||
window.timestamp = timestamp;
|
||||
window.wen = this.props.msg.wen;
|
||||
window.moment = moment;
|
||||
|
||||
return (
|
||||
<div className={"w-100 pl3 pr3 pt2 pb2 mb2 cf flex" + pending}>
|
||||
<div className="fl mr2">
|
||||
@ -47,7 +52,7 @@ export class Message extends Component {
|
||||
<div className="fr" style={{ flexGrow: 1, marginTop: -4 }}>
|
||||
<div>
|
||||
<p className="v-top label-small-mono gray dib mr3">~{this.props.msg.aut}</p>
|
||||
<p className="v-top label-small-mono gray dib">{moment.unix(this.props.msg.wen).format('hh:mm')}</p>
|
||||
<p className="v-top label-small-mono gray dib">{timestamp}</p>
|
||||
</div>
|
||||
{this.renderContent(this.props.details.type)}
|
||||
</div>
|
||||
|
@ -1,5 +1,6 @@
|
||||
import React, { Component } from 'react';
|
||||
import classnames from 'classnames';
|
||||
import { uuid } from '/lib/util';
|
||||
|
||||
|
||||
export class NewScreen extends Component {
|
||||
|
@ -18,6 +18,17 @@ export class Subscription {
|
||||
api.bind('/primary', 'PUT', api.authTokens.ship, 'chat',
|
||||
this.handleEvent.bind(this),
|
||||
this.handleError.bind(this));
|
||||
|
||||
/*window.addEventListener('beforeunload', (event) => {
|
||||
// Cancel the event as stated by the standard.
|
||||
event.preventDefault();
|
||||
// Chrome requires returnValue to be set.
|
||||
event.returnValue = '';
|
||||
|
||||
if (window.subscriptionId) {
|
||||
window.urb.unsubscribe(window.subscriptionId);
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
fetchMessages(circle, start, end) {
|
||||
|
@ -4,7 +4,28 @@ import classnames from 'classnames';
|
||||
|
||||
export default class ChatTile extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
configs: null,
|
||||
messages: null,
|
||||
message: null
|
||||
};
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
const { props, state } = this;
|
||||
if (prevProps !== props) {
|
||||
|
||||
// TODO: reducer logic :(
|
||||
|
||||
this.setState(props);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
console.log(this.state);
|
||||
return (
|
||||
<div className="bg-dark-gray w-100 h-100">
|
||||
<a className="w-100 h-100 db" style={{
|
||||
|
@ -14,7 +14,6 @@
|
||||
/| /js/
|
||||
/~ ~
|
||||
==
|
||||
|
||||
/= script
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
@ -63,9 +62,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]]]
|
||||
[ost.bol %poke /chat [our.bol %launch] [%noun [%chat /chattile '/~chat/js/tile.js']]]
|
||||
==
|
||||
:- [ost.bol %poke /chat [our.bol %launch] [%noun [%chat /chattile]]]~
|
||||
:- [ost.bol %poke /chat [our.bol %launch] [%noun [%chat /chattile '/~chat/js/tile.js']]]~
|
||||
this(sta u.old)
|
||||
::
|
||||
::
|
||||
@ -73,7 +72,16 @@
|
||||
++ peer-chattile
|
||||
|= wir=wire
|
||||
^- (quip move _this)
|
||||
[~ this]
|
||||
=/ numbers/(list [circle:hall @ud])
|
||||
%+ turn ~(tap by messages.str.sta)
|
||||
|= [cir=circle:hall lis=(list envelope:hall)]
|
||||
^- [circle:hall @ud]
|
||||
[cir (lent lis)]
|
||||
:_ this
|
||||
:~
|
||||
[ost.bol %diff %json (config-to-json str.sta)]
|
||||
[ost.bol %diff %json (numbers-to-json numbers)]
|
||||
==
|
||||
::
|
||||
:: +peer-messages: subscribe to subset of messages and updates
|
||||
::
|
||||
@ -81,6 +89,7 @@
|
||||
++ peer-primary
|
||||
|= wir=wire
|
||||
^- (quip move _this)
|
||||
~& (lent (prey:pubsub:userlib /primary bol))
|
||||
=* messages messages.str.sta
|
||||
=/ lisunitmov=(list (unit move))
|
||||
%+ turn ~(tap by messages)
|
||||
@ -134,9 +143,13 @@
|
||||
++ send-chat-update
|
||||
|= upd=update
|
||||
^- (list move)
|
||||
%+ weld
|
||||
%+ turn (prey:pubsub:userlib /primary bol)
|
||||
|= [=bone *]
|
||||
~& bone
|
||||
[bone %diff %chat-update upd]
|
||||
::
|
||||
%+ turn (prey:pubsub:userlib /chattile bol)
|
||||
|= [=bone *]
|
||||
[bone %diff %chat-update upd]
|
||||
::
|
||||
::
|
||||
|
@ -17,10 +17,6 @@
|
||||
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
||||
}
|
||||
|
||||
function getCjsExportFromNamespace (n) {
|
||||
return n && n.default || n;
|
||||
}
|
||||
|
||||
/*
|
||||
object-assign
|
||||
(c) Sindre Sorhus
|
||||
@ -45633,7 +45629,7 @@
|
||||
bind(path, method, ship = this.authTokens.ship, appl = "hall", success, fail) {
|
||||
this.bindPaths = lodash.uniq([...this.bindPaths, path]);
|
||||
|
||||
window.urb.subscribe(ship, appl, path,
|
||||
window.subscriptionId = window.urb.subscribe(ship, appl, path,
|
||||
(err) => {
|
||||
fail(err);
|
||||
},
|
||||
@ -47896,8 +47892,6 @@
|
||||
isBuffer: isBuffer
|
||||
});
|
||||
|
||||
var require$$0 = getCjsExportFromNamespace(bufferEs6);
|
||||
|
||||
var bn = createCommonjsModule(function (module) {
|
||||
(function (module, exports) {
|
||||
|
||||
@ -47950,7 +47944,7 @@
|
||||
|
||||
var Buffer;
|
||||
try {
|
||||
Buffer = require$$0.Buffer;
|
||||
Buffer = bufferEs6.Buffer;
|
||||
} catch (e) {
|
||||
}
|
||||
|
||||
@ -51997,6 +51991,17 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
|
||||
api.bind('/primary', 'PUT', api.authTokens.ship, 'chat',
|
||||
this.handleEvent.bind(this),
|
||||
this.handleError.bind(this));
|
||||
|
||||
/*window.addEventListener('beforeunload', (event) => {
|
||||
// Cancel the event as stated by the standard.
|
||||
event.preventDefault();
|
||||
// Chrome requires returnValue to be set.
|
||||
event.returnValue = '';
|
||||
|
||||
if (window.subscriptionId) {
|
||||
window.urb.unsubscribe(window.subscriptionId);
|
||||
}
|
||||
});*/
|
||||
}
|
||||
|
||||
fetchMessages(circle, start, end) {
|
||||
@ -56951,15 +56956,20 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
|
||||
render() {
|
||||
let pending = !!this.props.msg.pending ? ' o-80' : '';
|
||||
|
||||
let timestamp = moment.unix(this.props.msg.wen / 1000).format('hh:mm');
|
||||
window.timestamp = timestamp;
|
||||
window.wen = this.props.msg.wen;
|
||||
window.moment = moment;
|
||||
|
||||
return (
|
||||
react.createElement('div', { className: "w-100 pl3 pr3 pt2 pb2 mb2 cf flex" + pending, __self: this, __source: {fileName: _jsxFileName$8, lineNumber: 43}}
|
||||
, react.createElement('div', { className: "fl mr2" , __self: this, __source: {fileName: _jsxFileName$8, lineNumber: 44}}
|
||||
, react.createElement(Sigil, { ship: this.props.msg.aut, size: 32, __self: this, __source: {fileName: _jsxFileName$8, lineNumber: 45}} )
|
||||
react.createElement('div', { className: "w-100 pl3 pr3 pt2 pb2 mb2 cf flex" + pending, __self: this, __source: {fileName: _jsxFileName$8, lineNumber: 48}}
|
||||
, react.createElement('div', { className: "fl mr2" , __self: this, __source: {fileName: _jsxFileName$8, lineNumber: 49}}
|
||||
, react.createElement(Sigil, { ship: this.props.msg.aut, size: 32, __self: this, __source: {fileName: _jsxFileName$8, lineNumber: 50}} )
|
||||
)
|
||||
, react.createElement('div', { className: "fr", style: { flexGrow: 1, marginTop: -4 }, __self: this, __source: {fileName: _jsxFileName$8, lineNumber: 47}}
|
||||
, react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$8, lineNumber: 48}}
|
||||
, react.createElement('p', { className: "v-top label-small-mono gray dib mr3" , __self: this, __source: {fileName: _jsxFileName$8, lineNumber: 49}}, "~", this.props.msg.aut)
|
||||
, react.createElement('p', { className: "v-top label-small-mono gray dib" , __self: this, __source: {fileName: _jsxFileName$8, lineNumber: 50}}, moment.unix(this.props.msg.wen).format('hh:mm'))
|
||||
, react.createElement('div', { className: "fr", style: { flexGrow: 1, marginTop: -4 }, __self: this, __source: {fileName: _jsxFileName$8, lineNumber: 52}}
|
||||
, react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$8, lineNumber: 53}}
|
||||
, react.createElement('p', { className: "v-top label-small-mono gray dib mr3" , __self: this, __source: {fileName: _jsxFileName$8, lineNumber: 54}}, "~", this.props.msg.aut)
|
||||
, react.createElement('p', { className: "v-top label-small-mono gray dib" , __self: this, __source: {fileName: _jsxFileName$8, lineNumber: 55}}, timestamp)
|
||||
)
|
||||
, this.renderContent(this.props.details.type)
|
||||
)
|
||||
@ -57041,7 +57051,7 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
//closure();
|
||||
//setTimeout(closure, 2000);
|
||||
|
||||
|
||||
this.state = {
|
||||
@ -57149,19 +57159,19 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
|
||||
const { props, state } = this;
|
||||
|
||||
return (
|
||||
react.createElement('div', { className: "mt2 pa3 cf flex black bt" , __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 162}}
|
||||
, react.createElement('div', { className: "fl", style: { flexBasis: 35, height: 40 }, __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 163}}
|
||||
, react.createElement(Sigil, { ship: window.ship, size: 32, __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 164}} )
|
||||
react.createElement('div', { className: "mt2 pa3 cf flex black bt" , __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 165}}
|
||||
, react.createElement('div', { className: "fl", style: { flexBasis: 35, height: 40 }, __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 166}}
|
||||
, react.createElement(Sigil, { ship: window.ship, size: 32, __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 167}} )
|
||||
)
|
||||
, react.createElement('div', { className: "fr h-100 flex" , style: { flexGrow: 1, height: 40 }, __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 166}}
|
||||
, react.createElement('div', { className: "fr h-100 flex" , style: { flexGrow: 1, height: 40 }, __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 169}}
|
||||
, react.createElement('input', { className: "ml2 bn" ,
|
||||
style: { flexGrow: 1 },
|
||||
ref: this.textareaRef,
|
||||
placeholder: props.placeholder,
|
||||
value: state.message,
|
||||
onChange: this.messageChange, __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 167}} )
|
||||
, react.createElement('div', { className: "pointer", onClick: this.messageSubmit, __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 173}}
|
||||
, react.createElement(IconSend, {__self: this, __source: {fileName: _jsxFileName$b, lineNumber: 174}} )
|
||||
onChange: this.messageChange, __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 170}} )
|
||||
, react.createElement('div', { className: "pointer", onClick: this.messageSubmit, __self: this, __source: {fileName: _jsxFileName$b, lineNumber: 176}}
|
||||
, react.createElement(IconSend, {__self: this, __source: {fileName: _jsxFileName$b, lineNumber: 177}} )
|
||||
)
|
||||
)
|
||||
)
|
||||
@ -57681,23 +57691,23 @@ lyrtesmudnytbyrsenwegfyrmurtelreptegpecnelnevfes\
|
||||
|
||||
render() {
|
||||
return (
|
||||
react.createElement('div', { className: "h-100 w-100 pa3 pt2 overflow-x-hidden flex flex-column" , __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 86}}
|
||||
, react.createElement('h2', { className: "mb3", __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 87}}, "Create a New Chat" )
|
||||
, react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$g, lineNumber: 88}}
|
||||
, react.createElement('p', { className: "label-regular fw-bold" , __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 89}}, "Name")
|
||||
react.createElement('div', { className: "h-100 w-100 pa3 pt2 overflow-x-hidden flex flex-column" , __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 87}}
|
||||
, react.createElement('h2', { className: "mb3", __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 88}}, "Create a New Chat" )
|
||||
, react.createElement('div', {__self: this, __source: {fileName: _jsxFileName$g, lineNumber: 89}}
|
||||
, react.createElement('p', { className: "label-regular fw-bold" , __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 90}}, "Name")
|
||||
, react.createElement('input', {
|
||||
className: "body-large bn pa2 pl0 mb2 w-50" ,
|
||||
placeholder: "secret-chat",
|
||||
onChange: this.idChange, __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 90}} )
|
||||
, react.createElement('p', { className: "label-regular fw-bold" , __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 94}}, "Invites")
|
||||
onChange: this.idChange, __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 91}} )
|
||||
, react.createElement('p', { className: "label-regular fw-bold" , __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 95}}, "Invites")
|
||||
, react.createElement('input', {
|
||||
className: "body-large bn pa2 pl0 mb2 w-50" ,
|
||||
placeholder: "~zod, ~bus" ,
|
||||
onChange: this.invChange, __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 95}} )
|
||||
, react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$g, lineNumber: 99}} )
|
||||
onChange: this.invChange, __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 96}} )
|
||||
, react.createElement('br', {__self: this, __source: {fileName: _jsxFileName$g, lineNumber: 100}} )
|
||||
, react.createElement('button', {
|
||||
onClick: this.onClickCreate.bind(this),
|
||||
className: "body-large pointer underline bn" , __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 100}}, "-> Create" )
|
||||
className: "body-large pointer underline bn" , __self: this, __source: {fileName: _jsxFileName$g, lineNumber: 101}}, "-> Create" )
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -2206,17 +2206,38 @@
|
||||
|
||||
class ChatTile extends react_1 {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
configs: null,
|
||||
messages: null,
|
||||
message: null
|
||||
};
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
const { props, state } = this;
|
||||
if (prevProps !== props) {
|
||||
|
||||
// TODO: reducer logic :(
|
||||
|
||||
this.setState(props);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
console.log(this.state);
|
||||
return (
|
||||
react.createElement('div', { className: "bg-dark-gray w-100 h-100" , __self: this, __source: {fileName: _jsxFileName, lineNumber: 9}}
|
||||
react.createElement('div', { className: "bg-dark-gray w-100 h-100" , __self: this, __source: {fileName: _jsxFileName, lineNumber: 30}}
|
||||
, react.createElement('a', { className: "w-100 h-100 db" , style: {
|
||||
paddingTop: 68,
|
||||
paddingBottom: 68,
|
||||
paddingLeft: 64,
|
||||
paddingRight: 64
|
||||
},
|
||||
href: "/~chat", __self: this, __source: {fileName: _jsxFileName, lineNumber: 10}}
|
||||
, react.createElement('img', { src: "/~chat/img/Tile.png", width: 106, height: 98, __self: this, __source: {fileName: _jsxFileName, lineNumber: 17}} )
|
||||
href: "/~chat", __self: this, __source: {fileName: _jsxFileName, lineNumber: 31}}
|
||||
, react.createElement('img', { src: "/~chat/img/Tile.png", width: 106, height: 98, __self: this, __source: {fileName: _jsxFileName, lineNumber: 38}} )
|
||||
)
|
||||
)
|
||||
);
|
||||
|
@ -17,14 +17,14 @@
|
||||
::
|
||||
+$ diff
|
||||
$% [%hall-rumor rumor:hall]
|
||||
[%chat-initial streams]
|
||||
[%chat-update update]
|
||||
[%chat-config streams]
|
||||
[%json json]
|
||||
==
|
||||
::
|
||||
+$ poke
|
||||
$% [%hall-action action:hall]
|
||||
[%noun [@tas path]]
|
||||
[%noun [@tas path @t]]
|
||||
==
|
||||
::
|
||||
+$ state
|
||||
@ -81,61 +81,59 @@
|
||||
==
|
||||
==
|
||||
::
|
||||
++ parse-chat-command
|
||||
=, dejs:format
|
||||
=, dejs:hall-json
|
||||
%- of
|
||||
++ config-to-json
|
||||
|= str=streams
|
||||
=, enjs:format
|
||||
^- json
|
||||
%+ frond %chat
|
||||
%- pairs
|
||||
:~
|
||||
[%messages (ot circle+circ start+ni end+ni ~)]
|
||||
::
|
||||
[%inbox (conf:enjs:hall-json inbox.str)]
|
||||
::
|
||||
:- %configs
|
||||
%- pairs
|
||||
%+ turn ~(tap by configs.str)
|
||||
|= [cir=circle:hall con=(unit config:hall)]
|
||||
^- [@t json]
|
||||
:- (crip (circ:en-tape:hall-json cir))
|
||||
?~(con ~ (conf:enjs:hall-json u.con))
|
||||
::
|
||||
:- %circles :- %a
|
||||
%+ turn ~(tap in circles.str)
|
||||
|= nom=name:hall
|
||||
[%s nom]
|
||||
::
|
||||
:- %peers
|
||||
%- pairs
|
||||
%+ turn ~(tap by peers.str)
|
||||
|= [cir=circle:hall per=(set @p)]
|
||||
^- [@t json]
|
||||
:- (crip (circ:en-tape:hall-json cir))
|
||||
[%a (turn ~(tap in per) ship)]
|
||||
::
|
||||
==
|
||||
::
|
||||
+$ indices-internal-state
|
||||
$:
|
||||
lis=(list [circle:hall @])
|
||||
item=[cir=circle:hall count=@ud]
|
||||
index=@
|
||||
==
|
||||
++ numbers-to-json
|
||||
|= num=(list [circle:hall @ud])
|
||||
^- json
|
||||
=, enjs:format
|
||||
%+ frond %chat
|
||||
%- pairs
|
||||
:~
|
||||
::
|
||||
++ generate-circle-indices
|
||||
|= wir=wire
|
||||
^- (list [circle:hall @])
|
||||
=/ data
|
||||
%^ spin (swag [0 (lent wir)] wir) *indices-internal-state
|
||||
|= [a=@ta b=indices-internal-state]
|
||||
^- [* out=indices-internal-state]
|
||||
=/ switch (dvr index.b 3)
|
||||
?: =(q.switch 0) :: remainder 0, should be a ship
|
||||
?: =(index.b 0) :: if item is null, don't add to list
|
||||
:- 0
|
||||
%= b
|
||||
hos.cir.item (slav %p a)
|
||||
index +(index.b)
|
||||
:: %config
|
||||
:- %numbers
|
||||
:- %a
|
||||
%+ turn num
|
||||
|= [cir=circle:hall len=@ud]
|
||||
^- json
|
||||
%- pairs
|
||||
:~
|
||||
[%circle (circ:enjs:hall-json cir)]
|
||||
[%length (numb len)]
|
||||
==
|
||||
:: if item is not null, add to list
|
||||
:- 0
|
||||
%= b
|
||||
hos.cir.item (slav %p a)
|
||||
nom.cir.item *name:hall
|
||||
count.item 0
|
||||
lis (snoc lis.b item.b)
|
||||
index +(index.b)
|
||||
==
|
||||
?: =(q.switch 1) :: remainder 1, should be a circle name
|
||||
:- 0
|
||||
%= b
|
||||
nom.cir.item a
|
||||
index +(index.b)
|
||||
==
|
||||
?: =(q.switch 2) :: remainder 2, should be a number
|
||||
:- 0
|
||||
%= b
|
||||
count.item (need (rush a dem))
|
||||
index +(index.b)
|
||||
==
|
||||
!! :: impossible
|
||||
?: =(index.q.data 0)
|
||||
~
|
||||
(snoc lis.q.data item.q.data)
|
||||
::
|
||||
--
|
||||
::
|
||||
|
@ -1,56 +0,0 @@
|
||||
::
|
||||
::
|
||||
/? 309
|
||||
::
|
||||
/- hall
|
||||
/+ chat, hall-json
|
||||
::
|
||||
|_ str=streams:chat
|
||||
++ grow
|
||||
|%
|
||||
++ json
|
||||
=, enjs:format
|
||||
^- ^json
|
||||
%+ frond %initial
|
||||
%- pairs
|
||||
:~
|
||||
::
|
||||
[%inbox (conf:enjs:hall-json inbox.str)]
|
||||
::
|
||||
:- %configs
|
||||
%- pairs
|
||||
%+ turn ~(tap by configs.str)
|
||||
|= [cir=circle:hall con=(unit config:hall)]
|
||||
^- [@t ^json]
|
||||
:- (crip (circ:en-tape:hall-json cir))
|
||||
?~(con ~ (conf:enjs:hall-json u.con))
|
||||
::
|
||||
:- %messages
|
||||
%- pairs
|
||||
%+ turn ~(tap by messages.str)
|
||||
|= [cir=circle:hall lis=(list envelope:hall)]
|
||||
^- [@t ^json]
|
||||
:- (crip (circ:en-tape:hall-json cir))
|
||||
[%a (turn lis enve:enjs:hall-json)]
|
||||
::
|
||||
:- %circles :- %a
|
||||
%+ turn ~(tap in circles.str)
|
||||
|= nom=name:hall
|
||||
[%s nom]
|
||||
::
|
||||
:- %peers
|
||||
%- pairs
|
||||
%+ turn ~(tap by peers.str)
|
||||
|= [cir=circle:hall per=(set @p)]
|
||||
^- [@t ^json]
|
||||
:- (crip (circ:en-tape:hall-json cir))
|
||||
[%a (turn ~(tap in per) ship)]
|
||||
::
|
||||
==
|
||||
--
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun streams:chat
|
||||
--
|
||||
--
|
@ -15,7 +15,7 @@
|
||||
:: +card: output effect payload
|
||||
::
|
||||
+$ poke
|
||||
$% [%noun [@tas path]]
|
||||
$% [%noun [@tas path @t]]
|
||||
==
|
||||
::
|
||||
+$ card
|
||||
@ -41,7 +41,7 @@
|
||||
^- (quip move _this)
|
||||
=/ lismov/(list move) %+ weld
|
||||
`(list move)`[ost.bol %connect / [~ /'~clock'] %clock]~
|
||||
`(list move)`[ost.bol %poke /clock [our.bol %launch] [%noun [%clock /tile]]]~
|
||||
`(list move)`[ost.bol %poke /clock [our.bol %launch] [%noun [%clock /tile '/~clock/js/tile.js']]]~
|
||||
:- lismov
|
||||
this
|
||||
::
|
||||
|
@ -6,44 +6,17 @@ import classnames from 'classnames';
|
||||
import Header from '/components/header';
|
||||
import Tile from '/components/tile';
|
||||
|
||||
const loadExternalScript = (ext, callback) => {
|
||||
const script = document.createElement('script');
|
||||
script.src = '/~' + ext + '/tile.js';
|
||||
script.id = ext;
|
||||
document.body.appendChild(script);
|
||||
|
||||
script.onload = () => {
|
||||
console.log('callback');
|
||||
if (callback) callback();
|
||||
};
|
||||
};
|
||||
|
||||
export default class Home extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.loadedScripts = new Set();
|
||||
subscription.subscribe("/main");
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
let difference = new Set(
|
||||
[...this.props.keys]
|
||||
.filter(x => !prevProps.keys.has(x))
|
||||
);
|
||||
|
||||
difference.forEach((external) => {
|
||||
loadExternalScript(external, this.forceUpdate.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
let keys = [...this.props.keys];
|
||||
console.log(keys);
|
||||
let tileElems = keys.map((tile) => {
|
||||
console.log(tile);
|
||||
console.log(this.props.data[tile]);
|
||||
return (
|
||||
<Tile key={tile} type={tile} data={this.props.data[tile]} />
|
||||
);
|
||||
|
@ -11,7 +11,7 @@ export default class Tile extends Component {
|
||||
|
||||
render() {
|
||||
let SpecificTile = window[this.props.type + 'Tile'];
|
||||
console.log(this.props.type, this.props.data);
|
||||
|
||||
return (
|
||||
<div className="fl ma2 bg-white overflow-hidden"
|
||||
style={{ height: '234px', width: '234px' }}>
|
||||
|
@ -1,11 +1,8 @@
|
||||
|
||||
/+ *server, collections
|
||||
/= index
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
/: /===/app/launch/index
|
||||
/| /html/
|
||||
/~ ~
|
||||
==
|
||||
/^ $-(marl manx)
|
||||
/: /===/app/launch/index /!noun/
|
||||
/= script
|
||||
/^ octs
|
||||
/; as-octs:mimes:html
|
||||
@ -35,7 +32,7 @@
|
||||
[%diff %json json]
|
||||
==
|
||||
+$ tile [name=@tas subscribe=path]
|
||||
+$ tile-data (map @tas json)
|
||||
+$ tile-data (map @tas [jon=json url=@t])
|
||||
+$ state
|
||||
$% [%0 tiles=(set tile) data=tile-data path-to-tile=(map path @tas)]
|
||||
==
|
||||
@ -49,6 +46,7 @@
|
||||
++ prep
|
||||
|= old=(unit state)
|
||||
^- (quip move _this)
|
||||
~& 'launch prep'
|
||||
?~ old
|
||||
:_ this
|
||||
[ost.bol %connect / [~ /] %launch]~
|
||||
@ -60,33 +58,54 @@
|
||||
[~ this]
|
||||
::
|
||||
++ poke-noun
|
||||
|= [name=@tas subscribe=path]
|
||||
|= [name=@tas subscribe=path url=@t]
|
||||
^- (quip move _this)
|
||||
=/ beforedata (~(get by data.sta) name)
|
||||
=/ newdata
|
||||
?~ beforedata
|
||||
(~(put by data.sta) name [*json url])
|
||||
(~(put by data.sta) name [jon.u.beforedata url])
|
||||
:- [ost.bol %peer subscribe [our.bol name] subscribe]~
|
||||
%= this
|
||||
tiles.sta (~(put in tiles.sta) [name subscribe])
|
||||
data.sta (~(put by data.sta) name *json)
|
||||
data.sta newdata
|
||||
path-to-tile.sta (~(put by path-to-tile.sta) subscribe name)
|
||||
==
|
||||
::
|
||||
++ diff-json
|
||||
|= [pax=path jon=json]
|
||||
^- (quip move _this)
|
||||
=/ name/@tas (~(got by path-to-tile.sta) pax)
|
||||
=/ data/(unit [json url=@t]) (~(get by data.sta) name)
|
||||
?~ data
|
||||
[~ this]
|
||||
:-
|
||||
%+ turn (prey:pubsub:userlib /main bol)
|
||||
|= [=bone *]
|
||||
[bone %diff %json (frond:enjs:format name jon)]
|
||||
%= this
|
||||
data.sta (~(put by data.sta) name jon)
|
||||
data.sta (~(put by data.sta) name [jon url.u.data])
|
||||
==
|
||||
::
|
||||
++ peer-main
|
||||
|= [pax=path]
|
||||
^- (quip move _this)
|
||||
=/ data/json %- pairs:enjs:format ~(tap by data.sta)
|
||||
=/ data/json
|
||||
%- pairs:enjs:format
|
||||
%+ turn ~(tap by data.sta)
|
||||
|= [key=@tas [jon=json url=@t]]
|
||||
[key jon]
|
||||
:_ this
|
||||
[ost.bol %diff %json data]~
|
||||
::
|
||||
++ generate-script-marl
|
||||
|= data=tile-data
|
||||
^- marl
|
||||
%+ turn ~(tap by data)
|
||||
|= [key=@tas [jon=json url=@t]]
|
||||
^- manx
|
||||
;script@"{(trip url)}";
|
||||
::
|
||||
++ poke-handle-http-request
|
||||
%- (require-authorization:app ost.bol move this)
|
||||
|= =inbound-request:http-server
|
||||
@ -100,8 +119,9 @@
|
||||
i.back-path
|
||||
=/ site (flop site.request-line)
|
||||
?~ site
|
||||
=/ hym=manx (index (generate-script-marl data.sta))
|
||||
:_ this
|
||||
[ost.bol %http-response (html-response:app index)]~
|
||||
[ost.bol %http-response (manx-response:app hym)]~
|
||||
?+ site.request-line
|
||||
:_ this
|
||||
[ost.bol %http-response not-found:app]~
|
||||
|
18
apps/launch/urbit/app/launch/index.hoon
Normal file
18
apps/launch/urbit/app/launch/index.hoon
Normal file
@ -0,0 +1,18 @@
|
||||
|= scripts=marl
|
||||
;html
|
||||
;head
|
||||
;title: Home
|
||||
;meta(charset "utf-8");
|
||||
;meta
|
||||
=name "viewport"
|
||||
=content "width=device-width, initial-scale=1, shrink-to-fit=no";
|
||||
;link(rel "stylesheet", href "/~launch/css/index.css");
|
||||
==
|
||||
;body
|
||||
;div#root;
|
||||
;script@"/~/channel/channel.js";
|
||||
;script@"/~modulo/session.js";
|
||||
;* scripts
|
||||
;script@"/~launch/js/index.js";
|
||||
==
|
||||
==
|
@ -1,16 +0,0 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Home</title>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport"
|
||||
content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
|
||||
<link rel="stylesheet" href="/~launch/css/index.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="root" />
|
||||
<script src="/~/channel/channel.js"></script>
|
||||
<script src="/~modulo/session.js"></script>
|
||||
<script src="/~launch/js/index.js"></script>
|
||||
</body>
|
||||
</html>
|
@ -49126,7 +49126,7 @@
|
||||
|
||||
render() {
|
||||
let SpecificTile = window[this.props.type + 'Tile'];
|
||||
console.log(this.props.type, this.props.data);
|
||||
|
||||
return (
|
||||
react.createElement('div', { className: "fl ma2 bg-white overflow-hidden" ,
|
||||
style: { height: '234px', width: '234px' }, __self: this, __source: {fileName: _jsxFileName$2, lineNumber: 16}}
|
||||
@ -49141,53 +49141,26 @@
|
||||
}
|
||||
|
||||
const _jsxFileName$3 = "/Users/logan/Dev/interface/apps/launch/src/js/components/home.js";
|
||||
const loadExternalScript = (ext, callback) => {
|
||||
const script = document.createElement('script');
|
||||
script.src = '/~' + ext + '/tile.js';
|
||||
script.id = ext;
|
||||
document.body.appendChild(script);
|
||||
|
||||
script.onload = () => {
|
||||
console.log('callback');
|
||||
if (callback) callback();
|
||||
};
|
||||
};
|
||||
|
||||
class Home extends react_1 {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.loadedScripts = new Set();
|
||||
subscription.subscribe("/main");
|
||||
}
|
||||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
let difference = new Set(
|
||||
[...this.props.keys]
|
||||
.filter(x => !prevProps.keys.has(x))
|
||||
);
|
||||
|
||||
difference.forEach((external) => {
|
||||
loadExternalScript(external, this.forceUpdate.bind(this));
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
let keys = [...this.props.keys];
|
||||
console.log(keys);
|
||||
let tileElems = keys.map((tile) => {
|
||||
console.log(tile);
|
||||
console.log(this.props.data[tile]);
|
||||
return (
|
||||
react.createElement(Tile, { key: tile, type: tile, data: this.props.data[tile], __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 48}} )
|
||||
react.createElement(Tile, { key: tile, type: tile, data: this.props.data[tile], __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 21}} )
|
||||
);
|
||||
});
|
||||
|
||||
return (
|
||||
react.createElement('div', { className: "fl w-100 vh-100 bg-black center" , __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 53}}
|
||||
, react.createElement(Header, {__self: this, __source: {fileName: _jsxFileName$3, lineNumber: 54}} )
|
||||
, react.createElement('div', { className: "v-mid pa2 dtc" , __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 55}}
|
||||
react.createElement('div', { className: "fl w-100 vh-100 bg-black center" , __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 26}}
|
||||
, react.createElement(Header, {__self: this, __source: {fileName: _jsxFileName$3, lineNumber: 27}} )
|
||||
, react.createElement('div', { className: "v-mid pa2 dtc" , __self: this, __source: {fileName: _jsxFileName$3, lineNumber: 28}}
|
||||
, tileElems
|
||||
)
|
||||
)
|
||||
|
@ -18,7 +18,7 @@
|
||||
:: +card: output effect payload
|
||||
::
|
||||
+$ poke
|
||||
$% [%noun [@tas path]]
|
||||
$% [%noun [@tas path @t]]
|
||||
==
|
||||
::
|
||||
+$ card
|
||||
@ -46,7 +46,7 @@
|
||||
^- (quip move _this)
|
||||
=/ lismov/(list move) %+ weld
|
||||
`(list move)`[ost.bol %connect / [~ /'~timer'] %timer]~
|
||||
`(list move)`[ost.bol %poke /timer [our.bol %launch] [%noun [%timer /tile]]]~
|
||||
`(list move)`[ost.bol %poke /timer [our.bol %launch] [%noun [%timer /tile '/~timer/js/tile.js']]]~
|
||||
:- lismov
|
||||
?~ old
|
||||
this
|
||||
@ -71,7 +71,6 @@
|
||||
++ poke-json
|
||||
|= jon=json
|
||||
^- (quip move _this)
|
||||
~& jon
|
||||
?. ?=(%s -.jon)
|
||||
[~ this]
|
||||
=/ str/@t +.jon
|
||||
@ -100,13 +99,12 @@
|
||||
''
|
||||
i.back-path
|
||||
::
|
||||
~& site.request-line
|
||||
?+ site.request-line
|
||||
[[ost.bol %http-response not-found:app]~ this]
|
||||
::
|
||||
:: tile
|
||||
::
|
||||
[%'~timer' %tile ~]
|
||||
[%'~timer' %js %tile ~]
|
||||
[[ost.bol %http-response (js-response:app tile-js)]~ this]
|
||||
::
|
||||
:: images
|
||||
|
@ -26,7 +26,7 @@
|
||||
[%wait wire @da]
|
||||
==
|
||||
+$ poke
|
||||
$% [%noun [@tas path]]
|
||||
$% [%noun [@tas path @t]]
|
||||
==
|
||||
+$ state
|
||||
$% [%0 data=json time=@da location=@t timer=(unit @da)]
|
||||
@ -45,10 +45,11 @@
|
||||
++ prep
|
||||
|= old=(unit state)
|
||||
^- (quip move _this)
|
||||
=/ lismov/(list move) %+ weld
|
||||
`(list move)`[ost.bol %connect / [~ /'~weather'] %weather]~
|
||||
`(list move)`[ost.bol %poke /weather [our.bol %launch] [%noun [%weather /weathertile]]]~
|
||||
:- lismov
|
||||
:-
|
||||
:~
|
||||
[ost.bol %connect / [~ /'~weather'] %weather]
|
||||
[ost.bol %poke /weather [our.bol %launch] [%noun [%weather /weathertile '/~weather/js/tile.js']]]
|
||||
==
|
||||
?~ old
|
||||
this
|
||||
%= this
|
||||
|
Loading…
Reference in New Issue
Block a user