diff --git a/src/@chakra-ui/gatsby-plugin/theme.ts b/src/@chakra-ui/gatsby-plugin/theme.ts index 63abf3595b3..d9b2b116818 100644 --- a/src/@chakra-ui/gatsby-plugin/theme.ts +++ b/src/@chakra-ui/gatsby-plugin/theme.ts @@ -1,8 +1,4 @@ -import { - extendBaseTheme, - type ThemeConfig, - type ThemeOverride, -} from "@chakra-ui/react" +import { extendBaseTheme, type ThemeConfig } from "@chakra-ui/react" // Global style overrides import styles from "./styles" @@ -27,7 +23,7 @@ const config: ThemeConfig = { * The complete list of default Chakra styles can be found here: * https://github.com/chakra-ui/chakra-ui/tree/main/packages/theme/src */ -const theme: ThemeOverride = { +const theme = { config, styles, ...foundations, diff --git a/src/components/Banners/Implementations/WritersCohortBanner.tsx b/src/components/Banners/Implementations/WritersCohortBanner.tsx index a6423f217c3..87380b716bd 100644 --- a/src/components/Banners/Implementations/WritersCohortBanner.tsx +++ b/src/components/Banners/Implementations/WritersCohortBanner.tsx @@ -4,15 +4,20 @@ import { Text } from "@chakra-ui/react" import DismissableBanner from "../DismissableBanner" import Link from "../../Link" +import { supportedLanguages } from "../../../utils/languages" + interface IProps { pathname: string } const WritersCohortBanner: React.FC = ({ pathname }) => { + const pattern = supportedLanguages.join("|") + const strippedPathname = pathname.replace(new RegExp(`^/(${pattern})/`), "/") + if ( pathname.includes("contributing") || pathname.includes("community") || - pathname === "/" + strippedPathname === "/" ) { return ( diff --git a/src/components/BeaconChainActions.tsx b/src/components/BeaconChainActions.tsx index c11e2e1ff8e..026fae94968 100644 --- a/src/components/BeaconChainActions.tsx +++ b/src/components/BeaconChainActions.tsx @@ -118,11 +118,11 @@ const BeaconChainActions: React.FC = () => { - +

- + ) } diff --git a/src/components/CardList.tsx b/src/components/CardList.tsx index 789dc3f5f2a..b5f859ba7c7 100644 --- a/src/components/CardList.tsx +++ b/src/components/CardList.tsx @@ -26,7 +26,7 @@ export type CardListItem = { } export interface IProps extends BoxProps { - content: Array + items: Array clickHandler?: (idx: string | number) => void } @@ -92,12 +92,12 @@ const Card = (props: CardListItem & Omit) => { } const CardList: React.FC = ({ - content, + items, clickHandler = () => null, ...rest }) => ( - {content.map((listItem, idx) => { + {items.map((listItem, idx) => { const { link, id } = listItem const isLink = !!link diff --git a/src/components/Codeblock.tsx b/src/components/Codeblock.tsx index 809bf6cd81c..5d916ebd33f 100644 --- a/src/components/Codeblock.tsx +++ b/src/components/Codeblock.tsx @@ -204,7 +204,7 @@ export interface IProps { allowCollapse?: boolean codeLanguage: string fromHomepage?: boolean - children: React.ReactChild + children: React.ReactNode } const Codeblock: React.FC = ({ @@ -215,13 +215,16 @@ const Codeblock: React.FC = ({ }) => { const selectedTheme = useColorModeValue(codeTheme.light, codeTheme.dark) - const codeText = React.Children.map(children, (child) => { - return getValidChildrenForCodeblock(child) - }).join("") + const codeText = React.Children.toArray(children) + .map((child) => { + if (!child) return + return getValidChildrenForCodeblock(child) + }) + .join("") const [isCollapsed, setIsCollapsed] = useState(allowCollapse) - let className + let className: string if (React.isValidElement(children)) { className = children?.props?.className } else { diff --git a/src/components/EnergyConsumptionChart.tsx b/src/components/EnergyConsumptionChart.tsx index 70101737c89..e46c98dfbb7 100644 --- a/src/components/EnergyConsumptionChart.tsx +++ b/src/components/EnergyConsumptionChart.tsx @@ -1,9 +1,16 @@ import React from "react" -import { Box, Center, useBreakpointValue, useToken } from "@chakra-ui/react" +import { + Box, + Center, + chakra, + useBreakpointValue, + useToken, +} from "@chakra-ui/react" import { BarChart, Bar, Cell, + Text, XAxis, LabelList, ResponsiveContainer, @@ -12,7 +19,6 @@ import { import { useTranslation } from "gatsby-plugin-react-i18next" import Translation from "./Translation" -import Text from "./OldText" interface ITickProps { x: number @@ -26,23 +32,43 @@ type Data = Array<{ color: string }> -const CustomTick: React.FC = ({ x, y, payload }) => { - const textColor = useToken("colors", "text") +const RechartText = chakra(Text, { + shouldForwardProp: (prop) => { + const isValidRechartProp = [ + "width", + "children", + "x", + "y", + "dy", + "angle", + "scaleToFit", + "textAnchor", + "verticalAnchor", + "breakAll", + "maxLines", + ].includes(prop) + if (isValidRechartProp) return true + + return false + }, +}) + +const CustomTick: React.FC = ({ x, y, payload }) => { return ( - {payload.value} - + ) } @@ -175,8 +201,7 @@ const EnergyConsumptionChart: React.FC = () => { dataKey="name" tickLine={false} axisLine={false} - // @ts-ignore - tick={} + tick={(props) => } interval={0} /> { - + )} {!hasExchangeResults && ( diff --git a/src/components/FileContributorsCrowdin.tsx b/src/components/FileContributorsCrowdin.tsx index e6a70b4bbd7..1511f77f7b9 100644 --- a/src/components/FileContributorsCrowdin.tsx +++ b/src/components/FileContributorsCrowdin.tsx @@ -18,7 +18,7 @@ interface Data { contributors: Contributor[] } -interface LangContributor { +export interface LangContributor { lang: string data: Data[] } diff --git a/src/components/MergeArticleList.tsx b/src/components/MergeArticleList.tsx index 2c8e6343f8e..8a76be64d22 100644 --- a/src/components/MergeArticleList.tsx +++ b/src/components/MergeArticleList.tsx @@ -53,7 +53,7 @@ const MergeArticleList: React.FC = () => { return ( - + ) } diff --git a/src/components/Quiz/QuizWidget.tsx b/src/components/Quiz/QuizWidget.tsx index 7b5b617e25a..72113070617 100644 --- a/src/components/Quiz/QuizWidget.tsx +++ b/src/components/Quiz/QuizWidget.tsx @@ -60,8 +60,8 @@ import questionBank from "../../data/quizzes/questionBank" interface IProps { quizKey?: string - currentHandler: (next?: string) => void - statusHandler: (status: QuizStatus) => void + currentHandler?: (next?: string) => void + statusHandler?: (status: QuizStatus) => void maxQuestions?: number isStandaloneQuiz?: boolean } @@ -112,7 +112,7 @@ const QuizWidget: React.FC = ({ setSelectedAnswer(null) if (!isStandaloneQuiz) { - statusHandler("neutral") + statusHandler?.("neutral") } const currentQuizKey = @@ -220,11 +220,11 @@ const QuizWidget: React.FC = ({ if (!isStandaloneQuiz) { if (currentQuestionAnswerChoice?.isCorrect) { - statusHandler("success") + statusHandler?.("success") } if (!currentQuestionAnswerChoice?.isCorrect) { - statusHandler("error") + statusHandler?.("error") } } } @@ -241,7 +241,7 @@ const QuizWidget: React.FC = ({ setShowAnswer(false) if (!isStandaloneQuiz) { - statusHandler("neutral") + statusHandler?.("neutral") } } @@ -274,7 +274,7 @@ const QuizWidget: React.FC = ({ // Reset quiz status (modifies bg color for mobile) if (!isStandaloneQuiz) { - statusHandler("neutral") + statusHandler?.("neutral") } if (finishedQuiz) { @@ -288,7 +288,7 @@ const QuizWidget: React.FC = ({ } const handleNextQuiz = () => { - currentHandler(nextQuiz) + currentHandler?.(nextQuiz) } const AnswerIcon = () => { diff --git a/src/components/ShardChainsList.tsx b/src/components/ShardChainsList.tsx index d7af1b195b6..a06420e1d41 100644 --- a/src/components/ShardChainsList.tsx +++ b/src/components/ShardChainsList.tsx @@ -53,7 +53,7 @@ const ShardChainsList: React.FC = () => { return ( - + ) } diff --git a/src/components/StablecoinAccordion/index.tsx b/src/components/StablecoinAccordion/index.tsx index 3e5ea15b77c..baadd4fa050 100644 --- a/src/components/StablecoinAccordion/index.tsx +++ b/src/components/StablecoinAccordion/index.tsx @@ -141,7 +141,7 @@ const StablecoinAccordion: React.FC = () => {

- + @@ -167,7 +167,7 @@ const StablecoinAccordion: React.FC = () => { - + @@ -193,7 +193,7 @@ const StablecoinAccordion: React.FC = () => {

- +
@@ -237,7 +237,7 @@ const StablecoinAccordion: React.FC = () => {

- + diff --git a/src/components/Staking/StakingGuides.tsx b/src/components/Staking/StakingGuides.tsx index af7a9d58ecd..059195c694e 100644 --- a/src/components/Staking/StakingGuides.tsx +++ b/src/components/Staking/StakingGuides.tsx @@ -2,7 +2,7 @@ import React from "react" // Components -import CardList from "../CardList" +import CardList, { CardListItem } from "../CardList" import { Stack } from "@chakra-ui/react" import { useTranslation } from "gatsby-plugin-react-i18next" @@ -10,7 +10,7 @@ export interface IProps {} const StakingGuides: React.FC = () => { const { t } = useTranslation() - const guides = [ + const guides: CardListItem[] = [ { title: t("page-staking-guide-title-coincashew-ethereum"), link: "https://www.coincashew.com/coins/overview-eth/guide-or-how-to-setup-a-validator-on-eth2-mainnet", @@ -28,7 +28,7 @@ const StakingGuides: React.FC = () => { }, ] - return + return } export default StakingGuides diff --git a/src/content/translations/sl/nft/index.md b/src/content/translations/sl/nft/index.md index 45e29de3f58..c32a223ad81 100644 --- a/src/content/translations/sl/nft/index.md +++ b/src/content/translations/sl/nft/index.md @@ -12,7 +12,7 @@ summaryPoint2: NFT-ji dajejo ustvarjalcem vsebin več moči, kot so jo imeli kad summaryPoint3: Podprto s pametnimi pogodbami na Ethereumovi verigi blokov. --- -## What are NFTs? {#what-are-nfts} +## Kaj je NFT? {#what-are-nfts} NFT-ji so žetoni, ki so individualno unikatni. Vsak NFT ima drugačne lastnosti (nezamenljive) in je dokazljivo redek. To je drugače od žetonov, kot so ERC-20, kjer je vsak žeton v setu identičen in ima enake lastnosti (je zamenljiv). Vseeno vam je, kateri specifični bankovec imate v denarnici, zato ker so vsi identični in imajo enako vrednost. Vendar, vam _je_ pomembno, kateri specifični NFT imate, saj imajo vsi svoje individualne lastnosti, s katerimi jih lahko ločite od drugih (so nezamenljivi). diff --git a/src/data/NetworkUpgradeSummaryData.ts b/src/data/NetworkUpgradeSummaryData.ts index a5a610a2752..7b6a4578b82 100644 --- a/src/data/NetworkUpgradeSummaryData.ts +++ b/src/data/NetworkUpgradeSummaryData.ts @@ -1,7 +1,7 @@ interface NetworkUpgradeProps { - dateTimeAsString?: string - ethPriceInUSD?: number - waybackLink?: string + dateTimeAsString: string + ethPriceInUSD: number + waybackLink: string blockNumber?: number epochNumber?: number slotNumber?: number diff --git a/src/pages-conditional/dapps.tsx b/src/pages-conditional/dapps.tsx index a9b583677e2..1b9c0cbb747 100644 --- a/src/pages-conditional/dapps.tsx +++ b/src/pages-conditional/dapps.tsx @@ -40,7 +40,7 @@ import FeedbackCard from "../components/FeedbackCard" import Text from "../components/OldText" import OldHeading from "../components/OldHeading" import GlossaryTooltip from "../components/Glossary/GlossaryTooltip" -import GatsbyImage from "../components/GatsbyImage" +import GatsbyImage, { GatsbyImageType } from "../components/GatsbyImage" import { getImage, getSrc } from "../utils/image" import { trackCustomEvent } from "../utils/matomo" @@ -129,7 +129,7 @@ const ButtonSecondary = (props: Pick) => (