Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit addad87

Browse files
authoredSep 18, 2024··
chore: Cleanup react imports (#1102)
1 parent 94bfa93 commit addad87

File tree

14 files changed

+31
-43
lines changed

14 files changed

+31
-43
lines changed
 

‎app/(app)/portfolio/layout.tsx

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import { PortfolioProvider } from '@/lib/modules/portfolio/PortfolioProvider'
22
import { DefaultPageContainer } from '@/lib/shared/components/containers/DefaultPageContainer'
3+
import { PropsWithChildren } from 'react'
34

4-
type Props = {
5-
children: React.ReactNode
6-
}
7-
8-
export default async function PortfolioLayout({ children }: Props) {
5+
export default async function PortfolioLayout({ children }: PropsWithChildren) {
96
return (
107
<DefaultPageContainer minH="100vh">
118
<PortfolioProvider>{children}</PortfolioProvider>

‎app/(app)/vebal/layout.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ import { TokenBalancesProvider } from '@/lib/modules/tokens/TokenBalancesProvide
44
import { useTokens } from '@/lib/modules/tokens/TokensProvider'
55
import { DefaultPageContainer } from '@/lib/shared/components/containers/DefaultPageContainer'
66
import mainnetNetworkConfig from '@/lib/config/networks/mainnet'
7-
8-
type PropsWithChildren = {
9-
children: React.ReactNode
10-
}
7+
import { PropsWithChildren } from 'react'
118

129
export default function VebalLayout({ children }: PropsWithChildren) {
1310
const { getTokensByChain } = useTokens()

‎app/(marketing)/components/SandPatterns.tsx

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
import React from 'react'
2-
import { Box, Flex, FlexProps } from '@chakra-ui/react'
1+
import React, { PropsWithChildren } from 'react'
2+
import { Box, Flex } from '@chakra-ui/react'
33
import { motion, MotionStyle, useAnimation, useReducedMotion } from 'framer-motion'
44

5-
interface SandPatternsProps extends FlexProps {
6-
children: React.ReactNode
7-
}
8-
9-
const SandPatterns: React.FC<SandPatternsProps> = ({ children, ...rest }) => {
5+
const SandPatterns: React.FC<PropsWithChildren> = ({ children, ...rest }) => {
106
const circles = Array.from({ length: 10 }, (_, i) => i + 1)
117
const controls = useAnimation()
128
const shouldReduceMotion = useReducedMotion()

‎app/layout.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { SpeedInsights } from '@vercel/speed-insights/next'
1010
import '@/lib/assets/css/global.css'
1111
import { Fathom } from '@/lib/shared/services/fathom/Fathom'
1212
import { GlobalAlerts } from '@/lib/shared/components/navs/GlobalAlerts'
13+
import { PropsWithChildren } from 'react'
1314

1415
const { projectName } = getProjectConfig()
1516

@@ -33,7 +34,7 @@ export const metadata: Metadata = {
3334
],
3435
}
3536

36-
export default function RootLayout({ children }: { children: React.ReactNode }) {
37+
export default function RootLayout({ children }: PropsWithChildren) {
3738
return (
3839
<html lang="en" suppressHydrationWarning>
3940
<head>

‎lib/modules/pool/PoolDetail/PoolInfo/RateProviderInfo.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ import {
1616
import Link from 'next/link'
1717
import { ArrowUpRight } from 'react-feather'
1818
import { getRateProviderWarnings } from '../../pool.helpers'
19+
import { PropsWithChildren } from 'react'
1920

2021
type RateProviderInfoPopOverProps = {
2122
token: GqlToken
2223
data: GqlPriceRateProviderData | null
2324
level: number
24-
children: React.ReactNode
25-
}
25+
} & PropsWithChildren
2626

2727
type PopoverInfoBodyProps = {
2828
data: GqlPriceRateProviderData

‎lib/modules/portfolio/PortfolioClaim/ClaimNetworkPools/ClaimNetworkPoolsLayout.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { Card, CardProps, HStack, Heading, IconButton, Stack } from '@chakra-ui/react'
22
import Link from 'next/link'
3+
import { PropsWithChildren } from 'react'
34
import { ArrowLeft } from 'react-feather'
45

5-
interface Props extends CardProps {
6+
interface Props extends CardProps, PropsWithChildren {
67
backLink: string
7-
children: React.ReactNode
88
title: string
99
}
1010

‎lib/modules/portfolio/PortfolioProvider.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { GetPoolsDocument } from '@/lib/shared/services/api/generated/graphql'
44
import { useQuery as useApolloQuery } from '@apollo/experimental-nextjs-app-support/ssr'
5-
import { createContext, useCallback, useMemo } from 'react'
5+
import { createContext, PropsWithChildren, useCallback, useMemo } from 'react'
66
import { useProtocolRewards } from './PortfolioClaim/useProtocolRewards'
77
import { ClaimableReward, useClaimableBalances } from './PortfolioClaim/useClaimableBalances'
88
import { BalTokenReward, useBalTokenRewards } from './PortfolioClaim/useBalRewards'
@@ -252,11 +252,7 @@ function _usePortfolio() {
252252

253253
export const PortfolioContext = createContext<UsePortfolio | null>(null)
254254

255-
interface PortfolioProviderProps {
256-
children: React.ReactNode
257-
}
258-
259-
export function PortfolioProvider({ children }: PortfolioProviderProps) {
255+
export function PortfolioProvider({ children }: PropsWithChildren) {
260256
const hook = _usePortfolio()
261257
return <PortfolioContext.Provider value={hook}>{children}</PortfolioContext.Provider>
262258
}

‎lib/modules/transactions/transaction-steps/lib.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { TransactionBundle } from '@/lib/modules/web3/contracts/contract.types'
2-
import React from 'react'
2+
import { ReactNode } from 'react'
33
import { LockActionType } from '../../vebal/lock/lock.helpers'
44

55
export enum TransactionState {
@@ -72,7 +72,7 @@ export type TransactionStep = {
7272
stepType: StepType
7373
labels: TransactionLabels
7474
isComplete: () => boolean
75-
renderAction: () => React.ReactNode
75+
renderAction: () => ReactNode
7676
// All callbacks should be idempotent
7777
onSuccess?: () => void
7878
onActivated?: () => void

‎lib/shared/components/containers/FadeInOnView.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
'use client'
22

3-
import { useRef } from 'react'
3+
import { PropsWithChildren, useRef } from 'react'
44
import { useInView } from 'framer-motion'
55

6-
interface FadeInOnViewProps {
7-
children: React.ReactNode
6+
interface FadeInOnViewProps extends PropsWithChildren {
87
animateOnce?: boolean
98
}
109

‎lib/shared/components/modals/TransactionModalHeader.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useBlockExplorer } from '@/lib/shared/hooks/useBlockExplorer'
22
import { GqlChain } from '@/lib/shared/services/api/generated/graphql'
33
import { Center, HStack, ModalHeader, VStack, Text, Link } from '@chakra-ui/react'
44
import { AnimatePresence, motion } from 'framer-motion'
5-
import React from 'react'
5+
import { ReactNode } from 'react'
66
import { ArrowUpRight, Check } from 'react-feather'
77
import { Hash } from 'viem'
88

@@ -17,7 +17,7 @@ export function TransactionModalHeader({
1717
label: string
1818
txHash?: Hash
1919
chain: GqlChain
20-
timeout?: React.ReactNode
20+
timeout?: ReactNode
2121
isReceiptLoading?: boolean
2222
}) {
2323
const { getBlockExplorerTxUrl } = useBlockExplorer(chain)

‎lib/shared/components/navs/Navbar.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ import { motion, useMotionTemplate, useMotionValue, useScroll, useTransform } fr
1414
import { VeBalLink } from '@/lib/modules/vebal/VebalRedirectModal'
1515
import { MobileNav } from './MobileNav'
1616
import { useNav } from './useNav'
17-
import { useEffect, useMemo, useState } from 'react'
17+
import { ReactNode, useEffect, useMemo, useState } from 'react'
1818
import { usePathname } from 'next/navigation'
1919
import { useUserAccount } from '@/lib/modules/web3/UserAccountProvider'
2020

2121
type Props = {
22-
leftSlot?: React.ReactNode
23-
rightSlot?: React.ReactNode
22+
leftSlot?: ReactNode
23+
rightSlot?: ReactNode
2424
disableBlur?: boolean
2525
}
2626

‎lib/shared/components/tables/PaginatedTable.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import React from 'react'
1+
import { ReactNode } from 'react'
22
import { Box, BoxProps, Center, Text, Spinner, VStack, Skeleton } from '@chakra-ui/react'
33
import { Pagination } from '@/lib/shared/components/pagination/Pagination'
44

55
interface Props<T> extends BoxProps {
66
items: T[]
77
loading: boolean
8-
renderTableHeader: () => React.ReactNode
9-
renderTableRow: (item: T, index: number) => React.ReactNode
8+
renderTableHeader: () => ReactNode
9+
renderTableRow: (item: T, index: number) => ReactNode
1010
showPagination: boolean
1111
paginationProps: any // TODO: type this
1212
noItemsFoundLabel: string

‎lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { TooltipAprItem } from './TooltipAprItem'
2323
import BigNumber from 'bignumber.js'
2424
import { bn, fNum } from '@/lib/shared/utils/numbers'
2525
import { isVebalPool } from '@/lib/modules/pool/pool.helpers'
26+
import { ReactNode } from 'react'
2627

2728
interface Props {
2829
aprItems: GqlPoolAprItem[]
@@ -35,11 +36,11 @@ interface Props {
3536
totalBaseVeBalText: string
3637
totalVeBalTitle?: string
3738
maxVeBalText: string
38-
customPopoverContent?: React.ReactNode
39+
customPopoverContent?: ReactNode
3940
shouldDisplayBaseTooltip?: boolean
4041
shouldDisplayMaxVeBalTooltip?: boolean
4142
usePortal?: boolean
42-
children?: React.ReactNode | (({ isOpen }: { isOpen: boolean }) => React.ReactNode)
43+
children?: ReactNode | (({ isOpen }: { isOpen: boolean }) => ReactNode)
4344
}
4445

4546
const balRewardGradient =

‎lib/shared/components/tooltips/apr-tooltip/TooltipAprItem.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { useThemeColorMode } from '@/lib/shared/services/chakra/useThemeColorMode'
22
import { BoxProps, TextProps, Box, HStack, Text, Tooltip } from '@chakra-ui/react'
33
import BigNumber from 'bignumber.js'
4+
import { ReactNode } from 'react'
45

56
const tooltipTextDecorationStyles: TextProps = {
67
textDecoration: 'underline',
@@ -22,7 +23,7 @@ interface PopoverAprItemProps extends BoxProps {
2223
textBackgroundClip?: string
2324
tooltipText?: string
2425
textVariant?: string
25-
children?: React.ReactNode
26+
children?: ReactNode
2627
}
2728

2829
export function TooltipAprItem({

0 commit comments

Comments
 (0)
This repository has been archived.