messenger UI

This commit is contained in:
SuperCoolYun 2024-06-10 19:14:00 -04:00
parent b3376cb10f
commit d217f1f8aa
5 changed files with 256 additions and 9 deletions

View File

@ -7,7 +7,7 @@
^- manx ^- manx
;div.p2 ;div.p2
=label "Chat" =label "Chat"
;div.ma.fc.g2 ;div.ma.fc.g2
=style "max-width: 650px;" =style "max-width: 650px;"
;div.fc.g2 ;div.fc.g2
=id "children" =id "children"

View File

@ -1,10 +1,212 @@
/@ message
/@ groupchat /@ groupchat
/@ ship
/- feather-icons /- feather-icons
/- messages /- messages
:- [%sig %$ %htmx] :- [%sig %$ %htmx]
|= =groupchat |= ~
|= =bowl:neo |= =bowl:neo
|^
view
::
++ view
^- manx ^- manx
;div.p2 ;div.p2.fc.ac.view.g1
== ;style: {style}
;+ create-groupchat
;+ new-dm
;+ all-chats
==
::
++ pith-tape
|= =pith
^- tape
(en-tape:pith:neo pith)
::
++ style
^~
%- trip
'''
.view {
max-width: 650px;
padding-bottom: 50vh;
padding-top: 30px;
}
input[type="text"]:hover {
cursor: text;
}
input:focus {
outline: none;
}
.w70{
width: 70%;
}
'''
::
:: depending if value in input has space and more
++ create-groupchat
=/ pt (pith-tape here.bowl)
::
^- manx
;form.fr.jc.g1.createchat.w70
::=hx-sync "closest div:queue last"
=hx-post "/neo/hawk{pt}?stud=messenger-diff"
=head "new-groupchat"
=hx-target "find button .loading"
=hx-swap "outerHTML"
;input.grow.border.p2.br1.grow
=id "name-input"
=name "name"
=type "text"
=required ""
=placeholder "new groupchat"
=oninput "this.setAttribute('value', this.value);"
=autocomplete "off"
;
==
;button.loader.br1.hover.p2.b0.border
;span.loaded: create
;span.loading
;+ loading.feather-icons
==
:: ==
==
==
::
++ new-dm
;form.fr.jc.g1.w70
=hx-post "/neo/hawk{(pith-tape here.bowl)}?stud=messenger-diff"
=head "new-dm"
=hx-target "find button .loading"
=hx-swap "outerHTML"
;input.grow.border.p2.br1
=name "partner"
=type "text"
=required ""
=placeholder "~zod"
=oninput "this.setAttribute('value', this.value);"
=autocomplete "off"
;
==
;button.loader.br1.hover.p2.b0.border
;span.loaded; start dm
;span.loading
;+ loading.feather-icons
==
==
==
::
++ all-chats
=/ kids
%+ skid ~(tap of:neo kids.bowl)
|= [=pith =idea:neo]
=(p.pail.idea %groupchat)
^- manx
;div.fc.as.g1.w70
;div.fc.ac.g2.wf
;* %+ turn q.kids
|= [=pith =idea:neo]
?~ pith
;span.hidden: no dms
?: (lte 3 (lent pith))
;h1.hidden: {<pith>}
;a.br1.hover.b0.fr.jb.wf.border
=href "/neo/hawk{(pith-tape here.bowl)}{(pith-tape pith)}"
=hx-swap "innerHTML"
;h3.s-1.p2: {(scow %tas ;;(@tas -.pith))}
;h3.s-1.p2: {<+:;;([%p @p] (rear pith))>}
==
==
;div.fc.ac.g2.wf
;* %+ turn p.kids
|= [=pith =idea:neo]
?~ pith ;span.hidden: no groupchats
(chat pith idea)
==
==
::
++ chat
|= [=pith =idea:neo]
=/ org=@p +:;;([%p @p] (snag 1 `(list iota)`pith))
=/ members=(list ship) ~(tap in members:!<(groupchat q.pail.idea))
=/ chat +:;;([%t @t] (rear pith))
~& > ['members' members]
^- manx
;div.wf.br1.fc.g1
;div.fr.g1
;a.br1.hover.fr.jb.g2.wf.border.b0
=href "/neo/hawk{(pith-tape here.bowl)}{(pith-tape pith)}"
=hx-swap "innerHTML"
;h3.s-1.p2: {(trip chat)}
;h3.s-1.p2: {<org>}
==
;button.br1.hover.border.b0
=onclick (trip 'this.parentNode.nextElementSibling.classList.toggle("hidden"); this.parentNode.parentNode.classList.toggle("border"); this.parentNode.parentNode.classList.toggle("p2"); this.previousSibling.classList.toggle("border"); this.classList.toggle("border"); if (this.parentNode.nextElementSibling.classList.contains("hidden")){this.innerHTML="<span>V</span>"} else {this.innerHTML="<span>^</span>"}')
;span: V
==
==
;div.fc.g2.hidden
;div.fc.g2
;div.fr.je.g2
;+ ?. =(our.bowl org)
;span.hidden: ~
;button.hover.br1.b0.border
=onclick (trip 'this.parentNode.nextElementSibling.classList.toggle("hidden"); if (this.parentNode.nextElementSibling.classList.contains("hidden")){this.innerHTML="<span>+</span>"} else {this.innerHTML="<span>x</span>"}')
;span: +
==
==
;+ (add-member chat)
==
;* %+ turn `(list ship)`members
|= =ship
?: =(our.bowl ship)
;div.fr.jb.g1
;span.wf.br1.p2: {<ship>}
==
;div.fr.jb.g1
;span.wf.br1.p1: {<ship>}
;button.hover.b0.br1.loader.border
=hx-post "/neo/hawk{(pith-tape here.bowl)}?stud=groupchat-diff"
=hx-target "find .loading"
=hx-swap "outerHTML"
=head "remove"
=ship (scow %p ship)
=hx-on--after-request "this.parentNode.remove();"
=onmouseover "this.previousSibling.classList.add('b1');"
=onmouseout "this.previousSibling.classList.remove('b1');"
;span.loaded: x
;span.loading
;+ loading.feather-icons
==
==
==
==
==
++ add-member
|= chat=cord
;form.fr.gb.g1.hidden
=hx-post "/neo/hawk{(pith-tape here.bowl)}?stud=messenger-diff"
=head "invite-to-groupchat"
=hx-target "find button .loading"
=hx-swap "outerHTML"
;input.hidden
=type "text"
=name "name"
=value (trip chat)
;
==
;input.grow.border.p2.br1
=name "ship"
=type "text"
=placeholder "~zod, ~bus"
=oninput "this.setAttribute('value', this.value);"
=autocomplete "off"
;
==
;button.loader.hover.br1.b0.border
;span.loaded: +
;span.loading
;+ loading.feather-icons
==
==
==
--

View File

@ -0,0 +1,17 @@
/@ node
/@ groupchat-diff
/- manx-utils
:- [%node %$ %groupchat-diff]
|= nod=node
^- groupchat-diff
=/ mu ~(. manx-utils nod)
=/ head (@tas (got:mu %head))
~& >>> head
%- groupchat-diff
?+ head
~| [%unknown-head head]
!!
%remove
=/ =ship `@p`(slav %p (got:mu %pith))
[head ship]
==

View File

@ -0,0 +1,28 @@
/@ node
/@ messenger-diff
/- manx-utils
:- [%node %$ %messenger-diff]
|= nod=node
^- messenger-diff
=/ mu ~(. manx-utils nod)
=/ head (@tas (got:mu %head))
~& >>> head
%- messenger-diff
?+ head
~| [%unknown-head head]
!!
%new-dm
=/ partner `@p`(slav %p (vol:mu "partner"))
[head partner]
::
%new-groupchat
=/ name (vol:mu "name")
[head name]
::
%invite-to-groupchat
~& > (vol:mu "name")
=/ name (vol:mu "name")
=/ ship `@p`(slav %p (vol:mu "ship"))
~& >>> [head name ship]
[head name ship]
==

View File

@ -7,7 +7,7 @@
++ render-messages ++ render-messages
|= =bowl:neo |= =bowl:neo
^- manx ^- manx
;div ;div.fc.g2
=label "Messages" =label "Messages"
;* ;*
%+ turn %+ turn
@ -42,9 +42,9 @@
^- manx ^- manx
;form.fc.g2 ;form.fc.g2
=hx-post "{(en-tape:pith:neo :(welp /neo/hawk here.bowl location))}?stud=txt" =hx-post "{(en-tape:pith:neo :(welp /neo/hawk here.bowl location))}?stud=txt"
=hx-swap "beforebegin"
=hx-on-submit "this.reset()" =hx-on-submit "this.reset()"
=hx-target "find button .loading" =hx-target "this"
=hx-swap "outerHTML"
=head "msg" =head "msg"
;textarea.p2.border.br1 ;textarea.p2.border.br1
=name "text" =name "text"
@ -56,7 +56,7 @@
; ;
== ==
;button.p2.b1.br1.bd1.wfc.hover.loader ;button.p2.b1.br1.bd1.wfc.hover.loader
;span.loaded.s2: create ;span.loaded.s2: create
;span.loading ;span.loading
;+ loading.feather-icons ;+ loading.feather-icons
== ==