mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-12-20 04:01:40 +03:00
Only show the premium pennant when the content is not free
This commit is contained in:
parent
42a805f446
commit
a9fa26a023
@ -110,9 +110,13 @@ valueToString valueToString_ =
|
|||||||
Attribute { emptyEventsAndValues | valueToString = Just valueToString_ } identity
|
Attribute { emptyEventsAndValues | valueToString = Just valueToString_ } identity
|
||||||
|
|
||||||
|
|
||||||
{-| Lock the content if the teacher does not have premium access
|
{-| Lock Premium content if the user does not have Premium.
|
||||||
-}
|
-}
|
||||||
premium : { teacherPremiumLevel : PremiumLevel, contentPremiumLevel : PremiumLevel } -> Attribute value msg
|
premium :
|
||||||
|
{ teacherPremiumLevel : PremiumLevel
|
||||||
|
, contentPremiumLevel : PremiumLevel
|
||||||
|
}
|
||||||
|
-> Attribute value msg
|
||||||
premium { teacherPremiumLevel, contentPremiumLevel } =
|
premium { teacherPremiumLevel, contentPremiumLevel } =
|
||||||
Attribute emptyEventsAndValues <|
|
Attribute emptyEventsAndValues <|
|
||||||
\config ->
|
\config ->
|
||||||
@ -122,7 +126,10 @@ premium { teacherPremiumLevel, contentPremiumLevel } =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
{-| Show the pennant and attach this onClick handler
|
{-| Show Premium pennant on Premium content.
|
||||||
|
|
||||||
|
When the pennant is clicked, the msg that's passed in will fire.
|
||||||
|
|
||||||
-}
|
-}
|
||||||
showPennant : msg -> Attribute value msg
|
showPennant : msg -> Attribute value msg
|
||||||
showPennant premiumMsg =
|
showPennant premiumMsg =
|
||||||
@ -441,17 +448,15 @@ view label attributes =
|
|||||||
[]
|
[]
|
||||||
]
|
]
|
||||||
[ Html.text label ]
|
[ Html.text label ]
|
||||||
, case ( config.hideLabel, eventsAndValues.premiumMsg ) of
|
, case ( config.contentPremiumLevel, eventsAndValues.premiumMsg ) of
|
||||||
( False, Just premiumMsg ) ->
|
( Nothing, _ ) ->
|
||||||
-- TODO: should this flag show when the content premium
|
text ""
|
||||||
-- level is Free?? I somewhat think not!
|
|
||||||
ClickableSvg.button "Premium"
|
( Just PremiumLevel.Free, _ ) ->
|
||||||
Pennant.premiumFlag
|
text ""
|
||||||
[ ClickableSvg.onClick premiumMsg
|
|
||||||
, ClickableSvg.exactWidth 26
|
( Just _, Just premiumMsg ) ->
|
||||||
, ClickableSvg.exactHeight 24
|
premiumPennant premiumMsg
|
||||||
, ClickableSvg.css [ marginLeft (px 8) ]
|
|
||||||
]
|
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
text ""
|
text ""
|
||||||
@ -461,6 +466,17 @@ view label attributes =
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
premiumPennant : msg -> Html msg
|
||||||
|
premiumPennant onClick =
|
||||||
|
ClickableSvg.button "Premium"
|
||||||
|
Pennant.premiumFlag
|
||||||
|
[ ClickableSvg.onClick onClick
|
||||||
|
, ClickableSvg.exactWidth 26
|
||||||
|
, ClickableSvg.exactHeight 24
|
||||||
|
, ClickableSvg.css [ marginLeft (px 8) ]
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
radioInputIcon :
|
radioInputIcon :
|
||||||
{ isChecked : Bool
|
{ isChecked : Bool
|
||||||
, isLocked : Bool
|
, isLocked : Bool
|
||||||
|
Loading…
Reference in New Issue
Block a user