wip add and change password

+ changed on_click
This commit is contained in:
simplonco
2023-01-14 23:05:01 +01:00
parent a060ddf4e9
commit 0496b34577
7 changed files with 45 additions and 10 deletions

View File

@@ -302,6 +302,13 @@ export class ChatController {
const room_name = await this.chatService.getCurrentRoomName(req.user.username);
const room = await this.chatService.getRoomByName(room_name);
const users = room.users;
let index = users.indexOf(req.user.username);
if (index > -1)
{
users.splice(index, 1);
}
res.status(HttpStatus.OK).json({ users: users });
printCaller("- out ");
}

View File

@@ -2,7 +2,6 @@
<Button
bind:layout
new_layout=""
on_click={}
my_class=""
my_title=""
>
@@ -17,7 +16,6 @@
export let my_class = "";
export let my_title = "";
export let new_layout = "";
export let on_click = "";
function update_layout() {
layout.set(new_layout);
@@ -25,7 +23,7 @@
</script>
<button on:click={update_layout} on:click={on_click} title={my_title} class={my_class}>
<button on:click={update_layout} on:click title={my_title} class={my_class}>
<p><slot></slot></p>
</button>

View File

@@ -55,7 +55,7 @@
<p>rooms are loading...</p>
{:then rooms}
{#each rooms as room}
<Button my_class="list" on_click={function() {go_to_room(room)}}>
<Button my_class="list" on:click={function() {go_to_room(room)}}>
{room.client_name}
</Button>
{/each}

View File

@@ -52,7 +52,7 @@
<p>users are loading...</p>
{:then users}
{#each users as user}
<Button my_class="list" on_click={function() {invite_this_user(user.username)}}>
<Button my_class="list" on:click={function() {invite_this_user(user.username)}}>
{user.username}
</Button>
{/each}

View File

@@ -56,7 +56,7 @@
<p>rooms are loading...</p>
{:then rooms}
{#each rooms as room}
<Button my_class="list" on_click={function() {join_rooms(room)}}>
<Button my_class="list" on:click={function() {join_rooms(room)}}>
{room.name}
</Button>
{/each}

View File

@@ -71,7 +71,7 @@
</div>
<!-- send -->
<Button my_class="send" on_click={send_msg}>
<Button my_class="send" on:click={send_msg}>
send
</Button>

View File

@@ -8,9 +8,26 @@
let users = get_room_users();
console.log("current_room:", $current_room);
function change_password()
{
console.log("in change_password");
}
function remove_password()
{
console.log("in remove_password");
}
function add_password()
{
console.log("in add_password");
}
function user_profile()
{
console/log("in user_profile");
console.log("in user_profile");
}
function user_leave_room()
@@ -42,13 +59,26 @@
<!-- panel_room_set -->
<div class="panel panel_room_set __border_top">
{#if $current_room.type !== "direct"}
<Button on_click={user_leave_room}>
<Button on:click={user_leave_room}>
leave
</Button>
<Button new_layout="invite">
invite someone
</Button>
{/if}
{#if $current_room.protection }
<p class="__center">this room is password protected</p>
<Button on:click={change_password}>
change password
</Button>
<Button on:click={remove_password}>
remove password
</Button>
{:else}
<Button on:click={add_password}>
add password
</Button>
{/if}
<p>room users :</p>
<div class="room_users">
<div class="__show_if_only_child">
@@ -58,7 +88,7 @@
<p>list of users is loading...</p>
{:then users}
{#each users as user}
<Button new_layout="user" my_class="list" on_click={user_profile}>
<Button new_layout="user" my_class="list" on:click={user_profile}>
{user}
</Button>
{/each}