mirror of
https://gitlab.com/upRootNutrition/website.git
synced 2025-06-16 04:25:11 -05:00
436 lines
11 KiB
Elm
Executable file
436 lines
11 KiB
Elm
Executable file
module Pages.Interviews exposing (Model, Msg, page)
|
||
|
||
import Config.Data.Identity exposing (pageNames)
|
||
import Config.Helpers.CardFormat exposing (cardMaker)
|
||
import Config.Helpers.Converters exposing (formatSocial)
|
||
import Config.Helpers.Format
|
||
exposing
|
||
( headerFontSizeSmall
|
||
, paragraphFontSize
|
||
, paragraphSpacing
|
||
)
|
||
import Config.Helpers.Headers.Header exposing (..)
|
||
import Config.Helpers.Headers.Types exposing (Header)
|
||
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.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 exposing (colourTheme)
|
||
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
|
||
)
|
||
<|
|
||
List.concat
|
||
[ List.map (headerMaker device)
|
||
[ interviewHeader ]
|
||
, (case ( device.class, device.orientation ) of
|
||
_ ->
|
||
List.map (interviewMaker device)
|
||
)
|
||
[ sigmaNutritionRadio
|
||
, markBellsPowerProject
|
||
, foolproofMastery
|
||
, ketoGeeksPodcast
|
||
, legendaryLifePodcast
|
||
, muscleMemoirsPodcast
|
||
, fitAndFurious
|
||
, strenuousLifePodcast
|
||
, drShawnBakerPodcast
|
||
]
|
||
]
|
||
|
||
|
||
interviewHeader : Header
|
||
interviewHeader =
|
||
let
|
||
name =
|
||
"Interviews"
|
||
in
|
||
{ headerTitle = String.toUpper name
|
||
, hasImage = False
|
||
, hasLink = False
|
||
, headerBody = "This page showcases various podcasts and shows I've been on. If you’d like to have me as a guest on your podcast, feel free to reach out—I’d love to share my perspectives with your audience!"
|
||
}
|
||
|
||
|
||
interviewMaker : Device -> Interview -> Element msg
|
||
interviewMaker device interview =
|
||
cardMaker device interview.interviewName (contentList interview) (interviewImage interview) interview.interviewSocial
|
||
|
||
|
||
contentList : Interview -> List (Element msg)
|
||
contentList interview =
|
||
[ appearanceTitle interview
|
||
, appearanceMaker interview
|
||
]
|
||
|
||
|
||
interviewImage : Interview -> { src : String, description : String }
|
||
interviewImage interview =
|
||
{ src = "interviews/" ++ interview.interviewImage ++ ".png"
|
||
, description = interview.interviewImage
|
||
}
|
||
|
||
|
||
socialMaker : Interview -> Element msg
|
||
socialMaker interview =
|
||
paragraph
|
||
[ F.color colourTheme.textLightGrey
|
||
, paragraphSpacing
|
||
, F.bold
|
||
, headerFontSizeSmall
|
||
]
|
||
[ text "Social: "
|
||
, newTabLink
|
||
[ paragraphFontSize
|
||
, F.color colourTheme.textLightOrange
|
||
]
|
||
{ url = interview.interviewSocial
|
||
, label =
|
||
el
|
||
[ transitionStyleSlow
|
||
, hoverFontDarkOrange
|
||
]
|
||
<|
|
||
text (formatSocial interview.interviewSocial)
|
||
}
|
||
]
|
||
|
||
|
||
appearanceTitle : Interview -> Element msg
|
||
appearanceTitle interview =
|
||
paragraph
|
||
[ F.color colourTheme.textLightGrey
|
||
, paragraphSpacing
|
||
, headerFontSizeSmall
|
||
, F.bold
|
||
]
|
||
[ text "Appearances: " ]
|
||
|
||
|
||
appearanceMaker : Interview -> Element msg
|
||
appearanceMaker interview =
|
||
column [ spacing 15, 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 =
|
||
el
|
||
[ alignLeft
|
||
, width fill
|
||
]
|
||
<|
|
||
row
|
||
[ E.width fill
|
||
, spacing 5
|
||
]
|
||
[ el
|
||
[ F.color colourTheme.textLightGrey
|
||
, paragraphSpacing
|
||
, headerFontSizeSmall
|
||
, F.bold
|
||
, alignTop
|
||
, F.alignRight
|
||
]
|
||
<|
|
||
text (String.fromInt index ++ ". ")
|
||
, column
|
||
[ spacing 8
|
||
, width fill
|
||
]
|
||
[ episodeMaker appearanceEntry
|
||
, experienceMaker appearanceEntry
|
||
, dateMaker appearanceEntry
|
||
, subjectMaker appearanceEntry
|
||
, subjectList appearanceEntry
|
||
]
|
||
]
|
||
|
||
|
||
episodeMaker : Appearance -> Element msg
|
||
episodeMaker appearanceEntry =
|
||
newTabLink
|
||
[ paragraphFontSize
|
||
, F.color colourTheme.textLightOrange
|
||
]
|
||
{ url = appearanceEntry.appearanceLink
|
||
, label =
|
||
paragraph
|
||
[ F.size 18
|
||
]
|
||
[ text ("#" ++ appearanceEntry.appearanceEpisode ++ ": " ++ appearanceEntry.appearanceTitle)
|
||
|> el
|
||
[ F.color colourTheme.textLightOrange
|
||
, hoverFontDarkOrange
|
||
]
|
||
]
|
||
}
|
||
|
||
|
||
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 8
|
||
, 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) ]
|