Player list heading fixes

This commit is contained in:
James Lyne 2021-07-29 19:16:37 +01:00
parent f4aca39975
commit b143fc1561
3 changed files with 9 additions and 6 deletions

View File

@ -74,7 +74,7 @@ export default defineComponent({
following = computed(() => store.state.followTarget),
messageWorlds = computed(() => store.state.messages.worldsHeading),
messagePlayers = computed(() => store.state.messages.playersHeading),
messagePlayers = computed(() => store.getters.playersHeading),
playerMakersEnabled = computed(() => !!store.state.components.playerMarkers),

View File

@ -49,11 +49,7 @@ export default defineComponent({
setup() {
const store = useStore(),
messageHeading = computed(() => {
return store.state.messages.playersHeading
.replace('{cur}', players.value.length.toString())
.replace('{max}', maxPlayers.value.toString());
}),
messageHeading = computed(() => store.getters.playersHeading),
messageSkeletonPlayers = computed(() => store.state.messages.playersSkeleton),
messageSkeletonPlayersSearch = computed(() => store.state.messages.playersSearchSkeleton),
messagePlayersSearchPlaceholder = computed(() => store.state.messages.playersSearchPlaceholder),

View File

@ -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;
playersHeading(state: State, getters: GetterTree<State, State> & Getters): string;
}
export const getters: GetterTree<State, State> & Getters = {
@ -72,4 +73,10 @@ export const getters: GetterTree<State, State> & Getters = {
return getUrlForLocation(state.currentMap, {x,y,z}, zoom);
},
playersHeading(state: State): string {
return state.messages.playersHeading
.replace('{cur}', state.players.size.toString())
.replace('{max}', state.maxPlayers.toString());
}
}