feat: massive refactor

This commit is contained in:
Nick 2024-12-15 02:31:26 -06:00
parent c619757eff
commit fc7b85afc1
214 changed files with 4764 additions and 4716 deletions

View file

@ -1,17 +1,54 @@
module Pages.Debate.Cucklist exposing (Model, Msg, page)
import Config.Data.Identity exposing (pageNames)
import Config.Helpers.CardFormat
exposing
( cardContentSpacing
, cardFormatter
, cardMaker
, cardTitleMaker
, desktopCardMaker
, desktopImageBoxSize
, desktopImageSize
, fieldSpacer
, mobileCardMaker
, mobileImageBoxSize
, mobileImageSize
, topLevelBox
)
import Config.Helpers.Converters exposing (formatSocial)
import Config.Helpers.Format
exposing
( paragraphFontSize
, paragraphSpacing
)
import Config.Helpers.Response
exposing
( pageList
, topLevelContainer
)
import Config.Helpers.Viewport exposing (resetViewport)
import Config.Pages.Debate.Cuckery.Helpers exposing (..)
import Config.Pages.Debate.Cuckery.List
exposing
( cuckList
, cuckListNumber
)
import Config.Pages.Debate.Cuckery.Types exposing (..)
import Config.Pages.Headers.Helpers exposing (headerMaker)
import Config.Pages.Headers.Pages.CuckList exposing (cuckListHeader)
import Config.Pages.Headers.Records.CuckList exposing (cuckListHeader)
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)
@ -118,3 +155,449 @@ cucksList device =
)
cuckList
]
desktopCuckMaker : Cuck -> Element msg
desktopCuckMaker cuck =
row
topLevelBox
[ desktopCardMaker desktopImageBoxSize desktopImageSize (cuckImage cuck) (cuckSocial cuck)
, cardMaker
[ cardTitleMaker (cuckTitle cuck)
, cardFormatter
[ cardContentSpacing
[ column
fieldSpacer
[ socialMaker cuck
, dodgeTitle cuck
, dodgeMaker cuck
]
]
]
]
]
mobileCuckMaker : Cuck -> Element msg
mobileCuckMaker cuck =
column
topLevelBox
[ column [] []
, cardMaker
[ cardTitleMaker (cuckTitle cuck)
, cardFormatter
[ cardContentSpacing
[ column
fieldSpacer
[ column
[ alignTop
, centerX
, alignLeft
, spacing 3
]
[ row [ spacing 10 ]
[ mobileCardMaker mobileImageBoxSize mobileImageSize (cuckImage cuck) (cuckSocial cuck)
, socialMaker cuck
]
, dodgeTitle cuck
, dodgeMaker cuck
]
]
]
]
]
]
cuckImage :
Cuck
->
{ src : String
, description : String
}
cuckImage cuck =
{ src = "/cucks/" ++ cuck.cuckImage ++ "/" ++ cuck.cuckImage ++ ".png"
, description = cuck.cuckName
}
cuckTitle : Cuck -> String
cuckTitle cuck =
cuck.cuckName
cuckSocial : Cuck -> String
cuckSocial cuck =
cuck.cuckSocial
dodgeMaker : Cuck -> Element msg
dodgeMaker cuck =
column
[ spacing 10
, width fill
]
<|
List.map2 (\x y -> makeDodge x y)
cuck.cuckDodges
(List.range 1 (List.length cuck.cuckDodges))
socialMaker : Cuck -> Element msg
socialMaker cuck =
paragraph
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
, F.size 18
, 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
, paragraphFontSize
, F.bold
, F.size 18
]
[ text "Dodges: " ]
makeDodge : Dodge -> Int -> Element msg
makeDodge dodgeEntry index =
column
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, alignLeft
, spacing 8
, width fill
]
[ row
[ width fill
, paddingEach
{ top = 0
, right = 0
, bottom = 0
, left = 35
}
]
[ column
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.size 18
, alignTop
, alignRight
, F.alignRight
]
[ text (String.fromInt index ++ ". ") ]
, column
[ spacing 3
, width fill
]
[ circumstanceMaker dodgeEntry
, column
[ spacing 3
, width fill
]
[ propositionMaker dodgeEntry
, reductioMaker dodgeEntry
, attitudeMaker dodgeEntry
, reasonMaker dodgeEntry
]
]
]
]
dodgeWidth =
width <| px 93
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
, paragraphFontSize
]
++ [ F.size 18
]
)
[ text (String.fromInt index ++ ". ") ]
circumstanceMaker : Dodge -> Element msg
circumstanceMaker dodgeEntry =
column
[ width fill
]
[ newTabLink
[ paragraphFontSize
, F.color colourTheme.textLightOrange
]
{ url = dodgeEntry.dodgeLink
, label =
row [ F.size 18 ]
[ column [ width fill ]
[ paragraph []
[ el
[ transitionStyleSlow
, hoverFontDarkOrange
]
<|
text
(case dodgeEntry.dodgeDescription of
NoReply ->
"Debate 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"
VagueGesture ->
"Chose to gesture vaguely instead of engaging"
)
, paragraph [ F.color colourTheme.textLightGrey ] [ text "." ]
, column
[ spacing 5
, F.size 12
]
(List.indexedMap
(\index2 link ->
newTabLink
[ paddingEach
{ top = 0
, right = 0
, bottom = 0
, left = 5
}
]
{ url = link
, label =
row [ moveUp 5 ]
[ el
[ transitionStyleSlow
, hoverFontDarkOrange
]
<|
text (String.fromInt (index2 + 1))
, text ", " |> el [ F.color colourTheme.textLightGrey ]
]
}
)
dodgeEntry.dodgeReceipts
)
]
]
]
}
]
propositionMaker : Dodge -> Element msg
propositionMaker dodgeEntry =
row
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
]
[ paragraph
[ alignTop
, dodgeWidth
]
[ text "Proposition:"
]
, paragraph
[ E.width fill
, alignLeft
]
[ paragraph [ F.regular ] [ text (formatProposition dodgeEntry.dodgeProposition) ]
]
]
attitudeMaker : Dodge -> Element msg
attitudeMaker dodgeEntry =
row
([ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
]
++ [ width fill ]
)
[ paragraph
[ alignTop
, dodgeWidth
]
[ text "Attitude:"
]
, paragraph
[ E.width fill
, alignLeft
]
[ case dodgeEntry.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 : Dodge -> Element msg
reductioMaker dodgeEntry =
case dodgeEntry.dodgeFallacy of
Nothing ->
none
Just fallacy ->
case fallacy of
SpecificFallacy str ->
if String.isEmpty str then
none
else
displayFallacy str
AppealToNature ->
displayFallacy "Appeal to Nature"
AppealToTradition ->
displayFallacy "Appeal to Tradition"
AppealToIgnorance ->
displayFallacy "Appeal to Ignorance"
AppealFromIncredulity ->
displayFallacy "Appeal from Incredulity"
RedHerring ->
displayFallacy "Red Herring"
BeggingTheQuestion ->
displayFallacy "Begging the Question"
Strawman ->
displayFallacy "Strawman"
Equivocation ->
displayFallacy "Equivocation"
GeneticFallacy ->
displayFallacy "Genetic Fallacy"
MotteAndBailey ->
displayFallacy "Motte and Bailey"
reasonMaker : Dodge -> Element msg
reasonMaker dodgeEntry =
row
([ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
]
++ [ width fill ]
)
[ paragraph
[ alignTop
, dodgeWidth
]
[ text "Reason:"
]
, paragraph [ F.regular ]
[ text <|
case dodgeEntry.dodgeNicksDoxasticReason of
NoProp ->
"There is no proposition to evaluate."
VagueProp ->
"The proposition is too vague to evaluate."
SpecificPropReason str ->
str
]
]
displayFallacy : String -> Element msg
displayFallacy fallacyText =
row
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
]
[ paragraph
[ alignTop
, dodgeWidth
]
[ text "Fallacy:"
]
, paragraph
[ E.width fill
, alignLeft
]
[ paragraph [ F.regular ]
[ text fallacyText ]
]
]