Use search stats to populate search menu

This commit is contained in:
eikek
2021-10-05 10:27:21 +02:00
parent e52271f9cd
commit e961a5ac10
14 changed files with 257 additions and 55 deletions

View File

@ -15,6 +15,7 @@ module Comp.SearchMenu exposing
, isFulltextSearch
, isNamesSearch
, linkTargetMsg
, setFromStats
, textSearchString
, update
, updateDrop
@ -379,6 +380,11 @@ type Msg
| ToggleOpenAllAkkordionTabs
setFromStats : SearchStats -> Msg
setFromStats stats =
GetStatsResp (Ok stats)
linkTargetMsg : LinkTarget -> Maybe Msg
linkTargetMsg linkTarget =
case linkTarget of

View File

@ -245,6 +245,12 @@ makeWorkModel sel model =
}
noEmptyTags : Model -> Bool
noEmptyTags model =
Dict.filter (\k -> \v -> v.count == 0) model.availableTags
|> Dict.isEmpty
type Msg
= ToggleTag String
| ToggleCat String
@ -422,6 +428,7 @@ viewTagsDrop2 texts ddm wm settings model =
[ a
[ class S.secondaryBasicButtonPlain
, class "border rounded flex-none px-1 py-1"
, classList [ ( "hidden", noEmptyTags model ) ]
, href "#"
, onClick ToggleShowEmpty
]