mirror of
https://gitlab.com/upRootNutrition/website.git
synced 2025-06-16 04:25:11 -05:00
feat: refactoring and tidying up
This commit is contained in:
parent
62be86f2f9
commit
2295c85fca
112 changed files with 862 additions and 1698 deletions
|
@ -18,9 +18,12 @@ import Config.Helpers.CardFormat
|
|||
)
|
||||
import Config.Helpers.Format
|
||||
exposing
|
||||
( paragraphFontSize
|
||||
( headerFontSizeSmall
|
||||
, paragraphFontSize
|
||||
, paragraphSpacing
|
||||
)
|
||||
import Config.Helpers.Headers.Header exposing (headerMaker)
|
||||
import Config.Helpers.Headers.Types exposing (Header)
|
||||
import Config.Helpers.Response
|
||||
exposing
|
||||
( pageList
|
||||
|
@ -42,12 +45,6 @@ import Config.Pages.Donate.Records.PayPal exposing (donatePayPal)
|
|||
import Config.Pages.Donate.Records.Stripe exposing (donateStripe)
|
||||
import Config.Pages.Donate.Records.YouTube exposing (donateYouTube)
|
||||
import Config.Pages.Donate.Types exposing (..)
|
||||
import Config.Helpers.Header exposing (..)
|
||||
import Config.Helpers.Header
|
||||
exposing
|
||||
( Header
|
||||
, headerMaker
|
||||
)
|
||||
import Config.Style.Colour as T exposing (..)
|
||||
import Effect exposing (Effect)
|
||||
import Element as E exposing (..)
|
||||
|
@ -152,13 +149,13 @@ donateList device =
|
|||
[ donateHeader ]
|
||||
, (case ( device.class, device.orientation ) of
|
||||
( Phone, Portrait ) ->
|
||||
List.map donateMakerMobile
|
||||
List.map (\donate -> donateMakerMobile donate device)
|
||||
|
||||
( Tablet, Portrait ) ->
|
||||
List.map donateMakerMobile
|
||||
List.map (\donate -> donateMakerMobile donate device)
|
||||
|
||||
_ ->
|
||||
List.map donateMaker
|
||||
List.map (\donate -> donateMaker donate device)
|
||||
)
|
||||
[ donateLiberaPay
|
||||
, donateStripe
|
||||
|
@ -182,20 +179,20 @@ donateHeader =
|
|||
}
|
||||
|
||||
|
||||
donateMaker : Donate -> Element msg
|
||||
donateMaker donate =
|
||||
donateMaker : Donate -> Device -> Element msg
|
||||
donateMaker donate device =
|
||||
row
|
||||
topLevelBox
|
||||
[ desktopCardMaker desktopImageBoxSize desktopImageSize (donateImage donate) (donateLink donate)
|
||||
[ desktopCardMaker desktopImageBoxSize desktopImageSize (donateImage donate) donate.donateLink
|
||||
, cardMaker
|
||||
[ cardTitleMaker (donateTitle donate)
|
||||
[ cardTitleMaker donate.donateName
|
||||
, cardFormatter
|
||||
[ cardContentSpacing
|
||||
[ column
|
||||
fieldSpacer
|
||||
[ feeMaker donate
|
||||
, preferenceMaker donate
|
||||
, tableMaker donate
|
||||
, tableMaker donate device
|
||||
, proTitleMaker donate
|
||||
, proMaker donate
|
||||
, conTitleMaker donate
|
||||
|
@ -207,13 +204,13 @@ donateMaker donate =
|
|||
]
|
||||
|
||||
|
||||
donateMakerMobile : Donate -> Element msg
|
||||
donateMakerMobile donate =
|
||||
donateMakerMobile : Donate -> Device -> Element msg
|
||||
donateMakerMobile donate device =
|
||||
row
|
||||
topLevelBox
|
||||
[ column [] []
|
||||
, cardMaker
|
||||
[ cardTitleMaker (donateTitle donate)
|
||||
[ cardTitleMaker donate.donateName
|
||||
, cardFormatter
|
||||
[ cardContentSpacing
|
||||
[ column
|
||||
|
@ -222,14 +219,14 @@ donateMakerMobile donate =
|
|||
[ mobileCardMaker mobileImageBoxSize
|
||||
mobileImageSize
|
||||
(donateImage donate)
|
||||
(donateLink donate)
|
||||
donate.donateLink
|
||||
, column
|
||||
[ width fill ]
|
||||
[ feeMaker donate
|
||||
, preferenceMaker donate
|
||||
]
|
||||
]
|
||||
, tableMakerMobile donate
|
||||
, tableMaker donate device
|
||||
, proTitleMaker donate
|
||||
, proMaker donate
|
||||
, conTitleMaker donate
|
||||
|
@ -253,16 +250,6 @@ donateImage donate =
|
|||
}
|
||||
|
||||
|
||||
donateTitle : Donate -> String
|
||||
donateTitle donate =
|
||||
donate.donateName
|
||||
|
||||
|
||||
donateLink : Donate -> String
|
||||
donateLink donate =
|
||||
donate.donateLink
|
||||
|
||||
|
||||
donateWidth =
|
||||
width <| px 45
|
||||
|
||||
|
@ -270,64 +257,64 @@ donateWidth =
|
|||
feeMaker : Donate -> Element msg
|
||||
feeMaker donate =
|
||||
row
|
||||
([ F.color colourTheme.textLightGrey
|
||||
, paragraphSpacing
|
||||
, paragraphFontSize
|
||||
, F.bold
|
||||
]
|
||||
++ [ F.size 18
|
||||
, E.width fill
|
||||
]
|
||||
)
|
||||
[ F.color colourTheme.textLightOrange
|
||||
, paragraphSpacing
|
||||
, F.bold
|
||||
, headerFontSizeSmall
|
||||
, E.width fill
|
||||
, spacing 5
|
||||
]
|
||||
[ column
|
||||
[ alignTop
|
||||
, donateWidth
|
||||
]
|
||||
[ text "Fees:"
|
||||
]
|
||||
, column
|
||||
, el
|
||||
[ E.width fill
|
||||
, alignLeft
|
||||
]
|
||||
[ paragraph [ F.regular ]
|
||||
[ el [ F.color colourTheme.textLightOrange ] <|
|
||||
text donate.donateFees
|
||||
<|
|
||||
el
|
||||
[ F.regular
|
||||
, paragraphFontSize
|
||||
, F.color colourTheme.textLightGrey
|
||||
]
|
||||
]
|
||||
<|
|
||||
text donate.donateFees
|
||||
]
|
||||
|
||||
|
||||
proTitleMaker : Donate -> Element msg
|
||||
proTitleMaker donate =
|
||||
row
|
||||
[ F.color colourTheme.textLightGrey
|
||||
[ F.color colourTheme.textLightOrange
|
||||
, paragraphSpacing
|
||||
, paragraphFontSize
|
||||
, headerFontSizeSmall
|
||||
, F.bold
|
||||
]
|
||||
[ column
|
||||
[ el
|
||||
[ alignTop
|
||||
, width <| px 80
|
||||
]
|
||||
[ text "Pros:"
|
||||
]
|
||||
<|
|
||||
text "Pros:"
|
||||
]
|
||||
|
||||
|
||||
conTitleMaker : Donate -> Element msg
|
||||
conTitleMaker donate =
|
||||
row
|
||||
[ F.color colourTheme.textLightGrey
|
||||
[ F.color colourTheme.textLightOrange
|
||||
, paragraphSpacing
|
||||
, paragraphFontSize
|
||||
, headerFontSizeSmall
|
||||
, F.bold
|
||||
]
|
||||
[ column
|
||||
[ el
|
||||
[ alignTop
|
||||
, width <| px 80
|
||||
]
|
||||
[ text "Cons:"
|
||||
]
|
||||
<|
|
||||
text "Cons:"
|
||||
]
|
||||
|
||||
|
||||
|
@ -352,16 +339,14 @@ proMaker donate =
|
|||
makePro : Pros -> Element msg
|
||||
makePro pro =
|
||||
column
|
||||
([ F.color colourTheme.textLightGrey
|
||||
, paragraphSpacing
|
||||
, paragraphFontSize
|
||||
, F.bold
|
||||
, alignLeft
|
||||
]
|
||||
++ [ spacing 8
|
||||
, width fill
|
||||
]
|
||||
)
|
||||
[ F.color colourTheme.textLightGrey
|
||||
, paragraphSpacing
|
||||
, paragraphFontSize
|
||||
, F.bold
|
||||
, alignLeft
|
||||
, spacing 8
|
||||
, width fill
|
||||
]
|
||||
[ paragraph [ F.regular ]
|
||||
[ text ("‣ " ++ pro.pro) ]
|
||||
]
|
||||
|
@ -388,18 +373,17 @@ conMaker donate =
|
|||
makeCon : Cons -> Element msg
|
||||
makeCon con =
|
||||
column
|
||||
([ F.color colourTheme.textLightGrey
|
||||
, paragraphSpacing
|
||||
, paragraphFontSize
|
||||
, F.bold
|
||||
, alignLeft
|
||||
]
|
||||
++ [ spacing 8
|
||||
, width fill
|
||||
]
|
||||
)
|
||||
[ paragraph [ F.regular ]
|
||||
[ text ("‣ " ++ con.con) ]
|
||||
[ F.color colourTheme.textLightGrey
|
||||
, paragraphSpacing
|
||||
, paragraphFontSize
|
||||
, F.bold
|
||||
, alignLeft
|
||||
, spacing 8
|
||||
, width fill
|
||||
]
|
||||
[ paragraph [ F.regular ] <|
|
||||
[ text ("‣ " ++ con.con)
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
|
@ -414,16 +398,13 @@ preferenceMaker donate =
|
|||
, E.alignLeft
|
||||
]
|
||||
[ paragraph
|
||||
([ F.color colourTheme.textLightGrey
|
||||
, paragraphSpacing
|
||||
, paragraphFontSize
|
||||
, F.bold
|
||||
]
|
||||
++ [ F.size 18
|
||||
, alignLeft
|
||||
, E.width fill
|
||||
]
|
||||
)
|
||||
[ F.color colourTheme.textLightGrey
|
||||
, paragraphSpacing
|
||||
, F.bold
|
||||
, headerFontSizeSmall
|
||||
, alignLeft
|
||||
, E.width fill
|
||||
]
|
||||
[ el
|
||||
[ tooltip
|
||||
"This represents how strongly I prefer a given platform relative to other platforms."
|
||||
|
@ -435,6 +416,7 @@ preferenceMaker donate =
|
|||
, bottom = 0
|
||||
, left = 0
|
||||
}
|
||||
, F.color colourTheme.textLightOrange
|
||||
]
|
||||
<|
|
||||
text "Preference:"
|
||||
|
@ -486,24 +468,18 @@ getPreferenceTooltip num =
|
|||
"Preference is out of bounds."
|
||||
|
||||
|
||||
tableMaker : Donate -> Element msg
|
||||
tableMaker donate =
|
||||
tableMaker : Donate -> Device -> Element msg
|
||||
tableMaker donate device =
|
||||
column
|
||||
[ centerX
|
||||
, E.width fill
|
||||
]
|
||||
[ wrappedRow
|
||||
([ F.color colourTheme.textLightGrey
|
||||
, paragraphSpacing
|
||||
, paragraphFontSize
|
||||
, F.bold
|
||||
]
|
||||
++ [ E.alignLeft
|
||||
, E.width fill
|
||||
, htmlAttribute <| H.style "position" "relative"
|
||||
]
|
||||
)
|
||||
[ E.table
|
||||
[ el
|
||||
[ E.alignLeft
|
||||
, E.width fill
|
||||
]
|
||||
<|
|
||||
E.table
|
||||
[ spacing 0
|
||||
, D.rounded 10
|
||||
, D.width 2
|
||||
|
@ -513,70 +489,55 @@ tableMaker donate =
|
|||
{ data = donate.donateFeatures
|
||||
, columns =
|
||||
List.map createColumn
|
||||
[ { label = "Zero Fees"
|
||||
, getter = .free
|
||||
}
|
||||
, { label = "Subscriptions"
|
||||
, getter = .subscriptions
|
||||
}
|
||||
, { label = "User Friendly"
|
||||
, getter = .userFriendly
|
||||
}
|
||||
, { label = "Anonymous"
|
||||
, getter = .anonymous
|
||||
}
|
||||
, { label = "Rewards"
|
||||
, getter = .rewardTiers
|
||||
}
|
||||
]
|
||||
(case ( device.class, device.orientation ) of
|
||||
( Phone, Portrait ) ->
|
||||
mobileLabels
|
||||
|
||||
( Tablet, Portrait ) ->
|
||||
mobileLabels
|
||||
|
||||
_ ->
|
||||
desktopLabels
|
||||
)
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
tableMakerMobile : Donate -> Element msg
|
||||
tableMakerMobile donate =
|
||||
column
|
||||
[ centerX
|
||||
, E.width fill
|
||||
]
|
||||
[ wrappedRow
|
||||
([ F.color colourTheme.textLightGrey
|
||||
, paragraphSpacing
|
||||
, paragraphFontSize
|
||||
, F.bold
|
||||
]
|
||||
++ [ E.alignLeft
|
||||
, E.width fill
|
||||
, htmlAttribute <| H.style "position" "relative"
|
||||
]
|
||||
)
|
||||
[ E.table
|
||||
[ spacing 0
|
||||
, D.rounded 10
|
||||
, D.width 2
|
||||
, D.color colourTheme.textDarkGrey
|
||||
, clip
|
||||
]
|
||||
{ data = donate.donateFeatures
|
||||
, columns =
|
||||
List.map createColumn
|
||||
[ { label = "Free"
|
||||
, getter = .free
|
||||
}
|
||||
, { label = "Subs"
|
||||
, getter = .subscriptions
|
||||
}
|
||||
, { label = "Easy"
|
||||
, getter = .userFriendly
|
||||
}
|
||||
, { label = "Safe"
|
||||
, getter = .anonymous
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
desktopLabels : List { label : String, getter : { a | free : b, subscriptions : b, userFriendly : b, anonymous : b, rewardTiers : b } -> b }
|
||||
desktopLabels =
|
||||
[ { label = "Zero Fees"
|
||||
, getter = .free
|
||||
}
|
||||
, { label = "Subscriptions"
|
||||
, getter = .subscriptions
|
||||
}
|
||||
, { label = "User Friendly"
|
||||
, getter = .userFriendly
|
||||
}
|
||||
, { label = "Anonymous"
|
||||
, getter = .anonymous
|
||||
}
|
||||
, { label = "Rewards"
|
||||
, getter = .rewardTiers
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
mobileLabels : List { label : String, getter : { a | free : b, subscriptions : b, userFriendly : b, anonymous : b } -> b }
|
||||
mobileLabels =
|
||||
[ { label = "Free"
|
||||
, getter = .free
|
||||
}
|
||||
, { label = "Subs"
|
||||
, getter = .subscriptions
|
||||
}
|
||||
, { label = "Easy"
|
||||
, getter = .userFriendly
|
||||
}
|
||||
, { label = "Safe"
|
||||
, getter = .anonymous
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
createColumn : { label : String, getter : Features -> Maybe Bool } -> Column Features msg
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue