Move lesser used menubar items into a menu

This commit is contained in:
eikek
2021-12-31 23:40:40 +01:00
parent 05229a7e9c
commit f914aa723e
6 changed files with 107 additions and 47 deletions

View File

@@ -872,7 +872,7 @@ update mId key flags texts settings msg model =
cmd =
Api.saveClientSettings flags newSettings (ClientSettingsSaveResp newSettings)
in
noSub ( model, cmd )
noSub ( { model | viewMenuOpen = False }, cmd )
ClientSettingsSaveResp newSettings (Ok res) ->
if res.success then
@@ -922,7 +922,7 @@ update mId key flags texts settings msg model =
( pm, pc ) =
Comp.PublishItems.initQuery flags q
in
noSub ( { model | viewMode = PublishView pm }, Cmd.map PublishViewMsg pc )
noSub ( { model | viewMode = PublishView pm, viewMenuOpen = False }, Cmd.map PublishViewMsg pc )
Nothing ->
noSub ( model, Cmd.none )

View File

@@ -254,29 +254,26 @@ defaultMenuBar texts flags settings model =
isListView =
settings.itemSearchArrange == Data.ItemArrange.List
menuSep =
{ icon = i [] []
, label = "separator"
, disabled = False
, attrs =
[]
}
in
MB.view
{ end =
{ start =
[ MB.CustomElement <|
B.secondaryBasicButton
{ label = ""
, icon = Icons.share
, disabled = createQuery model == Nothing
, handler = onClick TogglePublishCurrentQueryView
, attrs =
[ title <|
if createQuery model == Nothing then
texts.nothingSelectedToShare
if settings.powerSearchEnabled then
powerSearchBar
else
texts.publishCurrentQueryTitle
, classList
[ ( btnStyle, True )
]
, href "#"
]
}
, MB.CustomElement <|
else
simpleSearchBar
]
, end =
[ MB.CustomElement <|
B.secondaryBasicButton
{ label = ""
, icon =
@@ -300,7 +297,7 @@ defaultMenuBar texts flags settings model =
]
}
, MB.Dropdown
{ linkIcon = "fa fa-grip-vertical"
{ linkIcon = "fa fa-bars"
, label = ""
, linkClass =
[ ( S.secondaryBasicButton, True )
@@ -314,6 +311,7 @@ defaultMenuBar texts flags settings model =
else
i [ class "fa fa-square font-thin" ] []
, disabled = False
, label = texts.showItemGroups
, attrs =
[ href "#"
@@ -326,6 +324,7 @@ defaultMenuBar texts flags settings model =
else
i [ class "fa fa-list" ] []
, disabled = False
, label = texts.listView
, attrs =
[ href "#"
@@ -338,6 +337,7 @@ defaultMenuBar texts flags settings model =
else
i [ class "fa fa-th-large" ] []
, disabled = False
, label = texts.tileView
, attrs =
[ href "#"
@@ -346,36 +346,49 @@ defaultMenuBar texts flags settings model =
}
, { icon = i [ class "fa fa-compress" ] []
, label = texts.expandCollapseRows
, disabled = False
, attrs =
[ href "#"
, classList [ ( "hidden", not isListView ) ]
, onClick ToggleExpandCollapseRows
]
}
]
}
]
, start =
[ MB.CustomElement <|
if settings.powerSearchEnabled then
powerSearchBar
, menuSep
, { label = "Share Results"
, icon = Icons.shareIcon ""
, disabled = createQuery model == Nothing
, attrs =
[ title <|
if createQuery model == Nothing then
texts.nothingSelectedToShare
else
simpleSearchBar
, MB.CustomButton
{ tagger = TogglePreviewFullWidth
, label = ""
, icon = Just "fa fa-expand"
, title =
if settings.cardPreviewFullWidth then
texts.fullHeightPreviewTitle
else
texts.publishCurrentQueryTitle
, href "#"
, if createQuery model == Nothing then
class ""
else
texts.fullWidthPreviewTitle
, inputClass =
[ ( btnStyle, True )
, ( "hidden sm:inline-block", False )
, ( "bg-gray-200 dark:bg-slate-600", settings.cardPreviewFullWidth )
else
onClick TogglePublishCurrentQueryView
]
}
, { label =
if settings.cardPreviewFullWidth then
texts.fullHeightPreviewTitle
else
texts.fullWidthPreviewTitle
, icon = i [ class "fa fa-expand" ] []
, disabled = False
, attrs =
[ href "#"
, onClick TogglePreviewFullWidth
, classList
[ ( "hidden sm:inline-block", False )
, ( "bg-gray-200 dark:bg-slate-600", settings.cardPreviewFullWidth )
]
]
}
]
}
]

View File

@@ -125,6 +125,7 @@ view texts flags model =
else
i [ class "fa fa-square font-thin" ] []
, label = texts.showItemGroups
, disabled = False
, attrs =
[ href "#"
, onClick ToggleShowGroups
@@ -132,6 +133,7 @@ view texts flags model =
}
, { icon = i [ class "fa fa-list" ] []
, label = texts.listView
, disabled = False
, attrs =
[ href "#"
, onClick (ToggleArrange Data.ItemArrange.List)
@@ -139,6 +141,7 @@ view texts flags model =
}
, { icon = i [ class "fa fa-th-large" ] []
, label = texts.tileView
, disabled = False
, attrs =
[ href "#"
, onClick (ToggleArrange Data.ItemArrange.Cards)