website/frontend/src/Cuckery/Helpers.elm

148 lines
5.3 KiB
Elm
Raw Normal View History

2024-11-13 23:29:50 -06:00
module Cuckery.Helpers exposing (..)
import Config.Colour exposing (..)
import Config.Format exposing (..)
import Cuckery.Types exposing (..)
import Effect exposing (Effect)
import Element exposing (..)
import Element.Border as D
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)
makeDodge : Dodge -> Int -> Element msg
makeDodge dodgeEntry index =
2024-11-16 00:26:41 -06:00
let
formatProposition : String -> String
formatProposition proposition =
if proposition == "N/A" then
proposition
else
"\"" ++ proposition ++ "\""
in
2024-11-13 23:29:50 -06:00
column paragraphAlignLeft
2024-11-14 21:10:41 -06:00
[ row (paragraphFormat ++ [ F.size 18 ])
2024-11-13 23:29:50 -06:00
[ text " "
, text (String.fromInt index ++ ". ")
, paragraphLinkFormat
{ url = dodgeEntry.dodgeLink
, label =
2024-11-14 21:10:41 -06:00
row [ F.size 18 ]
2024-11-13 23:29:50 -06:00
[ transitionHighlightedLinkHover <|
text
(case dodgeEntry.dodgeDescription of
NoReply ->
"Invitation extended with no response"
RanAway ->
"Engaged in written debate and ran away when cornered"
GhostedMe ->
"Debate invitation accepted with no follow-up"
OutrightNo ->
"Debate invitation declined"
InTooDeep ->
"Debate invitation accepted and subsequently retracted"
KillScreen ->
"All further debate invitations preemptively declined"
)
, text "." |> el [ F.color colourTheme.nonHighlightedText ]
]
}
]
, row paragraphBoldFormat
2024-11-14 17:27:31 -06:00
[ column [ alignTop, width <| px 184 ]
2024-11-13 23:29:50 -06:00
[ text " Proposition:"
]
2024-11-16 00:26:41 -06:00
, column [ width <| px 350, alignLeft ] [ paragraph [ F.regular ] [ text (formatProposition dodgeEntry.dodgeProposition) ] ]
2024-11-13 23:29:50 -06:00
]
, row (paragraphBoldFormat ++ [ width fill ])
2024-11-14 17:27:31 -06:00
[ column [ alignTop, width <| px 184 ]
[ text " Doxastic State:"
]
, column [ width <| px 350, alignLeft ]
[ case dodgeEntry.dodgeNicksDoxasticState of
Nothing ->
2024-11-14 19:36:47 -06:00
paragraph [ F.regular ] [ text "I don't form a doxastic state." ]
2024-11-13 23:29:50 -06:00
2024-11-14 17:27:31 -06:00
Just Belief ->
paragraph [ F.regular ]
2024-11-14 19:36:47 -06:00
[ text "I lean more toward "
2024-11-14 17:27:31 -06:00
, el [ F.bold ] (text "TRUE")
, text " than false."
]
2024-11-13 23:29:50 -06:00
2024-11-14 17:27:31 -06:00
Just Disbelief ->
paragraph [ F.regular ]
2024-11-14 19:36:47 -06:00
[ text "I lean more toward "
2024-11-14 17:27:31 -06:00
, text "FALSE" |> el [ F.bold ]
, text " than true."
]
2024-11-13 23:29:50 -06:00
2024-11-14 17:27:31 -06:00
Just Agnostic ->
2024-11-14 19:36:47 -06:00
el [ F.regular ] (text "I don't form beliefs about this proposition.")
2024-11-14 17:27:31 -06:00
]
2024-11-13 23:29:50 -06:00
]
, row (paragraphBoldFormat ++ [ width fill ])
2024-11-14 17:27:31 -06:00
[ column [ alignTop, width <| px 184 ]
[ text " Reason:"
]
, column [ width <| px 350, alignLeft ]
[ paragraph [ F.regular ]
[ text <|
case dodgeEntry.dodgeNicksDoxasticReason of
NoProp ->
2024-11-14 19:36:47 -06:00
"There is no proposition to evaluate."
2024-11-14 17:27:31 -06:00
2024-11-14 19:36:47 -06:00
VagueProp ->
"The proposition is too vague to evaluate."
2024-11-13 23:29:50 -06:00
2024-11-14 19:36:47 -06:00
SpecificProp str ->
2024-11-14 17:27:31 -06:00
str
]
]
2024-11-13 23:29:50 -06:00
]
]
cuckMaker : Cuck -> Element msg
cuckMaker cuck =
row [ imageSpacer, alignLeft ]
[ image
[ centerX
, centerY
, alignTop
, D.rounded 100
, clip
, width <| px 72
]
2024-11-13 23:29:50 -06:00
{ src = "cucks/" ++ cuck.cuckImage ++ ".png"
, description = cuck.cuckName
}
, column
paragraphAlignLeft
[ row nonHighlightedTitleFormat [ text cuck.cuckName ]
2024-11-14 21:10:41 -06:00
, row (paragraphBoldFormat ++ [ F.size 18 ])
2024-11-13 23:29:50 -06:00
[ text "Social:"
, paragraphLinkFormat
{ url = cuck.cuckSocial
, label = transitionHighlightedLinkHover <| text (formatCuckSocial cuck.cuckSocial)
2024-11-13 23:29:50 -06:00
}
]
2024-11-14 21:10:41 -06:00
, row (paragraphBoldFormat ++ [ F.size 18 ]) [ text "Dodges:" ]
2024-11-13 23:29:50 -06:00
, column [ spacing 8 ] <|
List.map2 (\x y -> makeDodge x y)
cuck.cuckDodges
(List.range 1 (List.length cuck.cuckDodges))
]
]