Skip to content

Commit

Permalink
Type fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Oct 30, 2024
1 parent 8d87694 commit 87417c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion centrifuge-app/src/components/PoolCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export function PoolCard({
</Text>
<Shelf gap={1}>
{ratings.map((rating) => {
return <RatingPill {...rating} />
return <RatingPill key={rating.agency} {...rating} />
})}
</Shelf>
</Box>
Expand Down
15 changes: 5 additions & 10 deletions centrifuge-app/src/components/PoolOverview/KeyMetrics.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CurrencyBalance, DailyTrancheState, Price } from '@centrifuge/centrifuge-js'
import { CurrencyBalance, DailyTrancheState, PoolMetadata, Price } from '@centrifuge/centrifuge-js'
import { NetworkIcon, formatBalanceAbbreviated, useCentrifuge } from '@centrifuge/centrifuge-react'
import {
Box,
Expand Down Expand Up @@ -46,12 +46,7 @@ type Tranche = Pick<DailyTrancheState, 'id'> & {

type TinlakeDataKey = keyof typeof tinlakeData

export type RatingType = {
agency?: string
reportUrl?: string
reportFile?: any
value?: string
}
type RatingProps = Partial<NonNullable<PoolMetadata['pool']['poolRatings']>[number]>

const ratingIcons: { [key: string]: JSX.Element } = {
"Moody's": <IconMoody size={16} />,
Expand Down Expand Up @@ -195,8 +190,8 @@ export const KeyMetrics = ({ poolId }: Props) => {
metric: 'Rating',
value: (
<Shelf gap={1}>
{metadata?.pool?.poolRatings.map((rating: RatingType) => (
<RatingPill {...rating} />
{metadata.pool.poolRatings.map((rating) => (
<RatingPill key={rating.agency} {...(rating as RatingProps)} />
))}
</Shelf>
),
Expand Down Expand Up @@ -332,7 +327,7 @@ const AvailableNetworks = ({ poolId }: { poolId: string }) => {
)
}

export const RatingPill = ({ agency, reportUrl, reportFile, value }: RatingType) => {
export const RatingPill = ({ agency, reportUrl, reportFile, value }: RatingProps) => {
const theme = useTheme()
const cent = useCentrifuge()
return (
Expand Down

0 comments on commit 87417c8

Please sign in to comment.