Merge pull request #1540 from thecodingmachine/TypoChatMessage
Typo Chat message Store
This commit is contained in:
commit
1f3b712097
@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import type {PlayerInterface} from "../../Phaser/Game/PlayerInterface";
|
||||
import {chatSubMenuVisbilityStore} from "../../Stores/ChatStore";
|
||||
import {chatSubMenuVisibilityStore} from "../../Stores/ChatStore";
|
||||
import {onDestroy, onMount} from "svelte";
|
||||
import type {Unsubscriber} from "svelte/store";
|
||||
import ChatSubMenu from "./ChatSubMenu.svelte";
|
||||
@ -12,11 +12,11 @@
|
||||
let chatSubMenuVisivilytUnsubcribe: Unsubscriber;
|
||||
|
||||
function openSubMenu() {
|
||||
chatSubMenuVisbilityStore.openSubMenu(player.name, line);
|
||||
chatSubMenuVisibilityStore.openSubMenu(player.name, line);
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
chatSubMenuVisivilytUnsubcribe = chatSubMenuVisbilityStore.subscribe((newValue) => {
|
||||
chatSubMenuVisivilytUnsubcribe = chatSubMenuVisibilityStore.subscribe((newValue) => {
|
||||
isSubMenuOpen = (newValue === player.name + line);
|
||||
})
|
||||
})
|
||||
|
@ -84,7 +84,12 @@ function createChatMessagesStore() {
|
||||
addExternalMessage(authorId: number, text: string) {
|
||||
update((list) => {
|
||||
const lastMessage = list[list.length - 1];
|
||||
if (lastMessage && lastMessage.type === ChatMessageTypes.text && lastMessage.text && lastMessage?.author?.userId === authorId) {
|
||||
if (
|
||||
lastMessage &&
|
||||
lastMessage.type === ChatMessageTypes.text &&
|
||||
lastMessage.text &&
|
||||
lastMessage?.author?.userId === authorId
|
||||
) {
|
||||
lastMessage.text.push(text);
|
||||
} else {
|
||||
list.push({
|
||||
@ -116,4 +121,4 @@ function createChatSubMenuVisibilityStore() {
|
||||
};
|
||||
}
|
||||
|
||||
export const chatSubMenuVisbilityStore = createChatSubMenuVisibilityStore();
|
||||
export const chatSubMenuVisibilityStore = createChatSubMenuVisibilityStore();
|
||||
|
Loading…
Reference in New Issue
Block a user