close and back is ok

This commit is contained in:
simplonco
2023-01-08 17:00:00 +01:00
parent 272221071d
commit b132c154e4
5 changed files with 85 additions and 70 deletions

View File

@@ -29,6 +29,7 @@
*/
function set_layouts(layout)
{
console.log("layouts:", layouts);
if (layout === "close")
return;
if (layout === layouts[0])
@@ -37,6 +38,7 @@
layouts = [layout, "home"];
else
layouts = [layout, layouts[0]];
console.log("- layouts:", layouts);
}
$: set_layouts(layout);
@@ -48,7 +50,7 @@
<HomeLayout bind:layout />
{:else if layout === "close"}
<CloseLayout bind:layout />
<CloseLayout bind:layout back={layouts[0]} />
{:else if layout === "room"}
<RoomLayout bind:layout back={layouts[1]} />

View File

@@ -1,12 +1,13 @@
<script>
<script lang="ts">
import Button from './Element_button.svelte';
export let layout;
export let layout = "";
export let back = "";
</script>
<div class="grid_box">
<Button bind:layout new_layout="home" my_class="chat">
<Button bind:layout new_layout={back} my_class="chat">
chat
</Button>
</div>

View File

@@ -1,3 +1,5 @@
import { user, msgs } from './Store_chat';
export function socket_events(socket)
{
socket.on('message', function(from, message)
@@ -5,6 +7,6 @@ export function socket_events(socket)
console.log("received msg:", message, from);
if (from === user.username)
from = "me";
msgs.update(msgs => [...msgs, { content: message, name: from }]);
msgs.update(msgs => [...msgs, { name: from, message: message }]);
});
}