chat is on every pages
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Router, { replace } from "svelte-spa-router";
|
import Router, { replace } from "svelte-spa-router";
|
||||||
import { primaryRoutes } from "./routes/primaryRoutes.js";
|
import { primaryRoutes } from "./routes/primaryRoutes.js";
|
||||||
|
import Chat from './pieces/chat/Chat.svelte';
|
||||||
|
|
||||||
const conditionsFailed = (event) => {
|
const conditionsFailed = (event) => {
|
||||||
console.error('conditionsFailed event', event.detail);
|
console.error('conditionsFailed event', event.detail);
|
||||||
@@ -12,5 +13,6 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<Chat />
|
||||||
<Router routes={primaryRoutes} on:conditionsFailed={conditionsFailed}/>
|
<Router routes={primaryRoutes} on:conditionsFailed={conditionsFailed}/>
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,6 @@
|
|||||||
import GenerateUserDisplay from '../../pieces/GenerateUserDisplay.svelte';
|
import GenerateUserDisplay from '../../pieces/GenerateUserDisplay.svelte';
|
||||||
import { push } from 'svelte-spa-router';
|
import { push } from 'svelte-spa-router';
|
||||||
|
|
||||||
import Chat from '../../pieces/chat/Chat.svelte';
|
|
||||||
|
|
||||||
let user;
|
let user;
|
||||||
|
|
||||||
onMount( async() => {
|
onMount( async() => {
|
||||||
@@ -17,8 +15,6 @@
|
|||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Chat color="bisque"/>
|
|
||||||
|
|
||||||
<div class="outer">
|
<div class="outer">
|
||||||
{#if user !== undefined}
|
{#if user !== undefined}
|
||||||
<GenerateUserDisplay user={user}/>
|
<GenerateUserDisplay user={user}/>
|
||||||
|
|||||||
@@ -2,14 +2,35 @@
|
|||||||
|
|
||||||
import Layouts from './Chat_layouts.svelte';
|
import Layouts from './Chat_layouts.svelte';
|
||||||
import { init_socket } from './Socket_chat';
|
import { init_socket } from './Socket_chat';
|
||||||
|
import { location } from 'svelte-spa-router';
|
||||||
|
|
||||||
export let color = "transparent";
|
|
||||||
|
|
||||||
|
let color = "transparent";
|
||||||
|
|
||||||
|
console.log("location:",$location);
|
||||||
|
if ($location !== '/')
|
||||||
init_socket();
|
init_socket();
|
||||||
|
|
||||||
|
function change_color(loc)
|
||||||
|
{
|
||||||
|
console.log("change color, location:", loc);
|
||||||
|
if (loc.startsWith("/game"))
|
||||||
|
console.log("in change");
|
||||||
|
if (loc.startsWith("/spectator"))
|
||||||
|
console.log("in change");
|
||||||
|
if (loc.startsWith("/ranking"))
|
||||||
|
console.log("in change");
|
||||||
|
if (loc.startsWith("/profile"))
|
||||||
|
console.log("in change");
|
||||||
|
}
|
||||||
|
|
||||||
|
$: change_color($location);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Layouts color={color} />
|
{#if $location !== '/'}
|
||||||
|
<Layouts color={color} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
<style></style>
|
<style></style>
|
||||||
|
|
||||||
|
|||||||
@@ -56,9 +56,6 @@
|
|||||||
<Button on:click={game_invitation}>
|
<Button on:click={game_invitation}>
|
||||||
game invitation
|
game invitation
|
||||||
</Button>
|
</Button>
|
||||||
<Button>
|
|
||||||
{block}
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
{#if back === "room_set"}
|
{#if back === "room_set"}
|
||||||
<Button>
|
<Button>
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ export async function invite_user(user_name: string)
|
|||||||
|
|
||||||
export async function get_my_rooms()
|
export async function get_my_rooms()
|
||||||
{
|
{
|
||||||
to_print("in get_my_rooms");
|
to_print("-------------------------------------------------------------------------------------------------------in get_my_rooms");
|
||||||
|
|
||||||
let response: FetchResponse = await fetch_chat_request('myrooms', FetchMethod.GET);
|
let response: FetchResponse = await fetch_chat_request('myrooms', FetchMethod.GET);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user