website/frontend/src/Pages/Debate.elm

277 lines
7.1 KiB
Elm
Raw Normal View History

2024-12-15 02:31:26 -06:00
module Pages.Debate exposing
( Model
, Msg
, debateArguments
, debateCuckList
, debateGibberish
, page
)
2024-12-08 02:18:36 -06:00
2024-12-15 02:31:26 -06:00
import Config.Data.Identity
exposing
( pageNames
)
2025-01-02 02:33:57 -06:00
import Config.Data.ImageFolders as M
exposing
( ImageFolder(..)
, imagePathMaker
)
import Config.Helpers.Cards.Inner.Text
2024-12-15 02:31:26 -06:00
exposing
2025-01-02 02:33:57 -06:00
( detailBodyLink
, detailBodyMaker
, detailFormat
, detailSpacing
, detailTitleMaker
2024-12-15 02:31:26 -06:00
)
2025-01-02 02:33:57 -06:00
import Config.Helpers.Cards.Outer.Helpers exposing (cardMaker)
import Config.Helpers.Cards.Outer.Types as C exposing (Cardable(..))
import Config.Helpers.Converters exposing (formatName)
import Config.Helpers.Headers.Helpers exposing (headerMaker)
2024-12-22 04:36:03 -06:00
import Config.Helpers.Headers.Records exposing (debateHeader)
2025-01-02 02:33:57 -06:00
import Config.Helpers.Headers.Types as R exposing (Header)
2024-12-11 03:48:49 -06:00
import Config.Helpers.Response
2024-12-09 19:53:09 -06:00
exposing
2024-12-09 20:30:04 -06:00
( pageList
2024-12-09 19:53:09 -06:00
, topLevelContainer
)
import Config.Helpers.Viewport exposing (resetViewport)
2024-12-18 20:11:04 -06:00
import Config.Pages.Debate.Arguments.List exposing (argumentList)
import Config.Pages.Debate.Cuckery.List exposing (cuckList)
import Config.Pages.Debate.Gibberish.List exposing (gibberishList)
2025-01-02 02:33:57 -06:00
import Config.Pages.Debate.Types exposing (Debate)
import Config.Style.Colour.Helpers as T
2024-12-15 02:31:26 -06:00
exposing
2025-01-02 02:33:57 -06:00
( ThemeColor(..)
, colourTheme
2024-12-15 02:31:26 -06:00
)
2024-12-24 03:08:39 -06:00
import Config.Style.Images exposing (imageSquareMaker)
2025-01-02 02:33:57 -06:00
import Effect exposing (Effect)
import Element as E
2024-12-15 02:31:26 -06:00
exposing
2025-01-02 02:33:57 -06:00
( Device
, DeviceClass(..)
, Element
, Orientation(..)
, alignLeft
, column
, el
, none
, paddingEach
, row
, text
2024-12-15 02:31:26 -06:00
)
2024-12-08 02:18:36 -06:00
import Layouts
import Page exposing (Page)
import Route exposing (Route)
2024-12-15 02:31:26 -06:00
import Route.Path as Path
2025-01-02 02:33:57 -06:00
import Shared exposing (Model)
2024-12-08 02:18:36 -06:00
import Task
import View exposing (View)
page : Shared.Model -> Route () -> Page Model Msg
page shared route =
Page.new
{ init = init
, update = update
, subscriptions = subscriptions
, view = view shared
}
|> Page.withLayout toLayout
toLayout : Model -> Layouts.Layout Msg
toLayout model =
Layouts.Navbar {}
-- INIT
type alias Model =
{}
init : () -> ( Model, Effect Msg )
init () =
( {}
2024-12-22 19:42:23 -06:00
, Effect.map
(\_ -> NoOp)
(Effect.sendCmd resetViewport)
2024-12-08 02:18:36 -06:00
)
-- UPDATE
type Msg
= NoOp
update : Msg -> Model -> ( Model, Effect Msg )
update msg model =
case msg of
NoOp ->
( model
, Effect.none
)
-- SUBSCRIPTIONS
subscriptions : Model -> Sub Msg
subscriptions model =
Sub.none
-- VIEW
view : Shared.Model -> Model -> View Msg
view shared model =
2024-12-14 23:59:50 -06:00
{ title = pageNames.pageDebate
2024-12-08 02:18:36 -06:00
, attributes = []
, element = debateContainer shared.device
}
debateContainer : Device -> Element msg
debateContainer device =
topLevelContainer (debateList device)
debateList : Device -> Element msg
debateList device =
2024-12-09 19:53:09 -06:00
column
2024-12-08 02:18:36 -06:00
(case ( device.class, device.orientation ) of
_ ->
2024-12-22 19:42:23 -06:00
pageList device
2024-12-08 02:18:36 -06:00
)
2024-12-09 19:53:09 -06:00
<|
List.concat
2024-12-22 04:36:03 -06:00
[ [ headerMaker (R.Debate debateHeader) ]
, List.map
2024-12-21 23:23:59 -06:00
(\debate ->
2024-12-24 03:08:39 -06:00
cardMaker device (C.Debate debate) (contentList device debate)
2024-12-21 23:23:59 -06:00
)
2024-12-09 19:53:09 -06:00
[ debateArguments
, debateCuckList
, debateGibberish
]
]
2024-12-15 02:31:26 -06:00
2024-12-24 03:08:39 -06:00
contentList : Device -> Debate -> List (Element msg)
contentList device debate =
[ descriptionMaker device debate ]
2024-12-15 02:31:26 -06:00
2024-12-24 03:08:39 -06:00
descriptionMaker : Device -> Debate -> Element msg
descriptionMaker device debate =
let
image : String -> Element msg
image size =
el
[ alignLeft
, paddingEach
{ top = 0
, right = 10
, bottom = 0
, left = 0
}
2024-12-15 02:31:26 -06:00
]
2024-12-24 03:08:39 -06:00
<|
imageSquareMaker device (imagePathMaker M.Debate debate.debateImage) True size
in
2024-12-27 23:24:35 -06:00
detailFormat row
[ case ( device.class, device.orientation ) of
( Phone, Portrait ) ->
none
( Tablet, Portrait ) ->
none
_ ->
image "Fatty"
, detailFormat column
[ inferenceMaker debate
, detailBodyMaker TextLightGrey
(text debate.debateDescription)
]
2024-12-24 03:08:39 -06:00
]
inferenceMaker : Debate -> Element msg
inferenceMaker debate =
2024-12-27 23:24:35 -06:00
detailFormat row
[ detailTitleMaker TextLightOrange
(case debate.debateTitle of
"Arguments" ->
"Inferences:"
"Cucklist" ->
"Cucks:"
"Gibberish" ->
"Gibberations:"
_ ->
""
)
, detailBodyMaker TextLightGrey
(text
2024-12-24 03:08:39 -06:00
(String.fromInt debate.debateCount)
2024-12-27 23:24:35 -06:00
)
2024-12-15 02:31:26 -06:00
]
debateArguments : Debate
debateArguments =
let
name =
"Arguments"
in
{ debateTitle = name
, debateLink = Path.toString Path.Debate_Arguments
2024-12-18 20:11:04 -06:00
, debateCount = List.length argumentList
2024-12-15 02:31:26 -06:00
, debateImage = formatName name
, isNewTabLink = False
, debateDescription = "This page features arguments that I hold to be sound, though with varying degrees of confidence. I'm open to hearing all challenges, as I am ready to engage with any substantive critiques and defend any argument listed. I have additionally included a confidence meter with each argument to give readers a clearer understanding of how strongly I hold to the argument."
}
debateCuckList : Debate
debateCuckList =
let
name =
"Cucklist"
in
{ debateTitle = name
, debateLink = Path.toString Path.Debate_Cucklist
2024-12-18 20:11:04 -06:00
, debateCount = List.length cuckList
2024-12-15 02:31:26 -06:00
, debateImage = formatName name
, isNewTabLink = False
, debateDescription = "This page features a list of complete fucking morons who wrote cheques with their mouths that their asses ultimately couldn't cash. Each person included in this list has dodged debating me in some way, shape, or form. Whether it's simply ignoring invitations, or outright refusing to engage, or agreeing to debate and then subsequently withdrawing. All such instances are catalogued here."
}
debateGibberish : Debate
debateGibberish =
let
name =
"Gibberish"
in
{ debateTitle = name
, debateLink = Path.toString Path.Debate_Gibberish
2024-12-18 20:11:04 -06:00
, debateCount = List.length gibberishList
2024-12-15 02:31:26 -06:00
, debateImage = formatName name
, isNewTabLink = False
, debateDescription = "This page is specifically for terms and ostensible concepts that I don't have a good reason to believe are understandable from at least one viewpoint. If the clarification of a philosophical term is unsatisfying or unsuccessful, and my interlocutor has exhausted all means of rendering the concept to me, the term ends up here until someone explains to me what the fuck it even means."
}