diff --git a/src/Client/MainComponents/Widgets.fs b/src/Client/MainComponents/Widgets.fs index a4bc4699..a0db0352 100644 --- a/src/Client/MainComponents/Widgets.fs +++ b/src/Client/MainComponents/Widgets.fs @@ -231,10 +231,10 @@ type Widget = let content = let switchContent = - if model.ProtocolState.TemplatesSelected.Length > 0 && not model.ProtocolState.IsProtocolSearch then - insertContent () - else + if model.ProtocolState.IsProtocolSearch then selectContent () + else + insertContent () Html.div [ prop.className "flex flex-col gap-4 @container/templateWidget" prop.children switchContent diff --git a/src/Client/Pages/ProtocolTemplates/ProtocolState.fs b/src/Client/Pages/ProtocolTemplates/ProtocolState.fs index ef70d720..c9cc9a72 100644 --- a/src/Client/Pages/ProtocolTemplates/ProtocolState.fs +++ b/src/Client/Pages/ProtocolTemplates/ProtocolState.fs @@ -70,7 +70,6 @@ module Protocol = let nextState = { state with TemplatesSelected = templates - IsProtocolSearch = true } nextState, Cmd.none | ProtocolIncreaseTimesUsed templateId -> diff --git a/src/Client/Pages/ProtocolTemplates/ProtocolView.fs b/src/Client/Pages/ProtocolTemplates/ProtocolView.fs index a3d92f36..74893703 100644 --- a/src/Client/Pages/ProtocolTemplates/ProtocolView.fs +++ b/src/Client/Pages/ProtocolTemplates/ProtocolView.fs @@ -38,9 +38,12 @@ type Templates = // Box 1 SidebarComponents.SidebarLayout.Description "Add template from database." - SidebarComponents.SidebarLayout.LogicContainer [ - Modals.SelectiveTemplateFromDB.Main(model, dispatch) - ] + if model.ProtocolState.IsProtocolSearch then + Protocol.SearchContainer.Main model dispatch + else + SidebarComponents.SidebarLayout.LogicContainer [ + Modals.SelectiveTemplateFromDB.Main(model, dispatch) + ] // Box 2 SidebarComponents.SidebarLayout.Description (Html.p [ diff --git a/src/Client/Views/SidebarView.fs b/src/Client/Views/SidebarView.fs index 32d3d04b..d5c74071 100644 --- a/src/Client/Views/SidebarView.fs +++ b/src/Client/Views/SidebarView.fs @@ -14,27 +14,24 @@ type SidebarView = Html.div [ prop.className "grow overflow-y-auto" prop.children [ - if model.ProtocolState.IsProtocolSearch then - Protocol.SearchContainer.Main model dispatch - else - match model.PageState with - | {SidebarPage = Routing.SidebarPage.BuildingBlock } -> - BuildingBlock.Core.addBuildingBlockComponent model dispatch + match model.PageState with + | {SidebarPage = Routing.SidebarPage.BuildingBlock } -> + BuildingBlock.Core.addBuildingBlockComponent model dispatch - | {SidebarPage = Routing.SidebarPage.TermSearch } -> - TermSearch.Main (model, dispatch) + | {SidebarPage = Routing.SidebarPage.TermSearch } -> + TermSearch.Main (model, dispatch) - | {SidebarPage = Routing.SidebarPage.FilePicker } -> - FilePicker.filePickerComponent model dispatch + | {SidebarPage = Routing.SidebarPage.FilePicker } -> + FilePicker.filePickerComponent model dispatch - | {SidebarPage = Routing.SidebarPage.Protocol } -> - Protocol.Templates.Main (model, dispatch) + | {SidebarPage = Routing.SidebarPage.Protocol } -> + Protocol.Templates.Main (model, dispatch) - | {SidebarPage = Routing.SidebarPage.DataAnnotator } -> - Pages.DataAnnotator.Main(model, dispatch) + | {SidebarPage = Routing.SidebarPage.DataAnnotator } -> + Pages.DataAnnotator.Main(model, dispatch) - | {SidebarPage = Routing.SidebarPage.JsonExport } -> - JsonExporter.Core.FileExporter.Main(model, dispatch) + | {SidebarPage = Routing.SidebarPage.JsonExport } -> + JsonExporter.Core.FileExporter.Main(model, dispatch) ] ]