From 13260bbfebb5dfb4f70f33db9bc9534d16ca147d Mon Sep 17 00:00:00 2001 From: James Lyne Date: Thu, 12 Aug 2021 14:27:39 +0100 Subject: [PATCH] Fix placeholders in Pl3xmap page title --- src/App.vue | 2 +- src/store/getters.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/App.vue b/src/App.vue index f22bbee..d34050a 100644 --- a/src/App.vue +++ b/src/App.vue @@ -43,7 +43,7 @@ export default defineComponent({ setup() { const store = useStore(), - title = computed(() => store.state.configuration.title), + title = computed(() => store.getters.pageTitle), currentUrl = computed(() => store.getters.url), currentServer = computed(() => store.state.currentServer), configurationHash = computed(() => store.state.configurationHash), diff --git a/src/store/getters.ts b/src/store/getters.ts index 189efba..56baffb 100644 --- a/src/store/getters.ts +++ b/src/store/getters.ts @@ -25,6 +25,7 @@ export type Getters = { night(state: State): boolean; mapBackground(state: State, getters: GetterTree & Getters): string; url(state: State, getters: GetterTree & Getters): string; + pageTitle(state: State, getters: GetterTree & Getters): string; playersHeading(state: State, getters: GetterTree & Getters): string; } @@ -74,6 +75,12 @@ export const getters: GetterTree & Getters = { return getUrlForLocation(state.currentMap, {x,y,z}, zoom); }, + pageTitle(state: State): string { + return state.configuration.title + .replace(/{world}/gi, state.currentWorld?.displayName || 'No world') + .replace(/{map}/gi, state.currentMap?.displayName || 'No map'); + }, + playersHeading(state: State): string { return state.messages.playersHeading .replace('{cur}', state.players.size.toString())