mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-10 10:05:09 +03:00
launch: added json marks
This commit is contained in:
parent
8d48b78cba
commit
0c2b770411
@ -1,14 +0,0 @@
|
||||
/- sur=launch
|
||||
^?
|
||||
=< [sur .]
|
||||
=, sur
|
||||
|%
|
||||
++ enjs
|
||||
=, enjs:format
|
||||
|%
|
||||
--
|
||||
++ dejs
|
||||
=, dejs:format
|
||||
|%
|
||||
--
|
||||
--
|
@ -1,5 +1,4 @@
|
||||
/- launch
|
||||
/+ default-agent, dbug
|
||||
/+ store=launch-store, default-agent, dbug
|
||||
|%
|
||||
+$ card card:agent:gall
|
||||
+$ versioned-state
|
||||
@ -11,8 +10,9 @@
|
||||
==
|
||||
::
|
||||
+$ state-zero
|
||||
$: =tiles:launch
|
||||
=tile-ordering:launch
|
||||
$: =tiles:store
|
||||
=tile-ordering:store
|
||||
first-time=?
|
||||
==
|
||||
--
|
||||
::
|
||||
@ -30,11 +30,11 @@
|
||||
=. new-state
|
||||
%_ new-state
|
||||
tiles
|
||||
%- ~(gas by *tiles:launch)
|
||||
%- ~(gas by *tiles:store)
|
||||
%+ turn `(list term)`[%chat %publish %link %dojo %weather %clock ~]
|
||||
|= =term
|
||||
:- term
|
||||
^- tile:launch
|
||||
^- tile:store
|
||||
?+ term [[%custom ~] %.y]
|
||||
%chat [[%basic 'Chat' '/~landscape/img/Chat.png' '/~chat'] %.y]
|
||||
%links [[%basic 'Links' '/~landscape/img/Links.png' '/~link'] %.y]
|
||||
@ -56,11 +56,11 @@
|
||||
=. new-state
|
||||
%_ new-state
|
||||
tiles
|
||||
%- ~(gas by *tiles:launch)
|
||||
%- ~(gas by *tiles:store)
|
||||
%+ turn `(list term)`[%chat %publish %link %dojo %weather %clock ~]
|
||||
|= =term
|
||||
:- term
|
||||
^- tile:launch
|
||||
^- tile:store
|
||||
?+ term [[%custom ~] %.y]
|
||||
%chat [[%basic 'Chat' '/~landscape/img/Chat.png' '/~chat'] %.y]
|
||||
%links [[%basic 'Links' '/~landscape/img/Links.png' '/~link'] %.y]
|
||||
@ -82,12 +82,12 @@
|
||||
|^
|
||||
=^ cards state
|
||||
?+ mark (on-poke:def mark vase)
|
||||
%launch-action (poke-action !<(action:launch vase))
|
||||
%launch-action (poke-action !<(action:store vase))
|
||||
==
|
||||
[cards this]
|
||||
::
|
||||
++ poke-action
|
||||
|= =action:launch
|
||||
|= =action:store
|
||||
^- (quip card _state)
|
||||
~& action
|
||||
?- -.action
|
||||
@ -114,15 +114,19 @@
|
||||
state(tile-ordering tile-ordering.action)
|
||||
::
|
||||
%change-is-shown
|
||||
=/ =tile:launch (~(got by tiles) name.action)
|
||||
=/ =tile:store (~(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))
|
||||
::
|
||||
%change-first-time
|
||||
:- (give [/all]~ action)
|
||||
state(first-time first-time.action)
|
||||
==
|
||||
::
|
||||
++ give
|
||||
|= [paths=(list path) =update:launch]
|
||||
|= [paths=(list path) =update:store]
|
||||
^- (list card)
|
||||
[%give %fact paths [%launch-update !>(update)]]~
|
||||
--
|
||||
@ -133,19 +137,24 @@
|
||||
|^
|
||||
?> (team:title our.bowl src.bowl)
|
||||
=/ cards=(list card)
|
||||
?+ path (on-watch:def path)
|
||||
[%all ~] (give [%initial tiles tile-ordering])
|
||||
?+ path (on-watch:def path)
|
||||
[%all ~] (give [%initial tiles tile-ordering first-time])
|
||||
[%keys ~] (give [%keys ~(key by tiles)])
|
||||
==
|
||||
[cards this]
|
||||
::
|
||||
++ give
|
||||
|= =update:launch
|
||||
|= =update:store
|
||||
^- (list card)
|
||||
[%give %fact ~ [%launch-update !>(update)]]~
|
||||
--
|
||||
::
|
||||
++ on-peek on-peek:def
|
||||
++ on-peek
|
||||
|= =path
|
||||
^- (unit (unit cage))
|
||||
?+ path (on-peek:def path)
|
||||
[%x %keys ~] ``noun+!>(~(key by tiles))
|
||||
==
|
||||
::
|
||||
++ on-arvo
|
||||
|= [wir=wire sin=sign-arvo]
|
||||
|
122
pkg/arvo/lib/launch-store.hoon
Normal file
122
pkg/arvo/lib/launch-store.hoon
Normal file
@ -0,0 +1,122 @@
|
||||
/- sur=launch-store
|
||||
^?
|
||||
=< [sur .]
|
||||
=, sur
|
||||
|%
|
||||
++ enjs
|
||||
=, enjs:format
|
||||
|%
|
||||
++ update
|
||||
|= upd=^update
|
||||
^- json
|
||||
|^ (frond %launch-update (pairs ~[(encode upd)]))
|
||||
::
|
||||
++ encode
|
||||
|= upd=^update
|
||||
^- [cord json]
|
||||
?- -.upd
|
||||
%add
|
||||
:- %add
|
||||
%- pairs
|
||||
:~ [%name s+name.upd]
|
||||
[%tile (tile tile.upd)]
|
||||
==
|
||||
::
|
||||
%remove [%remove s+name.upd]
|
||||
%change-order [%'changeOrder' (terms tile-ordering.upd)]
|
||||
%change-first-time [%'changeFirstTime' b+first-time.upd]
|
||||
%change-is-shown
|
||||
:- %change-is-shown
|
||||
%- pairs
|
||||
:~ [%name s+name.upd]
|
||||
[%is-shown b+is-shown.upd]
|
||||
==
|
||||
::
|
||||
%initial
|
||||
:- %initial
|
||||
%- pairs
|
||||
:~ [%tiles (tiles tiles.upd)]
|
||||
[%'tileOrdering' (terms tile-ordering.upd)]
|
||||
[%'firstTime' b+first-time.upd]
|
||||
==
|
||||
::
|
||||
%keys [%keys (terms ~(tap in keys.upd))]
|
||||
==
|
||||
::
|
||||
++ tile
|
||||
|= =^tile
|
||||
^- json
|
||||
%- pairs
|
||||
:~ [%type (tile-type type.tile)]
|
||||
[%'isShown' b+is-shown.tile]
|
||||
==
|
||||
::
|
||||
++ tiles
|
||||
|= =^tiles
|
||||
^- json
|
||||
%- pairs
|
||||
%+ turn ~(tap by tiles)
|
||||
|= [=term til=^tile]
|
||||
[term (tile til)]
|
||||
::
|
||||
++ tile-type
|
||||
|= type=^tile-type
|
||||
^- json
|
||||
?- -.type
|
||||
%basic
|
||||
%+ frond %basic
|
||||
%- pairs
|
||||
:~ [%title s+title.type]
|
||||
[%'iconUrl' s+icon-url.type]
|
||||
[%'linkedUrl' s+linked-url.type]
|
||||
==
|
||||
::
|
||||
%custom (frond %custom ~)
|
||||
==
|
||||
::
|
||||
++ terms
|
||||
|= terms=(list term)
|
||||
^- json
|
||||
[%a (turn terms |=(=term s+term))]
|
||||
--
|
||||
--
|
||||
::
|
||||
++ dejs
|
||||
=, dejs:format
|
||||
|%
|
||||
++ action
|
||||
|= =json
|
||||
^- ^action
|
||||
|^ (decode json)
|
||||
++ decode
|
||||
%- of
|
||||
:~ [%add (ot [[%name (su sym)] [%tile tile] ~])]
|
||||
[%remove (su sym)]
|
||||
[%change-order (ar (su sym))]
|
||||
[%change-first-time bo]
|
||||
[%change-is-shown (ot [[%name (su sym)] [%'isShown' bo] ~])]
|
||||
==
|
||||
--
|
||||
::
|
||||
++ tile
|
||||
|^
|
||||
%- ot
|
||||
:~ [%type tile-type]
|
||||
[%'isShown' bo]
|
||||
==
|
||||
::
|
||||
++ tile-type
|
||||
%- of
|
||||
:~ [%basic basic]
|
||||
[%custom ul]
|
||||
==
|
||||
::
|
||||
++ basic
|
||||
%- ot
|
||||
:~ [%title so]
|
||||
[%'iconUrl' so]
|
||||
[%'linkedUrl' so]
|
||||
==
|
||||
--
|
||||
--
|
||||
--
|
@ -1,9 +1,10 @@
|
||||
/- launch
|
||||
/+ *launch-store
|
||||
::
|
||||
|_ act=action:launch
|
||||
|_ act=action
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun action:launch
|
||||
++ noun action
|
||||
++ json dejs:action
|
||||
--
|
||||
--
|
||||
|
13
pkg/arvo/mar/launch/update.hoon
Normal file
13
pkg/arvo/mar/launch/update.hoon
Normal file
@ -0,0 +1,13 @@
|
||||
/+ *launch-store
|
||||
|_ upd=update
|
||||
++ grow
|
||||
|%
|
||||
++ json (update:enjs upd)
|
||||
--
|
||||
::
|
||||
++ grab
|
||||
|%
|
||||
++ noun update
|
||||
--
|
||||
::
|
||||
--
|
@ -16,11 +16,12 @@
|
||||
$% [%add name=term =tile]
|
||||
[%remove name=term]
|
||||
[%change-order =tile-ordering]
|
||||
[%change-first-time first-time=?]
|
||||
[%change-is-shown name=term is-shown=?]
|
||||
==
|
||||
::
|
||||
+$ update
|
||||
$% [%initial =tiles =tile-ordering]
|
||||
$% [%initial =tiles =tile-ordering first-time=?]
|
||||
[%keys keys=(set term)]
|
||||
action
|
||||
==
|
Loading…
Reference in New Issue
Block a user