diff src/lib/Shared.luan @ 41:818697418dbe

add voice link
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 27 Feb 2025 19:05:57 -0700
parents 7ea33179592a
children e138343b2c76
line wrap: on
line diff
--- a/src/lib/Shared.luan	Thu Feb 27 16:44:20 2025 -0700
+++ b/src/lib/Shared.luan	Thu Feb 27 19:05:57 2025 -0700
@@ -46,10 +46,17 @@
 				/ <%=crumb%>
 <%	end %>
 			</span>
-			<span>
+			<span right>
 <%	if user == nil then %>
 				<a href="/login.html">Login / Register</a>
-<%	else %>
+<%	else
+		local voice_url = user.voice_url
+		if voice_url ~= nil then
+%>
+				<a href="<%=voice_url%>" title="Call" target="voice"><img phone src="/images/call.svg"></a>
+<%
+		end
+%>
 				<a href="/account.html"><%= user.email %></a>
 <%	end %>
 			</span>
@@ -111,7 +118,7 @@
 <%
 end
 
-local function chat_other_users_html(chat,user)
+local function chat_other_users_html(chat,user,show_phone)
 	local my_id = user.id
 	local is_first = true
 	for _, user_id in ipairs(chat.user_ids) do
@@ -123,6 +130,10 @@
 				%>, <%
 			end
 			%><span email><%= other_user.email %></span><span online="<%= other_user.id %>"></span><%
+			local voice_url = other_user.voice_url
+			if voice_url ~= nil and show_phone then
+				%> <a href="<%=voice_url%>" title="Call" target="voice"><img phone src="/images/call.svg"></a><%
+			end
 		end
 	end
 end
@@ -133,7 +144,7 @@
 	local chats = chat_search( "chat_user_ids:"..user.id, "chat_updated desc" )
 	for _, chat in ipairs(chats) do
 %>
-		<div chat="<%=chat.id%>" onclick="selectChat(this)"><% chat_other_users_html(chat,user) %></div>
+		<div chat="<%=chat.id%>" onclick="selectChat(this)"><% chat_other_users_html(chat,user,false) %></div>
 <%
 	end
 end