Fix placeholders in Pl3xmap page title
This commit is contained in:
parent
f0a325ad99
commit
13260bbfeb
@ -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),
|
||||
|
@ -25,6 +25,7 @@ export type Getters = {
|
||||
night(state: State): boolean;
|
||||
mapBackground(state: State, getters: GetterTree<State, State> & Getters): string;
|
||||
url(state: State, getters: GetterTree<State, State> & Getters): string;
|
||||
pageTitle(state: State, getters: GetterTree<State, State> & Getters): string;
|
||||
playersHeading(state: State, getters: GetterTree<State, State> & Getters): string;
|
||||
}
|
||||
|
||||
@ -74,6 +75,12 @@ export const getters: GetterTree<State, State> & 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())
|
||||
|
Loading…
Reference in New Issue
Block a user