Rename chat component to ChatBox
This commit is contained in:
parent
416a2963c3
commit
ae377b8a26
10
src/App.vue
10
src/App.vue
@ -17,14 +17,14 @@
|
||||
<template>
|
||||
<Map></Map>
|
||||
<Sidebar></Sidebar>
|
||||
<Chat v-if="chatEnabled" v-show="chatEnabled && chatVisible"></Chat>
|
||||
<ChatBox v-if="chatBoxEnabled" v-show="chatBoxEnabled && chatVisible"></ChatBox>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import {computed, defineComponent, onBeforeUnmount, onMounted, onUnmounted, ref, watch} from 'vue';
|
||||
import Map from './components/Map.vue';
|
||||
import Sidebar from './components/Sidebar.vue';
|
||||
import Chat from './components/Chat.vue';
|
||||
import ChatBox from './components/ChatBox.vue';
|
||||
import {useStore} from "./store";
|
||||
import {ActionTypes} from "@/store/action-types";
|
||||
import Util from '@/util';
|
||||
@ -35,7 +35,7 @@ export default defineComponent({
|
||||
components: {
|
||||
Map,
|
||||
Sidebar,
|
||||
Chat
|
||||
ChatBox
|
||||
},
|
||||
|
||||
setup() {
|
||||
@ -43,7 +43,7 @@ export default defineComponent({
|
||||
updateInterval = computed(() => store.state.configuration.updateInterval),
|
||||
title = computed(() => store.state.configuration.title),
|
||||
currentUrl = computed(() => store.getters.url),
|
||||
chatEnabled = computed(() => store.state.components.chat),
|
||||
chatBoxEnabled = computed(() => store.state.components.chatBox),
|
||||
chatVisible = computed(() => store.state.ui.visibleElements.has('chat')),
|
||||
updatesEnabled = ref(false),
|
||||
updateTimeout = ref(0),
|
||||
@ -121,7 +121,7 @@ export default defineComponent({
|
||||
onUnmounted(() => window.addEventListener('resize', onResize));
|
||||
|
||||
return {
|
||||
chatEnabled,
|
||||
chatBoxEnabled,
|
||||
chatVisible,
|
||||
}
|
||||
},
|
||||
|
@ -123,7 +123,7 @@ function buildComponents(response: any): DynmapComponentConfig {
|
||||
markers: {
|
||||
showLabels: false,
|
||||
},
|
||||
chat: undefined,
|
||||
chatBox: undefined,
|
||||
chatBalloons: false,
|
||||
playerMarkers: undefined,
|
||||
coordinatesControl: undefined,
|
||||
@ -190,7 +190,7 @@ function buildComponents(response: any): DynmapComponentConfig {
|
||||
break;
|
||||
|
||||
case "chatbox":
|
||||
components.chat = {
|
||||
components.chatBox = {
|
||||
allowUrlName: component.allowurlname || false,
|
||||
showPlayerFaces: component.showplayerfaces || false,
|
||||
messageLifetime: component.messagettl || Infinity,
|
||||
|
@ -24,7 +24,7 @@
|
||||
<CoordinatesControl v-if="coordinatesControlEnabled" :leaflet="leaflet"></CoordinatesControl>
|
||||
<LinkControl v-if="linkControlEnabled" :leaflet="leaflet"></LinkControl>
|
||||
<ClockControl v-if="clockControlEnabled" :leaflet="leaflet"></ClockControl>
|
||||
<ChatControl v-if="chatEnabled" :leaflet="leaflet"></ChatControl>
|
||||
<ChatControl v-if="chatBoxEnabled" :leaflet="leaflet"></ChatControl>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -70,7 +70,7 @@ export default defineComponent({
|
||||
coordinatesControlEnabled = computed(() => store.getters.coordinatesControlEnabled),
|
||||
clockControlEnabled = computed(() => store.getters.clockControlEnabled),
|
||||
linkControlEnabled = computed(() => store.state.components.linkControl),
|
||||
chatEnabled = computed(() => store.state.components.chat),
|
||||
chatBoxEnabled = computed(() => store.state.components.chatBox),
|
||||
logoControls = computed(() => store.state.components.logoControls),
|
||||
|
||||
currentWorld = computed(() => store.state.currentWorld),
|
||||
@ -94,7 +94,7 @@ export default defineComponent({
|
||||
coordinatesControlEnabled,
|
||||
clockControlEnabled,
|
||||
linkControlEnabled,
|
||||
chatEnabled,
|
||||
chatBoxEnabled,
|
||||
logoControls,
|
||||
followTarget,
|
||||
panTarget,
|
||||
|
@ -40,7 +40,7 @@
|
||||
setup(props) {
|
||||
const store = useStore();
|
||||
let image = ref(defaultImage),
|
||||
facesEnabled = computed(() => store.state.components.chat?.showPlayerFaces),
|
||||
facesEnabled = computed(() => store.state.components.chatBox?.showPlayerFaces),
|
||||
showSender = computed(() => props.message.playerName && props.message.type === 'chat'),
|
||||
messageContent = computed(() => {
|
||||
switch(props.message.type) {
|
||||
|
2
src/dynmap.d.ts
vendored
2
src/dynmap.d.ts
vendored
@ -80,7 +80,7 @@ interface DynmapComponentConfig {
|
||||
clockControl ?: ClockControlOptions;
|
||||
linkControl: boolean;
|
||||
logoControls: Array<LogoControlOptions>;
|
||||
chat?: DynmapChatConfig;
|
||||
chatBox?: DynmapChatConfig;
|
||||
chatBalloons: boolean;
|
||||
}
|
||||
|
||||
|
@ -243,8 +243,8 @@ export const mutations: MutationTree<State> & Mutations = {
|
||||
[MutationTypes.ADD_CHAT](state: State, chat: Array<DynmapChat>) {
|
||||
state.chat.messages.unshift(...chat);
|
||||
|
||||
if(state.components.chat && isFinite(state.components.chat.messageHistory)) {
|
||||
state.chat.messages.splice(state.components.chat.messageHistory);
|
||||
if(state.components.chatBox && isFinite(state.components.chatBox.messageHistory)) {
|
||||
state.chat.messages.splice(state.components.chatBox.messageHistory);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -135,10 +135,10 @@ export const state: State = {
|
||||
//Optional "logo" controls.
|
||||
logoControls: [],
|
||||
|
||||
//Chat
|
||||
chat: undefined,
|
||||
//Chat box
|
||||
chatBox: undefined,
|
||||
|
||||
//Show chat messages above player markers
|
||||
//Chat balloons showing messages above player markers
|
||||
chatBalloons: false
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user