Added basic functionality to see users and conversations

This commit is contained in:
jsrobson10 2019-04-12 17:47:30 +10:00
parent f2231cd43c
commit 124867967c
3 changed files with 64 additions and 11 deletions

View File

@ -10,10 +10,10 @@
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="style.css">
</head> </head>
<body> <body>
<div class="chat-menu"> <div class='menu-vertical server-menu'>
<ul id="chat-menu-profiles"> <ul id="server-menu-profiles">
</ul> </ul>
<ul id="chat-menu-config"> <ul id="server-menu-config">
<li><a href="#" onclick="switch_new_profile()">New Profile</a></li> <li><a href="#" onclick="switch_new_profile()">New Profile</a></li>
</ul> </ul>
</div> </div>

View File

@ -32,8 +32,8 @@ fs.readFile("profiles.json", "utf-8", function(err, data)
profile_connect(i); profile_connect(i);
} }
document.getElementById("chat-menu-profiles").style.bottom = document.getElementById("server-menu-profiles").style.bottom =
document.getElementById("chat-menu-config").style.height; document.getElementById("server-menu-config").style.height;
}); });
function profiles_export() function profiles_export()
@ -91,12 +91,46 @@ function profile_switch_to(id)
{ {
// Set the active profile // Set the active profile
active_profile = id; active_profile = id;
// Create a chats menu
var chats_menu = "";
// Loop over the chats
var chats_array = Object.keys(connections[id].chats);
for(var i=0;i<chats_array.length;i++)
{
// Add to the chats menu
chats_menu += "<li><a href='#'>"+connections[id].chats[chats_array[i]].name+"</a></li>";
}
// Create a users menu
var users_menu = "";
// Loop over the users
var users_array = Object.keys(connections[id].users);
for(var i=0;i<users_array.length;i++)
{
// Add to the chats menu
users_menu += "<li><a href='#'>"+users_array[i]+"</a></li>";
}
// Set the html data
document.getElementById("chat-main").innerHTML = "\
<div id='chats-menu' class='menu-vertical'>\
<ul>"+chats_menu+"</ul>\
</div>\
<div id='chat-area'>\
</div>\
<div id='users-menu' class='menu-vertical'>\
<ul>"+users_menu+"</ul>\
</div>\
";
} }
function profiles_reload() function profiles_reload()
{ {
// Get the chat menu id // Get the chat menu id
var chat_menu = document.getElementById("chat-menu-profiles"); var chat_menu = document.getElementById("server-menu-profiles");
// Reset it // Reset it
chat_menu.innerHTML = ""; chat_menu.innerHTML = "";

View File

@ -1,28 +1,47 @@
.chat-menu ul#chat-menu-profiles { .server-menu ul#server-menu-profiles {
top: 0; top: 0;
bottom: 56px; bottom: 56px;
overflow-y: auto; overflow-y: auto;
} }
.chat-menu ul { #chats-menu ul {
top: 0;
bottom: 0;
left: 240px;
width: 100px;
background-color: #BBB;
}
#users-menu ul {
top: 0;
bottom: 0;
right: 0;
width: 100px;
background-color: #BBB;
}
.menu-vertical ul {
list-style-type: none; list-style-type: none;
margin: 0; margin: 0;
padding: 0; padding: 0;
background-color: #CCC; background-color: #CCC;
width: 240px;
position: fixed; position: fixed;
}
.server-menu ul {
width: 240px;
left: 0; left: 0;
bottom: 0; bottom: 0;
} }
.chat-menu ul li a { .menu-vertical ul li a {
display: block; display: block;
padding: 20px; padding: 20px;
text-decoration: none; text-decoration: none;
color: #000; color: #000;
} }
.chat-menu ul li a:hover { .menu-vertical ul li a:hover {
background-color: #AAA; background-color: #AAA;
} }