Added message dot
This commit is contained in:
parent
9d6bb0e583
commit
8b2a35dcce
4 changed files with 38 additions and 12 deletions
|
|
@ -53,6 +53,7 @@
|
||||||
<main class="pt-16 px-6 pb-8 w-full h-full container" id="app">
|
<main class="pt-16 px-6 pb-8 w-full h-full container" id="app">
|
||||||
</main>
|
</main>
|
||||||
<button id="chatButton" class="chat-button transition">💬</button>
|
<button id="chatButton" class="chat-button transition">💬</button>
|
||||||
|
<div id="chatMessageIn" class="chat-buttonMsg transition">🔴</div>
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script type="module" src="/src/pages/"></script>
|
<script type="module" src="/src/pages/"></script>
|
||||||
<script type="module" src="/src/carousel"></script>
|
<script type="module" src="/src/carousel"></script>
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@
|
||||||
top-4
|
top-4
|
||||||
left-6
|
left-6
|
||||||
}
|
}
|
||||||
|
overlay
|
||||||
.b-TTTgame {
|
.b-TTTgame {
|
||||||
@apply
|
@apply
|
||||||
absolute
|
absolute
|
||||||
|
|
@ -343,6 +343,23 @@ div-private {
|
||||||
hover:bg-red-700
|
hover:bg-red-700
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat-buttonMsg {
|
||||||
|
@apply
|
||||||
|
z-100
|
||||||
|
align-text-top
|
||||||
|
text-xs
|
||||||
|
fixed bottom-15
|
||||||
|
right-9
|
||||||
|
w-2
|
||||||
|
h-2
|
||||||
|
z-300
|
||||||
|
rounded-full
|
||||||
|
shadow-lg
|
||||||
|
flex items-center
|
||||||
|
justify-center
|
||||||
|
hover:bg-red-700
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.hidden{
|
.hidden{
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,7 @@ import type {
|
||||||
ClientProfilPartial,
|
ClientProfilPartial,
|
||||||
} from "./types_front";
|
} from "./types_front";
|
||||||
import type { User } from "@app/auth";
|
import type { User } from "@app/auth";
|
||||||
import {
|
import { navigateTo } from "@app/routing";
|
||||||
addRoute,
|
|
||||||
navigateTo,
|
|
||||||
setTitle,
|
|
||||||
type RouteHandlerParams,
|
|
||||||
type RouteHandlerReturn,
|
|
||||||
} from "@app/routing";
|
|
||||||
import authHtml from "./chat.html?raw";
|
import authHtml from "./chat.html?raw";
|
||||||
import { getUser } from "@app/auth";
|
import { getUser } from "@app/auth";
|
||||||
import { listBuddies } from "./chatHelperFunctions/listBuddies";
|
import { listBuddies } from "./chatHelperFunctions/listBuddies";
|
||||||
|
|
@ -33,7 +27,6 @@ import { quitChat } from "./chatHelperFunctions/quitChat";
|
||||||
import { openMessagePopup } from "./chatHelperFunctions/openMessagePopup";
|
import { openMessagePopup } from "./chatHelperFunctions/openMessagePopup";
|
||||||
import { windowStateVisable } from "./chatHelperFunctions/windowStateVisable";
|
import { windowStateVisable } from "./chatHelperFunctions/windowStateVisable";
|
||||||
import { cmdList } from "./chatHelperFunctions/cmdList";
|
import { cmdList } from "./chatHelperFunctions/cmdList";
|
||||||
import { showInfo } from "../toast";
|
|
||||||
import { actionBtnTTTGames } from "./chatHelperFunctions/actionBtnTTTGames";
|
import { actionBtnTTTGames } from "./chatHelperFunctions/actionBtnTTTGames";
|
||||||
|
|
||||||
const MAX_SYSTEM_MESSAGES = 10;
|
const MAX_SYSTEM_MESSAGES = 10;
|
||||||
|
|
@ -71,6 +64,7 @@ const buddies = document.getElementById("div-buddies") as HTMLDivElement;
|
||||||
const buttonMessage = document.getElementById("close-modal-message") ?? null;
|
const buttonMessage = document.getElementById("close-modal-message") ?? null;
|
||||||
const buttonPro = document.getElementById("close-modal") ?? null;
|
const buttonPro = document.getElementById("close-modal") ?? null;
|
||||||
const chatButton = document.querySelector("#chatButton");
|
const chatButton = document.querySelector("#chatButton");
|
||||||
|
const chatMessageIn = document.querySelector("#chatMessageIn");
|
||||||
const chatWindow = document.querySelector("#t-chatbox")!;
|
const chatWindow = document.querySelector("#t-chatbox")!;
|
||||||
const clearText = document.getElementById("b-clear") as HTMLButtonElement;
|
const clearText = document.getElementById("b-clear") as HTMLButtonElement;
|
||||||
const gameMessage = document.getElementById("game-modal") ?? null;
|
const gameMessage = document.getElementById("game-modal") ?? null;
|
||||||
|
|
@ -129,6 +123,8 @@ function initChatSocket() {
|
||||||
systemWindow.appendChild(messageElement);
|
systemWindow.appendChild(messageElement);
|
||||||
systemWindow.scrollTop = systemWindow.scrollHeight;
|
systemWindow.scrollTop = systemWindow.scrollHeight;
|
||||||
});
|
});
|
||||||
|
chatMessageIn?.classList.add("hidden");
|
||||||
|
|
||||||
|
|
||||||
// Listen for messages from the server "MsgObjectServer"
|
// Listen for messages from the server "MsgObjectServer"
|
||||||
socket.on("MsgObjectServer", (data: { message: ClientMessage }) => {
|
socket.on("MsgObjectServer", (data: { message: ClientMessage }) => {
|
||||||
|
|
@ -137,6 +133,8 @@ function initChatSocket() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatWindow && data.message.destination === "") {
|
if (chatWindow && data.message.destination === "") {
|
||||||
|
chatMessageIn?.classList.remove("hidden");
|
||||||
|
chatMessageIn!.textContent = '🔵';
|
||||||
const messageElement = document.createElement("div");
|
const messageElement = document.createElement("div");
|
||||||
messageElement.textContent = `${data.message.user}: ${data.message.text}`;
|
messageElement.textContent = `${data.message.user}: ${data.message.text}`;
|
||||||
chatWindow.appendChild(messageElement);
|
chatWindow.appendChild(messageElement);
|
||||||
|
|
@ -144,6 +142,8 @@ function initChatSocket() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatWindow && data.message.destination === "privateMsg") {
|
if (chatWindow && data.message.destination === "privateMsg") {
|
||||||
|
chatMessageIn?.classList.remove("hidden");
|
||||||
|
chatMessageIn!.textContent = '🔴';
|
||||||
const messageElement = document.createElement("div-private");
|
const messageElement = document.createElement("div-private");
|
||||||
messageElement.textContent = `🔒${data.message.user}: ${data.message.text}`;
|
messageElement.textContent = `🔒${data.message.user}: ${data.message.text}`;
|
||||||
chatWindow.appendChild(messageElement);
|
chatWindow.appendChild(messageElement);
|
||||||
|
|
@ -151,6 +151,8 @@ function initChatSocket() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatWindow && data.message.destination === "inviteMsg") {
|
if (chatWindow && data.message.destination === "inviteMsg") {
|
||||||
|
chatMessageIn?.classList.remove("hidden");
|
||||||
|
chatMessageIn!.textContent = '🟢';
|
||||||
const messageElement = document.createElement("div-private");
|
const messageElement = document.createElement("div-private");
|
||||||
const chatWindow = document.getElementById(
|
const chatWindow = document.getElementById(
|
||||||
"t-chatbox",
|
"t-chatbox",
|
||||||
|
|
@ -461,11 +463,14 @@ chatButton!.addEventListener("click",() => {
|
||||||
let socket = window.__state.chatSock;
|
let socket = window.__state.chatSock;
|
||||||
if (!socket) return;
|
if (!socket) return;
|
||||||
connected(socket);
|
connected(socket);
|
||||||
|
chatMessageIn?.classList.add("hidden");
|
||||||
|
chatMessageIn!.textContent = '';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
chatBox.classList.toggle("hidden");
|
chatBox.classList.toggle("hidden");
|
||||||
overlay.classList.remove("opacity-60");
|
overlay.classList.remove("opacity-60");
|
||||||
windowStateHidden();
|
windowStateHidden();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import { windowStateHidden } from "./windowStateHidden";
|
||||||
export async function quitChat () {
|
export async function quitChat () {
|
||||||
const chatBox = document.getElementById("chatBox")!;
|
const chatBox = document.getElementById("chatBox")!;
|
||||||
const overlay = document.querySelector('#overlay')!;
|
const overlay = document.querySelector('#overlay')!;
|
||||||
|
const chatMessageIn = document.querySelector("#chatMessageIn");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (chatBox.classList.contains('hidden')) {
|
if (chatBox.classList.contains('hidden')) {
|
||||||
|
|
@ -21,6 +22,8 @@ export async function quitChat () {
|
||||||
await windowStateHidden();
|
await windowStateHidden();
|
||||||
chatBox.classList.toggle('hidden');
|
chatBox.classList.toggle('hidden');
|
||||||
overlay.classList.remove('opacity-60');
|
overlay.classList.remove('opacity-60');
|
||||||
|
chatMessageIn?.classList.remove("hidden");
|
||||||
|
chatMessageIn!.textContent = '';
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showError('Failed to Quit Chat: Unknown error');
|
showError('Failed to Quit Chat: Unknown error');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue