Skip to content

Commit

Permalink
chore: Cleanup react imports (#1102)
Browse files Browse the repository at this point in the history
  • Loading branch information
garethfuller authored Sep 18, 2024
1 parent 94bfa93 commit addad87
Show file tree
Hide file tree
Showing 14 changed files with 31 additions and 43 deletions.
7 changes: 2 additions & 5 deletions app/(app)/portfolio/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import { PortfolioProvider } from '@/lib/modules/portfolio/PortfolioProvider'
import { DefaultPageContainer } from '@/lib/shared/components/containers/DefaultPageContainer'
import { PropsWithChildren } from 'react'

type Props = {
children: React.ReactNode
}

export default async function PortfolioLayout({ children }: Props) {
export default async function PortfolioLayout({ children }: PropsWithChildren) {
return (
<DefaultPageContainer minH="100vh">
<PortfolioProvider>{children}</PortfolioProvider>
Expand Down
5 changes: 1 addition & 4 deletions app/(app)/vebal/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import { TokenBalancesProvider } from '@/lib/modules/tokens/TokenBalancesProvide
import { useTokens } from '@/lib/modules/tokens/TokensProvider'
import { DefaultPageContainer } from '@/lib/shared/components/containers/DefaultPageContainer'
import mainnetNetworkConfig from '@/lib/config/networks/mainnet'

type PropsWithChildren = {
children: React.ReactNode
}
import { PropsWithChildren } from 'react'

export default function VebalLayout({ children }: PropsWithChildren) {
const { getTokensByChain } = useTokens()
Expand Down
10 changes: 3 additions & 7 deletions app/(marketing)/components/SandPatterns.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import React from 'react'
import { Box, Flex, FlexProps } from '@chakra-ui/react'
import React, { PropsWithChildren } from 'react'
import { Box, Flex } from '@chakra-ui/react'
import { motion, MotionStyle, useAnimation, useReducedMotion } from 'framer-motion'

interface SandPatternsProps extends FlexProps {
children: React.ReactNode
}

const SandPatterns: React.FC<SandPatternsProps> = ({ children, ...rest }) => {
const SandPatterns: React.FC<PropsWithChildren> = ({ children, ...rest }) => {
const circles = Array.from({ length: 10 }, (_, i) => i + 1)
const controls = useAnimation()
const shouldReduceMotion = useReducedMotion()
Expand Down
3 changes: 2 additions & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { SpeedInsights } from '@vercel/speed-insights/next'
import '@/lib/assets/css/global.css'
import { Fathom } from '@/lib/shared/services/fathom/Fathom'
import { GlobalAlerts } from '@/lib/shared/components/navs/GlobalAlerts'
import { PropsWithChildren } from 'react'

const { projectName } = getProjectConfig()

Expand All @@ -33,7 +34,7 @@ export const metadata: Metadata = {
],
}

export default function RootLayout({ children }: { children: React.ReactNode }) {
export default function RootLayout({ children }: PropsWithChildren) {
return (
<html lang="en" suppressHydrationWarning>
<head>
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/pool/PoolDetail/PoolInfo/RateProviderInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import {
import Link from 'next/link'
import { ArrowUpRight } from 'react-feather'
import { getRateProviderWarnings } from '../../pool.helpers'
import { PropsWithChildren } from 'react'

type RateProviderInfoPopOverProps = {
token: GqlToken
data: GqlPriceRateProviderData | null
level: number
children: React.ReactNode
}
} & PropsWithChildren

type PopoverInfoBodyProps = {
data: GqlPriceRateProviderData
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Card, CardProps, HStack, Heading, IconButton, Stack } from '@chakra-ui/react'
import Link from 'next/link'
import { PropsWithChildren } from 'react'
import { ArrowLeft } from 'react-feather'

interface Props extends CardProps {
interface Props extends CardProps, PropsWithChildren {
backLink: string
children: React.ReactNode
title: string
}

Expand Down
8 changes: 2 additions & 6 deletions lib/modules/portfolio/PortfolioProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

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

interface PortfolioProviderProps {
children: React.ReactNode
}

export function PortfolioProvider({ children }: PortfolioProviderProps) {
export function PortfolioProvider({ children }: PropsWithChildren) {
const hook = _usePortfolio()
return <PortfolioContext.Provider value={hook}>{children}</PortfolioContext.Provider>
}
Expand Down
4 changes: 2 additions & 2 deletions lib/modules/transactions/transaction-steps/lib.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TransactionBundle } from '@/lib/modules/web3/contracts/contract.types'
import React from 'react'
import { ReactNode } from 'react'
import { LockActionType } from '../../vebal/lock/lock.helpers'

export enum TransactionState {
Expand Down Expand Up @@ -72,7 +72,7 @@ export type TransactionStep = {
stepType: StepType
labels: TransactionLabels
isComplete: () => boolean
renderAction: () => React.ReactNode
renderAction: () => ReactNode
// All callbacks should be idempotent
onSuccess?: () => void
onActivated?: () => void
Expand Down
5 changes: 2 additions & 3 deletions lib/shared/components/containers/FadeInOnView.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
'use client'

import { useRef } from 'react'
import { PropsWithChildren, useRef } from 'react'
import { useInView } from 'framer-motion'

interface FadeInOnViewProps {
children: React.ReactNode
interface FadeInOnViewProps extends PropsWithChildren {
animateOnce?: boolean
}

Expand Down
4 changes: 2 additions & 2 deletions lib/shared/components/modals/TransactionModalHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useBlockExplorer } from '@/lib/shared/hooks/useBlockExplorer'
import { GqlChain } from '@/lib/shared/services/api/generated/graphql'
import { Center, HStack, ModalHeader, VStack, Text, Link } from '@chakra-ui/react'
import { AnimatePresence, motion } from 'framer-motion'
import React from 'react'
import { ReactNode } from 'react'
import { ArrowUpRight, Check } from 'react-feather'
import { Hash } from 'viem'

Expand All @@ -17,7 +17,7 @@ export function TransactionModalHeader({
label: string
txHash?: Hash
chain: GqlChain
timeout?: React.ReactNode
timeout?: ReactNode
isReceiptLoading?: boolean
}) {
const { getBlockExplorerTxUrl } = useBlockExplorer(chain)
Expand Down
6 changes: 3 additions & 3 deletions lib/shared/components/navs/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import { motion, useMotionTemplate, useMotionValue, useScroll, useTransform } fr
import { VeBalLink } from '@/lib/modules/vebal/VebalRedirectModal'
import { MobileNav } from './MobileNav'
import { useNav } from './useNav'
import { useEffect, useMemo, useState } from 'react'
import { ReactNode, useEffect, useMemo, useState } from 'react'
import { usePathname } from 'next/navigation'
import { useUserAccount } from '@/lib/modules/web3/UserAccountProvider'

type Props = {
leftSlot?: React.ReactNode
rightSlot?: React.ReactNode
leftSlot?: ReactNode
rightSlot?: ReactNode
disableBlur?: boolean
}

Expand Down
6 changes: 3 additions & 3 deletions lib/shared/components/tables/PaginatedTable.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react'
import { ReactNode } from 'react'
import { Box, BoxProps, Center, Text, Spinner, VStack, Skeleton } from '@chakra-ui/react'
import { Pagination } from '@/lib/shared/components/pagination/Pagination'

interface Props<T> extends BoxProps {
items: T[]
loading: boolean
renderTableHeader: () => React.ReactNode
renderTableRow: (item: T, index: number) => React.ReactNode
renderTableHeader: () => ReactNode
renderTableRow: (item: T, index: number) => ReactNode
showPagination: boolean
paginationProps: any // TODO: type this
noItemsFoundLabel: string
Expand Down
5 changes: 3 additions & 2 deletions lib/shared/components/tooltips/apr-tooltip/BaseAprTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { TooltipAprItem } from './TooltipAprItem'
import BigNumber from 'bignumber.js'
import { bn, fNum } from '@/lib/shared/utils/numbers'
import { isVebalPool } from '@/lib/modules/pool/pool.helpers'
import { ReactNode } from 'react'

interface Props {
aprItems: GqlPoolAprItem[]
Expand All @@ -35,11 +36,11 @@ interface Props {
totalBaseVeBalText: string
totalVeBalTitle?: string
maxVeBalText: string
customPopoverContent?: React.ReactNode
customPopoverContent?: ReactNode
shouldDisplayBaseTooltip?: boolean
shouldDisplayMaxVeBalTooltip?: boolean
usePortal?: boolean
children?: React.ReactNode | (({ isOpen }: { isOpen: boolean }) => React.ReactNode)
children?: ReactNode | (({ isOpen }: { isOpen: boolean }) => ReactNode)
}

const balRewardGradient =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useThemeColorMode } from '@/lib/shared/services/chakra/useThemeColorMode'
import { BoxProps, TextProps, Box, HStack, Text, Tooltip } from '@chakra-ui/react'
import BigNumber from 'bignumber.js'
import { ReactNode } from 'react'

const tooltipTextDecorationStyles: TextProps = {
textDecoration: 'underline',
Expand All @@ -22,7 +23,7 @@ interface PopoverAprItemProps extends BoxProps {
textBackgroundClip?: string
tooltipText?: string
textVariant?: string
children?: React.ReactNode
children?: ReactNode
}

export function TooltipAprItem({
Expand Down

0 comments on commit addad87

Please sign in to comment.