diff --git a/pkg/arvo/app/neo.hoon b/pkg/arvo/app/neo.hoon index 0629d5f5da..83bb0ac87e 100644 --- a/pkg/arvo/app/neo.hoon +++ b/pkg/arvo/app/neo.hoon @@ -1560,7 +1560,9 @@ =. run (emit (do-card #/[p/our.bowl] %make %root ~ ~)) =. run - (emit (do-card #/[p/our.bowl]/sky %make %sky ~ ~)) + (emit (do-card #/[p/our.bowl]/notifications %make %notifications ~ ~)) + =. run + (emit (do-card #/[p/our.bowl]/sky %make %sky ~ (~(gas by *crew:neo) not/#/[p/our.bowl]/notifications ~))) =. run (emit (do-card #/[p/our.bowl]/srv/hawk %make %hawk-eyre ~ ~)) =. run diff --git a/pkg/arvo/neo/cod/std/src/imp/home.hoon b/pkg/arvo/neo/cod/std/src/imp/home.hoon index 7e582e45b1..3a6834eae7 100644 --- a/pkg/arvo/neo/cod/std/src/imp/home.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/home.hoon @@ -36,6 +36,7 @@ [#/[p/our.bowl]/home/files %make %folder ~ ~] [#/[p/our.bowl]/home/planner %make %planner ~ ~] [#/[p/our.bowl]/home/messenger %make %messenger ~ ~] + [#/[p/our.bowl]/home/notifications %make %notifications ~ ~] [#/[p/our.bowl]/home/landscape %make %iframe `iframe/!>('/apps/landscape') ~] :: [#/[p/our.bowl]/home/docs %make %folder `folder/!>([%introduction %tutorials %guides ~]) ~] diff --git a/pkg/arvo/neo/cod/std/src/imp/mast-sky-ui.hoon b/pkg/arvo/neo/cod/std/src/imp/mast-sky-ui.hoon index f59b8973e0..7097edb631 100644 --- a/pkg/arvo/neo/cod/std/src/imp/mast-sky-ui.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/mast-sky-ui.hoon @@ -1,6 +1,7 @@ /@ ui-event /@ txt /@ order +/@ notification /- serv=sky-server ^- kook:neo =< @@ -335,11 +336,78 @@ == == ++ notifications - ;div.fc.g2(slot "notifications") - ;div.p3.br1.bd1: first - ;div.p3.br1.bd1: second - ;div.p3.br1.bd1: third - == + :: ;div.fc.g2(slot "notifications") + :: ;div.p3.br1.bd1: first + :: ;div.p3.br1.bd1: second + :: ;div.p3.br1.bd1: third + :: == + (nots-to-manx nots) + :: + ++ flagged-not + :* flag=%.y + time=~2000.1.1 + src=#/[p/~bud]/home/messages/dms/[p/~fun] + dst=#/[p/~bud]/home/messages/dms/[p/~fun] + cord='Unread notification.' + == + :: + ++ unflagged-not + :* flag=%.n + time=~1969.12.31 + src=#/[p/~bud]/home/messages/dms/[p/~fun] + dst=#/[p/~bud]/home/messages/dms/[p/~fun] + cord='Read notification.' + == + :: + ++ nots + :~ flagged-not + flagged-not + unflagged-not + == + :: + ++ not-to-manx + |= not=notification + ^- manx + ;div.bd1.br2.p0.tl.ma.mt1 + ;div.fr.g1.p0.wf + ;div.p0(style "width: 30%") + ;img@"https://ewr1.vultrobjects.com/urbit/hastuc-dibtux/2024.4.30..2.37.9..bae1.47ae.147a.e147-IMG_5592.jpeg"(style "margin: 0px; object-fit: cover; border-radius: 6px;"); + == + ;div.p1(style "width: 70%") + ;div.fr.jb + ;div.s-1 + =title "{<(format-src src.not)>}" + ; ship/desk + == + ;div.s-1 + ; {} + == + == + ; {(trip cord.not)} + == + == + == + :: + ++ nots-to-manx + |= nots=(list notification) + ^- manx + ;div(slot "notifications") + ;* + %+ turn + nots + |= not=notification + ^- manx + (not-to-manx not) + == + ++ format-src + |= =pith + ^- path + ?. =(%p (head (head pith))) + (pout pith) + (pout (tail pith)) + :: + :: XX format time.not + :: ++ lift |= in=manx ^- manx diff --git a/pkg/arvo/neo/cod/std/src/imp/message-sub.hoon b/pkg/arvo/neo/cod/std/src/imp/message-sub.hoon index 94d64fd960..18165df172 100644 --- a/pkg/arvo/neo/cod/std/src/imp/message-sub.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/message-sub.hoon @@ -33,6 +33,7 @@ ?> =(%rely stud) :_ state =+ !<([=term =leaf:neo] vax) + :: :: only get new kids %+ murn ~(tap of:neo q:(~(got by deps.bowl) %pub)) |= [=pith:neo =idea:neo] diff --git a/pkg/arvo/neo/cod/std/src/imp/message.hoon b/pkg/arvo/neo/cod/std/src/imp/message.hoon index 4977bc62c0..da032a9b67 100644 --- a/pkg/arvo/neo/cod/std/src/imp/message.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/message.hoon @@ -1 +1,32 @@ -~ \ No newline at end of file +/@ message +^- kook:neo +|% +++ state [%pro %message] +++ poke (sy %sig ~) +++ kids *kids:neo +++ deps *deps:neo +++ form + ^- form:neo + |_ [=bowl:neo =aeon:neo =stud:neo state-vase=vase] + +* state !<(message state-vase) + ++ init + |= old=(unit pail:neo) + ^- (quip card:neo pail:neo) + ?~ old + ~| "No message contents for {}" + !! + =/ new-message + !<(message q:(need old)) + :_ [%message !>(new-message)] + ~ + :: ?: =(our.bowl from.new-message) + :: ~ + :: :~ :- #/[p/our.bowl]/notifications + :: [%poke [%notification !>([%.y now.bowl here.bowl here.bowl contents.new-message])]] + :: == + ++ poke + |= [=stud:neo vaz=vase] + ^- (quip card:neo pail:neo) + [~ [%message !>(state)]] + -- +-- \ No newline at end of file diff --git a/pkg/arvo/neo/cod/std/src/imp/notification.hoon b/pkg/arvo/neo/cod/std/src/imp/notification.hoon new file mode 100644 index 0000000000..74342ed218 --- /dev/null +++ b/pkg/arvo/neo/cod/std/src/imp/notification.hoon @@ -0,0 +1,33 @@ +/@ flag +/@ notification +^- kook:neo +|% +++ state + ^- curb:neo + [%pro %notification] +++ poke + ^- (set stud:neo) + (sy %flag ~) +++ kids + *kids:neo +++ deps + *deps:neo +++ form + ^- form:neo + |_ [=bowl:neo =aeon:neo =stud:neo state-vase=vase] + +* state !<(notification state-vase) + ++ init + |= old=(unit pail:neo) + ^- (quip card:neo pail:neo) + ?^ old + [~ u.old] + ~| "notification: no notification provided" + !! + ++ poke + |= [=stud:neo vaz=vase] + ^- (quip card:neo pail:neo) + ?> =(stud %flag) + ?> =(our.bowl ship.src.bowl) + [~ [%notification !>([!<(flag vaz) time.state src.state dst.state cord.state])]] + -- +-- diff --git a/pkg/arvo/neo/cod/std/src/imp/notifications-config.hoon b/pkg/arvo/neo/cod/std/src/imp/notifications-config.hoon new file mode 100644 index 0000000000..d1aac89ef2 --- /dev/null +++ b/pkg/arvo/neo/cod/std/src/imp/notifications-config.hoon @@ -0,0 +1,31 @@ +^- kook:neo +|% +++ state [%pro %sig] +++ poke (sy %sig ~) +++ kids + ^- kids:neo + %- some + :- %y + %- ~(gas by *lads:neo) + :~ :- [[%.y %buzz] [%.n %tas] %.y] + [[%pro %sig] ~] + :- [[%.y %mute] [%.n %tas] %.y] + [[%pro %sig] ~] + :- [[%.y %kill] [%.n %tas] %.y] + [[%pro %sig] ~] + == +++ deps + *deps:neo +++ form + ^- form:neo + |_ [=bowl:neo =aeon:neo =stud:neo state-vase=vase] + ++ init + |= old=(unit pail:neo) + ^- (quip card:neo pail:neo) + [~ [%sig !>(~)]] + ++ poke + |= [=stud:neo vaz=vase] + ^- (quip card:neo pail:neo) + [~ [%sig !>(~)]] + -- +-- \ No newline at end of file diff --git a/pkg/arvo/neo/cod/std/src/imp/notifications.hoon b/pkg/arvo/neo/cod/std/src/imp/notifications.hoon new file mode 100644 index 0000000000..7d3be3238b --- /dev/null +++ b/pkg/arvo/neo/cod/std/src/imp/notifications.hoon @@ -0,0 +1,104 @@ +/@ notification +/@ notifications-controller +^- kook:neo +=> +:: +:: helper core +|% +++ has-pith-in + |= [piths=(set pith) query=pith] + ^- ? + %- ~(any in piths) + |= =pith + ^- ? + =(query (scag (lent query) pith)) +-- +:: +:: main core +|% +++ state + ^- curb:neo + [%pro %notifications-controller] +:: +++ poke + ^- (set stud:neo) + (sy %notification ~) +:: +++ kids + ^- kids:neo + %- some + :- %z + %- ~(gas by *lads:neo) + :~ :- [[%.y %notification] [%.n %da] %.n] + [[%pro %notification] ~] + :- [[%.y %config] [%.n %tas] %.n] + [[%pro %sig] ~] + == +:: +++ deps + *deps:neo +:: +++ form + ^- form:neo + |_ [=bowl:neo =aeon:neo =stud:neo state-vase=vase] + +* state !<(notifications-controller state-vase) + ++ init + |= old=(unit pail:neo) + ^- (quip card:neo pail:neo) + ?^ old + [~ u.old] + :_ [%notifications-controller !>(|=(notification #/config/default))] + :~ :- (welp here.bowl ~[%config %default]) + [%make %notifications-config `[%sig !>(~)] ~] + == + :: + ++ poke + |= [=stud:neo vaz=vase] + ^- (quip card:neo pail:neo) + ?> =(ship.src.bowl our.bowl) + ?+ stud + !! + %notifications-controller + [~ [%notifications-controller vaz]] + :: + %notification + =/ not !<(notification vaz) + ?< =('' cord.not) + ?< (gth time.not now.bowl) + :: XX should cut head off path more intelligently + :: "if head is our.bowl, remove head" + ?> =(pith.src.bowl (tail src.not)) + ~& >> (state not) + ~& >> ~(tar of:neo kids.bowl) + ~& >> (~(get by ~(tar of:neo kids.bowl)) (state not)) + ~& >> (~(kids of:neo kids.bowl) #/config/default) + :: =/ config + :: !< notifications-config + :: q.pail:(need (~(get by ~(tar of:neo kids.bowl)) (state not))) + :: :_ [%notifications-controller !>(state)] + :: ?: (has-pith-in kill.config src.not) + :: ~ + :: ?: (has-pith-in mute.config src.not) + :: =. flag.not %.y + :: :~ :- (welp here.bowl ~[[da/now.bowl]]) + :: [%make %notification `[%notification !>(not)] ~] + :: == + :: ?: (has-pith-in buzz.config src.not) + :: =. flag.not %.y + :: :~ :- (welp here.bowl ~[[da/now.bowl]]) + :: [%make %notification `[%notification !>(not)] ~] + :: :: XX send push notifications to subscribers + :: == + :_ [%notifications-controller !>(state)] + ?. flag.not + =. flag.not %.y + :~ :- (welp here.bowl ~[[da/now.bowl]]) + [%make %notification `[%notification !>(not)] ~] + == + :~ :- (welp here.bowl ~[[da/now.bowl]]) + [%make %notification `[%notification !>(not)] ~] + :: XX send push notifications to subscribers + == + == + -- +-- diff --git a/pkg/arvo/neo/cod/std/src/imp/sky.hoon b/pkg/arvo/neo/cod/std/src/imp/sky.hoon index 7737aca0d8..035932e0b9 100644 --- a/pkg/arvo/neo/cod/std/src/imp/sky.hoon +++ b/pkg/arvo/neo/cod/std/src/imp/sky.hoon @@ -1,3 +1,6 @@ +/@ flag +/@ notification +/@ notifications-controller /- serv=sky-server /* feather /* s-k-y @@ -6,11 +9,20 @@ =< |% ++ state pro/%sig -++ poke (sy %gift %bind-static-assets ~) +++ poke (sy %gift %rely %bind-static-assets ~) ++ kids :+ ~ %z schema.serv -++ deps *deps:neo +++ deps + %- ~(gas by *deps:neo) + :~ :- %not + :+ req=| [pro/%notifications-controller (sy %notification %notifications-controller ~)] + :+ ~ %z + %- ~(gas by *lads:neo) + :~ :- [&/%notification |/%da |] + [pro/%notification (sy %flag ~)] + == + == ++ form ^- form:neo |_ [=bowl:neo =aeon:neo =pail:neo] @@ -20,6 +32,21 @@ ?+ stud ~|(bad-stud/stud !!) %gift [~ sig/!>(~)] + :: + %rely + :_ sig/!>(~) + %+ murn + ~(tap by ~(tar of:neo q:(~(got by deps.bowl) %not))) + |= [=pith:neo =idea:neo] + ^- (unit card:neo) + ?. =(%notification p.pail.idea) + ~ + =/ not !<(notification q.pail.idea) + ~& >> not + ~ + :: %- some + :: :- (welp here.bowl #/notification/[da/time.not]) + :: [%make %notification `pail.idea ~] :: %bind-static-assets :_ sig/!>(~) diff --git a/pkg/arvo/neo/cod/std/src/lib/sky-server.hoon b/pkg/arvo/neo/cod/std/src/lib/sky-server.hoon index 86246bf18d..79a4e1344c 100644 --- a/pkg/arvo/neo/cod/std/src/lib/sky-server.hoon +++ b/pkg/arvo/neo/cod/std/src/lib/sky-server.hoon @@ -35,6 +35,9 @@ :: /strategy/~zod/... = (list pith) :- [&/%strategy &] [pro/%order (sy %order ~)] :: + :: /notification/~2024.8.19..14.47.48..9228 = notification + :- [&/%notification |/%da |] [pro/%notification (sy %flag ~)] + :: == :: :: backend diff --git a/pkg/arvo/neo/cod/std/src/pro/flag.hoon b/pkg/arvo/neo/cod/std/src/pro/flag.hoon new file mode 100644 index 0000000000..0d42f2278a --- /dev/null +++ b/pkg/arvo/neo/cod/std/src/pro/flag.hoon @@ -0,0 +1 @@ +,? diff --git a/pkg/arvo/neo/cod/std/src/pro/json.hoon b/pkg/arvo/neo/cod/std/src/pro/json.hoon index 3c840093b7..977ecbe28a 100644 --- a/pkg/arvo/neo/cod/std/src/pro/json.hoon +++ b/pkg/arvo/neo/cod/std/src/pro/json.hoon @@ -1 +1 @@ -json +,json diff --git a/pkg/arvo/neo/cod/std/src/pro/notification.hoon b/pkg/arvo/neo/cod/std/src/pro/notification.hoon new file mode 100644 index 0000000000..b0a4cce80c --- /dev/null +++ b/pkg/arvo/neo/cod/std/src/pro/notification.hoon @@ -0,0 +1 @@ +,[=flag =time src=pith dst=pith =cord] diff --git a/pkg/arvo/neo/cod/std/src/pro/notifications-controller.hoon b/pkg/arvo/neo/cod/std/src/pro/notifications-controller.hoon new file mode 100644 index 0000000000..04be12a293 --- /dev/null +++ b/pkg/arvo/neo/cod/std/src/pro/notifications-controller.hoon @@ -0,0 +1,2 @@ +/@ notification +$-(notification pith) \ No newline at end of file