feat: abstracted out argumentMaker

This commit is contained in:
Nick 2024-11-15 23:28:32 -06:00
parent 55eb3a8a60
commit 833c6b5d94
6 changed files with 345 additions and 232 deletions

View file

@ -3,6 +3,10 @@ module Pages.Debate exposing (Model, Msg, page)
import Config.Colour as T exposing (..)
import Config.Format as O exposing (..)
import Config.Identity as I exposing (..)
import Debate.Arguments.Ancestry.AncestralDiets exposing (..)
import Debate.Arguments.Ethics.EthicalSlurs exposing (..)
import Debate.Arguments.Nutrition.Malondialdehyde exposing (..)
import Debate.Helpers exposing (..)
import Effect exposing (Effect)
import Element exposing (..)
import Element.Border as D exposing (..)
@ -94,237 +98,19 @@ debateList : Element msg
debateList =
column
pageList
argumentList
type alias MakeRowInput =
{ argumentTitle : String
, propositionTitle : String
, propositionSummary : String
, definitionTable : List Definition
, argumentFormalization : List ArgumentEntry
}
type alias PremiseWithNotation =
{ premise : String
, notation : String
}
type alias ArgumentEntry =
{ premises : List PremiseWithNotation
, conclusion : String
, conclusionNotation : String
}
type alias Definition =
{ definiendum : String
, definiens : String
}
type alias Category =
{ categoryName : String
, propositions : List MakeRowInput
}
makeRow : MakeRowInput -> Element msg
makeRow makeRowInput =
let
argRows : List (Element msg)
argRows =
let
argumentFormatting =
[ centerX, F.center, spacing 3 ]
in
List.indexedMap
(\index argumentEntry ->
column (paragraphFormat ++ [ spacing 3, paddingEach { top = 30, right = 0, bottom = 0, left = 0 } ])
(List.indexedMap
(\premiseIndex premiseWithNotation ->
column argumentFormatting
[ paragraph paragraphHightlightedBoldText
[ text ("P" ++ String.fromInt (premiseIndex + 1) ++ ") ")
, text premiseWithNotation.premise
|> el [ F.color colourTheme.nonHighlightedText, F.regular ]
]
, paragraph argumentFormatting
[ text premiseWithNotation.notation
|> el [ F.color colourTheme.highlightText, F.bold ]
]
]
)
argumentEntry.premises
++ [ column argumentFormatting
[ paragraph paragraphHightlightedBoldText
[ text ("C" ++ String.fromInt (index + 1) ++ ") ")
, text argumentEntry.conclusion
|> el [ F.color colourTheme.nonHighlightedText, F.regular ]
]
, paragraph argumentFormatting
[ text argumentEntry.conclusionNotation
|> el [ F.color colourTheme.highlightText, F.bold ]
]
]
]
)
)
makeRowInput.argumentFormalization
in
column
[ paragraphWidth, alignLeft, spacing 8 ]
[ paragraph paragraphBoldFormat
[ text makeRowInput.argumentTitle |> el [ F.color colourTheme.nonHighlightedText, F.bold ]
]
, paragraph paragraphBoldFormat
[ text "Proposition: " |> el [ F.color colourTheme.highlightText ]
, text makeRowInput.propositionTitle |> el [ F.color colourTheme.nonHighlightedText, F.regular ]
]
, paragraph paragraphBoldFormat
[ text "Summary: " |> el [ F.color colourTheme.highlightText ]
, text makeRowInput.propositionSummary |> el [ F.color colourTheme.nonHighlightedText, F.regular ]
]
, wrappedRow (paragraphBoldFormat ++ [ alignLeft ])
[ Element.table [ spacing 8 ]
{ data = makeRowInput.definitionTable
, columns =
[ { header = el [ F.bold ] (text "Definiendum" |> el [ F.color colourTheme.highlightText ])
, width = fill |> maximum 50
, view =
\definition ->
text definition.definiendum
|> el [ F.color colourTheme.highlightText, F.bold ]
}
, { header = el [ F.bold ] (text "Definiens" |> el [ F.color colourTheme.highlightText ])
, width = fill
, view =
\definition ->
paragraph [ F.color colourTheme.nonHighlightedText, F.regular ]
[ text definition.definiens ]
}
<|
List.map
(\category ->
column [ spacing 20 ]
[ el (nonHighlightedTitleFormat ++ [ centerX ]) (text category.categoryName)
, column [] (List.map argumentMaker category.arguments)
]
}
)
[ { categoryName = "Ethics"
, arguments =
[ argumentAncestralDiets
, argumentEthicalSlurs
, argumentMalondialdehyde
]
}
]
, column [ centerX ] argRows
]
argumentList : List (Element msg)
argumentList =
List.map
(\category ->
column [ spacing 20 ]
[ el (nonHighlightedTitleFormat ++ [ centerX ]) (text category.categoryName)
, column [] (List.map makeRow category.propositions)
]
)
[ { categoryName = "Dietary Patterns"
, propositions =
[ { argumentTitle = "Argument for Using the Term Retard"
, propositionTitle = ""
, propositionSummary = ""
, definitionTable =
[ { definiendum = "C(x)"
, definiens = "(x) slur's negative connotations have been neutralised"
}
, { definiendum = "B(x)"
, definiens = "(x) slur has been rendered non-bigoted via altered usage"
}
, { definiendum = "D(x)"
, definiens = "oppressed people will continue to suffer from the use of (x) slur"
}
, { definiendum = "S(x)"
, definiens = "it is permissible to neutralise the term retard's negative connotations"
}
, { definiendum = "A(x)"
, definiens = "it is generally permissible to use the term retard with an altered non-bigoted meaning"
}
, { definiendum = "r"
, definiens = "retard"
}
]
, argumentFormalization =
[ { premises =
[ { premise = "For all slurs, (x) slur's negative connotations have been neutralised if and only if, (x) slur has been rendered non-bigoted via altered usage."
, notation = "(x(CxBx))"
}
, { premise = "For all slurs, if it is not the case that (x) slur's negative connotations have been neutralised, then oppressed people will continue to suffer from the use of (x) slur."
, notation = "(x(¬CxDx))"
}
, { premise = "It is not the case that the term retard's negative connotations have been neutralised."
, notation = "(¬Cr)"
}
, { premise = "If the term retard has not been rendered non-bigoted via altered usage and oppressed people will continue to suffer from the use of the term retard, then it is permissible to neutralise the term retard's negative connotations."
, notation = "(¬BrDrSr)"
}
, { premise = "If it is permissible to neutralise the term retard's negative connotations, then It is generally permissible to use the term retard with an altered non-bigoted meaning."
, notation = "(SrAr)"
}
]
, conclusion = "Therefore, it is generally permissible to use the term retard with an altered non-bigoted meaning."
, conclusionNotation = "(Ar)"
}
]
}
, { argumentTitle = ""
, propositionTitle = ""
, propositionSummary = ""
, definitionTable =
[ { definiendum = ""
, definiens = ""
}
, { definiendum = ""
, definiens = ""
}
]
, argumentFormalization =
[ { premises =
[ { premise = ""
, notation = ""
}
, { premise = ""
, notation = ""
}
, { premise = "."
, notation = ""
}
]
, conclusion = ""
, conclusionNotation = ""
}
]
}
, { argumentTitle = ""
, propositionTitle = ""
, propositionSummary = ""
, definitionTable =
[ { definiendum = ""
, definiens = ""
}
, { definiendum = ""
, definiens = ""
}
]
, argumentFormalization =
[ { premises =
[ { premise = ""
, notation = ""
}
, { premise = ""
, notation = ""
}
, { premise = "."
, notation = ""
}
]
, conclusion = ""
, conclusionNotation = ""
}
]
}
]
}
]