Compare commits

..

No commits in common. "f32d38287a6c106cdff00ffdf13b5bf514efab3a" and "b5d73e59fd4c93a4250e3550a3ce98319a38e002" have entirely different histories.

5 changed files with 17 additions and 40 deletions

View File

@ -1,5 +1,5 @@
body { body {
margin: 1vh; margin: 10;
font-family: 'Quicksand', sans-serif; font-family: 'Quicksand', sans-serif;
font-size: 3vh; font-size: 3vh;
} }

View File

@ -7,16 +7,14 @@
#app ul #app ul
{ {
font-size: 2vh; font-size: 2vh;
margin: 1vh 0 0 0; margin: 5px 0 0 0;
padding: 0 0 0 0; padding: 0 0 0 0;
list-style-type: none; list-style-type: none;
max-height: 80vh;
overflow: auto;
} }
#app li #app li
{ {
margin: 1vh 1vh 0 0; margin: 10px 10px 0 0;
} }
#app #chats { #app #chats {
@ -25,13 +23,13 @@
text-align: left; text-align: left;
} }
#app #users { #app #users {
margin: 0vh 5vh 0vh 0.1vh; margin-right: 5vh;
} }
#app #chat { #app #chat {
position: relative; position: relative;
max-height: 80vh; max-height: 80vh;
width: 80vh; width: 60%;
/*border: 2px solid green;*/ /*border: 2px solid green;*/
overflow: hidden; overflow: hidden;
} }
@ -51,11 +49,8 @@
#app #input_user{ #app #input_user{
color: green; color: green;
width: 20vh; width: 20vh;
height: 2.5vh; height: 3vh;
font-size: 2vh; font-size: 2vh;
border: none;
outline: none;
border-bottom: 0.25vh solid green;
} }
#app #input_chat{ #app #input_chat{
@ -65,7 +60,7 @@
width: 100%; width: 100%;
border: none; border: none;
outline: none; outline: none;
border-bottom: 0.25vh solid green; border-bottom: 0.5vh solid green;
caret-color: green; caret-color: green;
color: green; color: green;
font-size: 2vh; font-size: 2vh;
@ -75,8 +70,8 @@
text-align: left; text-align: left;
position: relative; position: relative;
max-width: 48%; max-width: 48%;
left: 2vh; left: 10px;
margin: 1vh 0 0 0; margin: 5px 0 0 0;
color: green; color: green;
word-wrap: break-word; word-wrap: break-word;
@ -86,8 +81,8 @@
text-align: right; text-align: right;
position: relative; position: relative;
max-width: 48%; max-width: 48%;
margin: 1vh 0 0 auto; margin: 5px 0 0 auto;
right: 2vh; right: 10px;
color: red; color: red;
/* permet le retour à la ligne à la place de dépasser*/ /* permet le retour à la ligne à la place de dépasser*/

View File

@ -7,12 +7,6 @@ class Channels {
} }
async createChannel(users_id, reload) { async createChannel(users_id, reload) {
users_id.forEach(user_id => {
if (user_id == null)
return console.log("createChannel error, null id;");
});
let response = await this.client._post("/api/chat/", { let response = await this.client._post("/api/chat/", {
users_id:users_id users_id:users_id
}); });

View File

@ -10,12 +10,11 @@ export default class extends AbstractView {
async postInit() { async postInit() {
let search = document.getElementById("input_user"); let search = document.getElementById("input_user");
search.oninput = this.users; search.addEventListener("input", this.users)
let chat_input = document.getElementById("input_chat"); let chat_input = document.getElementById("input_chat");
//chat_input.addEventListener("keydown", this.chat_manager) //chat_input.addEventListener("keydown", this.chat_manager)
this.last_add_chat = undefined;
this.users(); this.users();
this.chat(); this.chat();
@ -32,12 +31,6 @@ export default class extends AbstractView {
list_users.innerHTML = ""; list_users.innerHTML = "";
users.filter(user => user.username.toLowerCase().startsWith(search) == true).forEach((user) => { users.filter(user => user.username.toLowerCase().startsWith(search) == true).forEach((user) => {
if (user.user_id == null) {
console.log("list User one with id null;");
return;
}
var new_user = document.createElement("li"); var new_user = document.createElement("li");
// username // username
@ -53,29 +46,24 @@ export default class extends AbstractView {
if (logged && client.me.user_id != user.user_id) { if (logged && client.me.user_id != user.user_id) {
let add_chat = document.createElement("a"); let add_chat = document.createElement("a");
add_chat.id = "add_chat_off"; add_chat.id = "add_chat_off";
add_chat.onclick = async () => { add_chat.addEventListener("click", async () => {
add_chat.id = "add_chat_off";
if (client.channel != undefined) { if (client.channel != undefined) {
client.channel.members_id.forEach((member_id) => { client.channel.members_id.forEach((member_id) => {
if (member_id == user.user_id) if (member_id == user.user_id)
client.channel = undefined; client.channel = undefined;
}); });
if (client.channel == undefined) { if (client.channel == undefined)
add_chat.id = "add_chat_off";
this.last_add_chat = undefined;
return this.hideChat(); return this.hideChat();
}
client.channel.disconnect(); client.channel.disconnect();
} }
client.channel = await client.channels.createChannel([client.me.user_id , user.user_id], this.chat); client.channel = await client.channels.createChannel([client.me.user_id , user.user_id], this.chat);
this.chat(); this.chat();
if (this.last_add_chat != undefined)
this.last_add_chat.id = "add_chat_off";
this.last_add_chat = add_chat;
add_chat.id = "add_chat_on"; add_chat.id = "add_chat_on";
}; });
add_chat.appendChild(document.createTextNode("Chat")); add_chat.appendChild(document.createTextNode("Chat"));
new_user.appendChild(add_chat); new_user.appendChild(add_chat);

View File

@ -57,4 +57,4 @@ class MyProfileViewSet(viewsets.ModelViewSet):
instance: ProfileModel = self.get_object() instance: ProfileModel = self.get_object()
instance.avatar_url.name = instance.avatar_url.name[instance.avatar_url.name.find("static") - 1:] instance.avatar_url.name = instance.avatar_url.name[instance.avatar_url.name.find("static") - 1:]
return Response(self.serializer_class(instance).data, return Response(self.serializer_class(instance).data,
status=status.HTTP_200_OK) status=status.HTTP_200_OK)