Skip to content

Commit 1f76f89

Browse files
authored
Merge branch 'dev' into side-nav-fixes
2 parents 9f69230 + 99c2421 commit 1f76f89

File tree

7 files changed

+21
-47
lines changed

7 files changed

+21
-47
lines changed

src/components/Codeblock.tsx

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import React, { useEffect, useState } from "react"
1+
import React, { useState } from "react"
2+
import { useTranslation } from "next-i18next"
23
import Highlight, {
34
defaultProps,
45
Language,
@@ -9,9 +10,9 @@ import { Box, BoxProps, Flex, useColorModeValue } from "@chakra-ui/react"
910

1011
import CopyToClipboard from "@/components/CopyToClipboard"
1112
import Emoji from "@/components/Emoji"
12-
1313
// https://github.com/FormidableLabs/prism-react-renderer/tree/master#custom-language-support
14-
;(typeof global !== "undefined" ? global : window).Prism = Prism
14+
;
15+
(typeof global !== "undefined" ? global : window).Prism = Prism
1516
require("prismjs/components/prism-solidity")
1617

1718
const LINES_BEFORE_COLLAPSABLE = 8
@@ -217,6 +218,7 @@ const Codeblock: React.FC<IProps> = ({
217218
codeLanguage,
218219
fromHomepage = false,
219220
}) => {
221+
const { t } = useTranslation('common')
220222
const selectedTheme = useColorModeValue(codeTheme.light, codeTheme.dark)
221223

222224
const codeText = React.Children.toArray(children)
@@ -321,13 +323,9 @@ const Codeblock: React.FC<IProps> = ({
321323
totalLines - 1 > LINES_BEFORE_COLLAPSABLE && (
322324
<TopBarItem onClick={() => setIsCollapsed(!isCollapsed)}>
323325
{isCollapsed ? (
324-
// TODO: Implement after intl
325-
// <Translation id="show-all" />
326-
<>Show all</>
326+
t("show-all")
327327
) : (
328-
// TODO: Implement after intl
329-
// <Translation id="show-less" />
330-
<>Show less</>
328+
t("show-less")
331329
)}
332330
</TopBarItem>
333331
)}
@@ -338,16 +336,12 @@ const Codeblock: React.FC<IProps> = ({
338336
{!isCopied ? (
339337
<>
340338
<Emoji text=":clipboard:" fontSize="md" />{" "}
341-
{/* TODO: Implement after intl */}
342-
{/* <Translation id="copy" /> */}
343-
Copy
339+
{t("copy")}
344340
</>
345341
) : (
346342
<>
347343
<Emoji text=":white_check_mark:" fontSize="md" />{" "}
348-
{/* TODO: Implement after intl */}
349-
{/* <Translation id="copied" /> */}
350-
Copied
344+
{t("copied")}
351345
</>
352346
)}
353347
</TopBarItem>

src/components/ExpandableCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const ExpandableCard = ({
3434
eventName = "",
3535
}: ExpandableCardProps) => {
3636
const [isVisible, setIsVisible] = useState(false)
37-
const { t } = useTranslation("common") // TODO: Double-check namespace
37+
const { t } = useTranslation("common")
3838
const matomo = {
3939
eventAction,
4040
eventCategory: `ExpandableCard${eventCategory}`,

src/components/Staking/StakingProductsCardGrid.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import {
2525
UnknownProductGlyphIcon,
2626
WarningProductGlyphIcon,
2727
} from "@/components/icons/staking"
28-
import Translation from "@/components/Translation"
2928

3029
import { MatomoEventOptions } from "@/lib/utils/matomo"
3130

@@ -276,8 +275,7 @@ const StakingProductCard: React.FC<ICardProps> = ({
276275
</List>
277276
</Box>
278277
<Box {...PADDED_DIV_STYLE}>
279-
{/* TODO: Matomo - re-enable */}
280-
<ButtonLink to={url} /* customEventOptions={matomo} */ width="100%">
278+
<ButtonLink to={url} customEventOptions={matomo} width="100%">
281279
{t("page-staking-products-get-started")}
282280
</ButtonLink>
283281
</Box>

src/components/TranslationBanner.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ import Emoji from "./Emoji"
99

1010
export interface IProps {
1111
shouldShow: boolean
12-
isPageRightToLeft: boolean
1312
originalPagePath: string
1413
isPageContentEnglish: boolean
1514
}
1615

1716
const TranslationBanner: React.FC<IProps> = ({
1817
shouldShow,
19-
isPageRightToLeft,
2018
originalPagePath,
2119
isPageContentEnglish,
2220
}) => {
@@ -60,7 +58,6 @@ const TranslationBanner: React.FC<IProps> = ({
6058
>
6159
<Flex
6260
flexDirection="column"
63-
alignItems={isPageRightToLeft ? "flex-end" : "flex-start"}
6461
m={4}
6562
mt={{ base: 10, sm: 4 }}
6663
>
@@ -115,7 +112,7 @@ const TranslationBanner: React.FC<IProps> = ({
115112
<CloseButton
116113
position="absolute"
117114
top="0"
118-
insetInlineEnd={isPageRightToLeft ? "auto" : 0}
115+
insetInlineEnd="0"
119116
margin={2}
120117
color="secondary"
121118
_hover={{

src/components/TranslationBannerLegal.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,12 @@ import Translation from "./Translation"
1414

1515
export interface IProps {
1616
shouldShow: boolean
17-
isPageRightToLeft: boolean
1817
originalPagePath: string
1918
}
2019

2120
const TranslationBannerLegal: React.FC<IProps> = ({
2221
shouldShow,
2322
originalPagePath,
24-
isPageRightToLeft,
2523
}) => {
2624
// Default to isOpen being false, and let the useEffect set this.
2725
const [isOpen, setIsOpen] = useState(false)
@@ -61,12 +59,7 @@ const TranslationBannerLegal: React.FC<IProps> = ({
6159
md: "rgba(0, 0, 0, 0.16) 0px 2px 4px 0px",
6260
}}
6361
>
64-
<Flex
65-
direction="column"
66-
align={isPageRightToLeft ? "flex-end" : "flex-start"}
67-
m={4}
68-
mt={{ base: 10, sm: 4 }}
69-
>
62+
<Flex direction="column" m={4} mt={{ base: 10, sm: 4 }}>
7063
<Flex
7164
align={{ base: "flex-start", sm: "center" }}
7265
flexDirection={{ base: "column-reverse", sm: "row" }}
@@ -111,7 +104,7 @@ const TranslationBannerLegal: React.FC<IProps> = ({
111104
<CloseButton
112105
position="absolute"
113106
top={0}
114-
insetInlineEnd={isPageRightToLeft ? "auto" : 0}
107+
insetInlineEnd="0"
115108
margin={4}
116109
color="secondary"
117110
_hover={{

src/components/UpcomingEventsList.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ import { Box } from "@chakra-ui/react"
33

44
import Translation from "@/components/Translation"
55

6+
import { trackCustomEvent } from "@/lib/utils/matomo"
7+
68
import events from "../data/community-events.json"
79

810
import { Button } from "./Buttons"
911
import EventCard from "./EventCard"
1012
import InfoBanner from "./InfoBanner"
1113
import InlineLink from "./Link"
1214

13-
// TODO: add trackCustomEvent when util is migrated
14-
// import { trackCustomEvent } from "../utils/matomo"
15-
1615
interface ICommunityEventData {
1716
title: string
1817
to: string
@@ -88,12 +87,11 @@ const UpcomingEventsList: React.FC = () => {
8887
const loadMoreEvents = () => {
8988
setMaxRange((counter) => counter + eventsPerLoad)
9089
setIsVisible(maxRange + eventsPerLoad <= orderedUpcomingEvents.length)
91-
// TODO: add trackCustomEvent when util is migrated
92-
// trackCustomEvent({
93-
// eventCategory: "more events button",
94-
// eventAction: "click",
95-
// eventName: "load more",
96-
// })
90+
trackCustomEvent({
91+
eventCategory: "more events button",
92+
eventAction: "click",
93+
eventName: "load more",
94+
})
9795
}
9896

9997
if (orderedUpcomingEvents.length === 0) {

src/layouts/RootLayout.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { join } from "path"
33
import { useRouter } from "next/router"
44
import { Container } from "@chakra-ui/react"
55

6-
import { Lang } from "@/lib/types"
76
import { Root } from "@/lib/interfaces"
87

98
import FeedbackWidget from "@/components/FeedbackWidget"
@@ -13,7 +12,6 @@ import TranslationBanner from "@/components/TranslationBanner"
1312
import TranslationBannerLegal from "@/components/TranslationBannerLegal"
1413

1514
import { toPosixPath } from "@/lib/utils/relativePath"
16-
import { isLangRightToLeft } from "@/lib/utils/translations"
1715

1816
import { DEFAULT_LOCALE } from "@/lib/constants"
1917

@@ -47,8 +45,6 @@ export const RootLayout = ({
4745
(contentNotTranslated && !isPageLanguageEnglish)) &&
4846
!isLegal
4947
const shouldShowLegalTranslationBanner = isLegal && !isPageLanguageEnglish
50-
51-
const isPageRightToLeft = isLangRightToLeft(locale as Lang)
5248
const originalPagePath = toPosixPath(join(DEFAULT_LOCALE, asPath))
5349

5450
return (
@@ -58,13 +54,11 @@ export const RootLayout = ({
5854
<TranslationBanner
5955
shouldShow={shouldShowTranslationBanner}
6056
isPageContentEnglish={contentNotTranslated}
61-
isPageRightToLeft={isPageRightToLeft}
6257
originalPagePath={originalPagePath}
6358
/>
6459

6560
<TranslationBannerLegal
6661
shouldShow={shouldShowLegalTranslationBanner}
67-
isPageRightToLeft={isPageRightToLeft}
6862
originalPagePath={originalPagePath}
6963
/>
7064

0 commit comments

Comments
 (0)