Permalink for bookmark searches

This commit is contained in:
eikek
2022-01-26 21:21:36 +01:00
parent 631450cb16
commit cb3005211b
14 changed files with 114 additions and 81 deletions

View File

@ -209,7 +209,7 @@ type Msg
defaultPage : Flags -> Page
defaultPage _ =
SearchPage
DashboardPage
getUiLanguage : Model -> UiLanguage

View File

@ -323,11 +323,11 @@ updateWithSub msg model =
newModel =
{ model
| showNewItemsArrived = isProcessItem && model.page /= SearchPage
| showNewItemsArrived = isProcessItem && not (Page.isSearchPage model.page)
, jobsWaiting = max 0 (model.jobsWaiting - 1)
}
in
if model.page == SearchPage && isProcessItem then
if Page.isSearchPage model.page && isProcessItem then
updateSearch texts Page.Search.Data.RefreshView newModel
else
@ -375,7 +375,7 @@ updateDashboard : Messages -> Page.Dashboard.Data.Msg -> Model -> ( Model, Cmd M
updateDashboard texts lmsg model =
let
( dbm, dbc, dbs ) =
Page.Dashboard.Update.update texts.dashboard model.flags lmsg model.dashboardModel
Page.Dashboard.Update.update texts.dashboard model.key model.flags lmsg model.dashboardModel
in
( { model | dashboardModel = dbm }
, Cmd.map DashboardMsg dbc
@ -572,16 +572,16 @@ updateLogin lmsg model =
updateSearch : Messages -> Page.Search.Data.Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
updateSearch texts lmsg model =
let
mid =
( mid, bmId ) =
case model.page of
SearchPage ->
Util.Maybe.fromString model.itemDetailModel.detail.item.id
SearchPage bId ->
( Util.Maybe.fromString model.itemDetailModel.detail.item.id, bId )
_ ->
Nothing
( Nothing, Nothing )
result =
Page.Search.Update.update mid model.key model.flags texts.search model.uiSettings lmsg model.searchModel
Page.Search.Update.update bmId mid model.key model.flags texts.search model.uiSettings lmsg model.searchModel
model_ =
{ model | searchModel = result.model }
@ -628,7 +628,7 @@ initPage model_ page =
Messages.get <| App.Data.getUiLanguage model
in
case page of
SearchPage ->
SearchPage _ ->
Util.Update.andThen2
[ updateSearch texts Page.Search.Data.Init
, updateQueue Page.Queue.Data.StopRefresh

View File

@ -78,7 +78,7 @@ topNavUser auth model =
[ class S.infoMessageBase
, class "my-2 px-1 py-1 rounded-lg inline-block hover:opacity-50"
, classList [ ( "hidden", not model.showNewItemsArrived ) ]
, Page.href SearchPage
, Page.href (SearchPage Nothing)
, onClick ToggleShowNewItemsArrived
]
[ i [ class "fa fa-exclamation-circle mr-1" ] []
@ -165,8 +165,8 @@ mainContent model =
DashboardPage ->
viewDashboard texts model
SearchPage ->
viewSearch texts model
SearchPage bmId ->
viewSearch texts bmId model
CollectiveSettingPage ->
viewCollectiveSettings texts model
@ -298,7 +298,7 @@ dataMenu texts _ model =
]
, div [ class "py-1" ] [ hr [ class S.border ] [] ]
, dataPageLink model
SearchPage
(SearchPage Nothing)
[]
[ Icons.searchIcon "w-6"
, span [ class "ml-1" ]
@ -541,8 +541,8 @@ viewShareDetail texts shareId itemId model =
]
viewSearch : Messages -> Model -> List (Html Msg)
viewSearch texts model =
viewSearch : Messages -> Maybe String -> Model -> List (Html Msg)
viewSearch texts bmId model =
[ Html.map SearchMsg
(Search.viewSidebar texts.search
model.sidebarVisible