Skip to content

Commit

Permalink
chore: ad player defaults, add ad to farms page
Browse files Browse the repository at this point in the history
  • Loading branch information
thechefpenguin committed Nov 7, 2024
1 parent b1f182f commit 944dbb7
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 12 deletions.
4 changes: 2 additions & 2 deletions apps/web/src/components/AdPanel/CardLayouts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ const AdSlides = memo(({ forceMobile, isDismissible = true }: AdPlayerProps) =>
* For abstraction and use in pages where we need to
* directly render the Ads Card purely without any conditions
*/
export const AdPlayer = (props: AdPlayerProps) => {
return <AdSlides {...props} />
export const AdPlayer = ({ forceMobile = true, isDismissible = false, ...props }: AdPlayerProps) => {
return <AdSlides forceMobile={forceMobile} isDismissible={isDismissible} {...props} />
}

interface DesktopCardProps extends AdPlayerProps {
Expand Down
5 changes: 3 additions & 2 deletions apps/web/src/components/AdPanel/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ export const useAdConfig = () => {
.filter((ad) => ad.shouldRender)
}

const commonLayoutAdBlacklistedPages = ['/home', '/cake-staking', '/liquidity/pools']
/**
* On the pages mentioned, the Mobile ads will be placed directly in page instead of in the app layout.
* So don't render in the app layout.
*/
export const layoutMobileAdBlacklistedPages = ['/', '/home', '/cake-staking']
export const layoutMobileAdBlacklistedPages = [...commonLayoutAdBlacklistedPages, '/']

/**
* On the pages mentioned, the Desktop ads will be placed directly in page instead of in the app layout.
* So don't render in the app layout.
*/
export const layoutDesktopAdBlacklistedPages = ['/home', '/cake-staking']
export const layoutDesktopAdBlacklistedPages = [...commonLayoutAdBlacklistedPages]
4 changes: 2 additions & 2 deletions apps/web/src/views/CakeStaking/components/PageHead.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const PageHead = () => {
<>
{isMobile && (
<Box mb="16px">
<AdPanel.AdPlayer isDismissible={false} />
<AdPanel.AdPlayer />
</Box>
)}
<Flex justifyContent="space-between" flexDirection="row">
Expand All @@ -47,7 +47,7 @@ export const PageHead = () => {
</NextLinkFromReactRouter>
</Flex>

<Box>{!isMobile && <AdPanel.AdPlayer isDismissible={false} forceMobile />}</Box>
<Box>{!isMobile && <AdPanel.AdPlayer />}</Box>
</Flex>
</>
)
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/views/Home/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ const Hero = () => {
</NextLinkFromReactRouter>
</Flex>
<Flex mt="32px" alignItems="center" justifyContent="center" width="fit-content">
<AdPanel.AdPlayer isDismissible={false} forceMobile />
<AdPanel.AdPlayer />
</Flex>
</Flex>
<Flex
Expand Down
18 changes: 13 additions & 5 deletions apps/web/src/views/universalFarms/components/PoolsBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import { useTheme } from '@pancakeswap/hooks'
import { useTranslation } from '@pancakeswap/localization'
import { Box, Button, Column, LinkExternal, PageHeader, Row, Text } from '@pancakeswap/uikit'
import { Box, Button, Column, Flex, LinkExternal, PageHeader, Row, Text, useMatchBreakpoints } from '@pancakeswap/uikit'
import { VerticalDivider } from '@pancakeswap/widgets-internal'
import { BCakeBoosterCard } from 'views/Farms/components/YieldBooster/components/bCakeV3/BCakeBoosterCard'
import { AdPanel } from 'components/AdPanel'
import { FarmFlexWrapper, FarmH1, FarmH2 } from 'views/Farms/styled'

export const PoolsBanner = ({ additionLink }: { additionLink?: React.ReactNode }) => {
const { t } = useTranslation()
const { theme } = useTheme()
const { isMobile } = useMatchBreakpoints()

return (
<PageHeader>
{isMobile && (
<Box mb="24px">
<AdPanel.AdPlayer />
</Box>
)}
<Column>
<FarmFlexWrapper>
<Box style={{ flex: '1 1 100%' }}>
Expand Down Expand Up @@ -38,9 +45,10 @@ export const PoolsBanner = ({ additionLink }: { additionLink?: React.ReactNode }
)}
</Row>
</Box>
<Box>
<BCakeBoosterCard />
</Box>
<Flex alignItems="center">
{!isMobile && <AdPanel.AdPlayer />}
{/* <BCakeBoosterCard /> */}
</Flex>
</FarmFlexWrapper>
</Column>
</PageHeader>
Expand Down

0 comments on commit 944dbb7

Please sign in to comment.