Skip to content

Commit

Permalink
Run prettier for all files
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Jul 17, 2024
1 parent acf4e80 commit 239c816
Show file tree
Hide file tree
Showing 39 changed files with 69 additions and 77 deletions.
1 change: 0 additions & 1 deletion centrifuge-app/src/components/Charts/Legend.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Grid, Shelf, Stack, Text } from '@centrifuge/fabric'
import * as React from 'react'
import { Tooltips, TooltipsProps } from '../Tooltips'

export type LegendProps = {
Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/components/DebugFlags/DebugFlags.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Box, Shelf, Stack, Text } from '@centrifuge/fabric'
import * as React from 'react'
import styled from 'styled-components'
import { flagsConfig, Key } from './config'
import { Key, flagsConfig } from './config'
import { DebugFlagsContext, FlagsState, initialFlagsState, useDebugFlags } from './context'

function DebugFlagsImpl({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import {
TextInput,
} from '@centrifuge/fabric'
import * as React from 'react'
import { Navigate } from 'react-router'
import { lastValueFrom } from 'rxjs'
import { collectionMetadataSchema } from '../../schemas'
import { Dec } from '../../utils/Decimal'
import { getFileDataURI } from '../../utils/getFileDataURI'
import { useAddress } from '../../utils/useAddress'
import { ButtonGroup } from '../ButtonGroup'
import { Navigate } from 'react-router'

// TODO: replace with better fee estimate
const CREATE_FEE_ESTIMATE = 2
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/src/components/Head.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import { Helmet } from 'react-helmet-async'
import { config } from '../config'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,11 @@ export function InvestRedeemTinlakeProvider({ poolId, trancheId, children }: Pro
remainingRedeemToken: disburse?.remainingRedeemToken || Dec(0),
},
collectAmount,
collectType: !disburse?.payoutCurrencyAmount.isZero() ? 'redeem' : !disburse?.payoutTokenAmount.isZero() ? 'invest' : null,
collectType: !disburse?.payoutCurrencyAmount.isZero()
? 'redeem'
: !disburse?.payoutTokenAmount.isZero()
? 'invest'
: null,
needsToCollectBeforeOrder: !collectAmount.isZero(),
needsPoolCurrencyApproval: () => !!trancheInvestment?.poolCurrencyAllowance.isZero(),
needsTrancheTokenApproval: () => !!trancheInvestment?.tokenAllowance.isZero(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Box, Button, Card, Shelf, Stack, Text } from '@centrifuge/fabric'
import * as React from 'react'
import { Dec } from '../../utils/Decimal'
import { formatBalance, formatBalanceAbbreviated } from '../../utils/formatting'
import { useClaimCountdown } from './hooks'
import { useLiquidityRewards } from './LiquidityRewardsContext'
import { useClaimCountdown } from './hooks'

export function LiquidityRewardsClaimer() {
const {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Card, Stack } from '@centrifuge/fabric'
import * as React from 'react'
import { LiquidityRewardsClaimer } from './LiquidityRewardsClaimer'
import { useLiquidityRewards } from './LiquidityRewardsContext'
import { LiquidityRewardsStaker } from './LiquidityRewardsStaker'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Pool, TokenBalance } from '@centrifuge/centrifuge-js'
import { useBalances, useCentrifugeConsts, useCentrifugeTransaction } from '@centrifuge/centrifuge-react'
import Decimal from 'decimal.js-light'
import * as React from 'react'
import { Dec } from '../../utils/Decimal'
import { useAddress } from '../../utils/useAddress'
import { usePendingCollect, usePool } from '../../utils/usePools'
import { useAccountStakes, useComputeLiquidityRewards, useRewardCurrencyGroup } from './hooks'
import { LiquidityRewardsContext } from './LiquidityRewardsContext'
import { useAccountStakes, useComputeLiquidityRewards, useRewardCurrencyGroup } from './hooks'
import { LiquidityRewardsActions, LiquidityRewardsProviderProps, LiquidityRewardsState } from './types'

export function LiquidityRewardsProvider(props: LiquidityRewardsProviderProps) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import * as React from 'react'
import { millisecondsToDays } from '../../utils/date'
import { formatBalance } from '../../utils/formatting'
import { LightButton } from '../InvestRedeem/LightButton'
import { useActiveEpochData } from './hooks'
import { useLiquidityRewards } from './LiquidityRewardsContext'
import { useActiveEpochData } from './hooks'

export function LiquidityRewardsStaker() {
const activeEpochData = useActiveEpochData()
Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/components/Menu/PageLink.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Text } from '@centrifuge/fabric'
import { useLocation, Link, LinkProps } from 'react-router-dom'
import { Link, LinkProps, useLocation } from 'react-router-dom'
import styled from 'styled-components'
import { useIsAboveBreakpoint } from '../../utils/useIsAboveBreakpoint'
import { prefetchRoute } from '../Root'
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/src/components/MenuSwitch.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { SideNavigationContainer, SideNavigationItem } from '@centrifuge/fabric'
import * as React from 'react'
import { Link, useLocation } from 'react-router-dom'

export function MenuSwitch({ links }: { links: { to: string; label: string }[] }) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Box, IconX, Shelf, Text } from '@centrifuge/fabric'
import * as React from 'react'
import styled from 'styled-components'

type AlertBusinessVerificationProps = {
Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/components/Onboarding/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ export {
Legend,
Notification,
NotificationBar,
ValidEmailTooltip,
PoolBranding,
ValidEmailTooltip,
}
1 change: 0 additions & 1 deletion centrifuge-app/src/components/PoolCard/PoolStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { StatusChip, StatusChipProps } from '@centrifuge/fabric'
import * as React from 'react'

export type PoolStatusKey = 'Maker Pool' | 'Open for investments' | 'Closed' | 'Upcoming' | 'Archived'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Cell, Pie, PieChart as RechartsPieChart, Tooltip, TooltipProps } from 'recharts'
import { formatBalanceAbbreviated, formatPercentage } from '../../utils/formatting'
import { TooltipContainer, TooltipEntry, TooltipTitle } from '../Charts/Tooltip'
Expand Down
2 changes: 0 additions & 2 deletions centrifuge-app/src/components/Portfolio/CoinsSvg.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as React from 'react'

export function CoinsSvg() {
return (
<svg viewBox="0 0 119 72" fill="none" xmlns="http://www.w3.org/2000/svg">
Expand Down
2 changes: 0 additions & 2 deletions centrifuge-app/src/components/PortfolioCta/Cubes.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import * as React from 'react'

export function Cubes() {
return (
<svg
Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/components/Report/ReportFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { AnchorButton, Box, DateInput, SearchInput, Select, Shelf } from '@centr
import * as React from 'react'
import { useNavigate } from 'react-router'
import { nftMetadataSchema } from '../../schemas'
import { useBasePath } from '../../utils/useBasePath'
import { useActiveDomains } from '../../utils/useLiquidityPools'
import { useLoans } from '../../utils/useLoans'
import { useMetadata } from '../../utils/useMetadata'
import { useCentNFT } from '../../utils/useNFTs'
import { useDebugFlags } from '../DebugFlags'
import { GroupBy, Report, ReportContext } from './ReportContext'
import { formatPoolFeeTransactionType } from './utils'
import { useBasePath } from '../../utils/useBasePath'

type ReportFilterProps = {
pool: Pool
Expand Down
4 changes: 2 additions & 2 deletions centrifuge-app/src/components/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ const routes = [
{ path: '/issuer/create-pool', element: <IssuerCreatePoolPage /> },
{ path: '/history/:address', element: <TransactionHistoryPage /> },
{ path: '/history', element: <TransactionHistoryPage /> },
{ path: '/pools/tokens', element: <TokenOverviewPage />},
{ path: '/pools/:pid/assets/:aid', element: <LoanPage />},
{ path: '/pools/tokens', element: <TokenOverviewPage /> },
{ path: '/pools/:pid/assets/:aid', element: <LoanPage /> },
{ path: '/pools/:pid/transactions', element: <PoolTransactionsPage /> },
{ path: '/issuer/:pid/assets/create', element: <IssuerCreateLoanPage /> },
{ path: '/portfolio', element: <PortfolioPage /> },
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/src/components/Spinner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Shelf, ShelfProps } from '@centrifuge/fabric'
import { ThemeSize } from '@centrifuge/fabric/dist/utils/types'
import * as React from 'react'
import styled, { keyframes, useTheme } from 'styled-components'

const rotate = keyframes`
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/src/components/TinlakeRewards/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import { useTinlakeUserRewards } from '../../utils/tinlake/useTinlakeRewards'
import { useAddress } from '../../utils/useAddress'
import { ClaimTinlakeRewards } from './ClaimTinlakeRewards'
Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/components/TokenList.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { useBasePath } from '@centrifuge/centrifuge-app/src/utils/useBasePath'
import { CurrencyMetadata, PoolMetadata } from '@centrifuge/centrifuge-js'
import { IconChevronRight, Shelf, Text, TextWithPlaceholder, Thumbnail } from '@centrifuge/fabric'
import * as React from 'react'
import { formatBalance, formatBalanceAbbreviated, formatPercentage } from '../utils/formatting'
import { useBasePath } from '@centrifuge/centrifuge-app/src/utils/useBasePath'
import { usePoolMetadata } from '../utils/usePools'
import { Column, DataTable, SortableTableHeader } from './DataTable'
import { Eththumbnail } from './EthThumbnail'
Expand Down
11 changes: 9 additions & 2 deletions centrifuge-app/src/pages/IssuerPool/Configuration/Admins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ import { Tooltips } from '../../../components/Tooltips'
import { usePoolPermissions, useSuitableAccounts } from '../../../utils/usePermissions'
import { AddAddressInput } from './AddAddressInput'

type AdminRole = 'PoolAdmin' | 'Borrower' | 'PricingAdmin' | 'LiquidityAdmin' | 'InvestorAdmin' | 'LoanAdmin' | "PODReadAccess"
type AdminRole =
| 'PoolAdmin'
| 'Borrower'
| 'PricingAdmin'
| 'LiquidityAdmin'
| 'InvestorAdmin'
| 'LoanAdmin'
| 'PODReadAccess'

type Admin = {
address: string
Expand Down Expand Up @@ -188,7 +195,7 @@ export function Admins({ poolId }: { poolId: string }) {
},
{
align: 'center',
header: "Investor access",
header: 'Investor access',
cell: (row: Row) => (
<Field
name={`admins.${row.index}.roles.PODReadAccess`}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Box, Text } from '@centrifuge/fabric'
import * as React from 'react'
import { useParams } from 'react-router'
import { LayoutBase } from '../../../components/LayoutBase'
import { PageHeader } from '../../../components/PageHeader'
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/src/pages/IssuerPool/Reporting/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import { PoolReportPage } from '../../../components/Report/PoolReportPage'
import { IssuerPoolHeader } from '../Header'

Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/src/pages/Onboarding/EmailVerified.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Box, IconCheckCircle, Shelf, Spinner } from '@centrifuge/fabric'
import React from 'react'
import { Container, Content, ContentHeader, Header, Layout } from '../../components/Onboarding'
import { config } from '../../config'
import { useVerifyEmail } from './queries/useVerifyEmail'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import { PDFViewer } from '../../components/PDFViewer'
import { ValidationToast } from '../../components/ValidationToast'
import { OnboardingUser } from '../../types'
import { usePool, usePoolMetadata } from '../../utils/usePools'
import { TaxInfo } from './TaxInfo'
import { useSignAndSendDocuments } from './queries/useSignAndSendDocuments'
import { useSignRemark } from './queries/useSignRemark'
import { useUploadTaxInfo } from './queries/useUploadTaxInfo'
import { TaxInfo } from './TaxInfo'

type Props = {
signedAgreementUrl: string | undefined
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { AnchorButton, Box, IconArrowUpRight, Shelf, Spinner } from '@centrifuge/fabric'
import React from 'react'
import { useLocation } from 'react-router-dom'
import { Container, Content, ContentHeader, Header, Layout } from '../../components/Onboarding'
import { ethConfig } from '../../config'
Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/pages/Onboarding/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default function OnboardingPage() {
disconnect,
setIsOnboardingExternally,
externalSignature,
navigate
navigate,
])

const { data: signedAgreementData } = useSignedAgreement()
Expand Down
1 change: 0 additions & 1 deletion centrifuge-app/src/pages/Pool/Reporting/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import { PoolReportPage } from '../../../components/Report/PoolReportPage'
import { PoolDetailHeader } from '../Header'

Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/pages/Pool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ export default function PoolDetailPage() {
<Route path="/" element={<PoolDetailOverviewTab />} />
</Routes>
)
}
}
1 change: 0 additions & 1 deletion centrifuge-app/src/pages/Portfolio/TransactionHistory.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import { useParams } from 'react-router'
import { LayoutBase } from '../../components/LayoutBase'
import { LayoutSection } from '../../components/LayoutBase/LayoutSection'
Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/utils/tinlake/useEvmTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '@centrifuge/centrifuge-react'
import { TransactionRequest, TransactionResponse } from '@ethersproject/providers'
import * as React from 'react'
import { lastValueFrom, Observable, tap } from 'rxjs'
import { Observable, lastValueFrom, tap } from 'rxjs'

export function useEvmTransaction<T extends Array<any>>(
title: string,
Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/utils/useAverageMaturity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ActiveLoan } from '@centrifuge/centrifuge-js'
import * as React from 'react'
import { daysBetween, formatAge } from './date'
import { Dec } from './Decimal'
import { daysBetween, formatAge } from './date'
import { useLoans } from './useLoans'

export const useAverageMaturity = (poolId: string) => {
Expand Down
14 changes: 7 additions & 7 deletions centrifuge-app/src/utils/useBasePath.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { useMatch } from 'react-router-dom';
import { useMatch } from 'react-router-dom'

export const useBasePath = (defaultPath: string = ''): string => {
const matchPools = useMatch({ path: '/pools', end: false });
const matchIssuer = useMatch({ path: '/issuer', end: false });
const matchPools = useMatch({ path: '/pools', end: false })
const matchIssuer = useMatch({ path: '/issuer', end: false })

if (matchPools) {
return matchPools.pathnameBase;
return matchPools.pathnameBase
}

if (matchIssuer) {
return matchIssuer.pathnameBase;
return matchIssuer.pathnameBase
}

return defaultPath;
};
return defaultPath
}
4 changes: 2 additions & 2 deletions centrifuge-app/src/utils/useFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export function useFilters<T>({ key: prefix = 'f_', data = [], useSearchParams =
const filtered = data.filter((entry) => entries.every(([key, set]) => set.has(String(get(entry, key)))))

React.useEffect(() => {
navigate({ search: params.toString() }, { replace: true });
}, [params, navigate]);
navigate({ search: params.toString() }, { replace: true })
}, [params, navigate])

return {
setFilter,
Expand Down
10 changes: 5 additions & 5 deletions centrifuge-app/src/utils/useIsPageUnchanged.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useLocation } from 'react-router-dom';
import { useRef } from 'react';
import { useRef } from 'react'
import { useLocation } from 'react-router-dom'

export function useIsPageUnchanged(): () => boolean {
const location = useLocation();
const initialPath = useRef(location.pathname);
const location = useLocation()
const initialPath = useRef(location.pathname)

return () => initialPath.current === location.pathname;
return () => initialPath.current === location.pathname
}
Loading

0 comments on commit 239c816

Please sign in to comment.