diff --git a/frontend/src/Main.elm b/frontend/src/Main.elm index 8c08597..dde28a3 100644 --- a/frontend/src/Main.elm +++ b/frontend/src/Main.elm @@ -28,15 +28,13 @@ import Html.Attributes ) import Json.Decode import Page.Flakes exposing (Model(..)) -import Page.Home import Page.Options import Page.Packages import RemoteData exposing (RemoteData(..)) import Route exposing (SearchType(..)) import Search exposing - ( Msg(..) - , NixOSChannel + ( NixOSChannel , decodeNixOSChannels , defaultFlakeId ) @@ -68,7 +66,6 @@ type alias Model = type Page = NotFound - | Home Page.Home.Model | Packages Page.Packages.Model | Options Page.Options.Model | Flakes Page.Flakes.Model @@ -113,7 +110,6 @@ init flags url navKey = type Msg = ChangedUrl Url.Url | ClickedLink Browser.UrlRequest - | HomeMsg Page.Home.Msg | PackagesMsg Page.Packages.Msg | OptionsMsg Page.Options.Msg | FlakesMsg Page.Flakes.Msg @@ -199,9 +195,6 @@ pageMatch m1 m2 = ( NotFound, NotFound ) -> True - ( Home _, Home _ ) -> - True - ( Packages model_a, Packages model_b ) -> { model_a | show = Nothing, showInstallDetails = Search.Unset, result = NotAsked } == { model_b | show = Nothing, showInstallDetails = Search.Unset, result = NotAsked } @@ -321,10 +314,6 @@ update msg model = ( ChangedUrl url, _ ) -> changeRouteTo model url - ( HomeMsg subMsg, Home subModel ) -> - Page.Home.update subMsg subModel model.nixosChannels - |> updateWith Home HomeMsg model - ( PackagesMsg subMsg, Packages subModel ) -> Page.Packages.update model.navKey subMsg subModel model.nixosChannels |> updateWith Packages PackagesMsg model @@ -337,7 +326,7 @@ update msg model = Page.Flakes.update model.navKey subMsg subModel model.nixosChannels |> updateWith Flakes FlakesMsg model - ( _, _ ) -> + _ -> -- Disregard messages that arrived for the wrong page. ( model, Cmd.none ) @@ -455,9 +444,6 @@ viewPage model = NotFound -> div [] [ text "Not Found" ] - Home _ -> - div [] [ text "Welcome" ] - Packages packagesModel -> Html.map (\m -> PackagesMsg m) <| Page.Packages.view model.nixosChannels packagesModel diff --git a/frontend/src/Page/Flakes.elm b/frontend/src/Page/Flakes.elm index 5671921..5f33e7a 100644 --- a/frontend/src/Page/Flakes.elm +++ b/frontend/src/Page/Flakes.elm @@ -26,11 +26,10 @@ import Html.Events exposing (onClick) import Http exposing (Body) import Page.Options exposing (Msg(..)) import Page.Packages exposing (Msg(..)) -import RemoteData exposing (RemoteData(..)) +import RemoteData import Route exposing - ( Route(..) - , SearchType(..) + ( SearchType(..) ) import Search exposing diff --git a/frontend/src/Page/Home.elm b/frontend/src/Page/Home.elm deleted file mode 100644 index 9d4f3a8..0000000 --- a/frontend/src/Page/Home.elm +++ /dev/null @@ -1,45 +0,0 @@ -module Page.Home exposing (Model, Msg, init, update, view) - -import Html exposing (Html, div, text) -import Search exposing (NixOSChannel) - - - --- MODEL - - -type alias Model = - () - - -init : ( Model, Cmd Msg ) -init = - ( (), Cmd.none ) - - - --- UPDATE - - -type Msg - = NoOp - - -update : - Msg - -> Model - -> List NixOSChannel - -> ( Model, Cmd Msg ) -update msg model _ = - case msg of - NoOp -> - ( model, Cmd.none ) - - - --- VIEW - - -view : Model -> Html Msg -view _ = - div [] [ text "Home" ] diff --git a/frontend/src/Page/Packages.elm b/frontend/src/Page/Packages.elm index 6163da7..6d9f6d6 100644 --- a/frontend/src/Page/Packages.elm +++ b/frontend/src/Page/Packages.elm @@ -3,9 +3,7 @@ module Page.Packages exposing , Msg(..) , decodeResultAggregations , decodeResultItemSource - , encodeBuckets , init - , initBuckets , makeRequest , makeRequestBody , update @@ -14,7 +12,6 @@ module Page.Packages exposing , viewSuccess ) -import Browser.Events exposing (Visibility(..)) import Browser.Navigation import Html exposing @@ -47,12 +44,11 @@ import Json.Decode.Pipeline import Json.Encode import Maybe import Regex -import Route exposing (Route(..), SearchType) +import Route exposing (SearchType) import Search exposing - ( Details(..) + ( Details , NixOSChannel - , decodeResolvedFlake , viewBucket ) import Utils diff --git a/frontend/src/Route.elm b/frontend/src/Route.elm index b010293..dd40b29 100644 --- a/frontend/src/Route.elm +++ b/frontend/src/Route.elm @@ -6,13 +6,10 @@ module Route exposing , allTypes , fromUrl , href - , replaceUrl , routeToString - , searchTypeToString , searchTypeToTitle ) -import Browser.Navigation import Html import Html.Attributes import Route.SearchQuery exposing (SearchQuery) @@ -164,11 +161,6 @@ href targetRoute = Html.Attributes.href (routeToString targetRoute) -replaceUrl : Browser.Navigation.Key -> Route -> Cmd msg -replaceUrl navKey route = - Browser.Navigation.replaceUrl navKey (routeToString route) - - fromUrl : Url.Url -> Maybe Route fromUrl url = -- The RealWorld spec treats the fragment like a path. diff --git a/frontend/src/Search.elm b/frontend/src/Search.elm index e883243..204b3d8 100644 --- a/frontend/src/Search.elm +++ b/frontend/src/Search.elm @@ -11,14 +11,11 @@ module Search exposing , ResultItem , SearchResult , Sort(..) - , closeButton , decodeAggregation , decodeNixOSChannels , decodeResolvedFlake - , decodeResult , defaultFlakeId , elementId - , fromSortId , init , makeRequest , makeRequestBody @@ -36,7 +33,6 @@ module Search exposing import Base64 import Browser.Dom -import Browser.Events exposing (Visibility(..)) import Browser.Navigation import Html exposing @@ -379,7 +375,6 @@ type Msg a b | ToggleSort | BucketsChange String | ChannelChange String - | FlakeChange String | SubjectChange SearchType | QueryInput String | QueryInputSubmit @@ -464,16 +459,6 @@ update toRoute navKey msg model nixosChannels = |> ensureLoading nixosChannels |> pushUrl toRoute navKey - FlakeChange flake -> - { model - | channel = flake - , show = Nothing - , buckets = Nothing - , from = 0 - } - |> ensureLoading nixosChannels - |> pushUrl toRoute navKey - SubjectChange subject -> { model | searchType = subject diff --git a/frontend/src/index.html b/frontend/src/index.html index 3460e55..86a821f 100644 --- a/frontend/src/index.html +++ b/frontend/src/index.html @@ -2,29 +2,22 @@ - - - NixOS Search + + + NixOS Search - + - + - - + - - - - - - + + - - - - + diff --git a/frontend/tests/Example.elm b/frontend/tests/Example.elm index 1bcd7b0..0308534 100644 --- a/frontend/tests/Example.elm +++ b/frontend/tests/Example.elm @@ -1,8 +1,7 @@ module Example exposing (fuzzTest, unitTest, viewTest) -import Expect exposing (Expectation) -import Fuzz exposing (Fuzzer, int, list, string) -import Main exposing (..) +import Expect +import Fuzz exposing (int) import Test exposing (..) import Test.Html.Query as Query import Test.Html.Selector exposing (tag, text)