Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: cleanup outstanding type errors (non-queried) #11340

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/@chakra-ui/gatsby-plugin/theme.ts
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/components/BeaconChainActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ const BeaconChainActions: React.FC = () => {
<Translation id="consensus-explore" />
</H3>

<CardList content={datapoints} />
<CardList items={datapoints} />
<H3>
<Translation id="read-more" />
</H3>
<CardList content={reads} />
<CardList items={reads} />
</Box>
)
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/CardList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export type CardListItem = {
}

export interface IProps extends BoxProps {
content: Array<CardListItem>
items: Array<CardListItem>
clickHandler?: (idx: string | number) => void
}

Expand Down Expand Up @@ -92,12 +92,12 @@ const Card = (props: CardListItem & Omit<StackProps, "title" | "id">) => {
}

const CardList: React.FC<IProps> = ({
content,
items,
clickHandler = () => null,
...rest
}) => (
<Box bg="background.base" w="full" {...rest}>
{content.map((listItem, idx) => {
{items.map((listItem, idx) => {
const { link, id } = listItem
const isLink = !!link

Expand Down
13 changes: 8 additions & 5 deletions src/components/Codeblock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export interface IProps {
allowCollapse?: boolean
codeLanguage: string
fromHomepage?: boolean
children: React.ReactChild
children: React.ReactNode
}

const Codeblock: React.FC<IProps> = ({
Expand All @@ -215,13 +215,16 @@ const Codeblock: React.FC<IProps> = ({
}) => {
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 {
Expand Down
45 changes: 35 additions & 10 deletions src/components/EnergyConsumptionChart.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -12,7 +19,6 @@ import {
import { useTranslation } from "gatsby-plugin-react-i18next"

import Translation from "./Translation"
import Text from "./OldText"

interface ITickProps {
x: number
Expand All @@ -26,23 +32,43 @@ type Data = Array<{
color: string
}>

const CustomTick: React.FC<ITickProps> = ({ 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<ITickProps> = ({ x, y, payload }) => {
return (
<g transform={`translate(${x},${y})`}>
<Text
<RechartText
x={0}
y={0}
dy={15}
fill="text"
width={50}
fill={textColor}
textAnchor="middle"
verticalAnchor="middle"
fontSize="10px"
fontSize="2xs"
>
{payload.value}
</Text>
</RechartText>
</g>
)
}
Expand Down Expand Up @@ -175,8 +201,7 @@ const EnergyConsumptionChart: React.FC = () => {
dataKey="name"
tickLine={false}
axisLine={false}
// @ts-ignore
tick={<CustomTick />}
tick={(props) => <CustomTick {...props} />}
interval={0}
/>
<Legend
Expand Down
2 changes: 1 addition & 1 deletion src/components/EthExchanges/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const EthExchanges = () => {
<Text>
<Translation id="page-get-eth-exchanges-success-exchange" />
</Text>
<CardList content={filteredExchanges} />
<CardList items={filteredExchanges} />
</SuccessContainer>
)}
{!hasExchangeResults && (
Expand Down
2 changes: 1 addition & 1 deletion src/components/FileContributorsCrowdin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface Data {
contributors: Contributor[]
}

interface LangContributor {
export interface LangContributor {
lang: string
data: Data[]
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/MergeArticleList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const MergeArticleList: React.FC<IProps> = () => {

return (
<Box mb="4rem">
<CardList content={reads} />
<CardList items={reads} />
</Box>
)
}
Expand Down
16 changes: 8 additions & 8 deletions src/components/Quiz/QuizWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -112,7 +112,7 @@ const QuizWidget: React.FC<IProps> = ({
setSelectedAnswer(null)

if (!isStandaloneQuiz) {
statusHandler("neutral")
statusHandler?.("neutral")
}

const currentQuizKey =
Expand Down Expand Up @@ -220,11 +220,11 @@ const QuizWidget: React.FC<IProps> = ({

if (!isStandaloneQuiz) {
if (currentQuestionAnswerChoice?.isCorrect) {
statusHandler("success")
statusHandler?.("success")
}

if (!currentQuestionAnswerChoice?.isCorrect) {
statusHandler("error")
statusHandler?.("error")
}
}
}
Expand All @@ -241,7 +241,7 @@ const QuizWidget: React.FC<IProps> = ({
setShowAnswer(false)

if (!isStandaloneQuiz) {
statusHandler("neutral")
statusHandler?.("neutral")
}
}

Expand Down Expand Up @@ -274,7 +274,7 @@ const QuizWidget: React.FC<IProps> = ({

// Reset quiz status (modifies bg color for mobile)
if (!isStandaloneQuiz) {
statusHandler("neutral")
statusHandler?.("neutral")
}

if (finishedQuiz) {
Expand All @@ -288,7 +288,7 @@ const QuizWidget: React.FC<IProps> = ({
}

const handleNextQuiz = () => {
currentHandler(nextQuiz)
currentHandler?.(nextQuiz)
}

const AnswerIcon = () => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ShardChainsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const ShardChainsList: React.FC<IProps> = () => {

return (
<Box mb="4rem">
<CardList content={reads} />
<CardList items={reads} />
</Box>
)
}
Expand Down
8 changes: 4 additions & 4 deletions src/components/StablecoinAccordion/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const StablecoinAccordion: React.FC<IProps> = () => {
<Translation id="page-stablecoins-accordion-swap-dapp-link" />
</InlineLink>
</p>
<CardList content={cardListGroups.dapps} />
<CardList items={cardListGroups.dapps} />
</RightColumnPanel>
</AccordionCustomItem>
<AccordionCustomItem category="buy">
Expand All @@ -167,7 +167,7 @@ const StablecoinAccordion: React.FC<IProps> = () => {
<SectionTitle>
<Translation id="page-stablecoins-accordion-buy-exchanges-title" />
</SectionTitle>
<CardList content={cardListGroups.exchanges} />
<CardList items={cardListGroups.exchanges} />
</RightColumnPanel>
</AccordionCustomItem>
<AccordionCustomItem category="earn">
Expand All @@ -193,7 +193,7 @@ const StablecoinAccordion: React.FC<IProps> = () => {
<p>
<Translation id="page-stablecoins-accordion-earn-projects-copy" />
</p>
<CardList content={cardListGroups.earn} />
<CardList items={cardListGroups.earn} />
</RightColumnPanel>
</AccordionCustomItem>
<AccordionCustomItem category="generate">
Expand Down Expand Up @@ -237,7 +237,7 @@ const StablecoinAccordion: React.FC<IProps> = () => {
<Translation id="page-stablecoins-accordion-borrow-places-intro" />
</p>
<Box mb={8}>
<CardList content={cardListGroups.borrow} />
<CardList items={cardListGroups.borrow} />
</Box>
<SectionTitle>
<Translation id="page-stablecoins-accordion-borrow-risks-title" />
Expand Down
6 changes: 3 additions & 3 deletions src/components/Staking/StakingGuides.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
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"

export interface IProps {}

const StakingGuides: React.FC<IProps> = () => {
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",
Expand All @@ -28,7 +28,7 @@ const StakingGuides: React.FC<IProps> = () => {
},
]

return <Stack as={CardList} direction="column" gap={4} content={guides} />
return <Stack as={CardList} direction="column" gap={4} items={guides} />
}

export default StakingGuides
6 changes: 3 additions & 3 deletions src/data/NetworkUpgradeSummaryData.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interface NetworkUpgradeProps {
dateTimeAsString?: string
ethPriceInUSD?: number
waybackLink?: string
dateTimeAsString: string
ethPriceInUSD: number
waybackLink: string
blockNumber?: number
epochNumber?: number
slotNumber?: number
Expand Down
Loading
Loading