From 095c0e1bf35ca20e4cd97814be78a22630e73f06 Mon Sep 17 00:00:00 2001 From: James Lyne Date: Sun, 24 Jan 2021 15:46:34 +0000 Subject: [PATCH] Respect sidebaropened dynmap config on larger screens --- src/api.ts | 1 + src/dynmap.d.ts | 1 + src/store/mutations.ts | 5 +++++ src/store/state.ts | 1 + 4 files changed, 8 insertions(+) diff --git a/src/api.ts b/src/api.ts index 425f3a9..584220a 100644 --- a/src/api.ts +++ b/src/api.ts @@ -51,6 +51,7 @@ function buildServerConfig(response: any): DynmapServerConfig { title: response.title || 'Dynmap', loginEnabled: response['login-enabled'] || false, maxPlayers: response.maxcount || 0, + expandUI: response.sidebaropened && response.sidebaropened !== 'false', hash: response.confighash || 0, }; } diff --git a/src/dynmap.d.ts b/src/dynmap.d.ts index a9410e4..d063f1d 100644 --- a/src/dynmap.d.ts +++ b/src/dynmap.d.ts @@ -54,6 +54,7 @@ interface DynmapServerConfig { loginEnabled: boolean; maxPlayers: number; grayHiddenPlayers: boolean; + expandUI: boolean; hash: number; } diff --git a/src/store/mutations.ts b/src/store/mutations.ts index 631bea5..cbdfb48 100644 --- a/src/store/mutations.ts +++ b/src/store/mutations.ts @@ -79,6 +79,11 @@ export const mutations: MutationTree & Mutations = { // Sets configuration options from the initial config fetch [MutationTypes.SET_CONFIGURATION](state: State, config: DynmapServerConfig) { 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 diff --git a/src/store/state.ts b/src/store/state.ts index 2608234..2ce3eac 100644 --- a/src/store/state.ts +++ b/src/store/state.ts @@ -82,6 +82,7 @@ export const state: State = { loginEnabled: false, maxPlayers: 0, grayHiddenPlayers: false, + expandUI: false, hash: 0, },