Skip to content

Commit

Permalink
chore: fix type & lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tien committed Jul 3, 2023
1 parent eac7582 commit 6ba5c51
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 22 deletions.
1 change: 1 addition & 0 deletions apps/web/src/archetypes/Crowdloan/Indexx.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import { Crowdloan } from '@archetypes'
import { Await, Field, Grid, NoResults } from '@components'
import styled from '@emotion/styled'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const StakeCalculatorDialog = Object.assign(
}
/>
),
{ EstimatedYield: EstimatedYield }
{ EstimatedYield }
)

export default StakeCalculatorDialog
8 changes: 5 additions & 3 deletions apps/web/src/components/widgets/staking/AddStakeDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ const AddStakeDialog = (props: { account?: string; onDismiss: () => unknown }) =
error: inputError,
} = usePoolAddForm('bondExtra', props.account)

const bondExtraExtrinsic = useExtrinsic('nominationPools', 'bondExtra', {
FreeBalance: decimalAmount?.planck?.toString() ?? '0',
})
const bondExtraExtrinsic = useExtrinsic('nominationPools', 'bondExtra', [
{
FreeBalance: decimalAmount?.planck?.toString() ?? '0',
},
])

useEffect(
() => {
Expand Down
10 changes: 1 addition & 9 deletions apps/web/src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
import { RouteErrorElement } from '@components/widgets/ErrorBoundary'
import * as Sentry from '@sentry/react'
import { Navigate, createBrowserRouter, useSearchParams } from 'react-router-dom'
import { Navigate, createBrowserRouter } from 'react-router-dom'
import crowdloanRoutes from './crowdloans'
import dexRoutes from './dex'
import Explore from './explore'
import Layout from './layout'
import portfolioRoutes from './portfolio'
import Staking from './staking'

const NavigateToStaking = () => {
const [search] = useSearchParams()
search.set('action', 'stake')
search.sort()
return <Navigate to={{ pathname: '/portfolio', search: search.toString() }} />
}

export default Sentry.wrapCreateBrowserRouter(createBrowserRouter)([
{
path: '/',
Expand All @@ -35,7 +28,6 @@ export default Sentry.wrapCreateBrowserRouter(createBrowserRouter)([
{ path: 'history', element: <Navigate to="/portfolio/history" /> },
{ path: 'nfts', element: <Navigate to="/portfolio/collectibles" /> },
{ path: 'staking', element: <Staking /> },
{ path: 'transport', element: <Navigate to="/portfolio?action=transport" /> },
],
},
{ path: '*', element: <Navigate to="/" /> },
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports = {
argsIgnorePattern: '^_',
varsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_',
ignoreRestSiblings: true,
},
],
'@typescript-eslint/prefer-nullish-coalescing': ['error', { ignoreConditionalTests: true }],
Expand Down
9 changes: 1 addition & 8 deletions packages/ui/src/atoms/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ type PolymorphicIconProps<T extends IconElementType> = {
disabled?: boolean
containerColor?: string
contentColor?: string
disabledContainerColor?: string
disabledContentColor?: string
}

export type IconProps<T extends IconElementType> = PolymorphicIconProps<T> &
Expand All @@ -21,17 +19,12 @@ const Icon = <T extends IconElementType = 'button'>({
size = '4rem',
containerColor = 'transparent',
contentColor,
disabledContainerColor,
disabledContentColor,

...props
}: IconProps<T>) => {
const theme = useTheme()

contentColor = contentColor ?? theme.color.onBackground
disabledContentColor =
disabledContentColor !== undefined
? disabledContentColor
: `color-mix(in srgb, ${contentColor}, transparent ${Math.round((1 - theme.contentAlpha.disabled) * 100)}%)`

const Component = as

Expand Down
5 changes: 4 additions & 1 deletion packages/ui/src/atoms/IconButton/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import Icon from '../Icon'

type IconButtonElementType = Extract<ElementType, 'button' | 'a' | 'figure'> | ElementType<any>

type IconButtonProps<T extends IconButtonElementType = 'button'> = IconProps<T>
export type IconButtonProps<T extends IconButtonElementType = 'button'> = IconProps<T> & {
disabledContainerColor?: string
disabledContentColor?: string
}

const IconButton = <T extends IconButtonElementType = 'button'>(props: IconButtonProps<T>) => (
<Icon
Expand Down

0 comments on commit 6ba5c51

Please sign in to comment.