2024-11-18 18:55:36 -06:00
|
|
|
module Debate.Helpers exposing (..)
|
2024-11-15 23:28:32 -06:00
|
|
|
|
|
|
|
import Config.Colour as T exposing (..)
|
|
|
|
import Config.Format as O exposing (..)
|
|
|
|
import Debate.Types exposing (..)
|
|
|
|
import Effect exposing (Effect)
|
2024-11-20 22:47:57 -06:00
|
|
|
import Element as E exposing (..)
|
|
|
|
import Element.Background as B exposing (..)
|
2024-11-15 23:28:32 -06:00
|
|
|
import Element.Border as D exposing (..)
|
2024-11-19 13:17:57 -06:00
|
|
|
import Element.Events as V exposing (..)
|
2024-11-20 22:47:57 -06:00
|
|
|
import Element.Font as F exposing (..)
|
2024-11-15 23:28:32 -06:00
|
|
|
import Html
|
|
|
|
import Html.Attributes as H exposing (style, title, wrap)
|
|
|
|
import Layouts
|
|
|
|
import Page exposing (Page)
|
|
|
|
import Route exposing (Route)
|
|
|
|
import Shared
|
|
|
|
import View exposing (View)
|
|
|
|
|
|
|
|
|
|
|
|
argumentMaker : Argument -> Element msg
|
2024-11-16 00:26:41 -06:00
|
|
|
argumentMaker argument =
|
2024-11-15 23:28:32 -06:00
|
|
|
let
|
|
|
|
argRows : List (Element msg)
|
|
|
|
argRows =
|
|
|
|
let
|
2024-11-20 15:12:38 -06:00
|
|
|
argumentFormatting : List (Attribute msg)
|
2024-11-15 23:28:32 -06:00
|
|
|
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
|
2024-11-21 01:26:54 -06:00
|
|
|
[ text ("P" ++ String.fromInt (premiseIndex + 1) ++ ")")
|
2024-11-15 23:28:32 -06:00
|
|
|
, text premiseWithNotation.premise
|
2024-11-21 01:26:54 -06:00
|
|
|
|> el [ F.color colourTheme.nonHighlightedText, F.regular, paddingEach { top = 0, right = 0, bottom = 0, left = 5 } ]
|
2024-11-15 23:28:32 -06:00
|
|
|
]
|
|
|
|
, paragraph argumentFormatting
|
|
|
|
[ text premiseWithNotation.notation
|
|
|
|
|> el [ F.color colourTheme.highlightText, F.bold ]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
)
|
|
|
|
argumentEntry.premises
|
|
|
|
++ [ column argumentFormatting
|
|
|
|
[ paragraph paragraphHightlightedBoldText
|
2024-11-21 01:26:54 -06:00
|
|
|
[ text "C)"
|
2024-11-15 23:28:32 -06:00
|
|
|
, text argumentEntry.conclusion
|
2024-11-21 01:26:54 -06:00
|
|
|
|> el [ F.color colourTheme.nonHighlightedText, F.regular, paddingEach { top = 0, right = 0, bottom = 0, left = 5 } ]
|
2024-11-15 23:28:32 -06:00
|
|
|
]
|
|
|
|
, paragraph argumentFormatting
|
|
|
|
[ text argumentEntry.conclusionNotation
|
|
|
|
|> el [ F.color colourTheme.highlightText, F.bold ]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
]
|
|
|
|
)
|
|
|
|
)
|
2024-11-16 00:26:41 -06:00
|
|
|
argument.argumentFormalization
|
2024-11-18 18:55:36 -06:00
|
|
|
|
2024-11-20 15:12:38 -06:00
|
|
|
maybeReductioField : Element msg
|
2024-11-18 18:55:36 -06:00
|
|
|
maybeReductioField =
|
|
|
|
case argument.propositionReductio of
|
2024-11-20 22:47:57 -06:00
|
|
|
"" ->
|
2024-11-18 18:55:36 -06:00
|
|
|
none
|
2024-11-20 22:47:57 -06:00
|
|
|
|
2024-11-18 18:55:36 -06:00
|
|
|
reductio ->
|
2024-11-20 22:47:57 -06:00
|
|
|
row []
|
|
|
|
[ column
|
|
|
|
[ E.alignTop, E.alignLeft ]
|
|
|
|
[ paragraph (paragraphBoldFormat ++ [ F.size 18, E.width <| px 100 ])
|
2024-11-21 01:26:54 -06:00
|
|
|
[ el [ tooltip below (myTooltip "This is the position from which the reductio ad absurdum is derived.") ] (text "Reductio:") |> el [ F.color colourTheme.highlightText ]
|
2024-11-20 22:47:57 -06:00
|
|
|
]
|
|
|
|
]
|
|
|
|
, column [ E.width fill, E.alignLeft ]
|
|
|
|
[ paragraph []
|
|
|
|
[ text reductio |> el [ F.color colourTheme.nonHighlightedText, F.regular, F.size 16 ]
|
|
|
|
]
|
|
|
|
]
|
2024-11-18 18:55:36 -06:00
|
|
|
]
|
2024-11-15 23:28:32 -06:00
|
|
|
in
|
|
|
|
column
|
2024-11-20 22:47:57 -06:00
|
|
|
[ paragraphWidth, E.alignLeft, spacing 8, paddingEach { top = 0, right = 0, bottom = 60, left = 0 } ]
|
2024-11-15 23:28:32 -06:00
|
|
|
[ paragraph (paragraphBoldFormat ++ [ F.size 20 ])
|
2024-11-16 16:35:08 -06:00
|
|
|
[ newTabLink []
|
|
|
|
{ url = argument.proofLink
|
2024-11-16 18:34:05 -06:00
|
|
|
, label = transitionNonHighlightedLinkHover <| text argument.argumentTitle
|
2024-11-20 22:47:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
--create expandable text for this in the future
|
2024-11-15 23:28:32 -06:00
|
|
|
]
|
2024-11-20 22:47:57 -06:00
|
|
|
, row []
|
|
|
|
[ column
|
|
|
|
[ E.alignTop, E.alignLeft ]
|
|
|
|
[ paragraph (paragraphBoldFormat ++ [ F.size 18, E.width <| px 100 ])
|
2024-11-21 01:26:54 -06:00
|
|
|
[ 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 ] ]
|
2024-11-20 22:47:57 -06:00
|
|
|
]
|
|
|
|
, column
|
|
|
|
[ E.width fill, E.alignLeft ]
|
|
|
|
[ paragraph (paragraphBoldFormat ++ [ F.size 18 ]) [ text argument.propositionTitle |> el [ F.color colourTheme.nonHighlightedText, F.regular, F.size 16 ] ] ]
|
2024-11-15 23:28:32 -06:00
|
|
|
]
|
2024-11-18 18:55:36 -06:00
|
|
|
, maybeReductioField
|
2024-11-20 22:47:57 -06:00
|
|
|
, row [ E.alignTop ]
|
|
|
|
[ column
|
|
|
|
[ E.alignTop, E.alignLeft ]
|
|
|
|
[ paragraph (paragraphBoldFormat ++ [ F.size 18, E.width <| px 100 ])
|
2024-11-21 01:26:54 -06:00
|
|
|
[ el [ tooltip below (myTooltip "The following information provides additional context and insight into the reasoning behind the argument") ] (text "Summary:") |> el [ F.color colourTheme.highlightText ]
|
2024-11-20 22:47:57 -06:00
|
|
|
]
|
|
|
|
]
|
|
|
|
, column
|
|
|
|
[ E.width fill, E.alignLeft ]
|
|
|
|
[ paragraph (paragraphBoldFormat ++ [ F.size 18 ]) [ text argument.propositionSummary |> el [ F.color colourTheme.nonHighlightedText, F.regular, F.size 16 ] ] ]
|
2024-11-15 23:28:32 -06:00
|
|
|
]
|
2024-11-21 01:26:54 -06:00
|
|
|
, wrappedRow (paragraphBoldFormat ++ [ E.alignLeft, E.width fill ])
|
2024-11-20 22:47:57 -06:00
|
|
|
[ E.table
|
2024-11-15 23:28:32 -06:00
|
|
|
[ spacing 0
|
|
|
|
, D.rounded 10
|
|
|
|
, D.width 1
|
|
|
|
, D.color colourTheme.nonHighlightedDarkText
|
|
|
|
, clip
|
|
|
|
]
|
2024-11-16 00:26:41 -06:00
|
|
|
{ data = argument.definitionTable
|
2024-11-15 23:28:32 -06:00
|
|
|
, columns =
|
|
|
|
[ { header =
|
|
|
|
el
|
|
|
|
[ F.bold
|
|
|
|
, D.widthEach { bottom = 1, top = 1, left = 1, right = 1 }
|
|
|
|
, D.color colourTheme.nonHighlightedDarkText
|
|
|
|
, padding 8
|
|
|
|
]
|
|
|
|
(text "Definiendum" |> el [ F.color colourTheme.highlightText ])
|
|
|
|
, width = fill |> maximum 50
|
|
|
|
, view =
|
|
|
|
\definition ->
|
|
|
|
row
|
|
|
|
[ F.color colourTheme.highlightText
|
|
|
|
, F.bold
|
|
|
|
, D.widthEach { bottom = 1, top = 0, left = 1, right = 1 }
|
|
|
|
, D.color colourTheme.nonHighlightedDarkText
|
|
|
|
, padding 8
|
2024-11-20 22:47:57 -06:00
|
|
|
, E.height fill
|
2024-11-15 23:28:32 -06:00
|
|
|
]
|
2024-11-16 00:26:41 -06:00
|
|
|
[ row [ centerX ]
|
|
|
|
[ paragraph [] [ text definition.definiendum ]
|
|
|
|
]
|
2024-11-15 23:28:32 -06:00
|
|
|
]
|
|
|
|
}
|
|
|
|
, { header =
|
|
|
|
el
|
|
|
|
[ F.bold
|
|
|
|
, D.widthEach { bottom = 1, top = 1, left = 0, right = 1 }
|
|
|
|
, D.color colourTheme.nonHighlightedDarkText
|
|
|
|
, padding 8
|
|
|
|
]
|
|
|
|
(text "Definiens" |> el [ F.color colourTheme.highlightText ])
|
|
|
|
, width = fill
|
|
|
|
, view =
|
|
|
|
\definition ->
|
|
|
|
paragraph
|
|
|
|
[ F.color colourTheme.nonHighlightedText
|
|
|
|
, F.regular
|
|
|
|
, D.widthEach { bottom = 1, top = 0, left = 0, right = 1 }
|
|
|
|
, D.color colourTheme.nonHighlightedDarkText
|
|
|
|
, padding 8
|
2024-11-20 22:47:57 -06:00
|
|
|
, E.height fill
|
2024-11-15 23:28:32 -06:00
|
|
|
]
|
2024-11-16 00:26:41 -06:00
|
|
|
[ row []
|
|
|
|
[ paragraph [] [ text definition.definiens ]
|
|
|
|
]
|
|
|
|
]
|
2024-11-15 23:28:32 -06:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
, column [ centerX ] argRows
|
|
|
|
]
|