launch: finished the structure of the rewrite, supports tile hiding and tile reordering

This commit is contained in:
Logan Allen 2020-05-06 20:42:23 -04:00
parent f30b66055f
commit 9a008155c7
5 changed files with 144 additions and 58 deletions

View File

@ -94,7 +94,7 @@
~/ %chat-view-agent
|= [=wire =sign:agent:gall]
^- (quip card _this)
?+ -.sign (on-agent:def wire sign)
?+ -.sign (on-agent:def wire sign)
%kick
:_ this
[%pass / %agent [our.bol %chat-store] %watch /updates]~
@ -111,9 +111,8 @@
~/ %chat-view-arvo
|= [=wire =sign-arvo]
^- (quip card _this)
?. ?=(%bound +<.sign-arvo)
(on-arvo:def wire sign-arvo)
[~ this]
?: ?=(%bound +<.sign-arvo) [~ this]
(on-arvo:def wire sign-arvo)
::
++ on-save on-save:def
++ on-load

View File

@ -0,0 +1,14 @@
/- sur=launch
^?
=< [sur .]
=, sur
|%
++ enjs
=, enjs:format
|%
--
++ dejs
=, dejs:format
|%
--
--

View File

@ -1,6 +1,7 @@
/- launch
/+ *server, default-agent, dbug
/+ default-agent, dbug
|%
+$ card card:agent:gall
+$ versioned-state
$% [%0 *]
[%1 *]
@ -10,77 +11,140 @@
==
::
+$ state-zero
$: tiles=(map term tile:launch)
tile-ordering=(list term)
first-time=?
$: =tiles:launch
=tile-ordering:launch
==
::
+$ card card:agent:gall
++ launch-who
|= =desk
[%pass /who %arvo %e %serve [~ /who] desk /gen/who/hoon ~]
--
::
=| [%4 state-zero]
=* state -
%- agent:dbug
^- agent:gall
|_ bol=bowl:gall
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bol)
def ~(. (default-agent this %|) bowl)
::
++ on-init
^- (quip card _this)
:_ this(state *[%4 state-zero])
[(launch-who q.byk.bol)]~
=/ new-state *state-zero
=. new-state
%_ new-state
tiles
%- ~(gas by *tiles:launch)
%+ turn `(list term)`[%chat %publish %link %dojo %weather %clock ~]
|= =term
:- term
^- tile:launch
?+ term [[%custom ~] %.y]
%chat [[%basic 'Chat' '/~landscape/img/Chat.png' '/~chat'] %.y]
%links [[%basic 'Links' '/~landscape/img/Links.png' '/~link'] %.y]
%dojo [[%basic 'Dojo' '/~landscape/img/Dojo.png' '/~dojo'] %.y]
%publish
[[%basic 'Publish' '/~landscape/img/Publish.png' '/~publish'] %.y]
==
==
[~ this(state [%4 new-state])]
::
++ on-save !>(state)
::
++ on-load
|= old=vase
^- (quip card _this)
=/ old-state !<(versioned-state old)
?: ?=(%4 -.old-state)
[~ this(state old-state)]
:_ this
::%+ weld
:: []~ :: TODO: kill all subscriptions
:~ (launch-who q.byk.bol)
[%pass / %arvo %e %disconnect [~ /]]
==
=/ new-state *state-zero
=. new-state
%_ new-state
tiles
%- ~(gas by *tiles:launch)
%+ turn `(list term)`[%chat %publish %link %dojo %weather %clock ~]
|= =term
:- term
^- tile:launch
?+ term [[%custom ~] %.y]
%chat [[%basic 'Chat' '/~landscape/img/Chat.png' '/~chat'] %.y]
%links [[%basic 'Links' '/~landscape/img/Links.png' '/~link'] %.y]
%dojo [[%basic 'Dojo' '/~landscape/img/Dojo.png' '/~dojo'] %.y]
%publish
[[%basic 'Publish' '/~landscape/img/Publish.png' '/~publish'] %.y]
==
==
:_ this(state [%4 new-state])
:- [%pass / %arvo %e %disconnect [~ /]]
%+ turn ~(tap by wex.bowl)
|= [[=wire =ship =term] *]
^- card
[%pass wire %agent [ship term] %leave ~]
::
++ on-poke
|= [mar=mark vas=vase]
|= [=mark =vase]
^- (quip card _this)
?+ mar (on-poke:def mar vas)
%json
?> (team:title our.bol src.bol)
=/ jon !<(json vas)
:- ~
?. =(jon [%s 'disable welcome message'])
this
this(first-time %.n)
==
|^
=^ cards state
?+ mark (on-poke:def mark vase)
%launch-action (poke-action !<(action:launch vase))
==
[cards this]
::
++ poke-action
|= =action:launch
^- (quip card _state)
~& action
?- -.action
%add
?< (~(has by tiles) name.action)
:- (give [/all /keys ~] action)
%_ state
tiles (~(put by tiles) name.action tile.action)
tile-ordering (snoc tile-ordering name.action)
==
::
%remove
:- (give [/all /keys ~] action)
%_ state
tiles (~(del by tiles) name.action)
tile-ordering
%+ skip tile-ordering
|=(=term =(term name.action))
==
::
%change-order
?> =(~(key by tiles) (silt tile-ordering.action))
:- (give [/all]~ action)
state(tile-ordering tile-ordering.action)
::
%change-is-shown
=/ =tile:launch (~(got by tiles) name.action)
?. =(is-shown.tile is-shown.action) [~ state]
=. is-shown.tile is-shown.action
:- (give [/all]~ action)
state(tiles (~(put by tiles) name.action tile))
==
::
++ give
|= [paths=(list path) =update:launch]
^- (list card)
[%give %fact paths [%launch-update !>(update)]]~
--
::
++ on-watch
|= =path
^- (quip card _this)
(on-watch:def path)
|^
?> (team:title our.bowl src.bowl)
=/ cards=(list card)
?+ path (on-watch:def path)
[%all ~] (give [%initial tiles tile-ordering])
[%keys ~] (give [%keys ~(key by tiles)])
==
[cards this]
::
++ give
|= =update:launch
^- (list card)
[%give %fact ~ [%launch-update !>(update)]]~
--
::
:: |^
:: ?> (team:title our.bowl src.bowl)
:: =/ cards=(list card)
:: ?+ path (on-watch:def path)
:: [%keys ~] (give %chat-update !>([%keys ~(key by inbox)]))
:: [%all ~] (give %chat-initial !>(inbox))
:: ==
:: [cards this]
:: ::
:: ++ give
:: |= =cage
:: ^- (list card)
:: [%give %fact ~ cage]~
:: --
++ on-peek on-peek:def
::
++ on-arvo

View File

@ -99,11 +99,9 @@
::
++ on-init
^- (quip card _this)
=/ lac [%add %publish /publishtile '/~publish/tile.js']
=/ rav [%sing %t [%da now.bol] /app/publish/notebooks]
:_ this
:~ [%pass /bind %arvo %e %connect [~ /'~publish'] %publish]
[%pass /tile %agent [our.bol %launch] %poke %launch-action !>(lac)]
[%pass /read/paths %arvo %c %warp our.bol q.byk.bol `rav]
[%pass /permissions %agent [our.bol %permission-store] %watch /updates]
(invite-poke:main [%create /publish])

View File

@ -1,16 +1,27 @@
|%
+$ tiles (map term tile)
+$ tile-ordering (list term)
::
+$ tile
$% [%basic basic-tile]
$: type=tile-type
is-shown=?
==
::
+$ basic-tile
$: title=cord
icon-url=cord
linked-url=cord
+$ tile-type
$% [%basic title=cord icon-url=cord linked-url=cord]
[%custom ~]
==
::
+$ action
$% [%add name=@tas subscribe=path url=@t]
[%remove name=@tas subscribe=path]
$% [%add name=term =tile]
[%remove name=term]
[%change-order =tile-ordering]
[%change-is-shown name=term is-shown=?]
==
::
+$ update
$% [%initial =tiles =tile-ordering]
[%keys keys=(set term)]
action
==
--