From 5022994e8b26edcf9e258a591f0f46fe352e3104 Mon Sep 17 00:00:00 2001 From: bonbud-macryg Date: Fri, 27 Sep 2024 14:59:36 +0100 Subject: [PATCH 1/6] Draft mast circle ui --- .../neo/cod/std/src/imp/mast-circle-ui.hoon | 184 ++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 pkg/arvo/neo/cod/std/src/imp/mast-circle-ui.hoon diff --git a/pkg/arvo/neo/cod/std/src/imp/mast-circle-ui.hoon b/pkg/arvo/neo/cod/std/src/imp/mast-circle-ui.hoon new file mode 100644 index 0000000000..74d3e48820 --- /dev/null +++ b/pkg/arvo/neo/cod/std/src/imp/mast-circle-ui.hoon @@ -0,0 +1,184 @@ +/@ circle-diff +/@ circle +/@ ui-event +^- kook:neo +=< +|% +++ state pro/%manx +++ poke (sy %ui-event %rely ~) +++ kids *kids:neo +++ deps + ^- deps:neo + %- my + :~ :^ %src & [pro/%circle (sy %circle-diff ~)] + ~ + == +++ form + ^- form:neo + |_ [=bowl:neo =aeon:neo =pail:neo] + :: + ++ init + |= pal=(unit pail:neo) + ^- (quip card:neo pail:neo) + =/ =lore:neo + q:(~(got by deps.bowl) %src) + :- ~ + manx/!>((render (get-render-data lore) bowl)) + :: + ++ poke + |= [sud=stud:neo vaz=vase] + ^- (quip card:neo pail:neo) + ?+ sud ~|(bad-stud/sud !!) + :: + %ui-event + ~& >> "got ui-event!" + =/ eve !<(ui-event vaz) + =/ =lore:neo + q:(~(got by deps.bowl) %src) + =/ dat + (get-render-data lore) + ~& >> dat + ~& >> eve + :: ?> =(path.eve [%click %increment ~]) + :_ pail + ~ + :: :~ :- p:(~(got by deps.bowl) %src) + :: [%poke [%circle !>(+(dat))]] + :: == + :: + %rely + ~& >> "got rely!" + =/ =lore:neo + q:(~(got by deps.bowl) %src) + :- ~ + manx/!>((render (get-render-data lore) bowl)) + == + :: + -- +-- +:: +|% +:: ++$ render-data + $: =circle + =bowl:neo + == +++ get-render-data + |= =lore:neo + ^- circle + =/ data (get-vase-saga-by-pith lore ~) + ?~ data + !! + !<(circle (need data)) +:: +:: XX taken from another version of /lib/shrub-utils, +:: remove once that's merged +++ get-vase-saga-by-pith + |= [=lore:neo =pith:neo] + ^- (unit vase) + =/ idea=(unit idea:neo) (~(get of:neo lore) pith) + ?~ idea ~ + `q.q.saga:(need idea) +:: +++ render + |_ render-data + :: + ++ $ + ^- manx + ;html + ;head + ;meta(charset "utf-8"); + ;title: Circle + ;link + =href "/blue/blue-mime/{(scow %p our.bowl)}/static/feather" + =rel "stylesheet" + ; + == + ;link + =href "https://em-content.zobj.net/source/microsoft-teams/363/memo_1f4dd.png" + =rel "icon" + ; + == + ;script + ;+ ;/ + %- trip + ''' + function setLoading(idStr) { + let target = document.getElementById(idStr); + target.classList.add('htmx-request'); + }; + function setLoaded(idStr) { + let target = document.getElementById(idStr); + target.classList.remove('htmx-request'); + }; + ''' + == + == + ;+ body + == + :: + ++ body + ^- manx + ;body + ;div.p3 + ;main.p2.mw-page.ma + ;+ title + ;+ new-entry-form + ;+ friends-list + == + == + == + :: + ++ title + ^- manx + ;div.fr.jc.ac.prose + ;h1.tc.border.wfc.fr.jc.ac + =style + """ + width:100px; + height:100px; + border-radius:99% + """ + ; circle + == + == + :: + ++ new-entry-form + ^- manx + ;form.fr.jc.p3 + =onsubmit "document.getElementById('ship').value = '';" + ;input.border + =id "ship" + =type "text" + =autocomplete "off" + =placeholder "~sampel-palnet" + =oninput "this.setAttribute('value', this.value)" + ; + == + ;button.border.b1 + =type "submit" + ; add + == + == + :: + ++ friends-list + ^- manx + ;div.fc.g2 + ;* + %+ turn + %+ murn + ~(tap of:neo (~(del of:neo q:(~(got by deps.bowl) %src)) /)) + |= [=road:neo *] + ?. ?=([[%p ship=@] *] road) + ~ + `ship.road + |= =ship + ^- manx + ;div.border.p2.mono.fr.jb + ;div: {} + :: XX need to add logic for mast here + ;button.b1.border.hover.br1: x + == + == + -- +-- From 35edc3f55417d1253a2825c4b681c6e60e0da442 Mon Sep 17 00:00:00 2001 From: bonbud-macryg Date: Fri, 27 Sep 2024 15:18:26 +0100 Subject: [PATCH 2/6] Render kids of imp/circle --- pkg/arvo/neo/cod/std/src/imp/mast-circle-ui.hoon | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/arvo/neo/cod/std/src/imp/mast-circle-ui.hoon b/pkg/arvo/neo/cod/std/src/imp/mast-circle-ui.hoon index 74d3e48820..e415216add 100644 --- a/pkg/arvo/neo/cod/std/src/imp/mast-circle-ui.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/mast-circle-ui.hoon @@ -10,8 +10,13 @@ ++ deps ^- deps:neo %- my - :~ :^ %src & [pro/%circle (sy %circle-diff ~)] - ~ + :~ :^ %src + & + [pro/%circle (sy %circle-diff ~)] + :+ ~ %y + %- ~(gas by *lads:neo) + :~ [[|/%p |] pro/%sig ~] + == == ++ form ^- form:neo From 59e8da054eca66e8fd995b65ea0d3eab45ead4f0 Mon Sep 17 00:00:00 2001 From: bonbud-macryg Date: Mon, 30 Sep 2024 14:45:20 +0100 Subject: [PATCH 3/6] Fix delete from mast UI --- .../neo/cod/std/src/imp/mast-circle-ui.hoon | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/pkg/arvo/neo/cod/std/src/imp/mast-circle-ui.hoon b/pkg/arvo/neo/cod/std/src/imp/mast-circle-ui.hoon index e415216add..bd05ec679a 100644 --- a/pkg/arvo/neo/cod/std/src/imp/mast-circle-ui.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/mast-circle-ui.hoon @@ -33,8 +33,9 @@ ++ poke |= [sud=stud:neo vaz=vase] ^- (quip card:neo pail:neo) - ?+ sud ~|(bad-stud/sud !!) - :: + ?+ sud + ~_ leaf/"Bad stud {} at {<(pout here.bowl)>}" + !! %ui-event ~& >> "got ui-event!" =/ eve !<(ui-event vaz) @@ -44,12 +45,15 @@ (get-render-data lore) ~& >> dat ~& >> eve - :: ?> =(path.eve [%click %increment ~]) - :_ pail - ~ - :: :~ :- p:(~(got by deps.bowl) %src) - :: [%poke [%circle !>(+(dat))]] - :: == + ?+ path.eve + !! + [%click %delete @ ~] + =/ =ship (slav %p i.t.t.path.eve) + :_ pail + :~ :- p:(~(got by deps.bowl) %src) + [%poke [%circle-diff !>([%del (sy ship ~)])]] + == + == :: %rely ~& >> "got rely!" @@ -150,6 +154,7 @@ :: ++ new-entry-form ^- manx + :: XX add mast logic ;form.fr.jc.p3 =onsubmit "document.getElementById('ship').value = '';" ;input.border @@ -181,8 +186,11 @@ ^- manx ;div.border.p2.mono.fr.jb ;div: {} - :: XX need to add logic for mast here - ;button.b1.border.hover.br1: x + ;button.b1.border.hover.br1 + :: XX should show loading spinner on click + =event "/click/delete/{}" + ; x + == == == -- From ef1fc8fc740ea434e8d38bc6d097103e37d6e0a6 Mon Sep 17 00:00:00 2001 From: bonbud-macryg Date: Mon, 30 Sep 2024 15:00:16 +0100 Subject: [PATCH 4/6] Use %cull to delete ships --- pkg/arvo/neo/cod/std/src/imp/circle.hoon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/arvo/neo/cod/std/src/imp/circle.hoon b/pkg/arvo/neo/cod/std/src/imp/circle.hoon index baf6586b67..241b4a6d79 100644 --- a/pkg/arvo/neo/cod/std/src/imp/circle.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/circle.hoon @@ -39,7 +39,7 @@ %del %+ turn ~(tap in p.diff) |= =ship - [(snoc here.bowl p/ship) %tomb ~] + [(snoc here.bowl p/ship) %cull ~] == == -- From 422ce81e35482e6c026359d83ae480dfbee0d9a9 Mon Sep 17 00:00:00 2001 From: bonbud-macryg Date: Mon, 30 Sep 2024 15:34:16 +0100 Subject: [PATCH 5/6] Use +new-ship for all new ships --- pkg/arvo/neo/cod/std/src/imp/circle.hoon | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/arvo/neo/cod/std/src/imp/circle.hoon b/pkg/arvo/neo/cod/std/src/imp/circle.hoon index 241b4a6d79..caf062bcf3 100644 --- a/pkg/arvo/neo/cod/std/src/imp/circle.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/circle.hoon @@ -110,10 +110,7 @@ `ship.road |= =ship ^- manx - ;div.border.p2.mono.fr.jb - ;div: {} - ;button.b1.border.hover.br1: x - == + (new-ship ship) == ++ my-address (en-tape:pith:neo :(weld /hawk here.bowl)) From 3b29bc7fefc8d89a1113063844f7949714256630 Mon Sep 17 00:00:00 2001 From: bonbud-macryg Date: Mon, 30 Sep 2024 16:24:26 +0100 Subject: [PATCH 6/6] Remove stranded code reference to /hawk --- pkg/arvo/neo/cod/std/src/imp/circle.hoon | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkg/arvo/neo/cod/std/src/imp/circle.hoon b/pkg/arvo/neo/cod/std/src/imp/circle.hoon index caf062bcf3..c15dc3ffc5 100644 --- a/pkg/arvo/neo/cod/std/src/imp/circle.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/circle.hoon @@ -112,8 +112,6 @@ ^- manx (new-ship ship) == - ++ my-address - (en-tape:pith:neo :(weld /hawk here.bowl)) ++ form-new-ship |= here=pith ^- manx