2024-11-16 18:34:05 -06:00
|
|
|
module Pages.Arguments exposing (Model, Msg, page)
|
2024-11-12 19:23:16 -06:00
|
|
|
|
|
|
|
import Config.Colour as T exposing (..)
|
|
|
|
import Config.Format as O exposing (..)
|
|
|
|
import Config.Identity as I exposing (..)
|
2024-11-22 15:10:32 -06:00
|
|
|
import Debate.Arguments.Abortion exposing (..)
|
|
|
|
import Debate.Arguments.Agnosticism exposing (..)
|
|
|
|
import Debate.Arguments.AgriculturalPredation exposing (..)
|
|
|
|
import Debate.Arguments.AnabolicKeto exposing (..)
|
|
|
|
import Debate.Arguments.AnimalRights exposing (..)
|
|
|
|
import Debate.Arguments.AntagonisticPleiotropy exposing (..)
|
|
|
|
import Debate.Arguments.AntiRewilding exposing (..)
|
|
|
|
import Debate.Arguments.AntiVandalism exposing (..)
|
|
|
|
import Debate.Arguments.ApoBCVD exposing (..)
|
|
|
|
import Debate.Arguments.BoobyTrapPagers exposing (..)
|
|
|
|
import Debate.Arguments.CarbsObesity exposing (..)
|
|
|
|
import Debate.Arguments.ColonizingNature exposing (..)
|
|
|
|
import Debate.Arguments.CropDeaths exposing (..)
|
|
|
|
import Debate.Arguments.DairyCowRape exposing (..)
|
|
|
|
import Debate.Arguments.DietaryCholesterol exposing (..)
|
|
|
|
import Debate.Arguments.EfilismPatrolSquad exposing (..)
|
|
|
|
import Debate.Arguments.EpidemiologyCausality exposing (..)
|
|
|
|
import Debate.Arguments.EthicalSlurs exposing (..)
|
|
|
|
import Debate.Arguments.FineTuning exposing (..)
|
|
|
|
import Debate.Arguments.FlatEarthDebunk exposing (..)
|
|
|
|
import Debate.Arguments.FructoseNAFLD exposing (..)
|
|
|
|
import Debate.Arguments.HealthPromotingFoods exposing (..)
|
|
|
|
import Debate.Arguments.HealthSeeker exposing (..)
|
|
|
|
import Debate.Arguments.HealthyChocolate exposing (..)
|
|
|
|
import Debate.Arguments.HealthyDairy exposing (..)
|
|
|
|
import Debate.Arguments.HealthyFattyFish exposing (..)
|
|
|
|
import Debate.Arguments.HealthyFibre exposing (..)
|
|
|
|
import Debate.Arguments.HealthyFood exposing (..)
|
|
|
|
import Debate.Arguments.HealthyPlantFoods exposing (..)
|
|
|
|
import Debate.Arguments.HealthySeedOils exposing (..)
|
|
|
|
import Debate.Arguments.HealthySoy exposing (..)
|
|
|
|
import Debate.Arguments.ImmortalityReductio exposing (..)
|
|
|
|
import Debate.Arguments.Malondialdehyde exposing (..)
|
|
|
|
import Debate.Arguments.OddOrderPredators exposing (..)
|
|
|
|
import Debate.Arguments.Omega3Omega6Ratio exposing (..)
|
|
|
|
import Debate.Arguments.Ostroveganism exposing (..)
|
|
|
|
import Debate.Arguments.PlantBasedCVDReversal exposing (..)
|
|
|
|
import Debate.Arguments.PollinationReductio exposing (..)
|
|
|
|
import Debate.Arguments.PolyphenolReductio exposing (..)
|
|
|
|
import Debate.Arguments.ScratcherPioneers exposing (..)
|
|
|
|
import Debate.Arguments.SodiumCVD exposing (..)
|
|
|
|
import Debate.Arguments.TMAOCausality exposing (..)
|
2024-11-23 15:48:03 -06:00
|
|
|
import Debate.Arguments.Template exposing (argument)
|
2024-11-22 15:10:32 -06:00
|
|
|
import Debate.Arguments.TransPeople exposing (..)
|
|
|
|
import Debate.Arguments.TruncatedMeta exposing (..)
|
|
|
|
import Debate.Arguments.UnhealthyCoconutOil exposing (..)
|
|
|
|
import Debate.Arguments.UnhealthyProcessedMeat exposing (..)
|
|
|
|
import Debate.Arguments.UnhealthyRedMeat exposing (..)
|
|
|
|
import Debate.Arguments.UnhealthySaturatedFat exposing (..)
|
|
|
|
import Debate.Arguments.VeganSocietyReductio exposing (..)
|
2024-11-19 13:17:57 -06:00
|
|
|
import Debate.Helpers exposing (..)
|
2024-11-23 15:48:03 -06:00
|
|
|
import Debate.Types exposing (..)
|
2024-11-12 19:23:16 -06:00
|
|
|
import Effect exposing (Effect)
|
|
|
|
import Element exposing (..)
|
|
|
|
import Element.Border as D exposing (..)
|
|
|
|
import Element.Font as F
|
|
|
|
import Html
|
|
|
|
import Html.Attributes as H exposing (style, title, wrap)
|
|
|
|
import Layouts
|
2024-11-23 02:28:14 -06:00
|
|
|
import List.Extra as L exposing (..)
|
2024-11-12 19:23:16 -06:00
|
|
|
import Page exposing (Page)
|
2024-11-25 22:23:11 -05:00
|
|
|
import Ports exposing (gotArgHeight)
|
2024-11-12 19:23:16 -06:00
|
|
|
import Route exposing (Route)
|
|
|
|
import Shared
|
|
|
|
import View exposing (View)
|
|
|
|
|
|
|
|
|
|
|
|
page : Shared.Model -> Route () -> Page Model Msg
|
|
|
|
page shared route =
|
|
|
|
Page.new
|
|
|
|
{ init = init
|
|
|
|
, update = update
|
|
|
|
, subscriptions = subscriptions
|
2024-11-25 18:50:12 -06:00
|
|
|
, view = view shared
|
2024-11-12 19:23:16 -06:00
|
|
|
}
|
|
|
|
|> Page.withLayout toLayout
|
|
|
|
|
|
|
|
|
|
|
|
toLayout : Model -> Layouts.Layout Msg
|
|
|
|
toLayout model =
|
|
|
|
Layouts.Navbar {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- INIT
|
|
|
|
|
|
|
|
|
|
|
|
type alias Model =
|
2024-11-25 22:23:11 -05:00
|
|
|
{ argExpansions : List Bool
|
|
|
|
, argHeights : List Int
|
|
|
|
}
|
2024-11-12 19:23:16 -06:00
|
|
|
|
|
|
|
|
|
|
|
init : () -> ( Model, Effect Msg )
|
|
|
|
init () =
|
2024-11-25 22:23:11 -05:00
|
|
|
let
|
|
|
|
numArgs : Int
|
|
|
|
numArgs =
|
|
|
|
List.length argumentList
|
|
|
|
in
|
|
|
|
( { argExpansions = List.repeat numArgs False
|
|
|
|
, argHeights = List.repeat numArgs 0
|
|
|
|
}
|
2024-11-12 19:23:16 -06:00
|
|
|
, Effect.none
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- UPDATE
|
|
|
|
|
|
|
|
|
|
|
|
type Msg
|
2024-11-25 22:23:11 -05:00
|
|
|
= GotArgHeight (List Int)
|
|
|
|
| ToggleExpandArg Int
|
2024-11-12 19:23:16 -06:00
|
|
|
|
|
|
|
|
|
|
|
update : Msg -> Model -> ( Model, Effect Msg )
|
|
|
|
update msg model =
|
2024-11-25 22:23:11 -05:00
|
|
|
Debug.log (Debug.toString model.argHeights) <|
|
|
|
|
case msg of
|
|
|
|
GotArgHeight argHeights ->
|
|
|
|
( { model | argHeights = argHeights }, Effect.none )
|
|
|
|
|
|
|
|
ToggleExpandArg index ->
|
|
|
|
( case getAt index model.argExpansions of
|
|
|
|
Nothing ->
|
|
|
|
model
|
|
|
|
|
|
|
|
Just isExpanded ->
|
|
|
|
{ model
|
|
|
|
| argExpansions =
|
|
|
|
setAt index
|
|
|
|
(not isExpanded)
|
|
|
|
model.argExpansions
|
|
|
|
}
|
|
|
|
, Effect.sendCmd <| Ports.getArgHeight <| List.length model.argHeights
|
|
|
|
)
|
2024-11-12 19:23:16 -06:00
|
|
|
|
|
|
|
|
|
|
|
subscriptions : Model -> Sub Msg
|
|
|
|
subscriptions model =
|
2024-11-25 22:23:11 -05:00
|
|
|
gotArgHeight GotArgHeight
|
2024-11-12 19:23:16 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- VIEW
|
|
|
|
|
|
|
|
|
2024-11-25 18:50:12 -06:00
|
|
|
view : Shared.Model -> Model -> View Msg
|
|
|
|
view shared model =
|
2024-11-12 19:23:16 -06:00
|
|
|
{ title = debateName
|
|
|
|
, attributes = []
|
2024-11-25 18:50:12 -06:00
|
|
|
, element = debateContainer shared model
|
2024-11-12 19:23:16 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2024-11-25 18:50:12 -06:00
|
|
|
debateContainer : Shared.Model -> Model -> Element Msg
|
|
|
|
debateContainer shared model =
|
|
|
|
let
|
|
|
|
a : Device
|
|
|
|
a =
|
|
|
|
shared.device
|
|
|
|
in
|
2024-11-23 02:28:14 -06:00
|
|
|
topLevelContainer <| debateList model
|
2024-11-12 19:23:16 -06:00
|
|
|
|
|
|
|
|
2024-11-23 02:28:14 -06:00
|
|
|
debateList : Model -> Element Msg
|
|
|
|
debateList model =
|
2024-11-25 22:23:11 -05:00
|
|
|
let
|
|
|
|
argColumn : Bool -> Element Msg
|
|
|
|
argColumn isHidden =
|
|
|
|
column
|
|
|
|
[ padding 30
|
2024-11-26 04:32:11 -06:00
|
|
|
, spacing 15
|
2024-11-25 22:23:11 -05:00
|
|
|
]
|
|
|
|
<|
|
|
|
|
List.map argumentMaker <|
|
|
|
|
List.map4
|
|
|
|
(\w x y z ->
|
|
|
|
{ arg = w
|
|
|
|
, index = x
|
|
|
|
, isExpanded = y
|
|
|
|
, maybeHeight =
|
|
|
|
if isHidden then
|
|
|
|
Nothing
|
|
|
|
|
|
|
|
else
|
|
|
|
z
|
|
|
|
, titleClickMsg = ToggleExpandArg x
|
|
|
|
}
|
|
|
|
)
|
|
|
|
argumentList
|
|
|
|
(List.range 0 <| List.length model.argHeights)
|
|
|
|
model.argExpansions
|
|
|
|
(List.map Just model.argHeights)
|
|
|
|
in
|
|
|
|
el
|
2024-11-26 04:32:11 -06:00
|
|
|
[ behindContent <| argColumn True
|
|
|
|
, spacing 10
|
|
|
|
, centerX
|
|
|
|
, centerY
|
|
|
|
, alignTop
|
|
|
|
, paddingEach { top = 30, bottom = 30, left = 30, right = 30 }
|
|
|
|
]
|
2024-11-15 23:28:32 -06:00
|
|
|
<|
|
2024-11-25 22:23:11 -05:00
|
|
|
argColumn False
|
2024-11-23 15:48:03 -06:00
|
|
|
|
|
|
|
|
|
|
|
argumentList : List Argument
|
|
|
|
argumentList =
|
|
|
|
[ argumentApoBCVD
|
|
|
|
, argumentAnabolicKeto
|
|
|
|
, argumentAntagonisticPleiotropy
|
|
|
|
, argumentCarbsObesity
|
|
|
|
, argumentDietaryCholesterol
|
|
|
|
, argumentFructoseNAFLD
|
|
|
|
, argumentHealthPromotingFoods
|
|
|
|
, argumentHealthSeeker
|
|
|
|
, argumentHealthyChocolate
|
|
|
|
, argumentHealthyDairy
|
|
|
|
, argumentHealthyFattyFish
|
|
|
|
, argumentHealthyFibre
|
|
|
|
, argumentHealthyFood
|
|
|
|
, argumentHealthyPlantFoods
|
|
|
|
, argumentHealthySeedOils
|
|
|
|
, argumentHealthySoy
|
|
|
|
, argumentMalondialdehyde
|
|
|
|
, argumentOmega3Omega6Ratio
|
|
|
|
, argumentPlantBasedCVDReversal
|
|
|
|
, argumentPolyphenolReductio
|
|
|
|
, argumentSodiumCVD
|
|
|
|
, argumentTMAOCausality
|
|
|
|
, argumentUnhealthyCoconutOil
|
|
|
|
, argumentUnhealthyProcessedMeat
|
|
|
|
, argumentUnhealthyRedMeat
|
|
|
|
, argumentUnhealthySaturatedFat
|
|
|
|
, argumentAbortion
|
|
|
|
, argumentAgnosticism
|
|
|
|
, argumentAgriculturalPredation
|
|
|
|
, argumentAnimalRights
|
|
|
|
, argumentAntiRewilding
|
|
|
|
, argumentAntiVandalism
|
|
|
|
, argumentColonizingNature
|
|
|
|
, argumentCropDeaths
|
|
|
|
, argumentDairyCowRape
|
|
|
|
, argumentEfilismPatrolSquad
|
|
|
|
, argumentEthicalSlurs
|
|
|
|
, argumentFineTuning
|
|
|
|
, argumentImmortalityReductio
|
|
|
|
, argumentOddOrderPredators
|
|
|
|
, argumentOstroveganism
|
|
|
|
, argumentPollinationReductio
|
|
|
|
, argumentScratcherPioneers
|
|
|
|
, argumentTransPeople
|
|
|
|
, argumentVeganSocietyReductio
|
|
|
|
, argumentBoobyTrapPagers
|
|
|
|
, argumentEpidemiologyCausality
|
|
|
|
, argumentFlatEarthDebunk
|
|
|
|
, argumentTruncatedMeta
|
|
|
|
]
|