Skip to content

Commit

Permalink
YPP disabled: Landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
Lezek123 committed Nov 5, 2024
1 parent 47728ba commit d946843
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 51 deletions.
1 change: 1 addition & 0 deletions packages/atlas/atlas.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ joystream:

features:
ypp:
enabled: false # Whether the YPP is currently enabled
yppDelayThreshold: 300 # When the YPP sync backlog exceeds the threshold, Atlas will consider the YPP sync delayed.
landingPageOgTitle: 'Gleev Creator Rewards Program' # Open graph title for YPP landing page - used in open graph meta tags in HTML
landingPageOgDescription: 'Connect and monetize your content with Web3 native features on Gleev, the video streaming dApp built on Joystream blockchain.' # Open graph description for YPP landing page - used in open graph meta tags in HTML
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { FC } from 'react'

import { Text } from '@/components/Text'
import { DialogModal } from '@/components/_overlays/DialogModal'

export type ConnectWithYtModalProps = {
show: boolean
onClose: () => void
}

export const YppDisabledModal: FC<ConnectWithYtModalProps> = ({ show, onClose }) => {
// const smMatch = useMediaMatch('sm')
return (
<DialogModal
size="medium"
show={show}
dividers
primaryButton={{
text: 'Continue',
onClick: onClose,
}}
>
<Text variant="h400" as="h2" margin={{ bottom: 4 }}>
YouTube Partner Program temporarily disabled
</Text>
<Text variant="t200" as="p" color="colorText" margin={{ bottom: 4 }}>
Due to recent technical issues with the YouTube Synch service, YouTube Partner Program has been temporarily
disabled until further notice.
</Text>
<Text variant="t200" as="p" color="colorText" margin={{ bottom: 4 }}>
You can still create a channel on Gleev, but it will not be connected with your YouTube channel and you will not
be eligable for any YPP rewards.
</Text>
<Text variant="t200" as="p" color="colorText">
We apologize for any inconvenience.
</Text>
</DialogModal>
)
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './YppDisabledModal'
1 change: 1 addition & 0 deletions packages/atlas/src/config/configSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const configSchema = z.object({
}),
features: z.object({
ypp: z.object({
enabled: z.boolean(),
suspensionReasonsLink: z.string().nullable(),
yppDelayThreshold: z.number().nullable(),
googleConsoleClientId: z.string().nullable(),
Expand Down
29 changes: 25 additions & 4 deletions packages/atlas/src/views/global/YppLandingView/YppLandingView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import { useNavigate } from 'react-router-dom'
import { ParallaxProvider } from 'react-scroll-parallax'

import { YppReferralBanner } from '@/components/_ypp/YppReferralBanner'
import { absoluteRoutes } from '@/config/routes'
import { atlasConfig } from '@/config'
import { QUERY_PARAMS, absoluteRoutes } from '@/config/routes'
import { useHeadTags } from '@/hooks/useHeadTags'
import { useSegmentAnalytics } from '@/hooks/useSegmentAnalytics'
import { useUser } from '@/providers/user/user.hooks'
Expand All @@ -22,7 +23,13 @@ import { YppRewardSection } from './sections/YppRewardSection'
import { YppSignupVideo } from './sections/YppSignupVideo'
import { useGetYppSyncedChannels } from './useGetYppSyncedChannels'

import { YppDisabledModal } from '../../../components/_ypp/YppDisabledModal'
import { useRouterQuery } from '../../../hooks/useRouterQuery'

export const YppLandingView: FC = () => {
const yppEnabled = atlasConfig.features.ypp.enabled
const queryReferrerId = useRouterQuery(QUERY_PARAMS.REFERRER_ID)
const [showYppDisabledModal, setShowYppDisabledModal] = useState(!!queryReferrerId)
const headTags = useHeadTags('YouTube Partner Program')
const yppModalOpenName = useYppStore((state) => state.yppModalOpenName)
const setYppModalOpen = useYppStore((state) => state.actions.setYppModalOpenName)
Expand Down Expand Up @@ -110,7 +117,17 @@ export const YppLandingView: FC = () => {
{headTags}
<YppAuthorizationModal unSyncedChannels={unsyncedChannels} />
<ParallaxProvider>
<YppReferralBanner />
{yppEnabled ? (
<YppReferralBanner />
) : (
<YppDisabledModal
show={showYppDisabledModal}
onClose={() => {
navigate(absoluteRoutes.viewer.ypp())
setShowYppDisabledModal(false)
}}
/>
)}
<YppHero
onSelectChannel={() => setYppModalOpen('ypp-select-channel')}
onSignUpClick={handleYppSignUpClick}
Expand All @@ -120,8 +137,12 @@ export const YppLandingView: FC = () => {
onViewerEarnings={handleViewerEarnings}
/>
<CreatorOpportunities onSignUpClick={handleYppSignUpClick} />
<YppRewardSection />
<YppSignupVideo />
{yppEnabled ? (
<>
<YppRewardSection />
<YppSignupVideo />
</>
) : null}
<ViewerOpportunities sectionRef={viewerEarningsRef} />
<JoystreamRoadmap />
{/*<YppCardsSections />*/}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,16 @@ import {
} from '@/views/global/YppLandingView/YppLandingView.styles'
import { useSectionTextVariants } from '@/views/global/YppLandingView/sections/useSectionTextVariants'

const earningsOptions = [
{
title: 'YouTubers',
subtitle: 'Get sign up bonus and sync rewards with connecting YouTube channel.',
image: earning_yt,
},
const earningsOptions = (yppEnabled: boolean) => [
...(yppEnabled
? [
{
title: 'YouTubers',
subtitle: 'Get sign up bonus and sync rewards with connecting YouTube channel.',
image: earning_yt,
},
]
: []),
{
title: 'Creator Tokens',
subtitle: `Mint your own token and sell it on open market to raise funding for your ${atlasConfig.general.appName} channel.`,
Expand All @@ -40,14 +44,19 @@ const earningsOptions = [
subtitle: 'Mint your NFTs and earn from selling on marketplace and royalties with every future transaction.',
image: earning_nfts,
},
{
title: 'More earning',
subtitle: 'Earn with building out community and social promotions.',
image: earning_more,
},
...(yppEnabled
? [
{
title: 'More earning',
subtitle: 'Earn with building out community and social promotions.',
image: earning_more,
},
]
: []),
]

export const CreatorOpportunities = ({ onSignUpClick }: { onSignUpClick: () => void }) => {
const yppEnabled = atlasConfig.features.ypp.enabled
const setIsYppChannelFlow = useYppStore((state) => state.actions.setIsYppChannelFlow)
const setAuthModalOpenName = useAuthStore((state) => state.actions.setAuthModalOpenName)
const { trackRewardsCreateChannelButtonClick } = useSegmentAnalytics()
Expand Down Expand Up @@ -91,7 +100,7 @@ export const CreatorOpportunities = ({ onSignUpClick }: { onSignUpClick: () => v
</Text>
</HeaderGridItem>
<EarningsBox colSpan={{ base: 12, xs: 10 }} colStart={{ base: 1, xs: 2 }}>
{earningsOptions.map(({ title, subtitle, image }, idx) => (
{earningsOptions(yppEnabled).map(({ title, subtitle, image }, idx) => (
<FlexBox key={idx} gap={2} flow="column">
<ImageBox>
<Image alt={`${title} image`} src={image} width="610px" height="420px" />
Expand All @@ -116,9 +125,11 @@ export const CreatorOpportunities = ({ onSignUpClick }: { onSignUpClick: () => v
colStart={{ base: 1 }}
>
<FlexBox width="100%" flow={xsMatch ? 'row' : 'column'} alignItems="center" justifyContent="center" gap={4}>
<Button onClick={onSignUpClick} fullWidth={!xsMatch} size="large">
Sync from YouTube
</Button>
{yppEnabled ? (
<Button onClick={onSignUpClick} fullWidth={!xsMatch} size="large">
Sync from YouTube
</Button>
) : null}
{!memberChannels?.length ? (
<Button
onClick={() => {
Expand All @@ -128,7 +139,7 @@ export const CreatorOpportunities = ({ onSignUpClick }: { onSignUpClick: () => v
}}
fullWidth={!xsMatch}
size="large"
variant="secondary"
variant={yppEnabled ? 'secondary' : 'primary'}
>
Create New Channel
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ import {
} from '@/views/global/YppLandingView/YppLandingView.styles'
import { useSectionTextVariants } from '@/views/global/YppLandingView/sections/useSectionTextVariants'

const viewerEarningsOptions = [
{
title: 'Earn with Referrals',
subtitle: 'Refer YouTube channels and earn when they sign up using your link.',
image: viewer_earnings_referrals,
},
const viewerEarningsOptions = (yppEnabled: boolean) => [
...(yppEnabled
? [
{
title: 'Earn with Referrals',
subtitle: 'Refer YouTube channels and earn when they sign up using your link.',
image: viewer_earnings_referrals,
},
]
: []),
{
title: 'Claim Channels Revenue Share',
subtitle: `Buy creator tokens and claim part of channel's revenue.`,
Expand All @@ -49,6 +53,7 @@ const viewerEarningsOptions = [
]

export const ViewerOpportunities = ({ sectionRef }: { sectionRef: MutableRefObject<HTMLDivElement | null> }) => {
const yppEnabled = atlasConfig.features.ypp.enabled
const mdMatch = useMediaMatch('md')
const smMatch = useMediaMatch('sm')
const [titleVariant, subtitleVariant] = useSectionTextVariants()
Expand Down Expand Up @@ -87,7 +92,7 @@ export const ViewerOpportunities = ({ sectionRef }: { sectionRef: MutableRefObje
</Text>
</HeaderGridItem>
<EarningsBox colSpan={{ base: 12, xs: 10 }} colStart={{ base: 1, xs: 2 }}>
{viewerEarningsOptions.map(({ title, subtitle, image }, idx) => (
{viewerEarningsOptions(yppEnabled).map(({ title, subtitle, image }, idx) => (
<FlexBox key={idx} gap={2} flow="column">
<ImageBox>
<Image alt={`${title} image`} src={image} width="529px" height="360" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type YppFooterSectionProps = {
}

export const YppFooter: FC<YppFooterSectionProps> = ({ onSignUpClick }) => {
const yppEnabled = atlasConfig.features.ypp.enabled
const [titleVariant] = useSectionTextVariants()
const smMatch = useMediaMatch('sm')
const setIsYppChannelFlow = useYppStore((state) => state.actions.setIsYppChannelFlow)
Expand All @@ -52,7 +53,7 @@ export const YppFooter: FC<YppFooterSectionProps> = ({ onSignUpClick }) => {
Get started now
</Text>
<Text variant={titleVariant} as="h2" color="colorCoreBaseWhite" margin={{ top: 1 }}>
Pave the way to Web3 with your YouTube channel right away.
Pave the way to Web3 with your {yppEnabled ? 'YouTube ' : ''}channel right away.
</Text>

<FlexBox
Expand All @@ -63,9 +64,11 @@ export const YppFooter: FC<YppFooterSectionProps> = ({ onSignUpClick }) => {
gap={4}
marginTop={8}
>
<Button onClick={onSignUpClick} fullWidth={!smMatch} size="large">
Sync from YouTube
</Button>
{yppEnabled ? (
<Button onClick={onSignUpClick} fullWidth={!smMatch} size="large">
Sync from YouTube
</Button>
) : null}
{!memberChannels?.length ? (
<Button
onClick={() => {
Expand All @@ -75,7 +78,7 @@ export const YppFooter: FC<YppFooterSectionProps> = ({ onSignUpClick }) => {
}}
fullWidth={!smMatch}
size="large"
variant="secondary"
variant={yppEnabled ? 'secondary' : 'primary'}
>
Create New Channel
</Button>
Expand Down
43 changes: 24 additions & 19 deletions packages/atlas/src/views/global/YppLandingView/sections/YppHero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const YppHero: FC<YppHeroProps> = ({ onSignUpClick, yppAtlasStatus, onVie
? channels?.map((channel) => <PaidChannelCard key={channel.id} channel={channel} />)
: Array.from({ length: 30 }).map((_, idx) => <PaidChannelCard key={idx} loading />)
const widgetContentTextVariant = mdMatch ? ('h700' as const) : ('h600' as const)
const yppEnabled = atlasConfig.features.ypp.enabled

return (
<HeroBackgroundContainer noBackground>
Expand Down Expand Up @@ -140,14 +141,16 @@ export const YppHero: FC<YppHeroProps> = ({ onSignUpClick, yppAtlasStatus, onVie
</Button>
) : (
<FlexBox gap={4} flow={xsMatch ? 'row' : 'column'} alignItems="center" justifyContent="center">
<Button
onClick={onSignUpClick}
fullWidth={!xsMatch}
size={xxsMatch && !xsMatch ? 'large' : smMatch ? 'large' : 'medium'}
id="rewards-sync-button"
>
Sync from YouTube
</Button>
{yppEnabled ? (
<Button
onClick={onSignUpClick}
fullWidth={!xsMatch}
size={xxsMatch && !xsMatch ? 'large' : smMatch ? 'large' : 'medium'}
id="rewards-sync-button"
>
Sync from YouTube
</Button>
) : null}
{!memberChannels?.length ? (
<Button
onClick={() => {
Expand All @@ -157,7 +160,7 @@ export const YppHero: FC<YppHeroProps> = ({ onSignUpClick, yppAtlasStatus, onVie
}}
fullWidth={!xsMatch}
size={xxsMatch && !xsMatch ? 'large' : smMatch ? 'large' : 'medium'}
variant="secondary"
variant={yppEnabled ? 'secondary' : 'primary'}
id="rewards-new-channel-button"
>
Create New Channel
Expand Down Expand Up @@ -270,17 +273,19 @@ export const YppHero: FC<YppHeroProps> = ({ onSignUpClick, yppAtlasStatus, onVie
</GridItem>
</LayoutGrid>

<ImagesContainer width="100%" justifyContent="center">
<FrontImage src={crt_dashboard} alt="Hero back" width="1152" height="824" />
{xsMatch && (
<>
<RightImage src={crt_card} alt="Hero back" width="1152" height="824" />
<LeftImage src={payments} alt="Hero back" width="1152" height="824" />
</>
)}
</ImagesContainer>
{yppEnabled ? (
<ImagesContainer width="100%" justifyContent="center">
<FrontImage src={crt_dashboard} alt="Hero back" width="1152" height="824" />
{xsMatch && (
<>
<RightImage src={crt_card} alt="Hero back" width="1152" height="824" />
<LeftImage src={payments} alt="Hero back" width="1152" height="824" />
</>
)}
</ImagesContainer>
) : null}
</StyledLimitedWidthContainerHero>
{items && items.length >= 7 && (
{yppEnabled && items && items.length >= 7 && (
<StyledInfiniteCarousel
headerGridItemProps={{ colStart: { base: 1, lg: 2 }, colSpan: { base: 12, lg: 10 } }}
carouselHorizonthalOffset={-32}
Expand Down

0 comments on commit d946843

Please sign in to comment.