Rename chat component to ChatBox

This commit is contained in:
James Lyne 2021-01-06 16:02:36 +00:00
parent 416a2963c3
commit ae377b8a26
8 changed files with 17 additions and 17 deletions

View File

@ -17,14 +17,14 @@
<template> <template>
<Map></Map> <Map></Map>
<Sidebar></Sidebar> <Sidebar></Sidebar>
<Chat v-if="chatEnabled" v-show="chatEnabled && chatVisible"></Chat> <ChatBox v-if="chatBoxEnabled" v-show="chatBoxEnabled && chatVisible"></ChatBox>
</template> </template>
<script lang="ts"> <script lang="ts">
import {computed, defineComponent, onBeforeUnmount, onMounted, onUnmounted, ref, watch} from 'vue'; import {computed, defineComponent, onBeforeUnmount, onMounted, onUnmounted, ref, watch} from 'vue';
import Map from './components/Map.vue'; import Map from './components/Map.vue';
import Sidebar from './components/Sidebar.vue'; import Sidebar from './components/Sidebar.vue';
import Chat from './components/Chat.vue'; import ChatBox from './components/ChatBox.vue';
import {useStore} from "./store"; import {useStore} from "./store";
import {ActionTypes} from "@/store/action-types"; import {ActionTypes} from "@/store/action-types";
import Util from '@/util'; import Util from '@/util';
@ -35,7 +35,7 @@ export default defineComponent({
components: { components: {
Map, Map,
Sidebar, Sidebar,
Chat ChatBox
}, },
setup() { setup() {
@ -43,7 +43,7 @@ export default defineComponent({
updateInterval = computed(() => store.state.configuration.updateInterval), updateInterval = computed(() => store.state.configuration.updateInterval),
title = computed(() => store.state.configuration.title), title = computed(() => store.state.configuration.title),
currentUrl = computed(() => store.getters.url), 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')), chatVisible = computed(() => store.state.ui.visibleElements.has('chat')),
updatesEnabled = ref(false), updatesEnabled = ref(false),
updateTimeout = ref(0), updateTimeout = ref(0),
@ -121,7 +121,7 @@ export default defineComponent({
onUnmounted(() => window.addEventListener('resize', onResize)); onUnmounted(() => window.addEventListener('resize', onResize));
return { return {
chatEnabled, chatBoxEnabled,
chatVisible, chatVisible,
} }
}, },

View File

@ -123,7 +123,7 @@ function buildComponents(response: any): DynmapComponentConfig {
markers: { markers: {
showLabels: false, showLabels: false,
}, },
chat: undefined, chatBox: undefined,
chatBalloons: false, chatBalloons: false,
playerMarkers: undefined, playerMarkers: undefined,
coordinatesControl: undefined, coordinatesControl: undefined,
@ -190,7 +190,7 @@ function buildComponents(response: any): DynmapComponentConfig {
break; break;
case "chatbox": case "chatbox":
components.chat = { components.chatBox = {
allowUrlName: component.allowurlname || false, allowUrlName: component.allowurlname || false,
showPlayerFaces: component.showplayerfaces || false, showPlayerFaces: component.showplayerfaces || false,
messageLifetime: component.messagettl || Infinity, messageLifetime: component.messagettl || Infinity,

View File

@ -24,7 +24,7 @@
<CoordinatesControl v-if="coordinatesControlEnabled" :leaflet="leaflet"></CoordinatesControl> <CoordinatesControl v-if="coordinatesControlEnabled" :leaflet="leaflet"></CoordinatesControl>
<LinkControl v-if="linkControlEnabled" :leaflet="leaflet"></LinkControl> <LinkControl v-if="linkControlEnabled" :leaflet="leaflet"></LinkControl>
<ClockControl v-if="clockControlEnabled" :leaflet="leaflet"></ClockControl> <ClockControl v-if="clockControlEnabled" :leaflet="leaflet"></ClockControl>
<ChatControl v-if="chatEnabled" :leaflet="leaflet"></ChatControl> <ChatControl v-if="chatBoxEnabled" :leaflet="leaflet"></ChatControl>
</div> </div>
</template> </template>
@ -70,7 +70,7 @@ export default defineComponent({
coordinatesControlEnabled = computed(() => store.getters.coordinatesControlEnabled), coordinatesControlEnabled = computed(() => store.getters.coordinatesControlEnabled),
clockControlEnabled = computed(() => store.getters.clockControlEnabled), clockControlEnabled = computed(() => store.getters.clockControlEnabled),
linkControlEnabled = computed(() => store.state.components.linkControl), linkControlEnabled = computed(() => store.state.components.linkControl),
chatEnabled = computed(() => store.state.components.chat), chatBoxEnabled = computed(() => store.state.components.chatBox),
logoControls = computed(() => store.state.components.logoControls), logoControls = computed(() => store.state.components.logoControls),
currentWorld = computed(() => store.state.currentWorld), currentWorld = computed(() => store.state.currentWorld),
@ -94,7 +94,7 @@ export default defineComponent({
coordinatesControlEnabled, coordinatesControlEnabled,
clockControlEnabled, clockControlEnabled,
linkControlEnabled, linkControlEnabled,
chatEnabled, chatBoxEnabled,
logoControls, logoControls,
followTarget, followTarget,
panTarget, panTarget,

View File

@ -40,7 +40,7 @@
setup(props) { setup(props) {
const store = useStore(); const store = useStore();
let image = ref(defaultImage), 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'), showSender = computed(() => props.message.playerName && props.message.type === 'chat'),
messageContent = computed(() => { messageContent = computed(() => {
switch(props.message.type) { switch(props.message.type) {

2
src/dynmap.d.ts vendored
View File

@ -80,7 +80,7 @@ interface DynmapComponentConfig {
clockControl ?: ClockControlOptions; clockControl ?: ClockControlOptions;
linkControl: boolean; linkControl: boolean;
logoControls: Array<LogoControlOptions>; logoControls: Array<LogoControlOptions>;
chat?: DynmapChatConfig; chatBox?: DynmapChatConfig;
chatBalloons: boolean; chatBalloons: boolean;
} }

View File

@ -243,8 +243,8 @@ export const mutations: MutationTree<State> & Mutations = {
[MutationTypes.ADD_CHAT](state: State, chat: Array<DynmapChat>) { [MutationTypes.ADD_CHAT](state: State, chat: Array<DynmapChat>) {
state.chat.messages.unshift(...chat); state.chat.messages.unshift(...chat);
if(state.components.chat && isFinite(state.components.chat.messageHistory)) { if(state.components.chatBox && isFinite(state.components.chatBox.messageHistory)) {
state.chat.messages.splice(state.components.chat.messageHistory); state.chat.messages.splice(state.components.chatBox.messageHistory);
} }
}, },

View File

@ -135,10 +135,10 @@ export const state: State = {
//Optional "logo" controls. //Optional "logo" controls.
logoControls: [], logoControls: [],
//Chat //Chat box
chat: undefined, chatBox: undefined,
//Show chat messages above player markers //Chat balloons showing messages above player markers
chatBalloons: false chatBalloons: false
}, },