mirror of
https://github.com/urbit/shrub.git
synced 2024-12-25 04:52:06 +03:00
128 lines
2.6 KiB
Plaintext
128 lines
2.6 KiB
Plaintext
/- 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
|
|
:- %'changeIsShown'
|
|
%- pairs
|
|
:~ [%name s+name.upd]
|
|
[%'isShown' 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
|
|
%- pairs
|
|
:~ [%'linkedUrl' ?~(linked-url.type ~ s+u.linked-url.type)]
|
|
[%'image' ?~(image.type ~ s+u.image.type)]
|
|
==
|
|
==
|
|
::
|
|
++ 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 (ot [%'linkedUrl' (mu so)] [%'image' (mu so)] ~)]
|
|
==
|
|
::
|
|
++ basic
|
|
%- ot
|
|
:~ [%title so]
|
|
[%'iconUrl' so]
|
|
[%'linkedUrl' so]
|
|
==
|
|
--
|
|
--
|
|
--
|