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,19 +1,60 @@
module Pages.Debate.Arguments 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.Format
exposing
( paragraphFontSize
, paragraphSpacing
)
import Config.Helpers.Response
exposing
( pageList
, topLevelContainer
)
import Config.Helpers.StrengthBar
exposing
( barMaker
, barPadding
)
import Config.Helpers.ToolTip exposing (tooltip)
import Config.Helpers.Viewport exposing (resetViewport)
import Config.Pages.Debate.Arguments.Helpers exposing (..)
import Config.Pages.Debate.Arguments.List
exposing
( argumentList
, argumentListNumber
)
import Config.Pages.Debate.Arguments.Types exposing (..)
import Config.Pages.Debate.Gibberish.Helpers exposing (..)
import Config.Pages.Headers.Helpers exposing (headerMaker)
import Config.Pages.Headers.Records.Arguments exposing (argumentHeader)
import Config.Style.Colour exposing (colourTheme)
import Config.Style.Glow
exposing
( glowDeepDarkGrey
, glowDeepDarkOrange
)
import Config.Style.Transitions exposing (transitionStyleSlow)
import Effect exposing (Effect)
import Element as E exposing (..)
import Config.Pages.Headers.Helpers exposing (headerMaker)
import Config.Pages.Headers.Pages.Arguments exposing (argumentHeader)
import Element.Background as B
import Element.Border as D
import Element.Font as F
import Html exposing (div, hr)
import Html.Attributes as H exposing (style, title, wrap)
import Layouts
import Page exposing (Page)
import Route exposing (Route)
@ -123,3 +164,563 @@ debateList device =
)
argumentList
]
argumentMaker : Argument -> Element msg
argumentMaker argument =
row
topLevelBox
[ desktopCardMaker desktopImageBoxSize desktopImageSize (argumentImage argument) (argumentLink argument)
, cardMaker
[ cardTitleMaker argument.argumentTitle
, cardFormatter
[ cardContentSpacing
[ column
fieldSpacer
[ propositionMakerDesktop argument
, reductioMakerDesktop argument
, summaryMakerDesktop argument
, strengthBar argument
, tableMaker argument
, desktopFormalizationMaker argument
]
]
]
]
]
argumentMakerMobile : Argument -> Element msg
argumentMakerMobile argument =
row
topLevelBox
[ column [] []
, cardMaker
[ cardTitleMaker argument.argumentTitle
, cardFormatter
[ cardContentSpacing
[ column
fieldSpacer
[ row [ spacing 10, E.width fill ]
[ mobileCardMaker mobileImageBoxSize mobileImageSize (argumentImage argument) (argumentLink argument)
, column [ E.width fill ]
[ propositionMakerMobile argument
]
]
, reductioMakerMobile argument
, summaryMakerMobile argument
, strengthBar argument
, tableMaker argument
, mobileFormalizationMaker argument
]
]
]
]
]
argumentImage : Argument -> { src : String, description : String }
argumentImage argument =
{ src = "/arguments/" ++ argument.argumentImage ++ ".png"
, description = argument.argumentTitle
}
argumentLink : Argument -> String
argumentLink argument =
argument.proofLink
infoSpacing =
E.width <| px 100
propositionMakerDesktop : Argument -> Element msg
propositionMakerDesktop argument =
row []
[ propositionMaker
, propositionTitleMaker argument
]
propositionMakerMobile : Argument -> Element msg
propositionMakerMobile argument =
column []
[ propositionMaker
, propositionTitleMaker argument
]
propositionMaker : Element msg
propositionMaker =
column
[ E.alignTop, E.alignLeft ]
[ paragraph
([ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
]
++ [ F.size 18
, infoSpacing
]
)
[ el
[ tooltip
"A proposition is a declarative statement that can be evaluated as either true or false, and which serves as the basis for debate."
]
(text "Proposition:")
|> el [ F.color colourTheme.textLightOrange ]
]
]
propositionTitleMaker : Argument -> Element msg
propositionTitleMaker argument =
column
[ E.width fill, E.alignLeft ]
[ paragraph
([ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
]
++ [ F.size 18 ]
)
[ text argument.propositionTitle
|> el
[ F.color colourTheme.textLightGrey
, F.regular
, F.size 16
]
]
]
reductioMakerDesktop : Argument -> Element msg
reductioMakerDesktop argument =
case argument.propositionReductio of
"" ->
none
reductio ->
row
[]
[ reductioMaker
, reductioMakerTitle reductio
]
reductioMakerMobile : Argument -> Element msg
reductioMakerMobile argument =
case argument.propositionReductio of
"" ->
none
reductio ->
row
[]
[ reductioMaker
, reductioMakerTitle reductio
]
reductioMaker : Element msg
reductioMaker =
column
[ E.alignTop, E.alignLeft ]
[ paragraph
([ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
]
++ [ F.size 18
, infoSpacing
]
)
[ el
[ tooltip
"This is the position from which the reductio ad absurdum is derived."
]
(text "Reductio:")
|> el [ F.color colourTheme.textLightOrange ]
]
]
reductioMakerTitle : String -> Element msg
reductioMakerTitle reductio =
column [ E.width fill, E.alignLeft ]
[ paragraph
([ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
]
++ [ F.size 16
, spacing 3
]
)
[ text reductio ]
]
summaryMakerDesktop : Argument -> Element msg
summaryMakerDesktop argument =
row []
[ summaryMaker
, summaryMakerTitle argument
]
summaryMakerMobile : Argument -> Element msg
summaryMakerMobile argument =
column []
[ summaryMaker
, summaryMakerTitle argument
]
summaryMaker : Element msg
summaryMaker =
column
[ E.alignTop
, E.alignLeft
]
[ paragraph
([ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
]
++ [ F.size 18
, infoSpacing
]
)
[ el
[ tooltip
"The following information provides additional context and insight into the reasoning behind the argument."
]
(text "Summary:")
|> el [ F.color colourTheme.textLightOrange ]
]
]
summaryMakerTitle : Argument -> Element msg
summaryMakerTitle argument =
column
[ E.width fill
, E.alignLeft
]
[ paragraph
([ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
]
++ [ F.size 18
, spacing 3
]
)
[ text argument.propositionSummary
|> el
[ F.color colourTheme.textLightGrey
, F.regular
, F.size 16
]
]
]
strengthBar : Argument -> Element msg
strengthBar argument =
row [ E.width fill ]
[ strengthMaker
, strengthMakerBar argument
]
strengthMaker : Element msg
strengthMaker =
column
[ E.alignTop
, E.alignLeft
]
[ paragraph
([ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
]
++ [ F.size 18
, E.width fill
]
)
[ el
[ tooltip
"This represents my confidence in the soundness of the argument."
]
(el
[ paddingEach
{ top = 0
, right = 5
, bottom = 0
, left = 0
}
]
<|
text "Confidence:"
)
|> el [ F.color colourTheme.textLightOrange ]
]
]
strengthMakerBar : Argument -> Element msg
strengthMakerBar argument =
barPadding
[ barMaker getConfidenceTooltip argument.argumentCertainty ]
getConfidenceTooltip : Int -> String
getConfidenceTooltip num =
case num of
0 ->
"Extremely low. Speculative reasoning."
1 ->
"Very low. Extremely weak reasoning."
2 ->
"Low. Weak reasoning."
3 ->
"Kinda low. Somewhat weak reasoning."
4 ->
"Below average. More weak than strong."
5 ->
"Moderate. OK reasoning."
6 ->
"Above average. More strong than weak."
7 ->
"Kinda high. Somewhat strong reasoning."
8 ->
"High. Robust reasoning."
9 ->
"Very high. Extremely robust reasoning."
10 ->
"Extremely high. Air tight reasoning."
_ ->
"Confidence level out of expected range."
tableMaker : Argument -> Element msg
tableMaker argument =
column
[ centerX
, E.width fill
]
[ wrappedRow
([ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
]
++ [ E.alignLeft
, E.width fill
, htmlAttribute <| H.style "position" "relative"
]
)
[ E.table
[ spacing 0
, D.rounded 10
, D.width 2
, D.color colourTheme.textDarkGrey
, clip
]
{ data = argument.definitionTable
, columns =
[ { header =
el
[ F.bold
, D.widthEach
{ bottom = 1
, top = 1
, left = 1
, right = 1
}
, D.color colourTheme.textDarkGrey
, padding 8
, E.width fill
]
(text "Definiendum")
|> el [ F.color colourTheme.textLightOrange ]
, width = fill |> maximum 50
, view =
\definition ->
row
[ F.color colourTheme.textLightOrange
, F.bold
, D.widthEach
{ bottom = 1
, top = 0
, left = 1
, right = 1
}
, D.color colourTheme.textDarkGrey
, padding 8
, E.height fill
]
[ row [ centerX ]
[ paragraph [] [ text definition.definiendum ]
]
]
}
, { header =
el
[ F.bold
, D.widthEach
{ bottom = 1
, top = 1
, left = 0
, right = 1
}
, D.color colourTheme.textDarkGrey
, padding 8
, E.width fill
]
(text "Definiens")
|> el [ F.color colourTheme.textLightOrange ]
, width = fill
, view =
\definition ->
paragraph
[ F.color colourTheme.textLightGrey
, F.regular
, D.widthEach
{ bottom = 1
, top = 0
, left = 0
, right = 1
}
, D.color colourTheme.textDarkGrey
, padding 8
, E.height fill
]
[ row []
[ paragraph [] [ text definition.definiens ]
]
]
}
]
}
]
]
argumentDesktopPadding : Attribute msg
argumentDesktopPadding =
paddingXY 40 3
argumentMobilePadding : Attribute msg
argumentMobilePadding =
paddingXY 0 3
desktopFormalizationMaker : Argument -> Element msg
desktopFormalizationMaker argument =
formalizationMaker argument argumentDesktopPadding
mobileFormalizationMaker : Argument -> Element msg
mobileFormalizationMaker argument =
formalizationMaker argument argumentMobilePadding
formalizationMaker : Argument -> Attribute msg -> Element msg
formalizationMaker argument padding =
column
[ centerX
, E.width fill
, spacing 10
]
(List.indexedMap
(\index argumentEntry ->
column
([ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
]
++ [ spacing 3
, centerX
, E.width fill
, padding
]
)
(List.indexedMap
(\entryIndex entryWithNotation ->
column
[ centerX
, F.center
, spacing 3
, E.width fill
]
[ paragraph
[ F.color colourTheme.textLightOrange
, F.bold
, spacing 3
, F.size 17
]
[ text
(if entryIndex < List.length argumentEntry.premises then
"P" ++ String.fromInt (entryIndex + 1) ++ ") "
else
"C) "
)
, text
(if entryIndex < List.length argumentEntry.premises then
entryWithNotation.premise
else
argumentEntry.conclusion
)
|> el
[ F.color colourTheme.textLightGrey
, F.regular
, E.width fill
]
]
, paragraph
[ centerX
, F.center
, spacing 3
, E.width fill
, F.color colourTheme.textLightOrange
, F.bold
]
[ text
(if entryIndex < List.length argumentEntry.premises then
"(" ++ entryWithNotation.notation ++ ")"
else
"(" ++ argumentEntry.conclusionNotation ++ ")"
)
]
]
)
(argumentEntry.premises ++ [ { premise = argumentEntry.conclusion, notation = argumentEntry.conclusionNotation } ])
)
)
argument.argumentFormalization
)

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 ]
]
]

View file

@ -1,26 +1,56 @@
module Pages.Debate.Gibberish 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.Format
exposing
( paragraphFontSize
, paragraphSpacing
)
import Config.Helpers.Response
exposing
( pageList
, topLevelContainer
)
import Config.Helpers.StrengthBar
exposing
( barMaker
, barPadding
)
import Config.Helpers.ToolTip exposing (tooltip)
import Config.Helpers.Viewport exposing (resetViewport)
import Config.Pages.Debate.Arguments.Helpers exposing (..)
import Config.Pages.Debate.Arguments.Types exposing (..)
import Config.Pages.Debate.Gibberish.Domains.Epistemology exposing (epistemologyGibberish)
import Config.Pages.Debate.Gibberish.Domains.Metaphysics exposing (metaphysicsGibberish)
import Config.Pages.Debate.Gibberish.Domains.Normativity exposing (normativityGibberish)
import Config.Pages.Debate.Gibberish.Domains.Ontology exposing (ontologyGibberish)
import Config.Pages.Debate.Gibberish.Domains.PhilOfLanguage exposing (philOfLanguageGibberish)
import Config.Pages.Debate.Gibberish.Domains.PhilOfMind exposing (philOfMindGibberish)
import Config.Pages.Debate.Gibberish.Domains.Theology exposing (theologyGibberish)
import Config.Pages.Debate.Gibberish.Helpers exposing (..)
import Config.Pages.Debate.Gibberish.List exposing (gibberishListNumber)
import Config.Pages.Debate.Gibberish.Records.Epistemology exposing (epistemologyGibberish)
import Config.Pages.Debate.Gibberish.Records.Metaphysics exposing (metaphysicsGibberish)
import Config.Pages.Debate.Gibberish.Records.Normativity exposing (normativityGibberish)
import Config.Pages.Debate.Gibberish.Records.Ontology exposing (ontologyGibberish)
import Config.Pages.Debate.Gibberish.Records.PhilOfLanguage exposing (philOfLanguageGibberish)
import Config.Pages.Debate.Gibberish.Records.PhilOfMind exposing (philOfMindGibberish)
import Config.Pages.Debate.Gibberish.Records.Theology exposing (theologyGibberish)
import Config.Pages.Debate.Gibberish.Types exposing (..)
import Config.Pages.Headers.Helpers exposing (headerMaker)
import Config.Pages.Headers.Pages.Gibberish exposing (gibberishHeader)
import Config.Pages.Headers.Records.Gibberish exposing (gibberishHeader)
import Config.Style.Colour exposing (colourTheme)
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 Layouts
import List.Extra as L exposing (..)
import Page exposing (Page)
@ -138,3 +168,255 @@ gibberishList device =
, philOfLanguageGibberish
]
]
desktopGibberishMaker : Gibberish -> Element msg
desktopGibberishMaker gibberish =
row
topLevelBox
[ desktopCardMaker desktopImageBoxSize desktopImageSize (gibberishImage gibberish) gibberish.gibberishLink
, cardMaker
[ cardTitleMaker (gibberishTitle gibberish)
, cardFormatter
[ column [ spacing 20, padding 10 ]
[ descriptionMaker gibberish
, gibberishMakerBody gibberish
]
]
]
]
mobileGibberishMaker : Gibberish -> Element msg
mobileGibberishMaker gibberish =
row
topLevelBox
[ cardMaker
[ cardTitleMaker (gibberishTitle gibberish)
, cardFormatter
[ row [ spacing 20, padding 10 ]
[ column [] [ mobileCardMaker mobileImageBoxSize mobileImageSize (gibberishImage gibberish) gibberish.gibberishLink ]
, column [ width fill ]
[ descriptionMaker gibberish
]
]
, domainList gibberish
]
]
]
gibberishMakerBody : Gibberish -> Element msg
gibberishMakerBody gibberish =
cardContentSpacing
[ column
fieldSpacer
[ paragraph
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.size 18
, F.center
]
[ domainList gibberish
]
]
]
gibberishImage : Gibberish -> { src : String, description : String }
gibberishImage gibberish =
{ src = "/gibberish/" ++ gibberish.gibberishImage ++ ".png"
, description = gibberish.gibberishTitle
}
gibberishTitle : Gibberish -> String
gibberishTitle gibberish =
gibberish.gibberishTitle
domainList : Gibberish -> Element msg
domainList gibberish =
column
[ spacing 8
, E.width fill
]
(List.indexedMap (makeTerms intelligibilityBar) gibberish.gibberishTerms)
descriptionMaker : Gibberish -> Element msg
descriptionMaker gibberish =
column
[ E.width fill
, centerX
]
[ paragraph
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, spacing 3
, F.regular
, F.alignLeft
, F.size 16
]
[ text gibberish.gibberishDescription
]
]
makeTerms : (Terms -> Element msg) -> Int -> Terms -> Element msg
makeTerms bar index terms =
column
[ F.color colourTheme.textLightGrey
, paragraphSpacing
, paragraphFontSize
, F.bold
, E.alignLeft
, spacing 8
, E.width fill
]
[ row
[ F.color colourTheme.textLightGrey
, F.regular
, F.size 18
, F.bold
, F.alignLeft
, E.width fill
]
[ column
[ E.alignRight
, alignTop
]
[ paragraph
[]
[ text (String.fromInt (index + 1) ++ ". ") ]
]
, column
[ E.width fill
, paddingEach
{ top = 0
, bottom = 0
, left = 10
, right = 10
}
, spacing 3
]
[ paragraph
[]
[ el [ F.color colourTheme.textLightOrange ] <|
text <|
String.toLower "\""
++ terms.term
++ "\""
]
, bar terms
, paragraph
[ F.color colourTheme.textLightGrey
, F.regular
, F.size 16
, F.alignLeft
]
[ text
(case terms.explanation of
NoClue ->
"I have no fucking clue what this means."
SpecificExplanation str ->
str
)
]
]
]
]
intelligibilityBar : Terms -> Element msg
intelligibilityBar terms =
row
[ E.width fill
, height fill
]
[ column
[ E.alignTop
, E.alignLeft
]
[ paragraph
[ F.color colourTheme.textLightGrey
, F.bold
, F.size 18
, paragraphSpacing
, paragraphFontSize
, E.alignLeft
, E.width fill
]
[ el
[ tooltip
tooltipMessage
]
(el
[ paddingEach
{ top = 0
, right = 10
, bottom = 0
, left = 0
}
]
<|
text barTitle
)
]
]
, barPadding
[ barMaker getIntelligibilityTooltip terms.strength ]
]
tooltipMessage : String
tooltipMessage =
"This represents my confidence that the term can be understood from at least one viewpoint."
barTitle : String
barTitle =
"Intelligibility:"
getIntelligibilityTooltip : Int -> String
getIntelligibilityTooltip num =
case num of
0 ->
"Total fucking gibberish."
1 ->
"Extremely unclear, speaking in tongues."
2 ->
"Mostly unclear, hard to make any sense of."
3 ->
"Somewhat unclear, difficult to understand."
4 ->
"Slightly unclear, understandable with effort."
5 ->
"Neutral, not sure what to make of it."
6 ->
"Slightly clear, with unanswered questions."
7 ->
"Somewhat clear, kinda get the idea."
8 ->
"Very clear, usefulness questionable."
9 ->
"Extremely clear, usefulness dubious."
10 ->
"Perfectly clear, but also useless."
_ ->
"Intelligibility rating is out of bounds."