mirror of
				https://github.com/pierre42100/ComunicWeb
				synced 2025-10-31 10:14:51 +00:00 
			
		
		
		
	Display conversations in the sidebar
This commit is contained in:
		| @@ -85,6 +85,24 @@ body.sidebar-collapse .sidebar-menu { | ||||
| 	font-size: 90%; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Conversations entries | ||||
|  */ | ||||
|  | ||||
| .main-sidebar .memberships-list .conversation_memberhsip a { | ||||
| 	padding: 5px 5px 5px 15px; | ||||
| } | ||||
|  | ||||
| .main-sidebar .memberships-list .conversation_memberhsip span { | ||||
| 	font-size: 90%; | ||||
| } | ||||
|  | ||||
| .main-sidebar .memberships-list .conversation_memberhsip .subinfo { | ||||
| 	font-size: 80%; | ||||
| } | ||||
|  | ||||
|  | ||||
| body.sidebar-collapse .main-sidebar .memberships-list .subinfo { | ||||
| 	display: none; | ||||
| } | ||||
| @@ -102,7 +120,6 @@ body.sidebar-collapse .main-sidebar .memberships-list li:hover .subinfo { | ||||
| 	padding-left: 20px; | ||||
| } | ||||
|  | ||||
|  | ||||
| /** | ||||
|  * Conversations | ||||
|  */ | ||||
|   | ||||
| @@ -322,7 +322,7 @@ ComunicWeb.components.sideBar.main = { | ||||
| 	 * @param {*} memberships  | ||||
| 	 * @param {*} users  | ||||
| 	 * @param {*} groups  | ||||
| 	 * @param {*} convs | ||||
| 	 * @param {Map<number, String>} convs | ||||
| 	 */ | ||||
| 	applyMemberships: function(target, memberships, users, groups, convs) { | ||||
|  | ||||
| @@ -342,6 +342,9 @@ ComunicWeb.components.sideBar.main = { | ||||
| 			 | ||||
| 			if(e.type == "group") | ||||
| 				this.applyGroup(friendsTarget, groups.get(e.id), e.last_activity); | ||||
| 			 | ||||
| 			if(e.type == "conversation") | ||||
| 				this.applyConversation(friendsTarget, e.conv, convs.get(e.conv.ID)); | ||||
| 		}); | ||||
|  | ||||
| 		createElem2({ | ||||
| @@ -512,4 +515,48 @@ ComunicWeb.components.sideBar.main = { | ||||
| 			subInfoEl.innerHTML = timeDiffToStr(lastactive); | ||||
|  | ||||
| 	}, | ||||
|  | ||||
| 	/** | ||||
| 	 * Apply a conversation | ||||
| 	 *  | ||||
| 	 * @param {HTMLElement} target | ||||
| 	 * @param {Array<any>} conv | ||||
| 	 * @param {String} name | ||||
| 	 */ | ||||
| 	applyConversation: function(target, conv, name) { | ||||
|  | ||||
| 		let li = createElem2({ | ||||
| 			appendTo: target, | ||||
| 			type: "li", | ||||
| 			class: "conversation_memberhsip" | ||||
| 		}); | ||||
|  | ||||
| 		let a = createElem2({ | ||||
| 			appendTo: li, | ||||
| 			type: "a", | ||||
| 			onclick: () => alert("implement me")  // TODO implement | ||||
| 		}); | ||||
|  | ||||
| 		// Icon | ||||
| 		createElem2({ | ||||
| 			appendTo: a, | ||||
| 			type: "i", | ||||
| 			class: "fa fa-comments" | ||||
| 		}); | ||||
|  | ||||
| 		// Conversation name | ||||
| 		createElem2({ | ||||
| 			appendTo: a, | ||||
| 			type: "span", | ||||
| 			innerHTML: name | ||||
| 		}); | ||||
|  | ||||
| 		let subInfoEl = createElem2({ | ||||
| 			appendTo: a, | ||||
| 			type: "div", | ||||
| 			class: "subinfo", | ||||
| 			innerHTML: timeDiffToStr(conv.last_active) | ||||
| 		}); | ||||
|  | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user