Hide player list when playermarkers component is disabled (Fixes #21)

This commit is contained in:
James Lyne 2021-06-23 18:18:42 +01:00
parent 362ac3cbdc
commit f9e55ff673

View File

@ -21,15 +21,17 @@
:aria-label="messageWorlds" :aria-expanded="mapsVisible" @keydown="handleMapsKeydown"> :aria-label="messageWorlds" :aria-expanded="mapsVisible" @keydown="handleMapsKeydown">
<SvgIcon name="maps"></SvgIcon> <SvgIcon name="maps"></SvgIcon>
</button> </button>
<button :class="{'button--players': true}" @click="togglePlayers" :title="messagePlayers" <button v-if="playerMakersEnabled" :class="{'button--players': true}" @click="togglePlayers"
:aria-label="messagePlayers" :aria-expanded="playersVisible" @keydown="handlePlayersKeydown"> title="messagePlayers" :aria-label="messagePlayers" :aria-expanded="playersVisible"
@keydown="handlePlayersKeydown">
<SvgIcon name="players"></SvgIcon> <SvgIcon name="players"></SvgIcon>
</button> </button>
</header> </header>
<div class="sidebar__content" @keydown="handleSidebarKeydown"> <div class="sidebar__content" @keydown="handleSidebarKeydown">
<ServerList v-if="serverCount > 1" v-show="mapsVisible"></ServerList> <ServerList v-if="serverCount > 1" v-show="mapsVisible"></ServerList>
<WorldList v-if="mapCount > 1" v-show="mapsVisible"></WorldList> <WorldList v-if="mapCount > 1" v-show="mapsVisible"></WorldList>
<PlayerList id="players" v-if="previouslyVisible.has('players')" v-show="playersVisible"></PlayerList> <PlayerList id="players" v-if="playerMakersEnabled && previouslyVisible.has('players')"
v-show="playersVisible"></PlayerList>
<FollowTarget v-if="following" v-show="followVisible" :target="following"></FollowTarget> <FollowTarget v-if="following" v-show="followVisible" :target="following"></FollowTarget>
</div> </div>
</section> </section>
@ -73,6 +75,8 @@ export default defineComponent({
messageWorlds = computed(() => store.state.messages.worldsHeading), messageWorlds = computed(() => store.state.messages.worldsHeading),
messagePlayers = computed(() => store.state.messages.playersHeading), messagePlayers = computed(() => store.state.messages.playersHeading),
playerMakersEnabled = computed(() => !!store.state.components.playerMarkers),
playersVisible = computed(() => currentlyVisible.value.has('players')), playersVisible = computed(() => currentlyVisible.value.has('players')),
mapsVisible = computed(() => currentlyVisible.value.has('maps')), mapsVisible = computed(() => currentlyVisible.value.has('maps')),
followVisible = computed(() => { followVisible = computed(() => {
@ -128,6 +132,7 @@ export default defineComponent({
playersVisible, playersVisible,
mapsVisible, mapsVisible,
followVisible, followVisible,
playerMakersEnabled,
handleSidebarKeydown, handleSidebarKeydown,
handleMapsKeydown, handleMapsKeydown,