chore: push for isaac

This commit is contained in:
Nick 2024-11-25 18:50:12 -06:00
parent a5151ef112
commit 45ca7a9718
62 changed files with 385 additions and 55 deletions

View file

@ -13,7 +13,7 @@ import Element.Background as B exposing (..)
import Element.Border as D exposing (..)
import Element.Events as V exposing (..)
import Element.Font as F exposing (..)
import Html.Attributes exposing (form)
import Html.Attributes exposing (form, id)
import Layouts
import List.Extra exposing (..)
import Maybe exposing (withDefault)
@ -35,46 +35,47 @@ import View exposing (View)
-- )
argumentMaker : (Int -> msg) -> List Bool -> Argument -> Int -> Element msg
argumentMaker onClickMsg areArgsExpanded argument indexExpand =
argumentMaker : (Int -> msg) -> List Int -> Argument -> Int -> Element msg
argumentMaker onClickMsg argHeights argument indexExpand =
let
isArgumentExpanded : Bool
isArgumentExpanded : Int
isArgumentExpanded =
withDefault False <| getAt indexExpand areArgsExpanded
withDefault 0 <| getAt indexExpand argHeights
in
column
[ B.color colourTheme.darker
[ B.color colourTheme.cardBackground
, rounded 10
, E.width <| px 700
, E.htmlAttribute (id <| "arg" ++ String.fromInt indexExpand)
]
[ titleMaker onClickMsg indexExpand argument.argumentTitle isArgumentExpanded
, column
([ E.width <| px 600, centerX, transitionStyle, spacing 10 ]
++ (if not isArgumentExpanded then
[ transitionStyle
, height <| px 0
, roundEach { topLeft = 0, topRight = 0, bottomRight = 10, bottomLeft = 10 }
, clip
]
else
[ transitionStyle
, height <| px 800
, clip
]
)
-- ++ (if not isArgumentExpanded then
-- [ transitionStyle
-- -- , height <| px 0
-- , roundEach { topLeft = 0, topRight = 0, bottomRight = 10, bottomLeft = 10 }
-- , clip
-- ]
-- else
-- [ transitionStyle
-- , height <| px 300
-- , clip
-- ]
-- )
)
[ propositionMaker argument isArgumentExpanded
, reductioMaker argument isArgumentExpanded
, summaryMaker argument isArgumentExpanded
, strengthMaker argument isArgumentExpanded
, tableMaker argument isArgumentExpanded
, proofTreeMaker argument isArgumentExpanded
]
]
titleMaker : (Int -> msg) -> Int -> String -> Bool -> Element msg
titleMaker onClickMsg indexExpand title isArgumentExpanded =
titleMaker : (Int -> msg) -> Int -> String -> Int -> Element msg
titleMaker onClickMsg indexExpand title argHeight =
paragraph
(paragraphBoldFormat
++ [ F.size 20
@ -94,7 +95,7 @@ titleMaker onClickMsg indexExpand title isArgumentExpanded =
]
, V.onClick <| onClickMsg indexExpand
]
++ (if not isArgumentExpanded then
++ (if argHeight == 30 then
[ rounded 10 ]
else
@ -105,22 +106,37 @@ titleMaker onClickMsg indexExpand title isArgumentExpanded =
]
propositionMaker : Argument -> Bool -> Element msg
propositionMaker argument isArgumentExpanded =
row [ paddingEach { top = 10, right = 0, bottom = 0, left = 0 } ]
propositionMaker : Argument -> Int -> Element msg
propositionMaker argument argHeight =
row
[ paddingEach { top = 10, right = 0, bottom = 0, left = 0 }
]
[ column
[ E.alignTop, E.alignLeft ]
[ paragraph (paragraphBoldFormat ++ [ F.size 18, E.width <| px 100 ])
[ paragraph
(paragraphBoldFormat
++ [ F.size 18
, E.width <| px 100
]
)
[ el [ tooltip below (myTooltip "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.highlightText ] ]
]
, column
[ E.width fill, E.alignLeft ]
[ paragraph (paragraphBoldFormat ++ [ F.size 18 ]) [ text argument.propositionTitle |> el [ F.color colourTheme.nonHighlightedText, F.regular, F.size 16 ] ] ]
[ paragraph (paragraphBoldFormat ++ [ F.size 18 ])
[ text argument.propositionTitle
|> el
[ F.color colourTheme.nonHighlightedText
, F.regular
, F.size 16
]
]
]
]
reductioMaker : Argument -> Bool -> Element msg
reductioMaker argument isArgumentExpanded =
reductioMaker : Argument -> Int -> Element msg
reductioMaker argument argHeight =
case argument.propositionReductio of
"" ->
none
@ -140,8 +156,8 @@ reductioMaker argument isArgumentExpanded =
]
summaryMaker : Argument -> Bool -> Element msg
summaryMaker argument isArgumentExpanded =
summaryMaker : Argument -> Int -> Element msg
summaryMaker argument argHeight =
row []
[ column
[ E.alignTop, E.alignLeft ]
@ -151,12 +167,99 @@ summaryMaker argument isArgumentExpanded =
]
, column
[ E.width fill, E.alignLeft ]
[ paragraph (paragraphBoldFormat ++ [ F.size 18, spacing 3 ]) [ text argument.propositionSummary |> el [ F.color colourTheme.nonHighlightedText, F.regular, F.size 16 ] ] ]
[ paragraph
(paragraphBoldFormat
++ [ F.size 18
, spacing 3
]
)
[ text argument.propositionSummary
|> el
[ F.color colourTheme.nonHighlightedText
, F.regular
, F.size 16
]
]
]
]
tableMaker : Argument -> Bool -> Element msg
tableMaker argument isArgumentExpanded =
strengthMaker : Argument -> Int -> Element msg
strengthMaker argument argHeight =
let
barMaker : Int -> Element msg
barMaker num =
el
[ E.height <| px 12
, E.width <| px 500
, D.rounded 10
, D.color colourTheme.nonHighlightedDarkText
, D.width 2
, B.gradient
{ angle = 90
, steps =
List.concat
[ List.repeat num colourTheme.barGreen
, List.repeat (10 - num) colourTheme.barRed
]
}
, tooltip below (myTooltip (getConfidenceTooltip num))
]
none
getConfidenceTooltip : Int -> String
getConfidenceTooltip num =
case num of
0 ->
"Extremely low. Speculative reasoning."
1 ->
"Very low. Extremely weak reasoning."
2 ->
"Kinda low. Weak reasoning."
3 ->
"Low. Somewhat weak reasoning."
4 ->
"Below average. More weak than strong."
5 ->
"Moderate. OK reasoning."
6 ->
"Above average. More strong than weak."
7 ->
"High. Somewhat strong reasoning."
8 ->
"Kinda high. Robust reasoning."
9 ->
"Very high. Extremely robust reasoning."
10 ->
"Extremely high. Air tight reasoning."
_ ->
"Confidence level out of expected range."
in
row [ paddingEach { top = 10, right = 0, bottom = 0, left = 0 } ]
[ column
[ E.alignTop, E.alignLeft ]
[ paragraph (paragraphBoldFormat ++ [ F.size 18, E.width <| px 100 ])
[ el [ tooltip below (myTooltip "This represents my confidence in the soundness of the argument.") ] (text "Confidence:") |> el [ F.color colourTheme.highlightText ] ]
]
, column
[ E.width fill, E.alignLeft, centerY ]
[ barMaker argument.argumentCertainty ]
]
tableMaker : Argument -> Int -> Element msg
tableMaker argument argHeight =
let
formalizationMaker : List (Element msg)
formalizationMaker =
@ -265,8 +368,8 @@ tableMaker argument isArgumentExpanded =
]
proofTreeMaker : Argument -> Bool -> Element msg
proofTreeMaker argument isArgumentExpanded =
proofTreeMaker : Argument -> Int -> Element msg
proofTreeMaker argument argHeight =
row [ paddingEach { top = 10, right = 0, bottom = 10, left = 0 }, centerX, E.width fill ]
[ column [ E.alignRight ]
[ newTabLink