From 34395f798829c79b1c207bc7f0982f638c94485c Mon Sep 17 00:00:00 2001 From: Gareth Fuller Date: Wed, 18 Sep 2024 12:15:17 +0100 Subject: [PATCH 1/3] chore: Fixes to help monorepo builds --- .../ClaimNetworkPoolsLayout.tsx | 11 +- lib/shared/components/marketing/HomeHero.tsx | 147 +++++++++--------- .../api/apollo-global-data.provider.tsx | 5 +- test/utils/custom-renderers.tsx | 60 +++---- 4 files changed, 114 insertions(+), 109 deletions(-) diff --git a/lib/modules/portfolio/PortfolioClaim/ClaimNetworkPools/ClaimNetworkPoolsLayout.tsx b/lib/modules/portfolio/PortfolioClaim/ClaimNetworkPools/ClaimNetworkPoolsLayout.tsx index 9bae5112d..bd20a4832 100644 --- a/lib/modules/portfolio/PortfolioClaim/ClaimNetworkPools/ClaimNetworkPoolsLayout.tsx +++ b/lib/modules/portfolio/PortfolioClaim/ClaimNetworkPools/ClaimNetworkPoolsLayout.tsx @@ -1,21 +1,20 @@ 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, PropsWithChildren { +interface Props extends CardProps { backLink: string title: string } export function ClaimNetworkPoolsLayout({ backLink, children, title, ...rest }: Props) { return ( - - + + - } aria-label="" /> - + } variant="ghost" /> + {title} diff --git a/lib/shared/components/marketing/HomeHero.tsx b/lib/shared/components/marketing/HomeHero.tsx index 9b45f0181..02c27c518 100644 --- a/lib/shared/components/marketing/HomeHero.tsx +++ b/lib/shared/components/marketing/HomeHero.tsx @@ -12,27 +12,27 @@ export function HomeHero() { const [bgColor] = useToken('colors', ['background.level1']) return ( - - + + - + @@ -47,19 +47,19 @@ export function HomeHero() { @@ -69,11 +69,11 @@ export function HomeHero() { Passive yield-bearing pools for Liquidity Providers - + Join 240,000+ Liquidity Providers - @@ -94,24 +94,24 @@ export function HomeHero() { - + Balancer protocol: v3 Soon  - + Learn more @@ -119,11 +119,11 @@ export function HomeHero() { The trusted toolkit for true AMM experimentation - + Join 100+ protocol builders + -
+
Start building @@ -176,113 +177,113 @@ export function HomeHero() {
- + Balancer v3 Learn about the key benefits - + v3 Docs Go deep down the rabbithole - + Scaffold Balancer v3 Prototyping tool for Balancer v3 - + v2 Docs @@ -290,41 +291,41 @@ export function HomeHero() { Build on battle-tested smart contracts - + Get a Grant Help to get you set up diff --git a/lib/shared/services/api/apollo-global-data.provider.tsx b/lib/shared/services/api/apollo-global-data.provider.tsx index ce64eb9b4..6376fe2ea 100644 --- a/lib/shared/services/api/apollo-global-data.provider.tsx +++ b/lib/shared/services/api/apollo-global-data.provider.tsx @@ -19,10 +19,11 @@ import { getFxRates } from '../../utils/currencies' import { getPoolCategories } from '@/lib/modules/pool/categories/getPoolCategories' import { PoolCategoriesProvider } from '@/lib/modules/pool/categories/PoolCategoriesProvider' import { mins } from '../../utils/time' +import { PropsWithChildren } from 'react' export const revalidate = 60 -export async function ApolloGlobalDataProvider({ children }: React.PropsWithChildren) { +export async function ApolloGlobalDataProvider({ children }: PropsWithChildren) { const client = getApolloServerClient() const tokensQueryVariables = { @@ -56,8 +57,8 @@ export async function ApolloGlobalDataProvider({ children }: React.PropsWithChil return ( diff --git a/test/utils/custom-renderers.tsx b/test/utils/custom-renderers.tsx index d6961c949..ac26db59f 100644 --- a/test/utils/custom-renderers.tsx +++ b/test/utils/custom-renderers.tsx @@ -28,16 +28,17 @@ import { apolloTestClient } from './apollo-test-client' import { AppRouterContextProviderMock } from './app-router-context-provider-mock' import { testQueryClient } from './react-query' -export type WrapperProps = { children: ReactNode } -export type Wrapper = ({ children }: WrapperProps) => ReactNode +export type Wrapper = ({ children }: PropsWithChildren) => ReactNode -export const EmptyWrapper = ({ children }: WrapperProps) => <>{children} +export function EmptyWrapper({ children }: PropsWithChildren) { + return <>{children} +} export function testHook( hook: (props: TProps) => TResult, options?: RenderHookOptions | undefined ) { - function MixedProviders({ children }: WrapperProps) { + function MixedProviders({ children }: PropsWithChildren) { const LocalProviders = options?.wrapper || EmptyWrapper return ( @@ -49,7 +50,7 @@ export function testHook( const result = renderHook(hook, { ...options, - wrapper: MixedProviders, + wrapper: MixedProviders as React.ComponentType<{ children: React.ReactNode }>, }) return { @@ -58,7 +59,7 @@ export function testHook( } } -function GlobalProviders({ children }: WrapperProps) { +function GlobalProviders({ children }: PropsWithChildren) { const defaultRouterOptions = {} return ( @@ -68,16 +69,16 @@ function GlobalProviders({ children }: WrapperProps) { {children} @@ -105,36 +106,39 @@ export async function waitForLoadedUseQuery(hookResult: { current: { loading: bo await waitFor(() => expect(hookResult.current.loading).toBeFalsy()) } -export const DefaultAddLiquidityTestProvider = ({ children }: PropsWithChildren) => ( - - - {children} - - -) +export function DefaultAddLiquidityTestProvider({ children }: PropsWithChildren) { + return ( + + + {children} + + + ) +} -export const DefaultRemoveLiquidityTestProvider = ({ children }: PropsWithChildren) => ( - - {children} - -) +export function DefaultRemoveLiquidityTestProvider({ children }: PropsWithChildren) { + return ( + + {children} + + ) +} /* Builds a PoolProvider that injects the provided pool data*/ -export const buildDefaultPoolTestProvider = - (pool: GqlPoolElement = aGqlPoolElementMock()) => +export const buildDefaultPoolTestProvider = (pool: GqlPoolElement = aGqlPoolElementMock()) => // eslint-disable-next-line react/display-name - ({ children }: PropsWithChildren) => { + function ({ children }: PropsWithChildren) { return ( {children} From 1e67dee0526fbaeb76dd8c78456d29da63ee43e6 Mon Sep 17 00:00:00 2001 From: Gareth Fuller Date: Wed, 18 Sep 2024 12:18:34 +0100 Subject: [PATCH 2/3] chore: Only required change --- .../ClaimNetworkPoolsLayout.tsx | 8 +- lib/shared/components/marketing/HomeHero.tsx | 143 +++++++++--------- .../api/apollo-global-data.provider.tsx | 2 +- test/utils/custom-renderers.tsx | 51 +++---- 4 files changed, 99 insertions(+), 105 deletions(-) diff --git a/lib/modules/portfolio/PortfolioClaim/ClaimNetworkPools/ClaimNetworkPoolsLayout.tsx b/lib/modules/portfolio/PortfolioClaim/ClaimNetworkPools/ClaimNetworkPoolsLayout.tsx index bd20a4832..bbf03075a 100644 --- a/lib/modules/portfolio/PortfolioClaim/ClaimNetworkPools/ClaimNetworkPoolsLayout.tsx +++ b/lib/modules/portfolio/PortfolioClaim/ClaimNetworkPools/ClaimNetworkPoolsLayout.tsx @@ -9,12 +9,12 @@ interface Props extends CardProps { export function ClaimNetworkPoolsLayout({ backLink, children, title, ...rest }: Props) { return ( - - + + - } variant="ghost" /> - + } aria-label="" /> + {title} diff --git a/lib/shared/components/marketing/HomeHero.tsx b/lib/shared/components/marketing/HomeHero.tsx index 02c27c518..d7f5d3945 100644 --- a/lib/shared/components/marketing/HomeHero.tsx +++ b/lib/shared/components/marketing/HomeHero.tsx @@ -12,27 +12,27 @@ export function HomeHero() { const [bgColor] = useToken('colors', ['background.level1']) return ( - - + + - + @@ -47,19 +47,19 @@ export function HomeHero() { @@ -69,11 +69,11 @@ export function HomeHero() { Passive yield-bearing pools for Liquidity Providers - + Join 240,000+ Liquidity Providers - @@ -94,24 +94,24 @@ export function HomeHero() { - + Balancer protocol: v3 Soon  - + Learn more @@ -119,11 +119,11 @@ export function HomeHero() { The trusted toolkit for true AMM experimentation - + Join 100+ protocol builders - -
+
Start building @@ -177,113 +176,113 @@ export function HomeHero() {
- + Balancer v3 Learn about the key benefits - + v3 Docs Go deep down the rabbithole - + Scaffold Balancer v3 Prototyping tool for Balancer v3 - + v2 Docs @@ -291,41 +290,41 @@ export function HomeHero() { Build on battle-tested smart contracts - + Get a Grant Help to get you set up diff --git a/lib/shared/services/api/apollo-global-data.provider.tsx b/lib/shared/services/api/apollo-global-data.provider.tsx index 6376fe2ea..93fd8555a 100644 --- a/lib/shared/services/api/apollo-global-data.provider.tsx +++ b/lib/shared/services/api/apollo-global-data.provider.tsx @@ -57,8 +57,8 @@ export async function ApolloGlobalDataProvider({ children }: PropsWithChildren) return ( diff --git a/test/utils/custom-renderers.tsx b/test/utils/custom-renderers.tsx index ac26db59f..ff3fd8f73 100644 --- a/test/utils/custom-renderers.tsx +++ b/test/utils/custom-renderers.tsx @@ -30,9 +30,7 @@ import { testQueryClient } from './react-query' export type Wrapper = ({ children }: PropsWithChildren) => ReactNode -export function EmptyWrapper({ children }: PropsWithChildren) { - return <>{children} -} +export const EmptyWrapper = ({ children }: PropsWithChildren) => <>{children} export function testHook( hook: (props: TProps) => TResult, @@ -69,16 +67,16 @@ function GlobalProviders({ children }: PropsWithChildren) { {children} @@ -106,39 +104,36 @@ export async function waitForLoadedUseQuery(hookResult: { current: { loading: bo await waitFor(() => expect(hookResult.current.loading).toBeFalsy()) } -export function DefaultAddLiquidityTestProvider({ children }: PropsWithChildren) { - return ( - - - {children} - - - ) -} +export const DefaultAddLiquidityTestProvider = ({ children }: PropsWithChildren) => ( + + + {children} + + +) -export function DefaultRemoveLiquidityTestProvider({ children }: PropsWithChildren) { - return ( - - {children} - - ) -} +export const DefaultRemoveLiquidityTestProvider = ({ children }: PropsWithChildren) => ( + + {children} + +) /* Builds a PoolProvider that injects the provided pool data*/ -export const buildDefaultPoolTestProvider = (pool: GqlPoolElement = aGqlPoolElementMock()) => +export const buildDefaultPoolTestProvider = + (pool: GqlPoolElement = aGqlPoolElementMock()) => // eslint-disable-next-line react/display-name - function ({ children }: PropsWithChildren) { + ({ children }: PropsWithChildren) => { return ( {children} From 6dc5e2d877156dbe17b9dd7530201aadcdb70cd4 Mon Sep 17 00:00:00 2001 From: Gareth Fuller Date: Wed, 18 Sep 2024 14:51:33 +0100 Subject: [PATCH 3/3] chore: Move things about --- types/global-ts.d.ts => global.d.ts | 0 lib/shared/components/marketing/HomeHero.tsx | 6 +++--- tsconfig.json | 8 +------- 3 files changed, 4 insertions(+), 10 deletions(-) rename types/global-ts.d.ts => global.d.ts (100%) diff --git a/types/global-ts.d.ts b/global.d.ts similarity index 100% rename from types/global-ts.d.ts rename to global.d.ts diff --git a/lib/shared/components/marketing/HomeHero.tsx b/lib/shared/components/marketing/HomeHero.tsx index d7f5d3945..9b45f0181 100644 --- a/lib/shared/components/marketing/HomeHero.tsx +++ b/lib/shared/components/marketing/HomeHero.tsx @@ -137,12 +137,12 @@ export function HomeHero() { -
+
diff --git a/tsconfig.json b/tsconfig.json index a68881af4..466ba786b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -24,12 +24,6 @@ }, "types": ["vitest/globals"] }, - "include": [ - "next-env.d.ts", - "**/*.ts", - "**/*.tsx", - ".next/types/**/*.ts", - "types/global-ts.d.ts" - ], + "include": ["global.d.ts", "next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"], "exclude": ["node_modules", ".next"] }