mirror of
https://github.com/urbit/shrub.git
synced 2024-11-27 18:34:48 +03:00
+$ axal
This commit is contained in:
commit
7fbdecb6a5
@ -6,19 +6,60 @@
|
||||
^- tree-diff
|
||||
=/ pam (~(uni by pam:(parse-url:serv http-request)) (parse-form-body:serv http-request))
|
||||
=/ bod ~(. by pam)
|
||||
=<
|
||||
=/ head (@tas (got:bod 'head'))
|
||||
?+ head ~| [%unknown-head head] !!
|
||||
%send-poke
|
||||
=/ =path (stab (got:bod 'pith'))
|
||||
=/ =stud:neo !<(@tas (slap !>(~) (ream (got:bod 'stud'))))
|
||||
~& > got-bod-vase/(got:bod 'vase')
|
||||
::
|
||||
%send-make
|
||||
=/ =path
|
||||
%+ scan
|
||||
%+ welp
|
||||
%- trip (got:bod 'here')
|
||||
%- trip find-pith
|
||||
stap
|
||||
=/ =stud:neo bod-to-stud
|
||||
~& > got-bad-vase/(got:bod 'vase')
|
||||
?~ (rush (got:bod 'vase') vest)
|
||||
[head (pave:neo path) %vase-error !>(~)]
|
||||
=/ vax=vase (slap !>(.) (ream (got:bod 'vase')))
|
||||
[head (pave:neo path) stud vax]
|
||||
[head (pave:neo path) %vase-error [~ ~]]
|
||||
=/ vax=vase bod-to-vase
|
||||
~& vase/-.vax
|
||||
?. |(=(-:!>([*(unit pail:neo) *conf:neo]) -.vax) =(-:!>([~ ~]) -.vax))
|
||||
[head (pave:neo path) %vase-not-made [~ ~]]
|
||||
=/ tail-made !<([(unit pail:neo) conf:neo] vax)
|
||||
[head (pave:neo path) stud tail-made]
|
||||
::
|
||||
%send-poke
|
||||
=/ =pith:neo bod-to-pith
|
||||
=/ =stud:neo bod-to-stud
|
||||
~& > got-bad-vase/(got:bod 'vase')
|
||||
?~ (rush (got:bod 'vase') vest)
|
||||
[head pith %vase-error !>(~)]
|
||||
=/ vax=vase bod-to-vase
|
||||
[head pith stud vax]
|
||||
::
|
||||
%send-tomb
|
||||
~& >>> pith/(got:bod 'pith')
|
||||
=/ path (stab (got:bod 'pith'))
|
||||
[head (pave:neo path)]
|
||||
=/ =pith:neo bod-to-pith
|
||||
[head pith]
|
||||
==
|
||||
|%
|
||||
++ bod-to-pith
|
||||
^- pith:neo
|
||||
%- pave:neo
|
||||
%- stab find-pith
|
||||
::
|
||||
++ find-pith
|
||||
%- got:bod 'pith'
|
||||
::
|
||||
++ bod-to-vase
|
||||
^- vase
|
||||
%+ slap !>(.)
|
||||
%- ream (got:bod 'vase')
|
||||
::
|
||||
++ bod-to-stud
|
||||
^- stud:neo
|
||||
!< @tas
|
||||
%+ slap !>(~)
|
||||
%- ream (got:bod 'stud')
|
||||
::
|
||||
--
|
@ -47,9 +47,10 @@
|
||||
::
|
||||
++ make-chat
|
||||
=/ oninput
|
||||
"""
|
||||
this.setAttribute("value", this.value); this.nextElementSibling.nextElementSibling.setAttribute('hx-get', '/neo/hawk{(pith-tape here.bowl)}/dms/' + this.value); htmx.process(document.body);
|
||||
"""
|
||||
:: """
|
||||
:: this.setAttribute("value", this.value); this.nextElementSibling.nextElementSibling.setAttribute('hx-get', '/neo/hawk{(pith-tape here.bowl)}/dms/' + this.value); htmx.process(document.body);
|
||||
:: """
|
||||
(trip 'this.setAttribute("value", this.value); if (this.value.includes(" ~")){this.parentNode.setAttribute("head", "new-groupchat"); this.nextElementSibling.classList.remove("hidden");}else{this.parentNode.setAttribute("head", "new-dm"); this.nextElementSibling.classList.add("hidden");}')
|
||||
;form.fr.jc.g1.w70
|
||||
=hx-post "/neo/hawk{(pith-tape here.bowl)}?stud=messenger-diff"
|
||||
=head "new-dm"
|
||||
|
@ -44,10 +44,6 @@
|
||||
::
|
||||
%ack
|
||||
?~ !<((unit quit:neo) vase)
|
||||
=/ success-manx
|
||||
;div.p2
|
||||
;p: success
|
||||
==
|
||||
%: eyre-cards
|
||||
eyre-id
|
||||
bowl
|
||||
@ -88,6 +84,15 @@
|
||||
=/ diff !<(tree-diff vase)
|
||||
~& >>> diff-tree-imp/diff
|
||||
?- -.diff
|
||||
::
|
||||
%send-make
|
||||
:: =/ =pith:neo pith.diff
|
||||
:: =/ make-stud=stud:neo stud.diff
|
||||
:: =/ init=(unit pail:neo) init.diff
|
||||
:: =/ =conf:neo conf.diff
|
||||
:~
|
||||
[pith.diff %make stud.diff init.diff conf.diff]
|
||||
==
|
||||
::
|
||||
%send-poke
|
||||
=/ =pith:neo pith.diff
|
||||
@ -126,6 +131,7 @@
|
||||
empty-view
|
||||
==
|
||||
=/ here p.u.src
|
||||
~& >>> here/here
|
||||
^- (list card:neo)
|
||||
?+ method.request.req ~|(%unsupported-http-method !!)
|
||||
::
|
||||
@ -169,8 +175,42 @@
|
||||
=/ diff-vase
|
||||
(http-request [poke-stud `request:http`request.req])
|
||||
=/ diff-type !<(tree-diff diff-vase)
|
||||
=/ bol *bowl:neo
|
||||
=. here.bol here
|
||||
=. kids.bol q.u.src
|
||||
~& >> diff-type/diff-type
|
||||
?- -.diff-type
|
||||
::
|
||||
%send-make
|
||||
?: =(stud.diff-type %vase-error)
|
||||
%: eyre-cards
|
||||
eyre-id
|
||||
bowl
|
||||
200
|
||||
['content-type' 'text/html']~
|
||||
(err-manx ~)
|
||||
==
|
||||
?: =(stud.diff-type %vase-not-made)
|
||||
%: eyre-cards
|
||||
eyre-id
|
||||
bowl
|
||||
200
|
||||
['content-type' 'text/html']~
|
||||
(err-manx "failed to convert provided value to [=(unit pail:neo) =conf:neo] type")
|
||||
==
|
||||
:: make cards don't have %acks yet
|
||||
:: sending eyre response here for now
|
||||
%+ welp
|
||||
:~ (poke-tree-card here.bowl diff-vase)
|
||||
==
|
||||
%: eyre-cards
|
||||
eyre-id
|
||||
bowl
|
||||
200
|
||||
['content-type' 'text/html']~
|
||||
success-manx
|
||||
==
|
||||
::
|
||||
%send-poke
|
||||
?: =(stud.diff-type %vase-error)
|
||||
%: eyre-cards
|
||||
@ -182,13 +222,11 @@
|
||||
==
|
||||
:~ (poke-tree-card here.bowl diff-vase)
|
||||
==
|
||||
::
|
||||
%send-tomb
|
||||
=/ pax=pith:neo (tail (tail +.diff-type))
|
||||
=/ poke-card=(list card:neo) ~[(poke-tree-card here.bowl diff-vase)]
|
||||
=/ kids (kids-to-card pax q.u.src here.bowl here)
|
||||
=/ bol *bowl:neo
|
||||
=. here.bol here
|
||||
=. kids.bol q.u.src
|
||||
;: welp
|
||||
(flop kids)
|
||||
poke-card
|
||||
@ -271,7 +309,7 @@
|
||||
?~ tape "failed to parse entered value to hoon"
|
||||
tape
|
||||
^- manx
|
||||
;div.p2.error
|
||||
;div.wf.fr.js.p1.error
|
||||
;span: {msg}
|
||||
==
|
||||
::
|
||||
@ -282,6 +320,12 @@
|
||||
;p: deleted
|
||||
==
|
||||
::
|
||||
++ success-manx
|
||||
^- manx
|
||||
;div.p2
|
||||
;p: success
|
||||
==
|
||||
::
|
||||
++ view
|
||||
|= =bowl:neo
|
||||
;html
|
||||
@ -326,117 +370,75 @@
|
||||
.bd{
|
||||
border: 0.8px solid black;
|
||||
}
|
||||
.mt05{
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
.mr05{
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
.ml05{
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
.error{
|
||||
color: #FF0000;
|
||||
}
|
||||
.opened{
|
||||
background: black;
|
||||
color: white;
|
||||
}
|
||||
.bg-white{
|
||||
background: white;
|
||||
}
|
||||
.hover-gray:hover{
|
||||
background: #dbdbdb;
|
||||
}
|
||||
'''
|
||||
::
|
||||
++ body-view
|
||||
|= =bowl:neo
|
||||
;div.fc.js.p2.wf.p1
|
||||
;+ (kids-view bowl)
|
||||
==
|
||||
::
|
||||
++ kids-view
|
||||
|= =bowl:neo
|
||||
=/ first-kids=(list @t)
|
||||
:: TODO: if all kids
|
||||
:: only pith
|
||||
%+ turn
|
||||
::only short paths
|
||||
%+ sort
|
||||
%+ skim ~(tap of:neo kids.bowl)
|
||||
|= [=pith:neo *]
|
||||
~& kids-view/pith
|
||||
=(1 (lent pith))
|
||||
aor
|
||||
|= [=pith:neo *]
|
||||
%- crip "[{(en-tape:pith:neo pith)}]"
|
||||
=/ row-template=tape (join ' auto ' (weld "[first-row]" `tape`first-kids))
|
||||
;div
|
||||
=style "display: grid; grid-template-rows: {row-template}; grid-template-columns: auto; padding: 12px; margin:20px"
|
||||
;div.wf
|
||||
;+
|
||||
?~ node=(~(get of:neo kids.bowl) /)
|
||||
;div: no kids
|
||||
=/ =pail:neo q.saga.u.node
|
||||
;div
|
||||
=style
|
||||
"""
|
||||
grid-column-start: 1;
|
||||
grid-column-end: 2;
|
||||
grid-row-start: first-row;
|
||||
grid-row-end: first-row;
|
||||
padding: 8px;
|
||||
border: 2px solid black;
|
||||
border-radius: 6px;
|
||||
margin-top: 1rem;
|
||||
margin-right: 1rem;
|
||||
"""
|
||||
;p: {<p.pail>}
|
||||
;+ (state-print pail)
|
||||
;div.fc.js.p2.g2
|
||||
;+ (shrub-view bowl pail)
|
||||
;+ (kids-view bowl)
|
||||
==
|
||||
==
|
||||
::
|
||||
++ shrub-view
|
||||
|= [=bowl:neo =pail:neo]
|
||||
;div
|
||||
;div.fc.g2.bd.br2.p2
|
||||
;div.top.fr.jb
|
||||
;p.p2.hfc: {(en-tape:pith:neo here.bowl)}
|
||||
;+ buttons
|
||||
==
|
||||
;+ (state-print pail)
|
||||
;+ (forms bowl)
|
||||
==
|
||||
==
|
||||
++ kids-view
|
||||
|= =bowl:neo
|
||||
;div.fc.g2
|
||||
;*
|
||||
%+ turn
|
||||
%+ sort ~(tap of:neo kids.bowl)
|
||||
aor
|
||||
|= [=pith =idea:neo]
|
||||
|= [=pith:neo =idea:neo]
|
||||
^- manx
|
||||
?~ pith
|
||||
;div
|
||||
=style "visibility: hidden"
|
||||
nothing
|
||||
;div.hidden
|
||||
; nothing
|
||||
==
|
||||
~& > pith
|
||||
;div
|
||||
;h1: {(en-tape:pith:neo pith)}
|
||||
;a.fr.jb.g1.bd.br2.hover-gray
|
||||
=href "/neo/tree{(en-tape:pith:neo (welp here.bowl pith))}"
|
||||
;div.p2.hfc.p2.hover
|
||||
; {(en-tape:pith:neo pith)}
|
||||
==
|
||||
:: ;div.fc
|
||||
:: =style "grid-column-start: {(scow %ud +((lent pith)))}; grid-column-end: {(scow %ud (add 2 (lent pith)))}; grid-row-start: {(en-tape:pith:neo [-.pith ~])};grid-row-end: {(en-tape:pith:neo [-.pith ~])}; padding: 8px; border: 2px solid black; border-radius: 6px; margin-top: 1rem; margin-right: 1rem;"
|
||||
:: ;div.fc.p2
|
||||
:: ::;+ (forms bowl pith)
|
||||
:: ;div.top.fr.jb
|
||||
:: ;h3.p2.hfc.p2
|
||||
:: ; {(en-tape:pith:neo pith)}
|
||||
:: ==
|
||||
:: ;div.btn.fr.g4.p2.hover.pointer
|
||||
:: ;div.tomb.hidden
|
||||
:: ;div.loader.p2.bd.br2
|
||||
:: =onclick
|
||||
:: """
|
||||
:: $(this).parent().parent().parent().next().find('.tomb-form').toggleClass('hidden');
|
||||
:: $(this).parent().parent().parent().next().find('.poke-form').toggleClass('hidden');
|
||||
:: $(this).parent().toggleClass('hidden');
|
||||
:: """
|
||||
:: ;span.loaded: tomb
|
||||
:: ;span.loading: loading
|
||||
:: ==
|
||||
:: ==
|
||||
:: ;div.p2.bd.br2.hover.pointer
|
||||
:: =onclick
|
||||
:: """
|
||||
:: $(this).parent().parent().next().toggleClass('hidden');
|
||||
:: $(this).prev().toggleClass('hidden');
|
||||
:: $(this).parent().parent().parent().toggleClass('bd');
|
||||
:: $(this).parent().parent().parent().toggleClass('br2');
|
||||
:: """
|
||||
:: ;span: ***
|
||||
:: ==
|
||||
:: ==
|
||||
:: ==
|
||||
:: ;+ (forms bowl pith)
|
||||
:: ==
|
||||
:: ;div.state.p2
|
||||
:: =style "margin-top:auto;"
|
||||
:: ;+ (state-print q.saga.idea)
|
||||
:: ==
|
||||
:: ==
|
||||
;+ (preview-state q.saga.idea)
|
||||
==
|
||||
::
|
||||
++ forms
|
||||
|= [=bowl:neo =pith:neo]
|
||||
;div.hidden.forms
|
||||
;+ (poke-form bowl pith)
|
||||
;+ (tomb-form bowl pith)
|
||||
==
|
||||
::
|
||||
++ state-print
|
||||
@ -449,49 +451,121 @@
|
||||
(of-wall:format (~(win re (sell q.pail)) 0 80))
|
||||
==
|
||||
::
|
||||
++ tomb-form
|
||||
|= [=bowl:neo =pith:neo]
|
||||
=/ warning
|
||||
?~ ~(key by (~(kid of:neo kids.bowl) pith))
|
||||
"Are you sure you want to delete this shrub?"
|
||||
"Are you sure you want to delete this shrub and all their kids?"
|
||||
++ preview-state
|
||||
|= =pail:neo
|
||||
^- manx
|
||||
;form.tomb-form.p2.br2.bd.hidden
|
||||
=style "border: 2px solid #FF0000; border-radius: 6px;"
|
||||
=hx-post "/neo/tree{(en-tape:pith:neo here.bowl)}?stud=tree-diff&head=send-tomb"
|
||||
=hx-trigger "click from:find .tomb-trigger"
|
||||
:: FIX THIS
|
||||
:: =hx-target "previous .loader"
|
||||
:: =hx-swap "innerHTML"
|
||||
;div.fc.ac
|
||||
;p: {warning}
|
||||
;div.fr.js.p2
|
||||
;+ ;/
|
||||
=/ state-tape ~(ram re (sell q.pail))
|
||||
=/ length (lent state-tape)
|
||||
?: (gth length 140)
|
||||
(weld (oust [140 (sub length 140)] state-tape) "...")
|
||||
state-tape
|
||||
==
|
||||
;div.fr.ja.p2
|
||||
;button.tomb-trigger.hfc.p2.red-hover
|
||||
=onclick "$(this).parent().parent().parent().parent().parent().addClass('hidden');"
|
||||
=name "pith"
|
||||
=value (en-tape:pith:neo (welp here.bowl pith))
|
||||
;span: yes
|
||||
==
|
||||
;span.hfc.p2.red-hover.pointer
|
||||
::
|
||||
++ buttons
|
||||
;div.buttons.fr.g2
|
||||
;button.make.p2.bd.br2.bg-white
|
||||
=onclick
|
||||
"""
|
||||
$(this).parent().parent().addClass('hidden');
|
||||
$(this).parent().parent().parent().find('.poke-form').toggleClass('hidden');
|
||||
$(this).parent().parent().parent().prev().find('.btn').find('.tomb').toggleClass('hidden');
|
||||
$(this).toggleClass('toggled');
|
||||
$(this).parent().find('.poke').removeClass('toggled');
|
||||
$(this).parent().find('.tomb').removeClass('toggled');
|
||||
$(this).parent().parent().parent().find('.forms').find('.make-form').toggleClass('hidden');
|
||||
$(this).parent().parent().parent().find('.forms').find('.tomb-form').addClass('hidden');
|
||||
$(this).parent().parent().parent().find('.forms').find('.poke-form').addClass('hidden');
|
||||
"""
|
||||
;span: no
|
||||
;span: make
|
||||
==
|
||||
;button.poke.p2.bd.br2.bg-white
|
||||
=onclick
|
||||
"""
|
||||
$(this).toggleClass('toggled');
|
||||
$(this).parent().find('.make').removeClass('toggled');
|
||||
$(this).parent().find('.tomb').removeClass('toggled');
|
||||
$(this).parent().parent().parent().find('.forms').find('.poke-form').toggleClass('hidden');
|
||||
$(this).parent().parent().parent().find('.forms').find('.make-form').addClass('hidden');
|
||||
$(this).parent().parent().parent().find('.forms').find('.tomb-form').addClass('hidden');
|
||||
"""
|
||||
;span: poke
|
||||
==
|
||||
;button.tomb.p2.bd.br2.bg-white
|
||||
=onclick
|
||||
"""
|
||||
$(this).toggleClass('toggled');
|
||||
$(this).parent().find('.make').removeClass('toggled');
|
||||
$(this).parent().find('.poke').removeClass('toggled');
|
||||
$(this).parent().parent().parent().find('.forms').find('.tomb-form').toggleClass('hidden');
|
||||
$(this).parent().parent().parent().find('.forms').find('.make-form').addClass('hidden');
|
||||
$(this).parent().parent().parent().find('.forms').find('.poke-form').addClass('hidden');
|
||||
"""
|
||||
;span: tomb
|
||||
==
|
||||
==
|
||||
::
|
||||
++ forms
|
||||
|= =bowl:neo
|
||||
;div.forms.fc.ae.g2.wf.p1
|
||||
;+ (make-form bowl)
|
||||
;+ (poke-form bowl)
|
||||
;+ (tomb-form bowl)
|
||||
==
|
||||
::
|
||||
++ make-form
|
||||
|= =bowl:neo
|
||||
;form.make-form.hidden.bd.br2.fr.jb.g2.p2.wf.bg-white
|
||||
=hx-post "/neo/tree{(en-tape:pith:neo here.bowl)}?stud=tree-diff&head=send-make"
|
||||
=hx-swap "beforebegin"
|
||||
;input.hidden
|
||||
=type "text"
|
||||
=name "here"
|
||||
=value (en-tape:pith:neo here.bowl)
|
||||
;
|
||||
==
|
||||
;input.bd.br2.p2.ml05
|
||||
=type "text"
|
||||
=name "pith"
|
||||
=oninput "this.setAttribute('value', this.value);"
|
||||
=placeholder "/some/pith"
|
||||
=required ""
|
||||
;
|
||||
==
|
||||
;input.bd.br2.p2
|
||||
=type "text"
|
||||
=name "stud"
|
||||
=oninput "this.setAttribute('value', this.value);"
|
||||
=placeholder "%shrub-type"
|
||||
=required ""
|
||||
;
|
||||
==
|
||||
;input.bd.br2.p2.grow
|
||||
=type "text"
|
||||
=name "vase"
|
||||
=oninput "this.setAttribute('value', this.value);"
|
||||
=placeholder "[=(unit pail:neo) =conf:neo]"
|
||||
=required ""
|
||||
;
|
||||
==
|
||||
;button.bd.br2.p2.mr05.loader
|
||||
:: =onclick
|
||||
:: """
|
||||
:: $(this).parent().toggleClass('hidden');
|
||||
:: $(this).parent().next().toggleClass('bg-white');
|
||||
:: $(this).parent().next().find('.open').toggleClass('hidden');
|
||||
:: $(this).parent().next().find('.close').toggleClass('hidden');
|
||||
:: """
|
||||
;span.loaded: make
|
||||
;span.loading: loading
|
||||
==
|
||||
==
|
||||
::
|
||||
++ poke-form
|
||||
|= [=bowl:neo =pith:neo]
|
||||
|= =bowl:neo
|
||||
^- manx
|
||||
;form.poke-form.fr.jb.g2
|
||||
;form.poke-form.hidden.bd.br2.fr.jb.g2.p2.wf
|
||||
=hx-post "/neo/tree{(en-tape:pith:neo here.bowl)}?stud=tree-diff&head=send-poke"
|
||||
=hx-swap "beforebegin"
|
||||
;input.p2.bd.br2.grow
|
||||
;input.p2.bd.br2.ml05
|
||||
=type "text"
|
||||
=name "stud"
|
||||
=oninput "this.setAttribute('value', this.value);"
|
||||
@ -503,7 +577,7 @@
|
||||
;input.hidden
|
||||
=type "text"
|
||||
=name "pith"
|
||||
=value (en-tape:pith:neo (welp here.bowl pith))
|
||||
=value (en-tape:pith:neo here.bowl)
|
||||
;
|
||||
==
|
||||
;input.p2.bd.br2.grow
|
||||
@ -515,10 +589,45 @@
|
||||
=required ""
|
||||
;
|
||||
==
|
||||
;button.loader.bd.br2
|
||||
;button.loader.bd.br2.mr05
|
||||
;span.loaded: poke
|
||||
;span.loading: loading
|
||||
==
|
||||
==
|
||||
::
|
||||
++ tomb-form
|
||||
|= =bowl:neo
|
||||
=/ warning
|
||||
?~ ~(key by (~(kid of:neo kids.bowl) here.bowl))
|
||||
"Are you sure you want to delete this shrub?"
|
||||
"Are you sure you want to delete this shrub and all their kids?"
|
||||
^- manx
|
||||
;form.tomb-form.hidden.bd.br2.p2.wf
|
||||
=style "border: 2px solid #FF0000; border-radius: 6px;"
|
||||
=hx-post "/neo/tree{(en-tape:pith:neo here.bowl)}?stud=tree-diff&head=send-tomb"
|
||||
=hx-trigger "click from:find .tomb-trigger"
|
||||
:: FIX THIS
|
||||
:: =hx-target "previous .loader"
|
||||
:: =hx-swap "innerHTML"
|
||||
;div.fc.ac
|
||||
;p: {warning}
|
||||
==
|
||||
;div.fr.jc.g8.p2
|
||||
;button.tomb-trigger.hfc.p2.red-hover
|
||||
:: =onclick "$(this).parent().parent().parent().parent().parent().addClass('hidden');"
|
||||
=name "pith"
|
||||
=value (en-tape:pith:neo here.bowl)
|
||||
;span: yes
|
||||
==
|
||||
;span.hfc.p2.red-hover.pointer
|
||||
=onclick
|
||||
"""
|
||||
$(this).parent().parent().addClass('hidden');
|
||||
$(this).parent().parent().parent().parent().find('.top').find('.buttons').find('.tomb').toggleClass('toggled');
|
||||
"""
|
||||
;span: no
|
||||
==
|
||||
==
|
||||
==
|
||||
::
|
||||
--
|
@ -1,4 +1,5 @@
|
||||
$%
|
||||
[%send-make =pith:neo =stud:neo init=(unit pail:neo) =conf:neo]
|
||||
[%send-poke =pith:neo =stud:neo =vase]
|
||||
[%send-tomb =pith:neo]
|
||||
==
|
Loading…
Reference in New Issue
Block a user