mirror of
https://gitlab.com/upRootNutrition/website.git
synced 2025-06-16 12:25:12 -05:00
393 lines
9.8 KiB
Elm
Executable file
393 lines
9.8 KiB
Elm
Executable file
module Pages.Interviews exposing (Model, Msg, page)
|
|
|
|
import Config.Data.Identity exposing (pageNames)
|
|
import Config.Helpers.Cards.Inner.Helpers exposing (..)
|
|
import Config.Helpers.Cards.Outer.Helpers exposing (cardMaker)
|
|
import Config.Helpers.Cards.Outer.Types as C
|
|
import Config.Helpers.Converters exposing (formatSocial)
|
|
import Config.Helpers.Format
|
|
exposing
|
|
( headerFontSizeSmall
|
|
, paragraphFontSize
|
|
, paragraphSpacing
|
|
)
|
|
import Config.Helpers.Headers.Helpers exposing (..)
|
|
import Config.Helpers.Headers.Records exposing (interviewHeader)
|
|
import Config.Helpers.Headers.Types as R exposing (..)
|
|
import Config.Helpers.ImageFolders as M exposing (..)
|
|
import Config.Helpers.Response
|
|
exposing
|
|
( pageList
|
|
, topLevelContainer
|
|
)
|
|
import Config.Helpers.StrengthBar
|
|
exposing
|
|
( barMaker
|
|
, barPadding
|
|
)
|
|
import Config.Helpers.ToolTip exposing (tooltip)
|
|
import Config.Helpers.Viewport exposing (resetViewport)
|
|
import Config.Pages.Debate.Cuckery.List exposing (cuckListNumber)
|
|
import Config.Pages.Interviews.Records.DrShawnBakerPodcast exposing (drShawnBakerPodcast)
|
|
import Config.Pages.Interviews.Records.FitAndFurious exposing (fitAndFurious)
|
|
import Config.Pages.Interviews.Records.FoolproofMastery exposing (foolproofMastery)
|
|
import Config.Pages.Interviews.Records.KetogeeksPodcast exposing (ketoGeeksPodcast)
|
|
import Config.Pages.Interviews.Records.LegendaryLifePodcast exposing (legendaryLifePodcast)
|
|
import Config.Pages.Interviews.Records.MarkBellsPowerProject exposing (markBellsPowerProject)
|
|
import Config.Pages.Interviews.Records.MuscleMemoirsPodcast exposing (muscleMemoirsPodcast)
|
|
import Config.Pages.Interviews.Records.SigmaNutritionRadio exposing (sigmaNutritionRadio)
|
|
import Config.Pages.Interviews.Records.StrenuousLifePodcast exposing (strenuousLifePodcast)
|
|
import Config.Pages.Interviews.Types exposing (..)
|
|
import Config.Style.Colour.Helpers exposing (ThemeColor(..), colourTheme)
|
|
import Config.Style.Images exposing (imageSquareMaker)
|
|
import Config.Style.Transitions
|
|
exposing
|
|
( hoverFontDarkOrange
|
|
, transitionStyleFast
|
|
, transitionStyleSlow
|
|
)
|
|
import Effect exposing (Effect)
|
|
import Element as E exposing (..)
|
|
import Element.Background as B
|
|
import Element.Border as D
|
|
import Element.Font as F
|
|
import Html.Attributes as H exposing (style)
|
|
import Layouts
|
|
import Page exposing (Page)
|
|
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
|
|
, view = view shared
|
|
}
|
|
|> Page.withLayout toLayout
|
|
|
|
|
|
toLayout : Model -> Layouts.Layout Msg
|
|
toLayout model =
|
|
Layouts.Navbar {}
|
|
|
|
|
|
|
|
-- INIT
|
|
|
|
|
|
type alias Model =
|
|
{}
|
|
|
|
|
|
init : () -> ( Model, Effect Msg )
|
|
init () =
|
|
( {}
|
|
, Effect.map
|
|
(\_ -> NoOp)
|
|
(Effect.sendCmd resetViewport)
|
|
)
|
|
|
|
|
|
|
|
-- 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 =
|
|
{ title = pageNames.pageInterviews
|
|
, attributes = []
|
|
, element = interviewContainer shared.device
|
|
}
|
|
|
|
|
|
interviewContainer : Device -> Element msg
|
|
interviewContainer device =
|
|
topLevelContainer (interviewList device)
|
|
|
|
|
|
interviewList : Device -> Element msg
|
|
interviewList device =
|
|
column
|
|
(case ( device.class, device.orientation ) of
|
|
_ ->
|
|
pageList device
|
|
)
|
|
<|
|
|
List.concat
|
|
[ [ headerMaker (R.Interviews interviewHeader) ]
|
|
, List.map
|
|
(\interview ->
|
|
cardMaker device (C.Interview interview) (contentList device interview)
|
|
)
|
|
[ sigmaNutritionRadio
|
|
, markBellsPowerProject
|
|
, foolproofMastery
|
|
, ketoGeeksPodcast
|
|
, legendaryLifePodcast
|
|
, muscleMemoirsPodcast
|
|
, fitAndFurious
|
|
, strenuousLifePodcast
|
|
, drShawnBakerPodcast
|
|
]
|
|
]
|
|
|
|
|
|
contentList : Device -> Interview -> List (Element msg)
|
|
contentList device interview =
|
|
let
|
|
image : String -> Element msg
|
|
image size =
|
|
el
|
|
[ alignLeft
|
|
, alignTop
|
|
, paddingEach
|
|
{ top = 0
|
|
, right = 8
|
|
, bottom = 0
|
|
, left = 0
|
|
}
|
|
]
|
|
<|
|
|
imageSquareMaker device (imagePathMaker M.Interviews interview.interviewImage) True size
|
|
|
|
imageMaker : Element msg
|
|
imageMaker =
|
|
case ( device.class, device.orientation ) of
|
|
( Phone, Portrait ) ->
|
|
image "Smallish"
|
|
|
|
( Tablet, Portrait ) ->
|
|
image "Smallish"
|
|
|
|
_ ->
|
|
image "Test"
|
|
in
|
|
[ row
|
|
[ paddingEach
|
|
{ top = 3
|
|
, right = 0
|
|
, bottom = 0
|
|
, left = 0
|
|
}
|
|
, detailSpacing
|
|
, width fill
|
|
]
|
|
[ imageMaker
|
|
, detailFormat column
|
|
[ socialMaker interview.interviewSocial interview.interviewSocial
|
|
, detailTitleMaker TextLightGrey "Appearances:"
|
|
, appearanceMaker interview
|
|
]
|
|
]
|
|
]
|
|
|
|
|
|
appearanceMaker : Interview -> Element msg
|
|
appearanceMaker interview =
|
|
column [ spacing 10, width fill ] <|
|
|
List.map2 (\x y -> makeAppearance x y)
|
|
interview.interviewAppearances
|
|
(List.range 1 (List.length interview.interviewAppearances))
|
|
|
|
|
|
makeAppearance : Appearance -> Int -> Element msg
|
|
makeAppearance appearanceEntry index =
|
|
detailFormat row
|
|
[ listCounter index
|
|
, detailFormat column
|
|
[ episodeMaker appearanceEntry
|
|
, experienceMaker appearanceEntry
|
|
, dateMaker appearanceEntry
|
|
, subjectMaker appearanceEntry
|
|
, subjectList appearanceEntry
|
|
]
|
|
]
|
|
|
|
|
|
episodeMaker : Appearance -> Element msg
|
|
episodeMaker appearanceEntry =
|
|
newTabLink
|
|
[]
|
|
{ url = appearanceEntry.appearanceLink
|
|
, label = detailTitleMaker TextLightOrange ("#" ++ appearanceEntry.appearanceEpisode ++ ": " ++ appearanceEntry.appearanceTitle)
|
|
}
|
|
|
|
|
|
experienceMaker : Appearance -> Element msg
|
|
experienceMaker appearanceEntry =
|
|
row
|
|
[ width fill
|
|
, height fill
|
|
, spacing 5
|
|
]
|
|
[ column
|
|
[ E.alignTop
|
|
, E.alignLeft
|
|
]
|
|
[ paragraph
|
|
[ F.color colourTheme.textLightGrey
|
|
, paragraphSpacing
|
|
, headerFontSizeSmall
|
|
, F.bold
|
|
]
|
|
[ el
|
|
[ tooltip
|
|
"This represents how pleasant it was to interact with the host(s)."
|
|
]
|
|
(el
|
|
[]
|
|
<|
|
|
text "Pleasantness:"
|
|
)
|
|
]
|
|
]
|
|
, barPadding
|
|
[ barMaker getExperienceTooltip appearanceEntry.appearanceExperience ]
|
|
]
|
|
|
|
|
|
getExperienceTooltip : Int -> String
|
|
getExperienceTooltip num =
|
|
case num of
|
|
0 ->
|
|
"Nightmare. Complete fucking cunt."
|
|
|
|
1 ->
|
|
"Toxic. Deliberately malicious."
|
|
|
|
2 ->
|
|
"Hostile. Consistently disruptive."
|
|
|
|
3 ->
|
|
"Belligerent. Consistently disrespectful."
|
|
|
|
4 ->
|
|
"Uncivil. Frequently dismissive."
|
|
|
|
5 ->
|
|
"Neutral. Unremarkable social interaction."
|
|
|
|
6 ->
|
|
"Civil. Slightly considerate."
|
|
|
|
7 ->
|
|
"Pleasant. Genuinely respectful."
|
|
|
|
8 ->
|
|
"Very kind. Consistently supportive."
|
|
|
|
9 ->
|
|
"Compassionate. Went out of their way."
|
|
|
|
10 ->
|
|
"Absolute angel. Perfectly empathetic."
|
|
|
|
_ ->
|
|
"Behavior level out of expected range."
|
|
|
|
|
|
dateMaker : Appearance -> Element msg
|
|
dateMaker appearanceEntry =
|
|
row
|
|
[ F.color colourTheme.textLightGrey
|
|
, paragraphSpacing
|
|
, headerFontSizeSmall
|
|
, F.bold
|
|
]
|
|
[ el
|
|
[ alignTop
|
|
]
|
|
<|
|
|
text
|
|
"Published:"
|
|
, el
|
|
[ alignTop
|
|
, width fill
|
|
]
|
|
<|
|
|
paragraph
|
|
[ F.regular
|
|
, paragraphFontSize
|
|
]
|
|
[ text appearanceEntry.appearanceYear
|
|
]
|
|
]
|
|
|
|
|
|
subjectMaker : Appearance -> Element msg
|
|
subjectMaker appearanceEntry =
|
|
paragraph
|
|
[ F.color colourTheme.textLightGrey
|
|
, paragraphSpacing
|
|
, headerFontSizeSmall
|
|
, F.bold
|
|
]
|
|
[ column
|
|
[ alignTop
|
|
]
|
|
[ text "Subjects: "
|
|
]
|
|
]
|
|
|
|
|
|
subjectList : Appearance -> Element msg
|
|
subjectList appearanceEntry =
|
|
column
|
|
[ spacing 5
|
|
, width fill
|
|
, paddingEach
|
|
{ top = 0
|
|
, right = 0
|
|
, bottom = 0
|
|
, left = 10
|
|
}
|
|
]
|
|
<|
|
|
List.map2 (\x y -> makeSubject x)
|
|
appearanceEntry.appearanceSubjects
|
|
(List.range 1 (List.length appearanceEntry.appearanceSubjects))
|
|
|
|
|
|
makeSubject : Subjects -> Element msg
|
|
makeSubject subjects =
|
|
el
|
|
[ E.width fill
|
|
, alignLeft
|
|
]
|
|
<|
|
|
paragraph
|
|
[ F.regular
|
|
, paragraphFontSize
|
|
]
|
|
[ text ("• " ++ subjects.subject) ]
|
|
|