From 18a5d20ccfe8a488f3237fb4ba4f5e19813a37c3 Mon Sep 17 00:00:00 2001 From: Dillon Kearns Date: Thu, 25 Aug 2022 11:56:03 -0700 Subject: [PATCH] Review fixes. --- examples/todos/app/Api.elm | 9 +-------- examples/todos/app/ErrorPage.elm | 3 +-- examples/todos/app/Route/Login.elm | 16 ++-------------- examples/todos/app/Route/Visibility__.elm | 4 ++-- examples/todos/app/Shared.elm | 4 ---- examples/todos/app/Site.elm | 19 +------------------ examples/todos/elm.json | 10 +--------- plugins/Timestamps.elm | 2 +- src/Pages/Internal/Platform/Cli.elm | 13 ------------- src/Pages/Internal/Platform/Effect.elm | 1 - src/Pages/StaticHttpRequest.elm | 9 --------- src/Test/Html/Internal/ElmHtml/Markdown.elm | 1 - src/Test/Html/Internal/ElmHtml/ToString.elm | 2 +- tests/StaticHttpRequestsTests.elm | 2 +- 14 files changed, 11 insertions(+), 84 deletions(-) diff --git a/examples/todos/app/Api.elm b/examples/todos/app/Api.elm index 9442ce25..ec6a0157 100644 --- a/examples/todos/app/Api.elm +++ b/examples/todos/app/Api.elm @@ -1,17 +1,10 @@ module Api exposing (routes) -import ApiRoute exposing (ApiRoute) +import ApiRoute import DataSource exposing (DataSource) -import DataSource.Http import Html exposing (Html) -import Json.Decode -import Json.Encode -import MySession import Pages.Manifest as Manifest import Route exposing (Route) -import Server.Request -import Server.Response -import Server.Session as Session import Site diff --git a/examples/todos/app/ErrorPage.elm b/examples/todos/app/ErrorPage.elm index b9781ea4..3ae6ccec 100644 --- a/examples/todos/app/ErrorPage.elm +++ b/examples/todos/app/ErrorPage.elm @@ -2,8 +2,7 @@ module ErrorPage exposing (ErrorPage(..), Model, Msg, head, init, internalError, import Effect exposing (Effect) import Head -import Html exposing (Html) -import Html.Events exposing (onClick) +import Html import Route import View exposing (View) diff --git a/examples/todos/app/Route/Login.elm b/examples/todos/app/Route/Login.elm index 3a41e6e2..6c6add3e 100644 --- a/examples/todos/app/Route/Login.elm +++ b/examples/todos/app/Route/Login.elm @@ -12,7 +12,7 @@ import ErrorPage exposing (ErrorPage) import Form import Form.Field as Field import Form.FieldView -import Form.Validation as Validation exposing (Combined, Field, Validation) +import Form.Validation as Validation exposing (Combined, Field) import Head import Head.Seo as Seo import Html exposing (Html) @@ -26,7 +26,7 @@ import Pages.PageUrl exposing (PageUrl) import Pages.Url import Request.Hasura import Route -import RouteBuilder exposing (StatefulRoute, StatelessRoute, StaticPayload) +import RouteBuilder exposing (StatelessRoute, StaticPayload) import SendGrid import Server.Request as Request import Server.Response exposing (Response) @@ -59,12 +59,6 @@ route = |> RouteBuilder.buildNoState { view = view } -type alias Login = - { username : String - , password : String - } - - now : DataSource Time.Posix now = DataSource.Port.get "now" @@ -201,12 +195,6 @@ globalErrors formState = |> Html.ul [ Attr.style "color" "red" ] -type alias Request = - { cookies : Dict String String - , maybeFormData : Maybe (Dict String ( String, List String )) - } - - data : RouteParams -> Request.Parser (DataSource (Response Data ErrorPage)) data routeParams = MySession.withSession diff --git a/examples/todos/app/Route/Visibility__.elm b/examples/todos/app/Route/Visibility__.elm index 51b8a72d..d89c8991 100644 --- a/examples/todos/app/Route/Visibility__.elm +++ b/examples/todos/app/Route/Visibility__.elm @@ -22,10 +22,10 @@ import MySession import Pages.Msg import Pages.PageUrl exposing (PageUrl) import Pages.Transition -import Path exposing (Path) +import Path import Request.Hasura import Route -import RouteBuilder exposing (StatefulRoute, StatelessRoute, StaticPayload) +import RouteBuilder exposing (StatefulRoute, StaticPayload) import Server.Request as Request import Server.Response as Response exposing (Response) import Server.Session as Session exposing (Session) diff --git a/examples/todos/app/Shared.elm b/examples/todos/app/Shared.elm index a489ec73..d6402c43 100644 --- a/examples/todos/app/Shared.elm +++ b/examples/todos/app/Shared.elm @@ -29,7 +29,6 @@ type Msg , query : Maybe String , fragment : Maybe String } - | SharedMsg SharedMsg type alias Data = @@ -70,9 +69,6 @@ update msg model = OnPageChange _ -> ( { model | showMobileMenu = False }, Effect.none ) - SharedMsg globalMsg -> - ( model, Effect.none ) - subscriptions : Path -> Model -> Sub Msg subscriptions _ _ = diff --git a/examples/todos/app/Site.elm b/examples/todos/app/Site.elm index fdcf5394..ca0d489c 100644 --- a/examples/todos/app/Site.elm +++ b/examples/todos/app/Site.elm @@ -2,9 +2,8 @@ module Site exposing (canonicalUrl, config) import DataSource exposing (DataSource) import Head -import Route exposing (Route) +import Route import SiteConfig exposing (SiteConfig) -import Sitemap type alias Data = @@ -28,19 +27,3 @@ head = [ Head.sitemapLink "/sitemap.xml" ] |> DataSource.succeed - - -siteMap : - List (Maybe Route) - -> { path : List String, content : String } -siteMap allRoutes = - allRoutes - |> List.filterMap identity - |> List.map - (\route -> - { path = Route.routeToPath route |> String.join "/" - , lastMod = Nothing - } - ) - |> Sitemap.build { siteUrl = "https://elm-pages.com" } - |> (\sitemapXmlString -> { path = [ "sitemap.xml" ], content = sitemapXmlString }) diff --git a/examples/todos/elm.json b/examples/todos/elm.json index 29e84b4b..42f4e640 100644 --- a/examples/todos/elm.json +++ b/examples/todos/elm.json @@ -13,14 +13,12 @@ "dependencies": { "direct": { "MartinSStewart/elm-nonempty-string": "2.0.0", - "MartinSStewart/elm-serialize": "1.2.5", "avh4/elm-color": "1.0.0", "danfishgold/base64-bytes": "1.1.0", "danyx23/elm-mimetype": "4.0.1", "dillonkearns/elm-bcp47-language-tag": "1.0.1", "dillonkearns/elm-graphql": "5.0.9", "dillonkearns/elm-markdown": "6.0.1", - "dillonkearns/elm-sitemap": "1.0.1", "elm/browser": "1.0.2", "elm/bytes": "1.0.8", "elm/core": "1.0.5", @@ -42,19 +40,13 @@ "mgold/elm-nonempty-list": "4.2.0", "miniBill/elm-codec": "1.2.0", "noahzgordon/elm-color-extra": "1.0.2", - "pablohirafuji/elm-syntax-highlight": "3.4.0", "robinheghan/fnv1a": "1.0.0", - "robinheghan/murmur3": "1.0.0", "rtfeldman/elm-css": "16.1.1", "rtfeldman/elm-iso8601-date-strings": "1.1.4", - "tripokey/elm-fuzzy": "5.2.1", "turboMaCk/non-empty-list-alias": "1.2.0", - "vito/elm-ansi": "10.0.1", - "zwilias/json-decode-exploration": "6.0.0" + "vito/elm-ansi": "10.0.1" }, "indirect": { - "bburdette/toop": "1.0.1", - "billstclair/elm-xml-eeue56": "1.0.3", "elm/file": "1.0.5", "elm/random": "1.0.0", "fredcy/elm-parseint": "2.0.1", diff --git a/plugins/Timestamps.elm b/plugins/Timestamps.elm index 75c59918..0cb5ed60 100644 --- a/plugins/Timestamps.elm +++ b/plugins/Timestamps.elm @@ -3,7 +3,7 @@ module Timestamps exposing (Timestamps, data, format) import DataSource exposing (DataSource) import DataSource.Port import DateFormat -import Json.Decode as Decode exposing (Decoder) +import Json.Decode as Decode import Json.Decode.Extra import Json.Encode import List.Extra diff --git a/src/Pages/Internal/Platform/Cli.elm b/src/Pages/Internal/Platform/Cli.elm index dc5b0a4a..27722f30 100644 --- a/src/Pages/Internal/Platform/Cli.elm +++ b/src/Pages/Internal/Platform/Cli.elm @@ -12,7 +12,6 @@ import Bytes exposing (Bytes) import Bytes.Encode import Codec import DataSource exposing (DataSource) -import DataSource.Http exposing (RequestDetails) import Dict import Head import Html exposing (Html) @@ -67,7 +66,6 @@ type Msg } ) | GotBuildError BuildError - | Continue {-| -} @@ -562,17 +560,6 @@ update site config msg model = Nothing |> nextStepToEffect site config updatedModel - Continue -> - let - updatedModel : Model route - updatedModel = - model - in - StaticResponses.nextStep - updatedModel - Nothing - |> nextStepToEffect site config updatedModel - GotBuildError buildError -> let updatedModel : Model route diff --git a/src/Pages/Internal/Platform/Effect.elm b/src/Pages/Internal/Platform/Effect.elm index 99858c29..aca8b2c4 100644 --- a/src/Pages/Internal/Platform/Effect.elm +++ b/src/Pages/Internal/Platform/Effect.elm @@ -1,7 +1,6 @@ module Pages.Internal.Platform.Effect exposing (Effect(..)) import Bytes exposing (Bytes) -import DataSource.Http exposing (RequestDetails) import Pages.Internal.Platform.ToJsPayload exposing (ToJsSuccessPayloadNewCombined) import Pages.StaticHttp.Request as StaticHttp diff --git a/src/Pages/StaticHttpRequest.elm b/src/Pages/StaticHttpRequest.elm index fd81f26b..e6f23961 100644 --- a/src/Pages/StaticHttpRequest.elm +++ b/src/Pages/StaticHttpRequest.elm @@ -3,20 +3,11 @@ module Pages.StaticHttpRequest exposing (Error(..), MockResolver, RawRequest(..) import BuildError exposing (BuildError) import Dict import List.Extra -import Pages.Internal.StaticHttpBody import Pages.StaticHttp.Request import RequestsAndPending exposing (RequestsAndPending) import TerminalText as Terminal -type alias RequestDetails = - { url : String - , method : String - , headers : List ( String, String ) - , body : Pages.Internal.StaticHttpBody.Body - } - - type alias MockResolver = Pages.StaticHttp.Request.Request -> Maybe RequestsAndPending.Response diff --git a/src/Test/Html/Internal/ElmHtml/Markdown.elm b/src/Test/Html/Internal/ElmHtml/Markdown.elm index 4058ccd1..cdbef7af 100644 --- a/src/Test/Html/Internal/ElmHtml/Markdown.elm +++ b/src/Test/Html/Internal/ElmHtml/Markdown.elm @@ -12,7 +12,6 @@ module Test.Html.Internal.ElmHtml.Markdown exposing -} import Json.Decode exposing (field) -import Json.Encode import Test.Internal.KernelConstants exposing (kernelConstants) diff --git a/src/Test/Html/Internal/ElmHtml/ToString.elm b/src/Test/Html/Internal/ElmHtml/ToString.elm index 125a6076..ae83662c 100644 --- a/src/Test/Html/Internal/ElmHtml/ToString.elm +++ b/src/Test/Html/Internal/ElmHtml/ToString.elm @@ -11,7 +11,7 @@ module Test.Html.Internal.ElmHtml.ToString exposing -} -import Dict exposing (Dict) +import Dict import String import Test.Html.Internal.ElmHtml.InternalTypes exposing (..) diff --git a/tests/StaticHttpRequestsTests.elm b/tests/StaticHttpRequestsTests.elm index 72a9398c..0afb426d 100644 --- a/tests/StaticHttpRequestsTests.elm +++ b/tests/StaticHttpRequestsTests.elm @@ -544,7 +544,7 @@ config apiRoutes pages = , subscriptions = \_ _ _ -> Sub.none , routeToPath = \(Route route) -> route |> String.split "/" , sharedData = DataSource.succeed () - , onPageChange = \_ -> Continue + , onPageChange = \_ -> GotDataBatch [] , apiRoutes = \_ -> apiRoutes , pathPatterns = [] , byteDecodePageData = \_ -> Bytes.Decode.fail