wip load room messages, but i broke rooms list
This commit is contained in:
@@ -44,11 +44,14 @@ export class ChatController {
|
|||||||
@Post('leave')
|
@Post('leave')
|
||||||
async leaveRoom(@Body() body)
|
async leaveRoom(@Body() body)
|
||||||
{
|
{
|
||||||
const { room_id } = body;
|
}
|
||||||
// get user
|
|
||||||
let user;
|
@UseGuards(AuthenticateGuard)
|
||||||
await this.chatService.removeUserFromRoom(user, room_id);
|
@UseGuards(TwoFactorGuard)
|
||||||
return { message: 'Successfully left room.' };
|
@Get('messages')
|
||||||
|
async getMessages(@Req() req, @Res() res)
|
||||||
|
{
|
||||||
|
return this.chatService.getMessagesFromCurrentRoom(req.user, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,4 @@
|
|||||||
import {
|
import { WebSocketGateway, SubscribeMessage, WebSocketServer, MessageBody, ConnectedSocket, OnGatewayConnection, OnGatewayDisconnect } from '@nestjs/websockets';
|
||||||
WebSocketGateway,
|
|
||||||
SubscribeMessage,
|
|
||||||
WebSocketServer,
|
|
||||||
MessageBody,
|
|
||||||
ConnectedSocket,
|
|
||||||
OnGatewayConnection,
|
|
||||||
OnGatewayDisconnect,
|
|
||||||
} from '@nestjs/websockets';
|
|
||||||
import { UseGuards } from '@nestjs/common';
|
import { UseGuards } from '@nestjs/common';
|
||||||
import { UsersService } from 'src/users/users.service';
|
import { UsersService } from 'src/users/users.service';
|
||||||
import { PaginationQueryDto } from 'src/common/dto/pagination-query.dto';
|
import { PaginationQueryDto } from 'src/common/dto/pagination-query.dto';
|
||||||
@@ -51,6 +43,7 @@ export class ChatGateway
|
|||||||
console.log('client.username :', client.username);
|
console.log('client.username :', client.username);
|
||||||
client.local.emit('message', client.username, message);
|
client.local.emit('message', client.username, message);
|
||||||
// this.chatService.add_message(this.server, message);
|
// this.chatService.add_message(this.server, message);
|
||||||
|
this.chatService.addMessageToCurrentRoom(client.username, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { Chatroom } from './entities/chatroom.entity';
|
|||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
import { joinRoomDto } from './dto/joinRoom.dto';
|
import { joinRoomDto } from './dto/joinRoom.dto';
|
||||||
|
import { messagesDto } from './dto/messages.dto';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ChatService {
|
export class ChatService {
|
||||||
@@ -33,14 +34,14 @@ export class ChatService {
|
|||||||
return res.status(HttpStatus.OK).json({ rooms: rooms });
|
return res.status(HttpStatus.OK).json({ rooms: rooms });
|
||||||
}
|
}
|
||||||
|
|
||||||
async findRoomByName(name: string, @Res() res)
|
async findRoomByName(name: string)
|
||||||
{
|
{
|
||||||
const room = await this.chatroomRepository
|
const room = await this.chatroomRepository
|
||||||
.createQueryBuilder('chatroom')
|
.createQueryBuilder('chatroom')
|
||||||
.where('chatroom.name = :name', { name: name })
|
.where('chatroom.name = :name', { name: name })
|
||||||
.getOne();
|
.getOne();
|
||||||
|
|
||||||
return res.status(HttpStatus.OK).json({ room: room });
|
return room;
|
||||||
}
|
}
|
||||||
|
|
||||||
async findRoomById(id: number, @Res() res)
|
async findRoomById(id: number, @Res() res)
|
||||||
@@ -53,6 +54,16 @@ export class ChatService {
|
|||||||
return res.status(HttpStatus.OK).json({ room: room });
|
return res.status(HttpStatus.OK).json({ room: room });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async findUserByName(name: string)
|
||||||
|
{
|
||||||
|
const user = await this.userRepository
|
||||||
|
.createQueryBuilder('user')
|
||||||
|
.where('user.username = :name', { name: name })
|
||||||
|
.getOne();
|
||||||
|
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
async setCurrentRoom(user: User, name: string, @Res() res)
|
async setCurrentRoom(user: User, name: string, @Res() res)
|
||||||
{
|
{
|
||||||
const user_db = await this.usersService.findOneByFourtyTwoId(user.fortyTwoId);
|
const user_db = await this.usersService.findOneByFourtyTwoId(user.fortyTwoId);
|
||||||
@@ -77,6 +88,7 @@ export class ChatService {
|
|||||||
newChatroom.type = joinRoomDto.room_type;
|
newChatroom.type = joinRoomDto.room_type;
|
||||||
newChatroom.owner = user.fortyTwoId;
|
newChatroom.owner = user.fortyTwoId;
|
||||||
newChatroom.users = [user.fortyTwoId];
|
newChatroom.users = [user.fortyTwoId];
|
||||||
|
newChatroom.messages = [{ name: "SERVER", message: `creation of room ${joinRoomDto.room_name}` }];
|
||||||
this.chatroomRepository.save(newChatroom);
|
this.chatroomRepository.save(newChatroom);
|
||||||
|
|
||||||
this.setCurrentRoom(user, joinRoomDto.room_name, res)
|
this.setCurrentRoom(user, joinRoomDto.room_name, res)
|
||||||
@@ -89,5 +101,25 @@ export class ChatService {
|
|||||||
// get room
|
// get room
|
||||||
// remove user
|
// remove user
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async addMessageToCurrentRoom(name: string, message: string)
|
||||||
|
{
|
||||||
|
const user_db = await this.findUserByName(name);
|
||||||
|
const currentRoom = await this.findRoomByName(user_db.currentRoom);
|
||||||
|
let chat_message = {
|
||||||
|
name: name,
|
||||||
|
message: message,
|
||||||
|
};
|
||||||
|
console.log(message);
|
||||||
|
currentRoom.messages.push(chat_message);
|
||||||
|
this.chatroomRepository.save(currentRoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
async getMessagesFromCurrentRoom(user: User, @Res() res)
|
||||||
|
{
|
||||||
|
const user_db = await this.usersService.findOneByFourtyTwoId(user.fortyTwoId);
|
||||||
|
const currentRoom = await this.findRoomByName(user_db.currentRoom);
|
||||||
|
return res.status(HttpStatus.OK).json({ messages: currentRoom.messages });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { IsBoolean, IsEmpty, IsInt, IsNotEmpty, IsNumber, IsString, IsOptional, IsArray } from "class-validator";
|
||||||
|
import { IsNull } from "typeorm";
|
||||||
|
|
||||||
|
export class messagesDto
|
||||||
|
{
|
||||||
|
@IsArray()
|
||||||
|
messages: { name: string; message: string }[];
|
||||||
|
}
|
||||||
|
|
||||||
@@ -29,7 +29,10 @@ export class Chatroom {
|
|||||||
@Column()
|
@Column()
|
||||||
owner: string; // fortytwo id
|
owner: string; // fortytwo id
|
||||||
|
|
||||||
@Column({ type: "simple-array" })
|
@Column("simple-array")
|
||||||
users: string[]; // fortytwo id
|
users: string[]; // fortytwo id
|
||||||
|
|
||||||
|
@Column("json")
|
||||||
|
messages: { name: string, message: string }[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,4 +111,17 @@ export class UsersController {
|
|||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TEMP FOR HUGO
|
||||||
|
@UseGuards(AuthenticateGuard)
|
||||||
|
@UseGuards(TwoFactorGuard)
|
||||||
|
@Get('ftId')
|
||||||
|
getFortyTwoId(@Query('username') username: string, @Req() req) {
|
||||||
|
if (username === undefined) {
|
||||||
|
return this.usersService.findOne(req.user.id);
|
||||||
|
} else {
|
||||||
|
const user : User = req.user;
|
||||||
|
return this.usersService.findOneByUsername(user.id.toString(),username);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3890,6 +3890,8 @@ var app = (function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let msgs = writable([]);
|
||||||
|
|
||||||
/* src/pieces/chat/Layout_home.svelte generated by Svelte v3.53.1 */
|
/* src/pieces/chat/Layout_home.svelte generated by Svelte v3.53.1 */
|
||||||
|
|
||||||
const { console: console_1$9 } = globals;
|
const { console: console_1$9 } = globals;
|
||||||
@@ -3901,7 +3903,7 @@ var app = (function () {
|
|||||||
return child_ctx;
|
return child_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (31:1) <Button bind:layout new_layout="settings" my_class="settings dots icon">
|
// (45:1) <Button bind:layout new_layout="settings" my_class="settings dots icon">
|
||||||
function create_default_slot_3$5(ctx) {
|
function create_default_slot_3$5(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -3921,14 +3923,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_3$5.name,
|
id: create_default_slot_3$5.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(31:1) <Button bind:layout new_layout=\\\"settings\\\" my_class=\\\"settings dots icon\\\">",
|
source: "(45:1) <Button bind:layout new_layout=\\\"settings\\\" my_class=\\\"settings dots icon\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (36:1) <Button bind:layout new_layout="new" my_class="new transparent">
|
// (50:1) <Button bind:layout new_layout="new" my_class="new transparent">
|
||||||
function create_default_slot_2$9(ctx) {
|
function create_default_slot_2$9(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -3948,14 +3950,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_2$9.name,
|
id: create_default_slot_2$9.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(36:1) <Button bind:layout new_layout=\\\"new\\\" my_class=\\\"new transparent\\\">",
|
source: "(50:1) <Button bind:layout new_layout=\\\"new\\\" my_class=\\\"new transparent\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (41:1) <Button bind:layout new_layout="close" my_class="close icon">
|
// (55:1) <Button bind:layout new_layout="close" my_class="close icon">
|
||||||
function create_default_slot_1$9(ctx) {
|
function create_default_slot_1$9(ctx) {
|
||||||
let t;
|
let t;
|
||||||
|
|
||||||
@@ -3975,7 +3977,7 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot_1$9.name,
|
id: create_default_slot_1$9.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(41:1) <Button bind:layout new_layout=\\\"close\\\" my_class=\\\"close icon\\\">",
|
source: "(55:1) <Button bind:layout new_layout=\\\"close\\\" my_class=\\\"close icon\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4004,7 +4006,7 @@ var app = (function () {
|
|||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (55:3) {:then}
|
// (69:3) {:then}
|
||||||
function create_then_block$1(ctx) {
|
function create_then_block$1(ctx) {
|
||||||
let each_1_anchor;
|
let each_1_anchor;
|
||||||
let current;
|
let current;
|
||||||
@@ -4093,14 +4095,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_then_block$1.name,
|
id: create_then_block$1.name,
|
||||||
type: "then",
|
type: "then",
|
||||||
source: "(55:3) {:then}",
|
source: "(69:3) {:then}",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (57:5) <Button bind:layout new_layout="room" my_class="list">
|
// (71:5) <Button bind:layout new_layout="room" my_class="list">
|
||||||
function create_default_slot$b(ctx) {
|
function create_default_slot$b(ctx) {
|
||||||
let t0_value = /*room*/ ctx[7].name + "";
|
let t0_value = /*room*/ ctx[7].name + "";
|
||||||
let t0;
|
let t0;
|
||||||
@@ -4128,14 +4130,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_default_slot$b.name,
|
id: create_default_slot$b.name,
|
||||||
type: "slot",
|
type: "slot",
|
||||||
source: "(57:5) <Button bind:layout new_layout=\\\"room\\\" my_class=\\\"list\\\">",
|
source: "(71:5) <Button bind:layout new_layout=\\\"room\\\" my_class=\\\"list\\\">",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (56:4) {#each rooms as room}
|
// (70:4) {#each rooms as room}
|
||||||
function create_each_block$5(ctx) {
|
function create_each_block$5(ctx) {
|
||||||
let button;
|
let button;
|
||||||
let updating_layout;
|
let updating_layout;
|
||||||
@@ -4200,14 +4202,14 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_each_block$5.name,
|
id: create_each_block$5.name,
|
||||||
type: "each",
|
type: "each",
|
||||||
source: "(56:4) {#each rooms as room}",
|
source: "(70:4) {#each rooms as room}",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// (52:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}
|
// (66:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}
|
||||||
function create_pending_block$1(ctx) {
|
function create_pending_block$1(ctx) {
|
||||||
let p;
|
let p;
|
||||||
|
|
||||||
@@ -4215,7 +4217,7 @@ var app = (function () {
|
|||||||
c: function create() {
|
c: function create() {
|
||||||
p = element("p");
|
p = element("p");
|
||||||
p.textContent = "rooms are loaded...";
|
p.textContent = "rooms are loaded...";
|
||||||
add_location(p, file$p, 53, 4, 1121);
|
add_location(p, file$p, 67, 4, 1409);
|
||||||
},
|
},
|
||||||
m: function mount(target, anchor) {
|
m: function mount(target, anchor) {
|
||||||
insert_dev(target, p, anchor);
|
insert_dev(target, p, anchor);
|
||||||
@@ -4232,7 +4234,7 @@ var app = (function () {
|
|||||||
block,
|
block,
|
||||||
id: create_pending_block$1.name,
|
id: create_pending_block$1.name,
|
||||||
type: "pending",
|
type: "pending",
|
||||||
source: "(52:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}",
|
source: "(66:21) <!-- promise is pending --> <p>rooms are loaded...</p> {:then}",
|
||||||
ctx
|
ctx
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -4346,17 +4348,17 @@ var app = (function () {
|
|||||||
t6 = space();
|
t6 = space();
|
||||||
info.block.c();
|
info.block.c();
|
||||||
attr_dev(p0, "class", "title svelte-1jygwt2");
|
attr_dev(p0, "class", "title svelte-1jygwt2");
|
||||||
add_location(p0, file$p, 46, 2, 889);
|
add_location(p0, file$p, 60, 2, 1177);
|
||||||
attr_dev(p1, "class", "__center");
|
attr_dev(p1, "class", "__center");
|
||||||
add_location(p1, file$p, 49, 4, 999);
|
add_location(p1, file$p, 63, 4, 1287);
|
||||||
attr_dev(div0, "class", "__show_if_only_child");
|
attr_dev(div0, "class", "__show_if_only_child");
|
||||||
add_location(div0, file$p, 48, 3, 960);
|
add_location(div0, file$p, 62, 3, 1248);
|
||||||
attr_dev(div1, "class", "room_list");
|
attr_dev(div1, "class", "room_list");
|
||||||
add_location(div1, file$p, 47, 2, 933);
|
add_location(div1, file$p, 61, 2, 1221);
|
||||||
attr_dev(div2, "class", "panel panel_home __border_top svelte-1jygwt2");
|
attr_dev(div2, "class", "panel panel_home __border_top svelte-1jygwt2");
|
||||||
add_location(div2, file$p, 45, 1, 843);
|
add_location(div2, file$p, 59, 1, 1131);
|
||||||
attr_dev(div3, "class", "grid_box svelte-1jygwt2");
|
attr_dev(div3, "class", "grid_box svelte-1jygwt2");
|
||||||
add_location(div3, file$p, 27, 0, 484);
|
add_location(div3, file$p, 41, 0, 772);
|
||||||
},
|
},
|
||||||
l: function claim(nodes) {
|
l: function claim(nodes) {
|
||||||
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
throw new Error("options.hydrate only works if the component was compiled with the `hydratable: true` option");
|
||||||
@@ -4524,6 +4526,7 @@ var app = (function () {
|
|||||||
$$self.$capture_state = () => ({
|
$$self.$capture_state = () => ({
|
||||||
onMount,
|
onMount,
|
||||||
Button: Chat_button,
|
Button: Chat_button,
|
||||||
|
msgs,
|
||||||
layout,
|
layout,
|
||||||
rooms,
|
rooms,
|
||||||
get_rooms
|
get_rooms
|
||||||
@@ -8192,6 +8195,7 @@ var app = (function () {
|
|||||||
|
|
||||||
fetch(`${address}/api/v2/user`).then(resp => resp.json()).then(data => {
|
fetch(`${address}/api/v2/user`).then(resp => resp.json()).then(data => {
|
||||||
user = data;
|
user = data;
|
||||||
|
console.log("user:", user);
|
||||||
|
|
||||||
socket$1 = lookup(address, {
|
socket$1 = lookup(address, {
|
||||||
path: '/chat',
|
path: '/chat',
|
||||||
@@ -8199,8 +8203,6 @@ var app = (function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let msgs = writable([]);
|
|
||||||
|
|
||||||
/* src/pieces/chat/Layout_room.svelte generated by Svelte v3.53.1 */
|
/* src/pieces/chat/Layout_room.svelte generated by Svelte v3.53.1 */
|
||||||
const file$n = "src/pieces/chat/Layout_room.svelte";
|
const file$n = "src/pieces/chat/Layout_room.svelte";
|
||||||
|
|
||||||
@@ -8294,7 +8296,7 @@ var app = (function () {
|
|||||||
// (64:4) <Msg name={msg.name}>
|
// (64:4) <Msg name={msg.name}>
|
||||||
function create_default_slot_1$8(ctx) {
|
function create_default_slot_1$8(ctx) {
|
||||||
let html_tag;
|
let html_tag;
|
||||||
let raw_value = /*msg*/ ctx[4].content + "";
|
let raw_value = /*msg*/ ctx[4].message + "";
|
||||||
let html_anchor;
|
let html_anchor;
|
||||||
|
|
||||||
const block = {
|
const block = {
|
||||||
@@ -8308,7 +8310,7 @@ var app = (function () {
|
|||||||
insert_dev(target, html_anchor, anchor);
|
insert_dev(target, html_anchor, anchor);
|
||||||
},
|
},
|
||||||
p: function update(ctx, dirty) {
|
p: function update(ctx, dirty) {
|
||||||
if (dirty & /*$msgs*/ 8 && raw_value !== (raw_value = /*msg*/ ctx[4].content + "")) html_tag.p(raw_value);
|
if (dirty & /*$msgs*/ 8 && raw_value !== (raw_value = /*msg*/ ctx[4].message + "")) html_tag.p(raw_value);
|
||||||
},
|
},
|
||||||
d: function destroy(detaching) {
|
d: function destroy(detaching) {
|
||||||
if (detaching) detach_dev(html_anchor);
|
if (detaching) detach_dev(html_anchor);
|
||||||
@@ -8727,8 +8729,8 @@ var app = (function () {
|
|||||||
let msg = "";
|
let msg = "";
|
||||||
let text_area;
|
let text_area;
|
||||||
|
|
||||||
function add_local_msg(from, message) {
|
function add_local_msg(name, message) {
|
||||||
msgs.update(msgs => [...msgs, { content: message, name: from }]);
|
msgs.update(msgs => [...msgs, { name, message }]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function send_msg() {
|
function send_msg() {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -11,6 +11,7 @@
|
|||||||
.then((data) =>
|
.then((data) =>
|
||||||
{
|
{
|
||||||
user = data;
|
user = data;
|
||||||
|
console.log("user:", user);
|
||||||
socket = io(address,
|
socket = io(address,
|
||||||
{
|
{
|
||||||
path: '/chat',
|
path: '/chat',
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import Button from './Chat_button.svelte';
|
import Button from './Chat_button.svelte';
|
||||||
|
import { msgs } from './Store_msg.js';
|
||||||
export let layout;
|
export let layout;
|
||||||
|
|
||||||
let rooms = [
|
let rooms = [
|
||||||
@@ -23,6 +24,19 @@
|
|||||||
rooms = data.rooms;
|
rooms = data.rooms;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
function get_room_messages()
|
||||||
|
{
|
||||||
|
const messages = fetch('/api/v2/chat/messages')
|
||||||
|
.then(resp => resp.json())
|
||||||
|
.then(data =>
|
||||||
|
{
|
||||||
|
console.log(data.messages);
|
||||||
|
msgs.update(msgs => [...msgs, { name: name, message: message }]);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="grid_box">
|
<div class="grid_box">
|
||||||
@@ -59,16 +73,6 @@
|
|||||||
</Button>
|
</Button>
|
||||||
{/each}
|
{/each}
|
||||||
{/await}
|
{/await}
|
||||||
|
|
||||||
<!-- placeholders
|
|
||||||
<Button bind:layout new_layout="room" my_class="list">
|
|
||||||
another room
|
|
||||||
</Button>
|
|
||||||
<Button bind:layout new_layout="room" my_class="list">
|
|
||||||
placeholder
|
|
||||||
</Button>
|
|
||||||
------------- -->
|
|
||||||
<!-- END placeholders -->
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
let msg = "";
|
let msg = "";
|
||||||
let text_area;
|
let text_area;
|
||||||
|
|
||||||
function add_local_msg(from, message)
|
function add_local_msg(name, message)
|
||||||
{
|
{
|
||||||
msgs.update(msgs => [...msgs, { content: message, name: from }]);
|
msgs.update(msgs => [...msgs, { name: name, message: message }]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function send_msg()
|
function send_msg()
|
||||||
@@ -61,7 +61,7 @@
|
|||||||
<div class="panel panel_msg">
|
<div class="panel panel_msg">
|
||||||
<div class="msg_thread">
|
<div class="msg_thread">
|
||||||
{#each $msgs as msg}
|
{#each $msgs as msg}
|
||||||
<Msg name={msg.name}>{@html msg.content}</Msg>
|
<Msg name={msg.name}>{@html msg.message}</Msg>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user