Show delete/restore buttons conditionally

When only trashed items are selected, the "delete" button doesn't make
sense and vice versa.
This commit is contained in:
eikek 2021-08-15 12:41:10 +02:00
parent f4a2b86ea8
commit bc6924fd5d

View File

@ -16,6 +16,7 @@ import Comp.SearchMenu
import Comp.SearchStatsView import Comp.SearchStatsView
import Data.Flags exposing (Flags) import Data.Flags exposing (Flags)
import Data.ItemSelection import Data.ItemSelection
import Data.SearchMode
import Data.UiSettings exposing (UiSettings) import Data.UiSettings exposing (UiSettings)
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (..)
@ -78,6 +79,7 @@ confirmModal texts model =
texts.basics.yes texts.basics.yes
texts.basics.no texts.basics.no
texts.reallyDeleteQuestion texts.reallyDeleteQuestion
ConfirmRestore -> ConfirmRestore ->
Comp.ConfirmModal.defaultSettings Comp.ConfirmModal.defaultSettings
RestoreSelectedConfirmed RestoreSelectedConfirmed
@ -85,7 +87,6 @@ confirmModal texts model =
texts.basics.yes texts.basics.yes
texts.basics.no texts.basics.no
texts.reallyRestoreQuestion texts.reallyRestoreQuestion
in in
case model.viewMode of case model.viewMode of
SelectView svm -> SelectView svm ->
@ -270,6 +271,7 @@ editMenuBar texts model svm =
, inputClass = , inputClass =
[ ( btnStyle, True ) [ ( btnStyle, True )
, ( "bg-gray-200 dark:bg-bluegray-600", svm.action == DeleteSelected ) , ( "bg-gray-200 dark:bg-bluegray-600", svm.action == DeleteSelected )
, ( "hidden", model.searchMenuModel.searchMode == Data.SearchMode.Trashed )
] ]
} }
, MB.CustomButton , MB.CustomButton
@ -280,6 +282,7 @@ editMenuBar texts model svm =
, inputClass = , inputClass =
[ ( btnStyle, True ) [ ( btnStyle, True )
, ( "bg-gray-200 dark:bg-bluegray-600", svm.action == RestoreSelected ) , ( "bg-gray-200 dark:bg-bluegray-600", svm.action == RestoreSelected )
, ( "hidden", model.searchMenuModel.searchMode == Data.SearchMode.Normal )
] ]
} }
] ]