Hide sidebar by default on small devices

Closes: #1169
This commit is contained in:
eikek 2021-11-12 23:21:39 +01:00
parent 927c3dfac9
commit 28b4546607
4 changed files with 8 additions and 3 deletions

View File

@ -58,6 +58,7 @@
var elmFlags = {
"account": account,
"pdfSupported": pdfSupported,
"innerWidth": window.innerWidth,
"config": {{{flagsJson}}}
};
</script>

View File

@ -125,7 +125,7 @@ init key url flags_ settings =
, userMenuOpen = False
, subs = Sub.none
, uiSettings = settings
, sidebarVisible = settings.sideMenuVisible
, sidebarVisible = flags.innerWidth > 768 && settings.sideMenuVisible
, anonymousTheme = Data.UiTheme.Light
, anonymousUiLang = Messages.UiLanguage.English
, langMenuOpen = False

View File

@ -14,7 +14,7 @@ import Api
import App.Data exposing (..)
import Browser exposing (UrlRequest(..))
import Browser.Navigation as Nav
import Data.Flags
import Data.Flags exposing (Flags)
import Data.ServerEvent exposing (ServerEvent(..))
import Data.UiSettings exposing (UiSettings)
import Data.UiTheme
@ -349,10 +349,13 @@ applyClientSettings texts model settings =
let
setTheme =
Ports.setUiTheme settings.uiTheme
flags =
model.flags
in
Util.Update.andThen2
[ \m ->
( { m | sidebarVisible = settings.sideMenuVisible }
( { m | sidebarVisible = flags.innerWidth > 768 && settings.sideMenuVisible }
, setTheme
, Sub.none
)

View File

@ -42,6 +42,7 @@ type alias Config =
type alias Flags =
{ account : Maybe AuthResult
, pdfSupported : Bool
, innerWidth : Int
, config : Config
}