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), following = computed(() => store.state.followTarget),
messageWorlds = computed(() => store.state.messages.worldsHeading), messageWorlds = computed(() => store.state.messages.worldsHeading),
messagePlayers = computed(() => store.state.messages.playersHeading), messagePlayers = computed(() => store.getters.playersHeading),
playerMakersEnabled = computed(() => !!store.state.components.playerMarkers), playerMakersEnabled = computed(() => !!store.state.components.playerMarkers),

View File

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

View File

@ -25,6 +25,7 @@ export type Getters = {
night(state: State): boolean; night(state: State): boolean;
mapBackground(state: State, getters: GetterTree<State, State> & Getters): string; mapBackground(state: State, getters: GetterTree<State, State> & Getters): string;
url(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 = { 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); 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());
}
} }