2024-12-22 04:36:03 -06:00
|
|
|
module Config.Helpers.Cards.Helpers exposing (..)
|
2024-12-21 23:23:59 -06:00
|
|
|
|
|
|
|
import Config.Data.Identity
|
|
|
|
exposing
|
|
|
|
( pageNames
|
|
|
|
)
|
2024-12-22 04:36:03 -06:00
|
|
|
import Config.Helpers.Cards.Types as C exposing (..)
|
2024-12-21 23:23:59 -06:00
|
|
|
import Config.Helpers.Converters exposing (formatName)
|
|
|
|
import Config.Helpers.Format
|
|
|
|
exposing
|
2024-12-22 19:42:23 -06:00
|
|
|
( divider
|
|
|
|
, headerFontSizeBig
|
|
|
|
, headerFontSizeMedium
|
2024-12-21 23:23:59 -06:00
|
|
|
, paragraphFontSize
|
|
|
|
, paragraphSpacing
|
|
|
|
)
|
2024-12-23 03:15:35 -06:00
|
|
|
import Config.Helpers.ImageFolders as M exposing (..)
|
2024-12-22 04:36:03 -06:00
|
|
|
import Config.Helpers.Response exposing (contentContainer)
|
2024-12-21 23:23:59 -06:00
|
|
|
import Config.Pages.Debate.Arguments.Records.Template exposing (argument)
|
|
|
|
import Config.Style.Colour exposing (colourTheme)
|
|
|
|
import Config.Style.Glow
|
|
|
|
exposing
|
|
|
|
( glowDeepDarkGrey
|
|
|
|
, glowDeepDarkOrange
|
|
|
|
)
|
|
|
|
import Config.Style.Icons.Icons exposing (construction)
|
|
|
|
import Config.Style.Transitions
|
|
|
|
exposing
|
|
|
|
( hoverCircleButtonDarkOrange
|
|
|
|
, transitionStyleMedium
|
|
|
|
, transitionStyleSlow
|
|
|
|
)
|
|
|
|
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
|
|
|
|
import Route.Path as Path exposing (..)
|
|
|
|
import Shared
|
|
|
|
|
|
|
|
|
|
|
|
cardMaker : Device -> Cardable msg -> List (Element msg) -> Element msg
|
|
|
|
cardMaker device cardable contents =
|
|
|
|
let
|
2024-12-22 04:36:03 -06:00
|
|
|
hasLink : Bool
|
|
|
|
hasLink =
|
|
|
|
case cardable of
|
|
|
|
C.Contact _ ->
|
|
|
|
False
|
|
|
|
|
|
|
|
C.Cuck c ->
|
|
|
|
True
|
|
|
|
|
|
|
|
C.BlogArticle _ ->
|
|
|
|
False
|
|
|
|
|
|
|
|
C.BlogCard _ ->
|
|
|
|
True
|
|
|
|
|
|
|
|
C.Argument _ ->
|
2024-12-23 03:15:35 -06:00
|
|
|
False
|
2024-12-22 04:36:03 -06:00
|
|
|
|
|
|
|
C.Gibberish _ ->
|
|
|
|
True
|
|
|
|
|
|
|
|
C.Service _ ->
|
|
|
|
True
|
|
|
|
|
|
|
|
C.Debate _ ->
|
|
|
|
True
|
|
|
|
|
|
|
|
C.Donate _ ->
|
|
|
|
True
|
|
|
|
|
|
|
|
C.Interview _ ->
|
|
|
|
False
|
|
|
|
|
|
|
|
C.NutriDex _ ->
|
|
|
|
False
|
|
|
|
|
|
|
|
C.ServicePage _ ->
|
|
|
|
False
|
|
|
|
|
2024-12-22 19:42:23 -06:00
|
|
|
cardTitleMaker : String -> Maybe String -> Element msg
|
|
|
|
cardTitleMaker title maybeUrl =
|
2024-12-21 23:23:59 -06:00
|
|
|
el
|
2024-12-22 19:42:23 -06:00
|
|
|
([ headerFontSizeMedium
|
|
|
|
, F.bold
|
|
|
|
, F.color colourTheme.textLightGrey
|
|
|
|
, width fill
|
|
|
|
]
|
|
|
|
++ (case ( device.class, device.orientation ) of
|
|
|
|
( Phone, Portrait ) ->
|
|
|
|
[]
|
|
|
|
|
|
|
|
( Tablet, Portrait ) ->
|
|
|
|
[]
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
[ F.center
|
|
|
|
, B.color colourTheme.textDarkOrange
|
|
|
|
, D.roundEach
|
|
|
|
{ topLeft = 26
|
|
|
|
, topRight = 26
|
|
|
|
, bottomRight = 0
|
|
|
|
, bottomLeft = 0
|
|
|
|
}
|
|
|
|
, paddingEach
|
|
|
|
{ top = 6
|
|
|
|
, bottom = 3
|
|
|
|
, left = 20
|
|
|
|
, right = 20
|
|
|
|
}
|
|
|
|
]
|
|
|
|
)
|
|
|
|
)
|
2024-12-21 23:23:59 -06:00
|
|
|
<|
|
2024-12-22 19:42:23 -06:00
|
|
|
column
|
|
|
|
[ width fill
|
|
|
|
, spacing 10
|
|
|
|
]
|
|
|
|
[ case ( device.class, device.orientation ) of
|
|
|
|
( Phone, Portrait ) ->
|
|
|
|
case cardable of
|
|
|
|
C.NutriDex _ ->
|
|
|
|
none
|
|
|
|
|
|
|
|
C.Contact _ ->
|
|
|
|
none
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
divider
|
|
|
|
|
|
|
|
( Tablet, Portrait ) ->
|
|
|
|
case cardable of
|
|
|
|
C.NutriDex _ ->
|
|
|
|
none
|
|
|
|
|
|
|
|
C.Contact _ ->
|
|
|
|
none
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
divider
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
none
|
|
|
|
, case cardable of
|
|
|
|
C.BlogCard blogArticle ->
|
|
|
|
case ( device.class, device.orientation ) of
|
|
|
|
( Phone, Portrait ) ->
|
|
|
|
image
|
|
|
|
[ width fill
|
|
|
|
, paddingEach
|
|
|
|
{ top = 8
|
|
|
|
, bottom = 0
|
|
|
|
, left = 0
|
|
|
|
, right = 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
{ src = "/blog/" ++ blogArticle.articleImage ++ ".png", description = "" }
|
|
|
|
|
|
|
|
( Tablet, Portrait ) ->
|
|
|
|
image
|
|
|
|
[ width fill
|
|
|
|
, paddingEach
|
|
|
|
{ top = 8
|
|
|
|
, bottom = 0
|
|
|
|
, left = 0
|
|
|
|
, right = 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
{ src = "/blog/" ++ blogArticle.articleImage ++ ".png", description = "" }
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
none
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
none
|
|
|
|
, row [ width fill, spacing 10 ]
|
|
|
|
[ case cardable of
|
|
|
|
C.NutriDex _ ->
|
|
|
|
case ( device.class, device.orientation ) of
|
|
|
|
( Phone, Portrait ) ->
|
|
|
|
none
|
|
|
|
|
|
|
|
( Tablet, Portrait ) ->
|
|
|
|
none
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
paragraph [] [ text title ]
|
|
|
|
|
|
|
|
C.Contact _ ->
|
|
|
|
case ( device.class, device.orientation ) of
|
|
|
|
( Phone, Portrait ) ->
|
|
|
|
none
|
|
|
|
|
|
|
|
( Tablet, Portrait ) ->
|
|
|
|
none
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
paragraph [] [ text title ]
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
paragraph [] [ text title ]
|
|
|
|
, el
|
|
|
|
[ alignRight
|
|
|
|
]
|
|
|
|
(case ( device.class, device.orientation ) of
|
|
|
|
( Phone, Portrait ) ->
|
|
|
|
case maybeUrl of
|
|
|
|
Just url ->
|
|
|
|
readMoreLink url
|
|
|
|
|
|
|
|
Nothing ->
|
|
|
|
none
|
|
|
|
|
|
|
|
( Tablet, Portrait ) ->
|
|
|
|
case maybeUrl of
|
|
|
|
Just url ->
|
|
|
|
readMoreLink url
|
|
|
|
|
|
|
|
Nothing ->
|
|
|
|
none
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
none
|
|
|
|
)
|
|
|
|
]
|
|
|
|
]
|
|
|
|
|
|
|
|
readMoreLink : String -> Element msg
|
|
|
|
readMoreLink url =
|
|
|
|
link [ alignTop, paddingXY 0 5 ]
|
|
|
|
{ url = url
|
|
|
|
, label =
|
|
|
|
el
|
|
|
|
[ F.color colourTheme.textLightGrey
|
|
|
|
, B.color colourTheme.textDarkOrange
|
|
|
|
, D.rounded 10
|
|
|
|
, paddingEach
|
|
|
|
{ top = 6
|
|
|
|
, bottom = 3
|
|
|
|
, left = 10
|
|
|
|
, right = 10
|
|
|
|
}
|
|
|
|
, mouseOver
|
|
|
|
[ F.color colourTheme.textLightOrange
|
|
|
|
, B.color colourTheme.textDeepDarkOrange
|
|
|
|
]
|
|
|
|
, transitionStyleSlow
|
|
|
|
, paragraphFontSize
|
|
|
|
]
|
|
|
|
<|
|
|
|
|
text
|
|
|
|
(case cardable of
|
|
|
|
C.Donate _ ->
|
|
|
|
"Support!"
|
|
|
|
|
|
|
|
C.Argument _ ->
|
|
|
|
"Proof Tree!"
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
"Read More!"
|
|
|
|
)
|
|
|
|
}
|
2024-12-21 23:23:59 -06:00
|
|
|
|
2024-12-22 19:42:23 -06:00
|
|
|
cardInner : String -> Maybe String -> List (Element msg) -> Element msg
|
|
|
|
cardInner title maybeUrl elements =
|
2024-12-21 23:23:59 -06:00
|
|
|
column
|
2024-12-22 04:36:03 -06:00
|
|
|
[ width fill
|
2024-12-22 19:42:23 -06:00
|
|
|
, spacing 0
|
2024-12-22 04:36:03 -06:00
|
|
|
]
|
2024-12-22 19:42:23 -06:00
|
|
|
[ cardTitleMaker title maybeUrl
|
|
|
|
, (case ( device.class, device.orientation ) of
|
|
|
|
( Phone, Portrait ) ->
|
|
|
|
el
|
|
|
|
[ E.width fill
|
|
|
|
, centerX
|
|
|
|
]
|
|
|
|
|
|
|
|
( Tablet, Portrait ) ->
|
|
|
|
el
|
|
|
|
[ E.width fill
|
|
|
|
, centerX
|
|
|
|
]
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
cardStuff
|
|
|
|
)
|
|
|
|
<|
|
2024-12-21 23:23:59 -06:00
|
|
|
row
|
2024-12-22 04:36:03 -06:00
|
|
|
[ width fill
|
|
|
|
]
|
2024-12-21 23:23:59 -06:00
|
|
|
elements
|
|
|
|
]
|
|
|
|
|
|
|
|
cardOuter : Element msg -> Element msg
|
|
|
|
cardOuter elements =
|
2024-12-22 04:36:03 -06:00
|
|
|
contentContainer <|
|
2024-12-21 23:23:59 -06:00
|
|
|
el
|
2024-12-22 04:36:03 -06:00
|
|
|
([ E.width fill
|
|
|
|
]
|
2024-12-22 19:42:23 -06:00
|
|
|
++ (case ( device.class, device.orientation ) of
|
|
|
|
( Phone, Portrait ) ->
|
|
|
|
[]
|
|
|
|
|
|
|
|
( Tablet, Portrait ) ->
|
|
|
|
[]
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
[ E.width fill
|
|
|
|
, D.width 5
|
|
|
|
, D.color colourTheme.backgroundDarkGrey
|
|
|
|
, D.rounded 32
|
|
|
|
, glowDeepDarkGrey
|
2024-12-22 04:36:03 -06:00
|
|
|
]
|
2024-12-22 19:42:23 -06:00
|
|
|
++ (if hasLink then
|
|
|
|
[ mouseOver
|
|
|
|
[ D.color colourTheme.textDarkOrange
|
|
|
|
, B.color colourTheme.textDarkOrange
|
|
|
|
, glowDeepDarkOrange
|
|
|
|
]
|
|
|
|
, transitionStyleSlow
|
|
|
|
]
|
|
|
|
|
|
|
|
else
|
|
|
|
[]
|
|
|
|
)
|
2024-12-22 04:36:03 -06:00
|
|
|
)
|
|
|
|
)
|
2024-12-21 23:23:59 -06:00
|
|
|
elements
|
|
|
|
|
|
|
|
cardWithImageWithLink : Bool -> String -> String -> String -> List (Element msg) -> Element msg
|
|
|
|
cardWithImageWithLink linkBool title image url content =
|
|
|
|
linkChooser
|
|
|
|
linkBool
|
|
|
|
(cardInner title
|
2024-12-22 19:42:23 -06:00
|
|
|
(if hasLink then
|
|
|
|
Just url
|
|
|
|
|
|
|
|
else
|
|
|
|
Nothing
|
|
|
|
)
|
2024-12-21 23:23:59 -06:00
|
|
|
[ cardContentMaker content
|
|
|
|
]
|
|
|
|
)
|
|
|
|
url
|
|
|
|
|
|
|
|
cardWithNoImageWithLink : Bool -> String -> String -> List (Element msg) -> Element msg
|
|
|
|
cardWithNoImageWithLink linkBool title url content =
|
|
|
|
linkChooser
|
|
|
|
linkBool
|
|
|
|
(cardInner title
|
2024-12-22 19:42:23 -06:00
|
|
|
(Just url)
|
2024-12-21 23:23:59 -06:00
|
|
|
[ cardContentMaker content
|
|
|
|
]
|
|
|
|
)
|
|
|
|
url
|
|
|
|
|
|
|
|
cardWithImage : String -> String -> List (Element msg) -> Element msg
|
|
|
|
cardWithImage title image content =
|
|
|
|
cardOuter <|
|
|
|
|
cardInner title
|
2024-12-22 19:42:23 -06:00
|
|
|
Nothing
|
2024-12-21 23:23:59 -06:00
|
|
|
[ cardContentMaker content
|
|
|
|
]
|
|
|
|
|
|
|
|
cardWithNoImage : String -> List (Element msg) -> Element msg
|
|
|
|
cardWithNoImage title content =
|
|
|
|
cardOuter <|
|
|
|
|
cardInner title
|
2024-12-22 19:42:23 -06:00
|
|
|
Nothing
|
2024-12-21 23:23:59 -06:00
|
|
|
[ cardContentMaker content
|
|
|
|
]
|
|
|
|
|
|
|
|
linkChooser : Bool -> Element msg -> String -> Element msg
|
|
|
|
linkChooser linkBool element url =
|
|
|
|
cardOuter <|
|
2024-12-22 19:42:23 -06:00
|
|
|
case ( device.class, device.orientation ) of
|
|
|
|
( Phone, Portrait ) ->
|
|
|
|
el [ width fill ] <| element
|
2024-12-21 23:23:59 -06:00
|
|
|
|
2024-12-22 19:42:23 -06:00
|
|
|
( Tablet, Portrait ) ->
|
|
|
|
el [ width fill ] <| element
|
|
|
|
|
|
|
|
_ ->
|
|
|
|
(if linkBool then
|
|
|
|
newTabLink
|
|
|
|
|
|
|
|
else
|
|
|
|
link
|
|
|
|
)
|
|
|
|
[ width fill ]
|
|
|
|
{ url = url
|
|
|
|
, label = element
|
|
|
|
}
|
2024-12-21 23:23:59 -06:00
|
|
|
in
|
|
|
|
case cardable of
|
|
|
|
C.Contact contact ->
|
2024-12-22 04:36:03 -06:00
|
|
|
cardWithNoImage
|
|
|
|
(String.toUpper contact.contactName)
|
|
|
|
contents
|
2024-12-21 23:23:59 -06:00
|
|
|
|
|
|
|
C.Cuck cuck ->
|
2024-12-22 19:42:23 -06:00
|
|
|
cardWithImage
|
2024-12-21 23:23:59 -06:00
|
|
|
cuck.cuckName
|
2024-12-23 03:15:35 -06:00
|
|
|
(imagePathMaker M.Cuck cuck.cuckImage)
|
2024-12-21 23:23:59 -06:00
|
|
|
contents
|
|
|
|
|
|
|
|
C.BlogArticle blogArticle ->
|
|
|
|
cardWithNoImage
|
2024-12-22 04:36:03 -06:00
|
|
|
(String.toUpper blogArticle.articleName)
|
2024-12-21 23:23:59 -06:00
|
|
|
contents
|
|
|
|
|
|
|
|
C.BlogCard blogArticle ->
|
|
|
|
cardWithImageWithLink
|
|
|
|
blogArticle.isNewTabLink
|
|
|
|
blogArticle.articleName
|
2024-12-23 03:15:35 -06:00
|
|
|
(imagePathMaker M.BlogCard blogArticle.articleImage)
|
2024-12-21 23:23:59 -06:00
|
|
|
blogArticle.articleLink
|
|
|
|
contents
|
|
|
|
|
|
|
|
C.Argument argument ->
|
2024-12-23 03:15:35 -06:00
|
|
|
cardWithNoImage
|
2024-12-21 23:23:59 -06:00
|
|
|
argument.argumentTitle
|
|
|
|
contents
|
|
|
|
|
|
|
|
C.Gibberish gibberish ->
|
|
|
|
cardWithImageWithLink
|
|
|
|
gibberish.isNewTabLink
|
|
|
|
gibberish.gibberishTitle
|
2024-12-23 03:15:35 -06:00
|
|
|
(imagePathMaker M.Gibberish gibberish.gibberishImage)
|
2024-12-21 23:23:59 -06:00
|
|
|
gibberish.gibberishLink
|
|
|
|
contents
|
|
|
|
|
|
|
|
C.Service service ->
|
|
|
|
cardWithImageWithLink
|
|
|
|
service.isNewTabLink
|
|
|
|
service.serviceName
|
2024-12-23 03:15:35 -06:00
|
|
|
(imagePathMaker M.Service service.serviceImage)
|
2024-12-21 23:23:59 -06:00
|
|
|
service.serviceLink
|
|
|
|
contents
|
|
|
|
|
|
|
|
C.Debate debate ->
|
|
|
|
cardWithImageWithLink
|
|
|
|
debate.isNewTabLink
|
|
|
|
debate.debateTitle
|
2024-12-23 03:15:35 -06:00
|
|
|
(imagePathMaker M.Debate debate.debateImage)
|
2024-12-21 23:23:59 -06:00
|
|
|
debate.debateLink
|
|
|
|
contents
|
|
|
|
|
|
|
|
C.Donate donate ->
|
|
|
|
cardWithImageWithLink
|
|
|
|
donate.isNewTabLink
|
|
|
|
donate.donateName
|
2024-12-23 03:15:35 -06:00
|
|
|
(imagePathMaker M.Donate donate.donateImage)
|
2024-12-21 23:23:59 -06:00
|
|
|
donate.donateLink
|
|
|
|
contents
|
|
|
|
|
|
|
|
C.Interview interview ->
|
|
|
|
cardWithImage
|
|
|
|
interview.interviewName
|
2024-12-23 03:15:35 -06:00
|
|
|
(imagePathMaker M.Interviews interview.interviewImage)
|
2024-12-21 23:23:59 -06:00
|
|
|
contents
|
|
|
|
|
|
|
|
C.NutriDex nutriDex ->
|
|
|
|
cardWithNoImage
|
2024-12-22 04:36:03 -06:00
|
|
|
(String.toUpper nutriDex.nutriDexTitle)
|
|
|
|
contents
|
|
|
|
|
|
|
|
C.ServicePage service ->
|
|
|
|
cardWithNoImage
|
|
|
|
(String.toUpper service.serviceName)
|
2024-12-21 23:23:59 -06:00
|
|
|
contents
|
|
|
|
|
|
|
|
|
|
|
|
cardContentMaker : List (Element msg) -> Element msg
|
|
|
|
cardContentMaker content =
|
|
|
|
column
|
|
|
|
[ spacing 8
|
|
|
|
, width fill
|
|
|
|
]
|
|
|
|
content
|
|
|
|
|
|
|
|
|
|
|
|
cardStuff : Element msg -> Element msg
|
|
|
|
cardStuff content =
|
|
|
|
el
|
2024-12-22 04:36:03 -06:00
|
|
|
[ E.width fill
|
2024-12-21 23:23:59 -06:00
|
|
|
, centerX
|
|
|
|
, B.color colourTheme.backgroundDarkGrey
|
|
|
|
, padding 10
|
|
|
|
, D.roundEach
|
|
|
|
{ topLeft = 0
|
|
|
|
, topRight = 0
|
|
|
|
, bottomRight = 26
|
|
|
|
, bottomLeft = 26
|
|
|
|
}
|
|
|
|
]
|
|
|
|
<|
|
|
|
|
el
|
|
|
|
[ paddingEach
|
|
|
|
{ top = 0
|
|
|
|
, bottom = 0
|
|
|
|
, left = 15
|
|
|
|
, right = 15
|
|
|
|
}
|
|
|
|
, width fill
|
2024-12-22 04:36:03 -06:00
|
|
|
, height fill
|
2024-12-21 23:23:59 -06:00
|
|
|
]
|
|
|
|
content
|