website/frontend/src/Pages/Debate/Cucklist.elm

579 lines
14 KiB
Elm
Executable file

module Pages.Debate.Cucklist exposing (Model, Msg, page)
import Config.Data.Identity exposing (pageNames)
import Config.Helpers.Cards.Helpers exposing (cardMaker)
import Config.Helpers.Cards.Types as C
import Config.Helpers.Converters exposing (formatSocial)
import Config.Helpers.Format
exposing
( headerFontSizeSmall
, paragraphFontSize
, paragraphSpacing
, smallTextFontSize
)
import Config.Helpers.Headers.Helpers exposing (..)
import Config.Helpers.Headers.Records exposing (cuckListHeader)
import Config.Helpers.Headers.Types as R exposing (..)
import Config.Helpers.Response
exposing
( pageList
, topLevelContainer
)
import Config.Helpers.ToolTip exposing (tooltipImage)
import Config.Helpers.Viewport exposing (resetViewport)
import Config.Pages.Debate.Cuckery.List
exposing
( cuckList
, cuckListNumber
)
import Config.Pages.Debate.Cuckery.Types exposing (..)
import Config.Style.Colour exposing (colourTheme)
import Config.Style.Transitions
exposing
( hoverFontDarkOrange
, transitionStyleFast
, transitionStyleSlow
)
import Effect exposing (Effect)
import Element as E exposing (..)
import Element.Background as B
import Element.Border as D
import Element.Font as F
import Html.Attributes as H
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 shared
}
|> Page.withLayout toLayout
toLayout : Model -> Layouts.Layout Msg
toLayout model =
Layouts.Navbar {}
-- INIT
type alias Model =
{}
init : () -> ( Model, Effect Msg )
init () =
( {}
, Effect.map
(\_ -> NoOp)
(Effect.sendCmd resetViewport)
)
-- 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 : Shared.Model -> Model -> View Msg
view shared model =
{ title = "debate (" ++ pageNames.pageCucks ++ ")"
, attributes = []
, element = cucksContainer shared.device
}
cucksContainer : Device -> Element msg
cucksContainer device =
topLevelContainer (cucksList device)
cucksList : Device -> Element msg
cucksList device =
column
(case ( device.class, device.orientation ) of
_ ->
pageList device
)
<|
List.concat
[ [ headerMaker (R.CuckList cuckListHeader) ]
, List.map
(\cuck ->
cardMaker device (C.Cuck cuck) (contentList device cuck)
)
cuckList
]
contentList : Device -> Cuck -> List (Element msg)
contentList device cuck =
[ column
[ width fill
, spacing 3
, paddingEach
{ top =
case ( device.class, device.orientation ) of
( Phone, Portrait ) ->
3
( Tablet, Portrait ) ->
3
_ ->
0
, right = 0
, bottom = 0
, left = 0
}
]
[ socialMaker cuck
, dodgeTitle cuck
, dodgeMaker device cuck
]
]
dodgeMaker : Device -> Cuck -> Element msg
dodgeMaker device cuck =
column
[ spacing 10
, width fill
]
<|
List.map2 (\x y -> makeDodge device cuck x y)
cuck.cuckDodges
(List.range 1 (List.length cuck.cuckDodges))
socialMaker : Cuck -> Element msg
socialMaker cuck =
paragraph
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, F.bold
, headerFontSizeSmall
, spacing 8
]
[ text "Social: "
, newTabLink
[ paragraphFontSize
, F.color colourTheme.textLightOrange
]
{ url = cuck.cuckSocial
, label =
el
[ transitionStyleSlow
, hoverFontDarkOrange
]
<|
text (formatSocial cuck.cuckSocial)
}
]
dodgeTitle : Cuck -> Element msg
dodgeTitle cuck =
paragraph
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, F.bold
, headerFontSizeSmall
]
[ text "Dodges: " ]
makeDodge : Device -> Cuck -> Dodge -> Int -> Element msg
makeDodge device cuck dodge index =
column
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, alignLeft
, spacing 8
, width fill
]
[ row
[ width fill
, paddingEach
{ top = 0
, right = 0
, bottom = 0
, left = 10
}
]
[ column
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, headerFontSizeSmall
, alignTop
, alignRight
, F.alignRight
]
[ text (String.fromInt index ++ ". ") ]
, column
[ spacing 3
, width fill
]
[ circumstanceMaker cuck dodge
, column
[ spacing 3
, width fill
]
[ propositionMaker device dodge
, reductioMaker device dodge
, attitudeMaker device dodge
, reasonMaker device dodge
]
]
]
]
dodgeWidth =
width <| px 85
formatProposition : String -> String
formatProposition proposition =
if proposition == "N/A" then
proposition
else
"\"" ++ proposition ++ "\""
dodgeCounter : Int -> Element msg
dodgeCounter index =
column
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, headerFontSizeSmall
]
[ text (String.fromInt index ++ ". ") ]
circumstanceMaker : Cuck -> Dodge -> Element msg
circumstanceMaker cuck dodge =
el
[ spacing 5
]
<|
newTabLink
[ paragraphFontSize
, F.color colourTheme.textLightOrange
]
{ url = dodge.dodgeLink
, label =
el
[ headerFontSizeSmall
]
<|
circumstance cuck dodge
}
circumstance : Cuck -> Dodge -> Element msg
circumstance cuck dodge =
paragraph
[]
[ el
[ transitionStyleSlow
, hoverFontDarkOrange
]
<|
case dodge.dodgeDescription of
NoReply ->
text "Debate invitation extended with no response"
RanAway ->
text "Engaged in written debate and ran away when cornered"
GhostedMe ->
text "Debate invitation accepted with no follow-up"
OutrightNo ->
text "Debate invitation declined"
InTooDeep ->
text "Debate invitation accepted and subsequently retracted"
KillScreen ->
text "All further debate invitations preemptively declined"
VagueGesture ->
text "Chose to gesture vaguely instead of engaging"
, el [ F.color colourTheme.textLightGrey ] <|
text "."
-- , receipts cuck dodge
]
receipts : Cuck -> Dodge -> Element msg
receipts cuck dodge =
row
[ spacing 3
, smallTextFontSize
, paddingEach
{ top = 0
, right = 0
, bottom = 0
, left = 3
}
, htmlAttribute (H.style "position" "relative")
, htmlAttribute (H.style "top" "-5px")
]
<|
List.indexedMap
(\index2 link ->
paragraph
[ alignTop
, F.color colourTheme.textLightOrange
]
[ el
[ transitionStyleSlow
, hoverFontDarkOrange
]
(text (String.fromInt (index2 + 1)))
, text ", " |> el [ F.color colourTheme.textLightGrey ]
]
)
dodge.dodgeReceipts
propositionMaker : Device -> Dodge -> Element msg
propositionMaker device dodge =
(case ( device.class, device.orientation ) of
( Phone, Portrait ) ->
column
( Tablet, Portrait ) ->
column
_ ->
row
)
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
]
[ paragraph
[ alignTop
, dodgeWidth
]
[ text "Proposition:"
]
, paragraph
[ E.width fill
, alignLeft
]
[ paragraph [ F.regular ] [ text (formatProposition dodge.dodgeProposition) ]
]
]
attitudeMaker : Device -> Dodge -> Element msg
attitudeMaker device dodge =
(case ( device.class, device.orientation ) of
( Phone, Portrait ) ->
column
( Tablet, Portrait ) ->
column
_ ->
row
)
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
, width fill
]
[ paragraph
[ alignTop
, dodgeWidth
]
[ text "Attitude:"
]
, paragraph
[ E.width fill
, alignLeft
]
[ case dodge.dodgeNicksDoxasticState of
Nothing ->
paragraph [ F.regular ] [ text "I don't form a doxastic state." ]
Just Belief ->
paragraph [ F.regular ]
[ text "I lean more toward "
, el [ F.bold ] (text "TRUE")
, text " than false."
]
Just Disbelief ->
paragraph [ F.regular ]
[ text "I lean more toward "
, text "FALSE" |> el [ F.bold ]
, text " than true."
]
Just Agnostic ->
el [ F.regular ] (text "I don't form beliefs about this proposition.")
]
]
reductioMaker : Device -> Dodge -> Element msg
reductioMaker device dodge =
case dodge.dodgeFallacy of
Nothing ->
none
Just fallacy ->
case fallacy of
SpecificFallacy str ->
if String.isEmpty str then
none
else
displayFallacy device str
AppealToNature ->
displayFallacy device "Appeal to Nature"
AppealToTradition ->
displayFallacy device "Appeal to Tradition"
AppealToIgnorance ->
displayFallacy device "Appeal to Ignorance"
AppealFromIncredulity ->
displayFallacy device "Appeal from Incredulity"
RedHerring ->
displayFallacy device "Red Herring"
BeggingTheQuestion ->
displayFallacy device "Begging the Question"
Strawman ->
displayFallacy device "Strawman"
Equivocation ->
displayFallacy device "Equivocation"
GeneticFallacy ->
displayFallacy device "Genetic Fallacy"
MotteAndBailey ->
displayFallacy device "Motte and Bailey"
reasonMaker : Device -> Dodge -> Element msg
reasonMaker device dodge =
(case ( device.class, device.orientation ) of
( Phone, Portrait ) ->
column
( Tablet, Portrait ) ->
column
_ ->
row
)
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
, width fill
]
[ paragraph
[ alignTop
, dodgeWidth
]
[ text "Reason:"
]
, paragraph [ F.regular ]
[ text <|
case dodge.dodgeNicksDoxasticReason of
NoProp ->
"There is no proposition to evaluate."
VagueProp ->
"The proposition is too vague to evaluate."
SpecificPropReason str ->
str
]
]
displayFallacy : Device -> String -> Element msg
displayFallacy device fallacyText =
(case ( device.class, device.orientation ) of
( Phone, Portrait ) ->
column
( Tablet, Portrait ) ->
column
_ ->
row
)
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
]
[ paragraph
[ alignTop
, dodgeWidth
]
[ text "Fallacy:"
]
, paragraph
[ E.width fill
, alignLeft
]
[ paragraph [ F.regular ]
[ text fallacyText ]
]
]