diff --git a/browser/ui/webui/brave_rewards/rewards_page_data_source.cc b/browser/ui/webui/brave_rewards/rewards_page_data_source.cc index a1d047e268e..2ea427ea12d 100644 --- a/browser/ui/webui/brave_rewards/rewards_page_data_source.cc +++ b/browser/ui/webui/brave_rewards/rewards_page_data_source.cc @@ -64,6 +64,7 @@ static constexpr webui::LocalizedString kStrings[] = { IDS_REWARDS_ADS_SETTINGS_SUBDIVISION_AUTO_LABEL}, {"adsSettingsTitle", IDS_REWARDS_ADS_SETTINGS_TITLE}, {"adsSettingsText", IDS_REWARDS_ADS_SETTINGS_TEXT}, + {"adsViewedTooltip", IDS_REWARDS_ADS_VIEWED_TOOLTIP}, {"adTypeInlineContentLabel", IDS_REWARDS_AD_TYPE_INLINE_CONTENT_LABEL}, {"adTypeNewTabPageLabel", IDS_REWARDS_AD_TYPE_NEW_TAB_PAGE_LABEL}, {"adTypeNotificationLabel", IDS_REWARDS_AD_TYPE_NOTIFICATION_LABEL}, diff --git a/components/brave_ads/core/internal/account/statement/ads_received_util.cc b/components/brave_ads/core/internal/account/statement/ads_received_util.cc index 698d1fe2f2a..bd01ec50c77 100644 --- a/components/brave_ads/core/internal/account/statement/ads_received_util.cc +++ b/components/brave_ads/core/internal/account/statement/ads_received_util.cc @@ -20,7 +20,7 @@ size_t GetAdsReceivedForDateRange(const TransactionList& transactions, return transaction.confirmation_type == mojom::ConfirmationType::kViewedImpression && transaction.created_at >= from_time && - transaction.created_at <= to_time; + transaction.created_at <= to_time && transaction.value > 0; }); } diff --git a/components/brave_ads/core/internal/account/statement/ads_received_util_unittest.cc b/components/brave_ads/core/internal/account/statement/ads_received_util_unittest.cc index 2b7fa7d7d9e..f11deb7da84 100644 --- a/components/brave_ads/core/internal/account/statement/ads_received_util_unittest.cc +++ b/components/brave_ads/core/internal/account/statement/ads_received_util_unittest.cc @@ -33,7 +33,7 @@ TEST_F(BraveAdsAdsReceivedUtilTest, GetAdsReceivedForDateRange) { AdvanceClockTo(test::TimeFromString("25 December 2020")); const TransactionInfo transaction_2 = test::BuildUnreconciledTransaction( - /*value=*/0.0, mojom::AdType::kNotificationAd, + /*value=*/0.1, mojom::AdType::kNotificationAd, mojom::ConfirmationType::kClicked, /*should_generate_random_uuids=*/true); transactions.push_back(transaction_2); @@ -68,6 +68,13 @@ TEST_F(BraveAdsAdsReceivedUtilTest, GetAdsReceivedForDateRange) { transaction_6.ad_type = mojom::AdType::kInlineContentAd; transactions.push_back(transaction_6); + TransactionInfo transaction_7 = test::BuildUnreconciledTransaction( + /*value=*/0.00, mojom::AdType::kNotificationAd, + mojom::ConfirmationType::kViewedImpression, + /*should_generate_random_uuids=*/true); + transaction_7.ad_type = mojom::AdType::kNewTabPageAd; + transactions.push_back(transaction_7); + // Act const size_t ads_received = GetAdsReceivedForDateRange( transactions, from_time, test::DistantFuture()); diff --git a/components/brave_ads/core/internal/account/statement/ads_summary_util.cc b/components/brave_ads/core/internal/account/statement/ads_summary_util.cc index 7fa001f5e2e..0942e7d3227 100644 --- a/components/brave_ads/core/internal/account/statement/ads_summary_util.cc +++ b/components/brave_ads/core/internal/account/statement/ads_summary_util.cc @@ -20,7 +20,7 @@ base::flat_map GetAdsSummaryForDateRange( if (transaction.confirmation_type == mojom::ConfirmationType::kViewedImpression && transaction.created_at >= from_time && - transaction.created_at <= to_time) { + transaction.created_at <= to_time && transaction.value > 0) { ++ads_summary[transaction.ad_type]; } } diff --git a/components/brave_ads/core/internal/account/statement/ads_summary_util_unittest.cc b/components/brave_ads/core/internal/account/statement/ads_summary_util_unittest.cc index 19b07274b2d..8dc659377e0 100644 --- a/components/brave_ads/core/internal/account/statement/ads_summary_util_unittest.cc +++ b/components/brave_ads/core/internal/account/statement/ads_summary_util_unittest.cc @@ -32,7 +32,7 @@ TEST_F(BraveAdsAdsSummaryUtilTest, GetAdsSummaryForDateRange) { AdvanceClockTo(test::TimeFromString("25 December 2020")); const TransactionInfo transaction_2 = test::BuildUnreconciledTransaction( - /*value=*/0.0, mojom::AdType::kNotificationAd, + /*value=*/0.1, mojom::AdType::kNotificationAd, mojom::ConfirmationType::kClicked, /*should_generate_random_uuids=*/true); transactions.push_back(transaction_2); @@ -67,6 +67,13 @@ TEST_F(BraveAdsAdsSummaryUtilTest, GetAdsSummaryForDateRange) { transaction_6.ad_type = mojom::AdType::kInlineContentAd; transactions.push_back(transaction_6); + TransactionInfo transaction_7 = test::BuildUnreconciledTransaction( + /*value=*/0.00, mojom::AdType::kNotificationAd, + mojom::ConfirmationType::kViewedImpression, + /*should_generate_random_uuids=*/true); + transaction_7.ad_type = mojom::AdType::kNewTabPageAd; + transactions.push_back(transaction_7); + // Act const base::flat_map ads_summary = GetAdsSummaryForDateRange(transactions, from_time, test::DistantFuture()); diff --git a/components/brave_rewards/resources/rewards_page/components/home/earning_card.style.ts b/components/brave_rewards/resources/rewards_page/components/home/earning_card.style.ts index 17830ed343c..5c630bb390c 100644 --- a/components/brave_rewards/resources/rewards_page/components/home/earning_card.style.ts +++ b/components/brave_rewards/resources/rewards_page/components/home/earning_card.style.ts @@ -29,15 +29,27 @@ export const style = scoped.css` color: ${color.text.tertiary}; text-align: center; min-height: 80px; + display: flex; + flex-direction: column; + align-items: center; } .counter-value { - --leo-icon-size: 16px; + --leo-icon-size: 14px; + + position: relative; font: ${font.heading.h2}; color: ${color.text.primary}; leo-tooltip { - padding-inline-start: 8px; + position: absolute; + inset-inline-start: calc(100% + 6px); + inset-block-start: 4px; + + [slot=content] { + max-width: 250px; + text-align: start; + } } } diff --git a/components/brave_rewards/resources/rewards_page/components/home/earning_card.tsx b/components/brave_rewards/resources/rewards_page/components/home/earning_card.tsx index 9672392c892..e454c798e00 100644 --- a/components/brave_rewards/resources/rewards_page/components/home/earning_card.tsx +++ b/components/brave_rewards/resources/rewards_page/components/home/earning_card.tsx @@ -6,6 +6,7 @@ import * as React from 'react' import Button from '@brave/leo/react/button' import Icon from '@brave/leo/react/icon' +import Tooltip from '@brave/leo/react/tooltip' import { formatMessage } from '../../../shared/lib/locale_context' import { useAppState } from '../../lib/app_model_context' @@ -84,6 +85,7 @@ export function EarningCard() { $1: (content) => (
{content} + {renderAdsViewedTooltip()}
) } @@ -115,6 +117,15 @@ export function EarningCard() { ) } + function renderAdsViewedTooltip() { + return ( + + +
{getString('adsViewedTooltip')}
+
+ ) + } + function renderEarningsCounter() { if (!adsInfo) { return @@ -124,6 +135,7 @@ export function EarningCard() { $1: (content) => (
{content} + {renderAdsViewedTooltip()}
) } diff --git a/components/brave_rewards/resources/rewards_page/lib/locale_strings.ts b/components/brave_rewards/resources/rewards_page/lib/locale_strings.ts index 03f339f62e6..34e59cffec7 100644 --- a/components/brave_rewards/resources/rewards_page/lib/locale_strings.ts +++ b/components/brave_rewards/resources/rewards_page/lib/locale_strings.ts @@ -32,6 +32,7 @@ export type StringKey = 'adsSettingsSubdivisionAutoLabel' | 'adsSettingsTitle' | 'adsSettingsText' | + 'adsViewedTooltip' | 'adTypeInlineContentLabel' | 'adTypeNewTabPageLabel' | 'adTypeNotificationLabel' | diff --git a/components/brave_rewards/resources/rewards_page/stories/storybook_strings.ts b/components/brave_rewards/resources/rewards_page/stories/storybook_strings.ts index 35a8f45b7d8..b0810a79763 100644 --- a/components/brave_rewards/resources/rewards_page/stories/storybook_strings.ts +++ b/components/brave_rewards/resources/rewards_page/stories/storybook_strings.ts @@ -30,6 +30,7 @@ export const localeStrings: { [K in StringKey]: string } = { adsSettingsSubdivisionAutoLabel: 'Auto-detect', adsSettingsTitle: 'Ads settings', adsSettingsText: 'Control what kinds of Brave Ads you see, and how often. The more you see, the more you can earn.', + adsViewedTooltip: 'This shows the number of Brave Ads you\'ve seen this month that qualify for earning BAT.', adTypeInlineContentLabel: 'Brave News ads', adTypeNewTabPageLabel: 'New tab page ads', adTypeNotificationLabel: 'Notification ads', diff --git a/components/brave_rewards/resources/shared/components/newtab/rewards_card.style.ts b/components/brave_rewards/resources/shared/components/newtab/rewards_card.style.ts index 37b5a6e36bd..a0ebce0b356 100644 --- a/components/brave_rewards/resources/shared/components/newtab/rewards_card.style.ts +++ b/components/brave_rewards/resources/shared/components/newtab/rewards_card.style.ts @@ -210,7 +210,6 @@ export const earningsHeaderText = styled.div` export const earningsInfo = styled.span` position: relative; - display: none; .icon { height: 12px; @@ -258,24 +257,6 @@ export const earningsTooltip = styled.div.attrs({ 'data-theme': 'light' })` } ` -export const manageAds = styled.div.attrs({ 'data-theme': 'light' })` - margin-top: 14px; - - a { - color: ${color.text.interactive}; - font-weight: 600; - font-size: 12px; - line-height: 16px; - text-decoration: none; - } - - .icon { - height: 9px; - width: auto; - color: ${color.icon.interactive}; - } -` - export const earningsDisplay = styled.div` display: flex; align-items: center; diff --git a/components/brave_rewards/resources/shared/components/newtab/rewards_card.tsx b/components/brave_rewards/resources/shared/components/newtab/rewards_card.tsx index d71d520c037..65dd14a92bd 100644 --- a/components/brave_rewards/resources/shared/components/newtab/rewards_card.tsx +++ b/components/brave_rewards/resources/shared/components/newtab/rewards_card.tsx @@ -16,10 +16,8 @@ import { ArrowCircleIcon } from '../icons/arrow_circle_icon' import { BatIcon } from '../icons/bat_icon' import { OptInIcon } from '../icons/optin_icon' import { InfoIcon } from './icons/info_icon' -import { CaretIcon } from '../icons/caret_icon' import { TokenAmount } from '../token_amount' import { ExchangeAmount } from '../exchange_amount' -import { NewTabLink } from '../new_tab_link' import { SelectCountryCard } from './select_country_card' import { PaymentStatusView } from '../payment_status_view' import { TosUpdateNotice } from '../tos_update_notice' @@ -251,12 +249,6 @@ export function RewardsCard (props: Props) {
{getString('rewardsEarningInfoText')} - - - {getString('rewardsManageAds')} - - -
diff --git a/components/resources/rewards_strings.grdp b/components/resources/rewards_strings.grdp index 450119a2c21..e04212b7cf7 100644 --- a/components/resources/rewards_strings.grdp +++ b/components/resources/rewards_strings.grdp @@ -128,9 +128,6 @@ Continue - - This reflects your estimated earnings range for Brave Ads this month. - How does it work? @@ -765,6 +762,9 @@ Control what kinds of Brave Ads you see, and how often. The more you see, the more you can earn. + + This shows the number of Brave Ads you've seen this month that qualify for earning BAT. + Brave News ads diff --git a/components/webui/webui_resources.cc b/components/webui/webui_resources.cc index e1429f1acc2..1bf210e72ba 100644 --- a/components/webui/webui_resources.cc +++ b/components/webui/webui_resources.cc @@ -262,7 +262,7 @@ base::span GetWebUILocalizedStrings( {"rewardsConnectAccountText", IDS_REWARDS_CONNECT_ACCOUNT_TEXT}, {"rewardsContinue", IDS_REWARDS_WIDGET_CONTINUE}, {"rewardsEarningsTitle", IDS_REWARDS_ESTIMATED_EARNINGS_TITLE}, - {"rewardsEarningInfoText", IDS_REWARDS_WIDGET_EARNING_INFO_TEXT}, + {"rewardsEarningInfoText", IDS_REWARDS_ADS_VIEWED_TOOLTIP}, {"rewardsHowDoesItWork", IDS_REWARDS_WIDGET_HOW_DOES_IT_WORK}, {"rewardsLearnMore", IDS_REWARDS_LEARN_MORE}, {"rewardsManageAds", IDS_REWARDS_WALLET_MANAGE_ADS}, @@ -692,7 +692,7 @@ base::span GetWebUILocalizedStrings( {"walletViewStatement", IDS_REWARDS_WALLET_VIEW_STATEMENT}, {"walletVerified", IDS_REWARDS_WALLET_VERIFIED}, {"walletBalanceTitle", IDS_REWARDS_WALLET_BALANCE_TITLE}, - {"walletEarningInfoText", IDS_REWARDS_WIDGET_EARNING_INFO_TEXT}, + {"walletEarningInfoText", IDS_REWARDS_ADS_VIEWED_TOOLTIP}, {"loading", IDS_BRAVE_REWARDS_LOADING_LABEL}, }},