Add some annotations and remove some unused modules.

This commit is contained in:
Dillon Kearns 2021-06-24 11:59:51 -07:00
parent 6a0741bb75
commit cd8a445ef3
5 changed files with 5 additions and 240 deletions

View File

@ -80,10 +80,12 @@ link route attrs children =
route route
empty : Html msg
empty = empty =
div [] [] div [] []
linkStyle : Attribute msg
linkStyle = linkStyle =
css css
[ Tw.text_lg [ Tw.text_lg

View File

@ -93,7 +93,7 @@ view :
-> StaticPayload Data RouteParams -> StaticPayload Data RouteParams
-> View Msg -> View Msg
view maybeUrl sharedModel static = view maybeUrl sharedModel static =
{ title = "elm-pages - a statically typed site generator" -- metadata.title -- TODO { title = "elm-pages - a statically typed site generator"
, body = , body =
[ landingView [ landingView
] ]

View File

@ -1,159 +0,0 @@
module Page.Projects exposing (Data, Model, Msg, page)
import DataSource exposing (DataSource)
import DataSource.File
import DataSource.Glob as Glob
import DataSource.Http
import Head
import Head.Seo as Seo
import Html.Styled exposing (div, text)
import Html.Styled.Attributes exposing (css)
import OptimizedDecoder
import Page exposing (Page, PageWithState, StaticPayload)
import Pages.PageUrl exposing (PageUrl)
import Pages.Url
import Path
import Secrets
import Shared
import Tailwind.Utilities as Tw
import View exposing (View)
type alias Model =
()
type alias Msg =
Never
type alias RouteParams =
{}
page : Page RouteParams Data
page =
Page.single
{ head = head
, data = data
}
|> Page.buildNoState { view = view }
type alias Repo =
{ stars : Int
}
--
--
--projects : DataSource (List Project)
--projects =
-- DataSource.combine
-- [ githubProjects
-- , paidProjects
-- ]
-- |> DataSource.map List.concat
--
--
--paidProjects : DataSource (List Project)
--paidProjects =
-- DataSource.succeed
-- [ { openSource = False
-- , name = "elm-ts-interop-pro"
-- , url = "https://elm-ts-interop.com"
-- }
-- ]
--
--
--githubProjects : DataSource (List Project)
--githubProjects =
-- DataSource.Http.get (Secrets.succeed "https://api.github.com/users/dillonkearns/repos")
-- (OptimizedDecoder.list
-- (OptimizedDecoder.map3 Project
-- (OptimizedDecoder.succeed True)
-- (OptimizedDecoder.field "name" OptimizedDecoder.string)
-- (OptimizedDecoder.field "url" OptimizedDecoder.string)
-- )
-- )
type alias Project =
{ name : String
, description : String
, repo : Repo
}
data : DataSource (List Project)
data =
Glob.succeed
(\projectName filePath ->
DataSource.map2 (Project projectName)
(DataSource.File.rawFile filePath)
(repo projectName)
)
|> Glob.match (Glob.literal "projects/")
|> Glob.capture Glob.wildcard
|> Glob.match (Glob.literal ".txt")
|> Glob.captureFilePath
|> Glob.toDataSource
|> DataSource.resolve
repo : String -> DataSource Repo
repo repoName =
DataSource.Http.get
(Secrets.succeed ("https://api.github.com/repos/dillonkearns/" ++ repoName))
(OptimizedDecoder.map Repo
(OptimizedDecoder.field "stargazers_count" OptimizedDecoder.int)
)
head :
StaticPayload Data RouteParams
-> List Head.Tag
head static =
Seo.summary
{ canonicalUrlOverride = Nothing
, siteName = "elm-pages"
, image =
{ url = [ "images", "icon-png.png" ] |> Path.join |> Pages.Url.fromPath
, alt = "elm-pages logo"
, dimensions = Nothing
, mimeType = Nothing
}
, description = "TODO"
, locale = Nothing
, title = "TODO title" -- metadata.title -- TODO
}
|> Seo.website
type alias Data =
List Project
view :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> View Msg
view maybeUrl sharedModel static =
{ title = "Projects"
, body =
[ div
[ css
[ Tw.pt_32
, Tw.px_16
]
]
(static.data
|> List.map
(\project ->
text (project.name ++ ": " ++ project.description)
)
)
]
}

View File

@ -1,80 +0,0 @@
module Page.Time exposing (Data, Model, Msg, page)
import DataSource
import DataSource.Http
import Head
import Head.Seo as Seo
import Html.Styled as Html
import OptimizedDecoder
import Page exposing (Page, PageWithState, StaticPayload)
import Pages.PageUrl exposing (PageUrl)
import Pages.Url
import Path
import Secrets
import Shared
import View exposing (View)
type alias Model =
()
type alias Msg =
Never
type alias Data =
String
type alias RouteParams =
{}
page : Page RouteParams Data
page =
Page.serverless
{ head = head
, data = \_ _ -> data
, routeFound = \_ -> DataSource.succeed True
}
|> Page.buildNoState { view = view }
data : DataSource.DataSource String
data =
DataSource.Http.get (Secrets.succeed "/.netlify/functions/time")
OptimizedDecoder.string
head :
StaticPayload Data {}
-> List Head.Tag
head static =
Seo.summary
{ canonicalUrlOverride = Nothing
, siteName = "elm-pages"
, image =
{ url = [ "images", "icon-png.png" ] |> Path.join |> Pages.Url.fromPath
, alt = "elm-pages logo"
, dimensions = Nothing
, mimeType = Nothing
}
, description = "TODO"
, locale = Nothing
, title = "TODO title" -- metadata.title -- TODO
}
|> Seo.website
view :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data {}
-> View msg
view maybeUrl sharedModel static =
{ title = "TODO title"
, body =
[ Html.text static.data
]
}

View File

@ -66,6 +66,7 @@ serialize =
S.list serializeEntry S.list serializeEntry
serializeEntry : S.Codec e (Entry Data)
serializeEntry = serializeEntry =
S.customType S.customType
(\vEntry value -> (\vEntry value ->
@ -77,6 +78,7 @@ serializeEntry =
|> S.finishCustomType |> S.finishCustomType
serializeData : S.Codec e Data
serializeData = serializeData =
S.record Data S.record Data
|> S.field .anchorId S.string |> S.field .anchorId S.string