diff --git a/modules/webapp/src/main/elm/Comp/ChannelMenu.elm b/modules/webapp/src/main/elm/Comp/ChannelMenu.elm index 7c948d2d..ad162001 100644 --- a/modules/webapp/src/main/elm/Comp/ChannelMenu.elm +++ b/modules/webapp/src/main/elm/Comp/ChannelMenu.elm @@ -41,6 +41,7 @@ menuItem : Texts -> Model msg -> ChannelType -> MB.DropdownMenu msg menuItem texts model ct = { icon = Data.ChannelType.icon ct "w-6 h-6 text-center inline-block" , label = texts ct + , disabled = False , attrs = [ href "" , onClick (model.onItem ct) diff --git a/modules/webapp/src/main/elm/Comp/ItemDetail/SingleAttachment.elm b/modules/webapp/src/main/elm/Comp/ItemDetail/SingleAttachment.elm index 7c8bd0fb..52942e49 100644 --- a/modules/webapp/src/main/elm/Comp/ItemDetail/SingleAttachment.elm +++ b/modules/webapp/src/main/elm/Comp/ItemDetail/SingleAttachment.elm @@ -228,6 +228,7 @@ attachHeader texts settings model _ attach = , items = [ { icon = i [ class "fa fa-download" ] [] , label = texts.downloadFile + , disabled = False , attrs = [ download attachName , href fileUrl @@ -235,6 +236,7 @@ attachHeader texts settings model _ attach = } , { icon = i [ class "fa fa-file" ] [] , label = texts.renameFile + , disabled = False , attrs = [ href "#" , onClick (EditAttachNameStart attach.id) @@ -242,6 +244,7 @@ attachHeader texts settings model _ attach = } , { icon = i [ class "fa fa-file-archive" ] [] , label = texts.downloadOriginalArchiveFile + , disabled = False , attrs = [ href (fileUrl ++ "/archive") , target "_new" @@ -250,6 +253,7 @@ attachHeader texts settings model _ attach = } , { icon = i [ class "fa fa-external-link-alt" ] [] , label = texts.originalFile + , disabled = False , attrs = [ href (fileUrl ++ "/original") , target "_new" @@ -263,6 +267,7 @@ attachHeader texts settings model _ attach = else i [ class "fa fa-toggle-off" ] [] , label = texts.viewExtractedData + , disabled = False , attrs = [ onClick (AttachMetaClick attach.id) , href "#" @@ -270,6 +275,7 @@ attachHeader texts settings model _ attach = } , { icon = i [ class "fa fa-redo-alt" ] [] , label = texts.reprocessFile + , disabled = False , attrs = [ onClick (RequestReprocessFile attach.id) , href "#" @@ -277,6 +283,7 @@ attachHeader texts settings model _ attach = } , { icon = i [ class Icons.showQr ] [] , label = texts.showQrCode + , disabled = False , attrs = [ onClick (ToggleShowQrAttach attach.id) , href "#" @@ -284,6 +291,7 @@ attachHeader texts settings model _ attach = } , { icon = i [ class "fa fa-trash" ] [] , label = texts.deleteThisFile + , disabled = False , attrs = [ onClick (RequestDeleteAttachment attach.id) , href "#" diff --git a/modules/webapp/src/main/elm/Comp/MenuBar.elm b/modules/webapp/src/main/elm/Comp/MenuBar.elm index df7cceea..c25fa281 100644 --- a/modules/webapp/src/main/elm/Comp/MenuBar.elm +++ b/modules/webapp/src/main/elm/Comp/MenuBar.elm @@ -96,6 +96,7 @@ type alias DropdownData msg = type alias DropdownMenu msg = { icon : Html msg , label : String + , disabled : Bool , attrs : List (Attribute msg) } @@ -171,10 +172,16 @@ makeDropdown model = menuStyle = "absolute right-0 bg-white dark:bg-slate-800 border dark:border-slate-700 z-50 dark:text-slate-300 shadow-lg transition duration-200 min-w-max " - itemStyle = - "transition-colors duration-200 items-center block px-4 py-2 text-normal hover:bg-gray-200 dark:hover:bg-slate-700 dark:hover:text-slate-50" + itemStyleBase = + "transition-colors duration-200 items-center block px-4 py-2 text-normal z-50 " - menuItem m = + itemStyleHover = + " hover:bg-gray-200 dark:hover:bg-slate-700 dark:hover:text-slate-50" + + itemStyle = + itemStyleBase ++ itemStyleHover + + menuLink m = a (class itemStyle :: m.attrs) [ m.icon @@ -185,6 +192,34 @@ makeDropdown model = [ text m.label ] ] + + disabledLink m = + a + ([ href "#" + , disabled True + , class itemStyleBase + , class "disabled" + ] + ++ m.attrs + ) + [ m.icon + , span + [ class "ml-2" + , classList [ ( "hidden", m.label == "" ) ] + ] + [ text m.label + ] + ] + + menuItem m = + if m.label == "separator" then + div [ class "py-1" ] [ hr [ class S.border ] [] ] + + else if m.disabled then + disabledLink m + + else + menuLink m in div [ class "relative" ] [ a diff --git a/modules/webapp/src/main/elm/Page/Home/Update.elm b/modules/webapp/src/main/elm/Page/Home/Update.elm index 182495ba..960ad4d9 100644 --- a/modules/webapp/src/main/elm/Page/Home/Update.elm +++ b/modules/webapp/src/main/elm/Page/Home/Update.elm @@ -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 ) diff --git a/modules/webapp/src/main/elm/Page/Home/View2.elm b/modules/webapp/src/main/elm/Page/Home/View2.elm index 3f4bf2b1..550bc112 100644 --- a/modules/webapp/src/main/elm/Page/Home/View2.elm +++ b/modules/webapp/src/main/elm/Page/Home/View2.elm @@ -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 ) + ] + ] + } ] } ] diff --git a/modules/webapp/src/main/elm/Page/Share/Menubar.elm b/modules/webapp/src/main/elm/Page/Share/Menubar.elm index c2ae67c2..5df6db84 100644 --- a/modules/webapp/src/main/elm/Page/Share/Menubar.elm +++ b/modules/webapp/src/main/elm/Page/Share/Menubar.elm @@ -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)