1- /* global $rdf */
2- /* Tools for doing things with a message
3- * Let is be cretiev here. Allow all sorts of things to
1+ /**
2+ * Tools for doing things with a message
3+ * Let us be creative here. Allow all sorts of things to
44 * be done to a message - linking to new or old objects in an open way
55 *
66 * Ideas: Bookmark, Like, star, pin at top of chat, reply as new thread,
7- * If you made it originally: edit, delete, attach
7+ * If you made it originally: edit, delete, attach
8+ * @packageDocumentation
89 */
910
11+ /* global $rdf */
12+
1013const UI = {
1114 authn : require ( '../authn/authn' ) ,
1215 icons : require ( '../iconBase' ) ,
@@ -55,7 +58,8 @@ function updatePromise (del, ins) {
5558 } ) // promise
5659}
5760
58- /* Emoji in Unicode
61+ /**
62+ * Emoji in Unicode
5963 */
6064
6165var emoji = { }
@@ -64,7 +68,8 @@ emoji[ns.schema('DisagreeAction')] = '👎'
6468emoji [ ns . schema ( 'EndorseAction' ) ] = '⭐️'
6569emoji [ ns . schema ( 'LikeAction' ) ] = '❤️'
6670
67- /* Strip of sentiments expressed
71+ /**
72+ * Create strip of sentiments expressed
6873 */
6974export function sentimentStrip ( target , doc ) {
7075 const actions = kb . each ( null , ns . schema ( 'target' ) , target , doc )
@@ -73,12 +78,12 @@ export function sentimentStrip (target, doc) {
7378 const strings = sentiments . map ( x => emoji [ x ] || '' )
7479 return dom . createTextNode ( strings . join ( ' ' ) )
7580}
76- /** Strip of sentiments expressed
81+ /**
82+ * Create strip of sentiments expressed, with hyperlinks
7783 *
7884 * @param target {NamedNode} - The thing about which they are expressed
79- * @param doc {NamedNode} - The document iun which they are expressed
85+ * @param doc {NamedNode} - The document in which they are expressed
8086 */
81-
8287export function sentimentStripLinked ( target , doc ) {
8388 var strip = dom . createElement ( 'span' )
8489 function refresh ( ) {
@@ -107,6 +112,9 @@ export function sentimentStripLinked (target, doc) {
107112 return strip
108113}
109114
115+ /**
116+ * Creates a message toolbar component
117+ */
110118export function messageToolbar ( message , messageRow , userContext ) {
111119 const div = dom . createElement ( 'div' )
112120 function closeToolbar ( ) {
@@ -225,12 +233,12 @@ export function messageToolbar (message, messageRow, userContext) {
225233 // https://schema.org/AgreeAction
226234 me = UI . authn . currentUser ( ) // If already logged on
227235 if ( me ) {
228- // Things yo mnust be logged in fo
236+ // Things you mnust be logged in for
229237 var context1 = { me, dom, div }
230238 div . appendChild (
231239 sentimentButton (
232240 context1 ,
233- message , // @@ use UI.widgets.sentimentButton
241+ message , // @@ TODO use UI.widgets.sentimentButton
234242 UI . icons . iconBase + THUMBS_UP_ICON ,
235243 ns . schema ( 'AgreeAction' ) ,
236244 message . doc ( ) ,
0 commit comments