Skip to content

Commit

Permalink
Ad banner on Merits page (#2527)
Browse files Browse the repository at this point in the history
* add ad banner to merits page

* update tests

* fix ad position with horizontal menu
  • Loading branch information
maxaleks authored Jan 23, 2025
1 parent 031d442 commit c9606a1
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
17 changes: 13 additions & 4 deletions ui/pages/RewardsDashboard.pw.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { contextWithAuth } from 'playwright/fixtures/auth';
import { ENVS_MAP } from 'playwright/fixtures/mockEnvs';
import { contextWithRewards } from 'playwright/fixtures/rewards';
import { test, expect } from 'playwright/lib';
import * as pwConfig from 'playwright/utils/config';

import RewardsDashboard from './RewardsDashboard';

Expand All @@ -24,17 +25,25 @@ testWithAuth.beforeEach(async({ mockEnvs, mockApiResponse }) => {
await mockApiResponse('user_info', profileMock.withEmailAndWallet);
});

testWithAuth('base view +@dark-mode +@mobile', async({ render, mockApiResponse }) => {
testWithAuth('base view +@dark-mode +@mobile', async({ page, render, mockApiResponse }) => {
await mockApiResponse('rewards_user_balances', rewardsBalanceMock.base);
await mockApiResponse('rewards_user_daily_check', dailyRewardMock.base);
await mockApiResponse('rewards_user_referrals', referralsMock.base);
await mockApiResponse('rewards_config', rewardsConfigMock.base);

const component = await render(<RewardsDashboard/>);
await expect(component).toHaveScreenshot();

await expect(component).toHaveScreenshot({
mask: [ page.locator(pwConfig.adsBannerSelector) ],
maskColor: pwConfig.maskColor,
});
});

testWithAuth('with error', async({ render }) => {
testWithAuth('with error', async({ page, render }) => {
const component = await render(<RewardsDashboard/>);
await expect(component).toHaveScreenshot();

await expect(component).toHaveScreenshot({
mask: [ page.locator(pwConfig.adsBannerSelector) ],
maskColor: pwConfig.maskColor,
});
});
28 changes: 16 additions & 12 deletions ui/pages/RewardsDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import DailyRewardClaimButton from 'ui/rewards/dashboard/DailyRewardClaimButton'
import RewardsDashboardCard from 'ui/rewards/dashboard/RewardsDashboardCard';
import RewardsDashboardCardValue from 'ui/rewards/dashboard/RewardsDashboardCardValue';
import RewardsReadOnlyInputWithCopy from 'ui/rewards/RewardsReadOnlyInputWithCopy';
import AdBanner from 'ui/shared/ad/AdBanner';
import Skeleton from 'ui/shared/chakra/Skeleton';
import LinkExternal from 'ui/shared/links/LinkExternal';
import PageTitle from 'ui/shared/Page/PageTitle';
Expand Down Expand Up @@ -43,18 +44,21 @@ const RewardsDashboard = () => {

return (
<>
<PageTitle
title="Dashboard"
secondRow={ (
<span>
The Blockscout Merits Program is just getting started! Learn more about the details,
features, and future plans in our{ ' ' }
<LinkExternal href="https://www.blog.blockscout.com/blockscout-merits-rewarding-block-explorer-skills">
blog post
</LinkExternal>.
</span>
) }
/>
<Flex gap={ 3 } justifyContent="space-between">
<PageTitle
title="Dashboard"
secondRow={ (
<span>
The Blockscout Merits Program is just getting started! Learn more about the details,
features, and future plans in our{ ' ' }
<LinkExternal href="https://www.blog.blockscout.com/blockscout-merits-rewarding-block-explorer-skills">
blog post
</LinkExternal>.
</span>
) }
/>
<AdBanner platform="mobile" w="fit-content" flexShrink={ 0 } borderRadius="md" overflow="hidden" display={{ base: 'none', lg: 'block ' }}/>
</Flex>
<Flex flexDirection="column" alignItems="flex-start" w="full" gap={ 6 }>
{ isError && <Alert status="error">Failed to load some data. Please try again later.</Alert> }
<Flex gap={ 6 } flexDirection={{ base: 'column', md: 'row' }} w="full">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c9606a1

Please sign in to comment.