Rename HomePage to SearchPage

This commit is contained in:
eikek 2022-01-26 21:20:34 +01:00
parent 5b5a25ac72
commit c38ab3ef82
18 changed files with 82 additions and 82 deletions

View File

@ -26,13 +26,13 @@ import Http
import Messages.UiLanguage exposing (UiLanguage)
import Page exposing (Page(..))
import Page.CollectiveSettings.Data
import Page.Home.Data
import Page.ItemDetail.Data
import Page.Login.Data
import Page.ManageData.Data
import Page.NewInvite.Data
import Page.Queue.Data
import Page.Register.Data
import Page.Search.Data
import Page.Share.Data
import Page.ShareDetail.Data
import Page.Upload.Data
@ -45,7 +45,7 @@ type alias Model =
, key : Key
, page : Page
, version : VersionInfo
, homeModel : Page.Home.Data.Model
, searchModel : Page.Search.Data.Model
, loginModel : Page.Login.Data.Model
, manageDataModel : Page.ManageData.Data.Model
, collSettingsModel : Page.CollectiveSettings.Data.Model
@ -98,18 +98,18 @@ init key url flags_ settings =
( sdm, sdc ) =
Page.ShareDetail.Data.init (Page.pageShareDetail page) flags
homeViewMode =
searchViewMode =
if settings.searchMenuVisible then
Page.Home.Data.SearchView
Page.Search.Data.SearchView
else
Page.Home.Data.SimpleView
Page.Search.Data.SimpleView
in
( { flags = flags
, key = key
, page = page
, version = Api.Model.VersionInfo.empty
, homeModel = Page.Home.Data.init flags homeViewMode
, searchModel = Page.Search.Data.init flags searchViewMode
, loginModel = loginm
, manageDataModel = mdm
, collSettingsModel = csm
@ -171,7 +171,7 @@ type Msg
= NavRequest UrlRequest
| NavChange Url
| VersionResp (Result Http.Error VersionInfo)
| HomeMsg Page.Home.Data.Msg
| SearchMsg Page.Search.Data.Msg
| LoginMsg Page.Login.Data.Msg
| ManageDataMsg Page.ManageData.Data.Msg
| CollSettingsMsg Page.CollectiveSettings.Data.Msg
@ -201,7 +201,7 @@ type Msg
defaultPage : Flags -> Page
defaultPage _ =
HomePage
SearchPage
getUiLanguage : Model -> UiLanguage

View File

@ -22,8 +22,6 @@ import Messages exposing (Messages)
import Page exposing (Page(..))
import Page.CollectiveSettings.Data
import Page.CollectiveSettings.Update
import Page.Home.Data
import Page.Home.Update
import Page.ItemDetail.Data
import Page.ItemDetail.Update
import Page.Login.Data
@ -36,6 +34,8 @@ import Page.Queue.Data
import Page.Queue.Update
import Page.Register.Data
import Page.Register.Update
import Page.Search.Data
import Page.Search.Update
import Page.Share.Data
import Page.Share.Update
import Page.ShareDetail.Data
@ -121,8 +121,8 @@ updateWithSub msg model =
SetLanguage lang ->
( { model | anonymousUiLang = lang, langMenuOpen = False }, Cmd.none, Sub.none )
HomeMsg lm ->
updateHome texts lm model
SearchMsg lm ->
updateSearch texts lm model
ShareMsg lm ->
updateShare lm model
@ -318,12 +318,12 @@ updateWithSub msg model =
newModel =
{ model
| showNewItemsArrived = isProcessItem && model.page /= HomePage
| showNewItemsArrived = isProcessItem && model.page /= SearchPage
, jobsWaiting = max 0 (model.jobsWaiting - 1)
}
in
if model.page == HomePage && isProcessItem then
updateHome texts Page.Home.Data.RefreshView newModel
if model.page == SearchPage && isProcessItem then
updateSearch texts Page.Search.Data.RefreshView newModel
else
( newModel, Cmd.none, Sub.none )
@ -360,7 +360,7 @@ applyClientSettings texts model settings =
, Sub.none
)
, updateUserSettings texts Page.UserSettings.Data.UpdateSettings
, updateHome texts Page.Home.Data.UiSettingsUpdated
, updateSearch texts Page.Search.Data.UiSettingsUpdated
, updateItemDetail texts Page.ItemDetail.Data.UiSettingsUpdated
]
{ model | uiSettings = settings }
@ -404,7 +404,7 @@ updateItemDetail : Messages -> Page.ItemDetail.Data.Msg -> Model -> ( Model, Cmd
updateItemDetail texts lmsg model =
let
inav =
Page.Home.Data.itemNav model.itemDetailModel.detail.item.id model.homeModel
Page.Search.Data.itemNav model.itemDetailModel.detail.item.id model.searchModel
result =
Page.ItemDetail.Update.update
@ -421,12 +421,12 @@ updateItemDetail texts lmsg model =
}
( hm, hc, hs ) =
updateHome texts (Page.Home.Data.SetLinkTarget result.linkTarget) model_
updateSearch texts (Page.Search.Data.SetLinkTarget result.linkTarget) model_
( hm1, hc1, hs1 ) =
case result.removedItem of
Just removedId ->
updateHome texts (Page.Home.Data.RemoveItem removedId) hm
updateSearch texts (Page.Search.Data.RemoveItem removedId) hm
Nothing ->
( hm, hc, hs )
@ -552,22 +552,22 @@ updateLogin lmsg model =
)
updateHome : Messages -> Page.Home.Data.Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
updateHome texts lmsg model =
updateSearch : Messages -> Page.Search.Data.Msg -> Model -> ( Model, Cmd Msg, Sub Msg )
updateSearch texts lmsg model =
let
mid =
case model.page of
HomePage ->
SearchPage ->
Util.Maybe.fromString model.itemDetailModel.detail.item.id
_ ->
Nothing
result =
Page.Home.Update.update mid model.key model.flags texts.home model.uiSettings lmsg model.homeModel
Page.Search.Update.update mid model.key model.flags texts.search model.uiSettings lmsg model.searchModel
model_ =
{ model | homeModel = result.model }
{ model | searchModel = result.model }
( lm, lc, ls ) =
case result.newSettings of
@ -579,11 +579,11 @@ updateHome texts lmsg model =
in
( lm
, Cmd.batch
[ Cmd.map HomeMsg result.cmd
[ Cmd.map SearchMsg result.cmd
, lc
]
, Sub.batch
[ Sub.map HomeMsg result.sub
[ Sub.map SearchMsg result.sub
, ls
]
)
@ -611,9 +611,9 @@ initPage model_ page =
Messages.get <| App.Data.getUiLanguage model
in
case page of
HomePage ->
SearchPage ->
Util.Update.andThen2
[ updateHome texts Page.Home.Data.Init
[ updateSearch texts Page.Search.Data.Init
, updateQueue Page.Queue.Data.StopRefresh
]
model

View File

@ -19,14 +19,14 @@ import Messages.App exposing (Texts)
import Messages.UiLanguage
import Page exposing (Page(..))
import Page.CollectiveSettings.View2 as CollectiveSettings
import Page.Home.Data
import Page.Home.View2 as Home
import Page.ItemDetail.View2 as ItemDetail
import Page.Login.View2 as Login
import Page.ManageData.View2 as ManageData
import Page.NewInvite.View2 as NewInvite
import Page.Queue.View2 as Queue
import Page.Register.View2 as Register
import Page.Search.Data
import Page.Search.View2 as Search
import Page.Share.View as Share
import Page.ShareDetail.View as ShareDetail
import Page.Upload.View2 as Upload
@ -76,7 +76,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 HomePage
, Page.href SearchPage
, onClick ToggleShowNewItemsArrived
]
[ i [ class "fa fa-exclamation-circle mr-1" ] []
@ -133,7 +133,7 @@ headerNavItem authenticated model =
[ class "inline-flex font-bold items-center px-4"
, classList [ ( "hover:bg-blue-200 dark:hover:bg-slate-800", authenticated ) ]
, if authenticated then
Page.href HomePage
Page.href SearchPage
else
href "#"
@ -160,8 +160,8 @@ mainContent model =
, class styleMain
]
(case model.page of
HomePage ->
viewHome texts model
SearchPage ->
viewSearch texts model
CollectiveSettingPage ->
viewCollectiveSettings texts model
@ -280,7 +280,7 @@ dataMenu texts _ model =
, classList [ ( "hidden", not model.navMenuOpen ) ]
]
[ dataPageLink model
HomePage
SearchPage
[]
[ img
[ class "w-4 inline-block"
@ -510,20 +510,20 @@ viewShareDetail texts shareId itemId model =
]
viewHome : Messages -> Model -> List (Html Msg)
viewHome texts model =
[ Html.map HomeMsg
(Home.viewSidebar texts.home
viewSearch : Messages -> Model -> List (Html Msg)
viewSearch texts model =
[ Html.map SearchMsg
(Search.viewSidebar texts.search
model.sidebarVisible
model.flags
model.uiSettings
model.homeModel
model.searchModel
)
, Html.map HomeMsg
(Home.viewContent texts.home
, Html.map SearchMsg
(Search.viewContent texts.search
model.flags
model.uiSettings
model.homeModel
model.searchModel
)
]
@ -647,7 +647,7 @@ viewItemDetail : Messages -> String -> Model -> List (Html Msg)
viewItemDetail texts id model =
let
inav =
Page.Home.Data.itemNav id model.homeModel
Page.Search.Data.itemNav id model.searchModel
in
[ Html.map ItemDetailMsg
(ItemDetail.viewSidebar texts.itemDetail

View File

@ -741,7 +741,7 @@ update key flags inav settings msg model =
resultModelCmd ( model, Page.set key (ItemDetailPage id) )
Nothing ->
resultModelCmd ( model, Page.set key HomePage )
resultModelCmd ( model, Page.set key SearchPage )
in
{ result_ | removedItem = Just removedId }

View File

@ -80,7 +80,7 @@ menuBar texts inav settings model =
[ MB.CustomElement <|
a
[ class S.secondaryBasicButton
, Page.href HomePage
, Page.href SearchPage
, title texts.backToSearchResults
]
[ i [ class "fa fa-arrow-left" ] []

View File

@ -14,13 +14,13 @@ module Messages exposing
import Messages.App
import Messages.Page.CollectiveSettings
import Messages.Page.Home
import Messages.Page.ItemDetail
import Messages.Page.Login
import Messages.Page.ManageData
import Messages.Page.NewInvite
import Messages.Page.Queue
import Messages.Page.Register
import Messages.Page.Search
import Messages.Page.Share
import Messages.Page.ShareDetail
import Messages.Page.Upload
@ -45,7 +45,7 @@ type alias Messages =
, queue : Messages.Page.Queue.Texts
, userSettings : Messages.Page.UserSettings.Texts
, manageData : Messages.Page.ManageData.Texts
, home : Messages.Page.Home.Texts
, search : Messages.Page.Search.Texts
, share : Messages.Page.Share.Texts
, shareDetail : Messages.Page.ShareDetail.Texts
}
@ -112,7 +112,7 @@ gb =
, queue = Messages.Page.Queue.gb
, userSettings = Messages.Page.UserSettings.gb
, manageData = Messages.Page.ManageData.gb
, home = Messages.Page.Home.gb
, search = Messages.Page.Search.gb
, share = Messages.Page.Share.gb
, shareDetail = Messages.Page.ShareDetail.gb
}
@ -134,7 +134,7 @@ de =
, queue = Messages.Page.Queue.de
, userSettings = Messages.Page.UserSettings.de
, manageData = Messages.Page.ManageData.de
, home = Messages.Page.Home.de
, search = Messages.Page.Search.de
, share = Messages.Page.Share.de
, shareDetail = Messages.Page.ShareDetail.de
}

View File

@ -5,7 +5,7 @@
-}
module Messages.Page.Home exposing
module Messages.Page.Search exposing
( Texts
, de
, gb
@ -17,14 +17,14 @@ import Messages.Comp.ItemCardList
import Messages.Comp.ItemMerge
import Messages.Comp.PublishItems
import Messages.Comp.SearchStatsView
import Messages.Page.HomeSideMenu
import Messages.Page.SearchSideMenu
type alias Texts =
{ basics : Messages.Basics.Texts
, itemCardList : Messages.Comp.ItemCardList.Texts
, searchStatsView : Messages.Comp.SearchStatsView.Texts
, sideMenu : Messages.Page.HomeSideMenu.Texts
, sideMenu : Messages.Page.SearchSideMenu.Texts
, itemMerge : Messages.Comp.ItemMerge.Texts
, publishItems : Messages.Comp.PublishItems.Texts
, bookmarkManage : Messages.Comp.BookmarkQueryManage.Texts
@ -66,7 +66,7 @@ gb =
{ basics = Messages.Basics.gb
, itemCardList = Messages.Comp.ItemCardList.gb
, searchStatsView = Messages.Comp.SearchStatsView.gb
, sideMenu = Messages.Page.HomeSideMenu.gb
, sideMenu = Messages.Page.SearchSideMenu.gb
, itemMerge = Messages.Comp.ItemMerge.gb
, publishItems = Messages.Comp.PublishItems.gb
, bookmarkManage = Messages.Comp.BookmarkQueryManage.gb
@ -108,7 +108,7 @@ de =
{ basics = Messages.Basics.de
, itemCardList = Messages.Comp.ItemCardList.de
, searchStatsView = Messages.Comp.SearchStatsView.de
, sideMenu = Messages.Page.HomeSideMenu.de
, sideMenu = Messages.Page.SearchSideMenu.de
, itemMerge = Messages.Comp.ItemMerge.de
, publishItems = Messages.Comp.PublishItems.de
, bookmarkManage = Messages.Comp.BookmarkQueryManage.de

View File

@ -5,7 +5,7 @@
-}
module Messages.Page.HomeSideMenu exposing
module Messages.Page.SearchSideMenu exposing
( Texts
, de
, gb

View File

@ -51,7 +51,7 @@ emptyLoginData =
type Page
= HomePage
= SearchPage
| LoginPage LoginData
| ManageDataPage
| CollectiveSettingPage
@ -68,7 +68,7 @@ type Page
isSecured : Page -> Bool
isSecured page =
case page of
HomePage ->
SearchPage ->
True
LoginPage _ ->
@ -141,8 +141,8 @@ loginPage p =
pageName : Page -> String
pageName page =
case page of
HomePage ->
"Home"
SearchPage ->
"Search"
LoginPage _ ->
"Login"
@ -226,8 +226,8 @@ uploadId page =
pageToString : Page -> String
pageToString page =
case page of
HomePage ->
"/app/home"
SearchPage ->
"/app/search"
LoginPage data ->
case data.referrer of
@ -312,10 +312,10 @@ pathPrefix =
parser : Parser (Page -> a) a
parser =
oneOf
[ Parser.map HomePage
[ Parser.map SearchPage
(oneOf
[ Parser.top
, s pathPrefix </> s "home"
, s pathPrefix </> s "search"
]
)
, Parser.map LoginPage (s pathPrefix </> s "login" <?> loginPageParser)

View File

@ -60,7 +60,7 @@ update key flags inav settings msg model =
Cmd.none
_ ->
Page.set key HomePage
Page.set key SearchPage
in
{ model = { model | detail = result.model }
, cmd = Cmd.batch [ pageSwitch, Cmd.map ItemDetailMsg result.cmd ]

View File

@ -53,7 +53,7 @@ update loginData flags msg model =
AuthResp (Ok lr) ->
let
gotoRef =
Maybe.withDefault HomePage loginData.referrer |> Page.goto
Maybe.withDefault SearchPage loginData.referrer |> Page.goto
in
if lr.success && not lr.requireSecondFactor then
( { model | formState = AuthSuccess lr, password = "" }

View File

@ -5,7 +5,7 @@
-}
module Page.Home.Data exposing
module Page.Search.Data exposing
( ConfirmModalValue(..)
, Model
, Msg(..)

View File

@ -5,7 +5,7 @@
-}
module Page.Home.SideMenu exposing (view)
module Page.Search.SideMenu exposing (view)
import Comp.Basic as B
import Comp.ItemDetail.MultiEditMenu
@ -16,8 +16,8 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick)
import Messages.Page.HomeSideMenu exposing (Texts)
import Page.Home.Data exposing (..)
import Messages.Page.SearchSideMenu exposing (Texts)
import Page.Search.Data exposing (..)
import Set
import Styles as S

View File

@ -5,7 +5,7 @@
-}
module Page.Home.Update exposing
module Page.Search.Update exposing
( UpdateResult
, update
)
@ -28,9 +28,9 @@ import Data.ItemSelection
import Data.Items
import Data.SearchMode exposing (SearchMode)
import Data.UiSettings exposing (UiSettings)
import Messages.Page.Home exposing (Texts)
import Messages.Page.Search exposing (Texts)
import Page exposing (Page(..))
import Page.Home.Data exposing (..)
import Page.Search.Data exposing (..)
import Process
import Scroll
import Set exposing (Set)

View File

@ -5,7 +5,7 @@
-}
module Page.Home.View2 exposing (viewContent, viewSidebar)
module Page.Search.View2 exposing (viewContent, viewSidebar)
import Api
import Comp.Basic as B
@ -27,10 +27,10 @@ import Data.UiSettings exposing (UiSettings)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (onClick, onInput)
import Messages.Page.Home exposing (Texts)
import Messages.Page.Search exposing (Texts)
import Page exposing (Page(..))
import Page.Home.Data exposing (..)
import Page.Home.SideMenu
import Page.Search.Data exposing (..)
import Page.Search.SideMenu
import Set
import Styles as S
import Util.Html
@ -44,7 +44,7 @@ viewSidebar texts visible flags settings model =
, class S.sidebarBg
, classList [ ( "hidden", not visible ) ]
]
[ Page.Home.SideMenu.view texts.sideMenu flags settings model
[ Page.Search.SideMenu.view texts.sideMenu flags settings model
]

View File

@ -19,7 +19,7 @@ import Comp.SharePasswordForm
import Data.Flags exposing (Flags)
import Data.ItemArrange exposing (ItemArrange)
import Http
import Page.Home.Data exposing (Msg(..))
import Page.Search.Data exposing (Msg(..))
import Set exposing (Set)
import Util.Html exposing (KeyCode)

View File

@ -195,7 +195,7 @@ renderSuccessMsg texts public model =
[ text texts.successBox.line1
, a
[ class S.successMessageLink
, Page.href HomePage
, Page.href SearchPage
]
[ text texts.successBox.itemsPage
]

View File

@ -247,7 +247,7 @@ de =
, queue = Messages.Page.Queue.gb
, userSettings = Messages.Page.UserSettings.gb
, manageData = Messages.Page.ManageData.gb
, home = Messages.Page.Home.gb
, search = Messages.Page.Search.gb
}
```
@ -340,7 +340,7 @@ de =
, queue = Messages.Page.Queue.gb
, userSettings = Messages.Page.UserSettings.gb
, manageData = Messages.Page.ManageData.gb
, home = Messages.Page.Home.gb
, search = Messages.Page.Search.gb
}
```