mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 06:35:32 +03:00
123 lines
2.4 KiB
Plaintext
123 lines
2.4 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 ~)
|
|
==
|
|
::
|
|
++ 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]
|
|
==
|
|
--
|
|
--
|
|
--
|