mirror of
https://gitlab.com/upRootNutrition/website.git
synced 2025-06-16 20:35:13 -05:00
feat: standardized formatting conventions across pages
This commit is contained in:
parent
d5e7cfe814
commit
ead41f0ed0
19 changed files with 503 additions and 446 deletions
|
@ -1,7 +1,9 @@
|
|||
module Debate.Helpers exposing (..)
|
||||
|
||||
import Config.CardFormat exposing (..)
|
||||
import Config.Colour as T exposing (..)
|
||||
import Config.Format as O exposing (..)
|
||||
import Config.StrengthBar exposing (..)
|
||||
import Debate.Types exposing (..)
|
||||
import Effect exposing (Effect)
|
||||
import Element as E exposing (..)
|
||||
|
@ -11,6 +13,7 @@ import Element.Events as V exposing (..)
|
|||
import Element.Font as F exposing (..)
|
||||
import Html exposing (div, hr)
|
||||
import Html.Attributes as H exposing (style, title, wrap)
|
||||
import Json.Decode exposing (field)
|
||||
import Layouts
|
||||
import Page exposing (Page)
|
||||
import Route exposing (Route)
|
||||
|
@ -21,78 +24,38 @@ import View exposing (View)
|
|||
argumentMaker : Argument -> Element msg
|
||||
argumentMaker argument =
|
||||
row
|
||||
[ spacing 20
|
||||
, E.width fill
|
||||
, E.height fill
|
||||
, E.alignTop
|
||||
, E.alignRight
|
||||
]
|
||||
[ imageMaker argument
|
||||
, column
|
||||
[ E.width <| px 650
|
||||
, alignTop
|
||||
]
|
||||
[ column
|
||||
[ B.color colourTheme.cardBackground
|
||||
, rounded 26
|
||||
]
|
||||
[ titleMaker argument
|
||||
, column [ paddingEach { top = 10, right = 30, bottom = 10, left = 30 }, spacing 10 ]
|
||||
[ propositionMaker argument
|
||||
, reductioMaker argument
|
||||
, summaryMaker argument
|
||||
, strengthMaker argument
|
||||
, tableMaker argument
|
||||
, proofTreeMaker argument
|
||||
topLevelBox
|
||||
[ cardImageMaker (argumentImage argument)
|
||||
, cardMaker
|
||||
[ cardTitleMaker (argumentTitle argument)
|
||||
, cardFormatter
|
||||
[ cardContentSpacing
|
||||
[ column
|
||||
[ fieldSpacer
|
||||
]
|
||||
[ propositionMaker argument
|
||||
, reductioMaker argument
|
||||
, summaryMaker argument
|
||||
, strengthMaker argument
|
||||
, tableMaker argument
|
||||
, proofTreeMaker argument
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
imageMaker : Argument -> Element msg
|
||||
imageMaker argument =
|
||||
column
|
||||
[ E.width <| px 115
|
||||
, E.height <| px 115
|
||||
, E.alignTop
|
||||
, E.alignRight
|
||||
]
|
||||
[ column
|
||||
[ D.rounded 100
|
||||
, D.width 5
|
||||
, D.color colourTheme.cardBackground
|
||||
, B.color colourTheme.cardBackground
|
||||
]
|
||||
[ E.image
|
||||
[ E.alignRight
|
||||
, alignTop
|
||||
, D.rounded 100
|
||||
, clip
|
||||
, E.width <| px 90
|
||||
, E.height <| px 90
|
||||
]
|
||||
{ src = "arguments/" ++ argument.argumentImage ++ ".png"
|
||||
, description = argument.argumentTitle
|
||||
}
|
||||
]
|
||||
]
|
||||
argumentImage : Argument -> { src : String, description : String }
|
||||
argumentImage argument =
|
||||
{ src = "arguments/" ++ argument.argumentImage ++ ".png"
|
||||
, description = argument.argumentTitle
|
||||
}
|
||||
|
||||
|
||||
titleMaker : Argument -> Element msg
|
||||
titleMaker argument =
|
||||
row
|
||||
(nonHighlightedTitleFormat
|
||||
++ [ F.size 20
|
||||
, B.color colourTheme.highlightTextHover
|
||||
, paddingEach { top = 6, bottom = 3, left = 25, right = 15 }
|
||||
, alignBottom
|
||||
, E.width fill
|
||||
, D.roundEach { topLeft = 26, topRight = 26, bottomRight = 0, bottomLeft = 0 }
|
||||
]
|
||||
)
|
||||
[ text argument.argumentTitle
|
||||
]
|
||||
argumentTitle : Argument -> String
|
||||
argumentTitle argument =
|
||||
argument.argumentTitle
|
||||
|
||||
|
||||
propositionMaker : Argument -> Element msg
|
||||
|
@ -147,66 +110,6 @@ summaryMaker argument =
|
|||
|
||||
strengthMaker : Argument -> Element msg
|
||||
strengthMaker argument =
|
||||
let
|
||||
barMaker : Int -> Element msg
|
||||
barMaker num =
|
||||
el
|
||||
[ E.height <| px 12
|
||||
, E.width fill
|
||||
, 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 ->
|
||||
"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."
|
||||
in
|
||||
row [ E.width fill ]
|
||||
[ column
|
||||
[ E.alignTop, E.alignLeft ]
|
||||
|
@ -215,10 +118,50 @@ strengthMaker argument =
|
|||
]
|
||||
, column
|
||||
[ E.width fill, E.alignLeft, centerY ]
|
||||
[ barMaker argument.argumentCertainty ]
|
||||
[ 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 =
|
||||
let
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue