Skip to content

Commit

Permalink
feat: news v2, warning text on notification (#1115)
Browse files Browse the repository at this point in the history
  • Loading branch information
IanKrieger authored Mar 7, 2024
1 parent 5ec14db commit 574a5c5
Show file tree
Hide file tree
Showing 7 changed files with 133 additions and 74 deletions.
2 changes: 0 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
npm run extract
git add *.po
2 changes: 2 additions & 0 deletions src/components/Assets/ImagePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const ImagePreview = ({
height,
width,
bgcolor: "#AEB1C2",
borderRadius: "6px",
}}
>
{url?.endsWith(".pad") ? (
Expand All @@ -45,6 +46,7 @@ export const ImagePreview = ({
style={{
opacity: selected === false ? 0.3 : 1,
filter: selected === false ? "grayscale(20%)" : "none",
borderRadius: "6px",
}}
/>
) : (
Expand Down
137 changes: 80 additions & 57 deletions src/components/Creatives/NewsPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,73 +14,96 @@ export function NewsPreview() {
return (
<Card
sx={{
bgcolor: "rgba(53, 53, 53, 0.47)",
display: "flex",
flexDirection: "column",
height: "525px",
width: "600px",
textDecoration: "none",
bgcolor: "rgba(33, 39, 42, 1)",
borderRadius: "16px",
}}
>
<Box display="flex" justifyContent="center">
{value?.imageUrl ? (
<ImagePreview url={value.imageUrl} height={400} width={500} />
) : (
<Box height={400} width={500} />
)}
</Box>
<Box
padding="20px 25px"
bgcolor="rgba(53, 53, 53, 0.47)"
flexGrow={1}
display="flex"
flexDirection="column"
justifyContent="space-between"
sx={{
padding: "16px",
display: "flex",
flexDirection: "column",
gap: "8px",
bgcolor: "rgba(255, 255, 255, 0.05)",
}}
>
<Box display="flex" justifyContent="center" borderRadius="12px">
{value?.imageUrl ? (
<ImagePreview url={value.imageUrl} height={400} width={500} />
) : (
<Box height={400} width={500} />
)}
</Box>
<Box height="18px" gap="8px">
<OutlinedAd />{" "}
<AdDescription description={value?.description ?? advertiser.name} />
</Box>
<Typography
display="flex"
alignItems="center"
margin={0}
textAlign="start"
fontWeight={600}
fontSize="14px"
lineHeight="22px"
color="rgba(255, 255, 255, 1)"
>
{value?.title || (
<Trans>
This is a news display ad, it wll look like part of the news feed.
</Trans>
)}
</Typography>
<Box
width="100px"
height="35px"
padding="5px, 9px, 5px, 9px"
borderRadius="8px"
bgcolor="rgba(104, 123, 133, 0.3)"
display="flex"
flexDirection="row"
mb={1}
gap={2}
justifyContent="space-between"
alignItems="center"
justifyContent="center"
>
<Typography
color="#ffff"
fontSize="16px"
fontWeight={500}
maxWidth={400}
>
{value?.title || (
<Trans>
This is a news display ad, it wll look like part of the news
feed.
</Trans>
)}
</Typography>
<Box
width="200px"
display="flex"
alignItems="center"
justifyContent="flex-end"
>
<Box
color="#ffff"
border="1px solid #ffff"
padding="8px 10px"
minWidth="100px"
textAlign="center"
borderRadius="100px"
>
<Typography fontSize="14px">
{value?.ctaText || <Trans>Click Here!</Trans>}
</Typography>
</Box>
</Box>
<span style={{ fontSize: "11px", color: "#fff", fontWeight: 600 }}>
{value?.ctaText || <Trans>Click Here!</Trans>}
</span>
</Box>
<Typography color="#ffff" fontSize="14px" fontWeight={500}>
{value?.description ?? advertiser.name}
</Typography>
</Box>
</Card>
);
}

const OutlinedAd = () => {
return (
<span
style={{
lineHeight: "16px",
padding: "0px 2px",
border: "1px solid rgba(255, 255, 255, 0.3)",
borderRadius: "3px",
textDecoration: "none",
fontSize: "11px",
color: "rgba(255, 255, 255, 1)",
}}
>
<Trans>Ad</Trans>
</span>
);
};

const AdDescription = (props: { description: string }) => {
return (
<span
style={{
margin: "0",
fontWeight: "400",
fontSize: "11px",
lineHeight: "18px",
color: "rgba(255, 255, 255, 0.5)",
}}
>
{props.description}
</span>
);
};
18 changes: 13 additions & 5 deletions src/locales/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ msgstr "Account Settings"
msgid "Activate"
msgstr "Activate"

#: src/components/Creatives/NewsPreview.tsx:90
msgid "Ad"
msgstr "Ad"

#: src/validation/CreativeSchema.tsx:45
msgid "Ad body is required"
msgstr "Ad body is required"
Expand Down Expand Up @@ -450,7 +454,7 @@ msgstr "City"
msgid "City is required"
msgstr "City is required"

#: src/components/Creatives/NewsPreview.tsx:75
#: src/components/Creatives/NewsPreview.tsx:69
msgid "Click Here!"
msgstr "Click Here!"

Expand Down Expand Up @@ -847,7 +851,7 @@ msgstr "Enter Ads Manager"
msgid "Enter your email address to get a secure login link. Use this link to access your Brave Ads account."
msgstr "Enter your email address to get a secure login link. Use this link to access your Brave Ads account."

#: src/user/ads/NotificationAd.tsx:73
#: src/user/ads/NotificationAd.tsx:79
msgid "Example - https://brave.com/brave-rewards/"
msgstr "Example - https://brave.com/brave-rewards/"

Expand Down Expand Up @@ -1010,7 +1014,7 @@ msgstr "I would like to receive marketing emails about new features and promotio
msgid "Image"
msgstr "Image"

#: src/components/Assets/ImagePreview.tsx:56
#: src/components/Assets/ImagePreview.tsx:58
msgid "Image failed to load"
msgstr "Image failed to load"

Expand Down Expand Up @@ -1174,6 +1178,10 @@ msgstr "Logging in"
msgid "Make payment & submit for approval"
msgstr "Make payment & submit for approval"

#: src/user/ads/NotificationAd.tsx:68
msgid "Make sure to include your brand name in the title OR body of the ad. Otherwise, it will be rejected."
msgstr "Make sure to include your brand name in the title OR body of the ad. Otherwise, it will be rejected."

#: src/auth/registration/AccountChoice.tsx:72
#~ msgid "Managed service"
#~ msgstr "Managed service"
Expand Down Expand Up @@ -1819,7 +1827,7 @@ msgstr "Take our survey!"
#~ msgstr "Tap into over <0>9 billion</0> annual Web searches"

#: src/user/ads/InlineContentAd.tsx:84
#: src/user/ads/NotificationAd.tsx:72
#: src/user/ads/NotificationAd.tsx:78
msgid "Target URL"
msgstr "Target URL"

Expand Down Expand Up @@ -1883,7 +1891,7 @@ msgstr "The username or password did not match our records."
#~ msgid "Third party tracking acknowledgement is required"
#~ msgstr "Third party tracking acknowledgement is required"

#: src/components/Creatives/NewsPreview.tsx:54
#: src/components/Creatives/NewsPreview.tsx:52
msgid "This is a news display ad, it wll look like part of the news feed."
msgstr "This is a news display ad, it wll look like part of the news feed."

Expand Down
18 changes: 13 additions & 5 deletions src/locales/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ msgstr ""
msgid "Activate"
msgstr ""

#: src/components/Creatives/NewsPreview.tsx:90
msgid "Ad"
msgstr ""

#: src/validation/CreativeSchema.tsx:45
msgid "Ad body is required"
msgstr ""
Expand Down Expand Up @@ -454,7 +458,7 @@ msgstr ""
msgid "City is required"
msgstr ""

#: src/components/Creatives/NewsPreview.tsx:75
#: src/components/Creatives/NewsPreview.tsx:69
msgid "Click Here!"
msgstr ""

Expand Down Expand Up @@ -851,7 +855,7 @@ msgstr ""
msgid "Enter your email address to get a secure login link. Use this link to access your Brave Ads account."
msgstr ""

#: src/user/ads/NotificationAd.tsx:73
#: src/user/ads/NotificationAd.tsx:79
msgid "Example - https://brave.com/brave-rewards/"
msgstr ""

Expand Down Expand Up @@ -1018,7 +1022,7 @@ msgstr ""
msgid "Image"
msgstr ""

#: src/components/Assets/ImagePreview.tsx:56
#: src/components/Assets/ImagePreview.tsx:58
msgid "Image failed to load"
msgstr ""

Expand Down Expand Up @@ -1182,6 +1186,10 @@ msgstr ""
msgid "Make payment & submit for approval"
msgstr ""

#: src/user/ads/NotificationAd.tsx:68
msgid "Make sure to include your brand name in the title OR body of the ad. Otherwise, it will be rejected."
msgstr ""

#: src/auth/registration/AccountChoice.tsx:72
#~ msgid "Managed service"
#~ msgstr ""
Expand Down Expand Up @@ -1827,7 +1835,7 @@ msgstr ""
#~ msgstr ""

#: src/user/ads/InlineContentAd.tsx:84
#: src/user/ads/NotificationAd.tsx:72
#: src/user/ads/NotificationAd.tsx:78
msgid "Target URL"
msgstr ""

Expand Down Expand Up @@ -1891,7 +1899,7 @@ msgstr ""
#~ msgid "Third party tracking acknowledgement is required"
#~ msgstr ""

#: src/components/Creatives/NewsPreview.tsx:54
#: src/components/Creatives/NewsPreview.tsx:52
msgid "This is a news display ad, it wll look like part of the news feed."
msgstr ""

Expand Down
18 changes: 13 additions & 5 deletions src/locales/pt.po
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ msgstr ""
msgid "Activate"
msgstr ""

#: src/components/Creatives/NewsPreview.tsx:90
msgid "Ad"
msgstr ""

#: src/validation/CreativeSchema.tsx:45
msgid "Ad body is required"
msgstr ""
Expand Down Expand Up @@ -454,7 +458,7 @@ msgstr ""
msgid "City is required"
msgstr ""

#: src/components/Creatives/NewsPreview.tsx:75
#: src/components/Creatives/NewsPreview.tsx:69
msgid "Click Here!"
msgstr ""

Expand Down Expand Up @@ -851,7 +855,7 @@ msgstr ""
msgid "Enter your email address to get a secure login link. Use this link to access your Brave Ads account."
msgstr ""

#: src/user/ads/NotificationAd.tsx:73
#: src/user/ads/NotificationAd.tsx:79
msgid "Example - https://brave.com/brave-rewards/"
msgstr ""

Expand Down Expand Up @@ -1018,7 +1022,7 @@ msgstr ""
msgid "Image"
msgstr ""

#: src/components/Assets/ImagePreview.tsx:56
#: src/components/Assets/ImagePreview.tsx:58
msgid "Image failed to load"
msgstr ""

Expand Down Expand Up @@ -1182,6 +1186,10 @@ msgstr ""
msgid "Make payment & submit for approval"
msgstr ""

#: src/user/ads/NotificationAd.tsx:68
msgid "Make sure to include your brand name in the title OR body of the ad. Otherwise, it will be rejected."
msgstr ""

#: src/auth/registration/AccountChoice.tsx:72
#~ msgid "Managed service"
#~ msgstr ""
Expand Down Expand Up @@ -1827,7 +1835,7 @@ msgstr ""
#~ msgstr ""

#: src/user/ads/InlineContentAd.tsx:84
#: src/user/ads/NotificationAd.tsx:72
#: src/user/ads/NotificationAd.tsx:78
msgid "Target URL"
msgstr ""

Expand Down Expand Up @@ -1891,7 +1899,7 @@ msgstr ""
#~ msgid "Third party tracking acknowledgement is required"
#~ msgstr ""

#: src/components/Creatives/NewsPreview.tsx:54
#: src/components/Creatives/NewsPreview.tsx:52
msgid "This is a news display ad, it wll look like part of the news feed."
msgstr ""

Expand Down
12 changes: 12 additions & 0 deletions src/user/ads/NotificationAd.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ const NotificationAdForm = (props: NotificationAdProps) => {
maxLengthInstantFeedback={60}
/>

<Typography
variant="caption"
textAlign="center"
display="block"
fontWeight={500}
>
<Trans>
Make sure to include your brand name in the title OR body of the ad.
Otherwise, it will be rejected.
</Trans>
</Typography>

<NotificationPreview />

<UrlResolver
Expand Down

0 comments on commit 574a5c5

Please sign in to comment.