module Pages.Dodgers exposing (Model, Msg, page) import Config.Identity exposing (dodgersName) import Config.Theme as T exposing (..) import Effect exposing (Effect) import Element exposing (..) import Element.Font as F import Html.Attributes as H exposing (style) import Layouts import Page exposing (Page) import Route exposing (Route) import Shared import View exposing (View) page : Shared.Model -> Route () -> Page Model Msg page shared route = Page.new { init = init , update = update , subscriptions = subscriptions , view = view } |> Page.withLayout toLayout toLayout : Model -> Layouts.Layout Msg toLayout model = Layouts.Navbar {} -- INIT type alias Model = {} init : () -> ( Model, Effect Msg ) init () = ( {} , Effect.none ) -- UPDATE type Msg = NoOp update : Msg -> Model -> ( Model, Effect Msg ) update msg model = case msg of NoOp -> ( model , Effect.none ) -- SUBSCRIPTIONS subscriptions : Model -> Sub Msg subscriptions model = Sub.none -- VIEW view : Model -> View Msg view model = { title = dodgersName , attributes = [] , element = dodgersContainer } dodgersContainer : Element msg dodgersContainer = topLevelContainer dodgersList dodgersList : Element msg dodgersList = column pageList dodgers type alias MakeRowInput = { cuckImage : String , cuckName : String , cuckSocial : String , cuckDodges : List DodgeEntry } type alias DodgeEntry = { dodgeLink : String , dodgeDescription : String , dodgeProposition : String } makeRow : MakeRowInput -> Element msg makeRow makeRowInput = let cuckImageFormat : List (Attribute msg) cuckImageFormat = [ width <| px 80 ] dodgeRows : List (Element msg) dodgeRows = List.indexedMap (\index dodgeEntry -> column paragraphAlignLeft [ row paragraphFormat [ text " " , text (String.fromInt (index + 1) ++ ". ") , paragraphLinkFormat { url = dodgeEntry.dodgeLink , label = row [] [ transitionHighlightedLinkHover <| text dodgeEntry.dodgeDescription , text "." |> el [ F.color colourTheme.nonHighlightedText ] ] } ] , row paragraphBoldFormat [ text " • Proposition:" , row [ F.regular ] [ text dodgeEntry.dodgeProposition ] ] ] ) makeRowInput.cuckDodges in row [ imageSpacer, alignLeft ] [ image cuckImageFormat { src = makeRowInput.cuckImage , description = makeRowInput.cuckName } , column paragraphAlignLeft [ row nonHighlightedTitleFormat [ text makeRowInput.cuckName ] , row paragraphBoldFormat [ text "Social:" , paragraphLinkFormat { url = makeRowInput.cuckSocial , label = transitionHighlightedLinkHover <| text makeRowInput.cuckName } ] , row paragraphBoldFormat [ text "Dodges:" ] , column [ spacing 8 ] dodgeRows ] ] type alias DodgeType = { noReply : String , ranAway : String , ghostedMe : String , outrightNo : String , inTooDeep : String } type alias PropType = { noClearProp : String } dodgers : List (Element msg) dodgers = let dodgeType : DodgeType dodgeType = { noReply = "Invitation extended with no response" , ranAway = "Engaged in written debate and dodged when cornered" , ghostedMe = "Debate invitation accepted with no follow-up" , outrightNo = "Debate invitation declined" , inTooDeep = "Debate invitation accepted and subsequently retracted" } propType : PropType propType = { noClearProp = "failed to state position clearly." } in List.map makeRow [ { cuckImage = "cucks/adamsinger" , cuckName = "Adam Singer" , cuckSocial = "https://twitter.com/AdamSinger" , cuckDodges = [ { dodgeLink = "https://twitter.com/TheNutrivore/status/1566491269194719232?s=20" , dodgeDescription = dodgeType.noReply , dodgeProposition = propType.noClearProp } ] } , { cuckImage = "cucks/" , cuckName = "" , cuckSocial = "" , cuckDodges = [ { dodgeLink = "" , dodgeDescription = dodgeType.noReply , dodgeProposition = propType.noClearProp } ] } ]