Respect sidebaropened dynmap config on larger screens

This commit is contained in:
James Lyne 2021-01-24 15:46:34 +00:00
parent ed2472dc55
commit 095c0e1bf3
4 changed files with 8 additions and 0 deletions

View File

@ -51,6 +51,7 @@ function buildServerConfig(response: any): DynmapServerConfig {
title: response.title || 'Dynmap', title: response.title || 'Dynmap',
loginEnabled: response['login-enabled'] || false, loginEnabled: response['login-enabled'] || false,
maxPlayers: response.maxcount || 0, maxPlayers: response.maxcount || 0,
expandUI: response.sidebaropened && response.sidebaropened !== 'false',
hash: response.confighash || 0, hash: response.confighash || 0,
}; };
} }

1
src/dynmap.d.ts vendored
View File

@ -54,6 +54,7 @@ interface DynmapServerConfig {
loginEnabled: boolean; loginEnabled: boolean;
maxPlayers: number; maxPlayers: number;
grayHiddenPlayers: boolean; grayHiddenPlayers: boolean;
expandUI: boolean;
hash: number; hash: number;
} }

View File

@ -79,6 +79,11 @@ export const mutations: MutationTree<State> & Mutations = {
// Sets configuration options from the initial config fetch // Sets configuration options from the initial config fetch
[MutationTypes.SET_CONFIGURATION](state: State, config: DynmapServerConfig) { [MutationTypes.SET_CONFIGURATION](state: State, config: DynmapServerConfig) {
state.configuration = Object.assign(state.configuration, config); state.configuration = Object.assign(state.configuration, config);
if(state.configuration.expandUI && !state.ui.smallScreen) {
state.ui.visibleElements.add('players');
state.ui.visibleElements.add('maps');
}
}, },
//Set messsages from the initial config fetch //Set messsages from the initial config fetch

View File

@ -82,6 +82,7 @@ export const state: State = {
loginEnabled: false, loginEnabled: false,
maxPlayers: 0, maxPlayers: 0,
grayHiddenPlayers: false, grayHiddenPlayers: false,
expandUI: false,
hash: 0, hash: 0,
}, },