Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add shadow background to nav bar #2502

Merged
merged 8 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ function CustomLegend({
<Dot color={item.color} />
{hasType(item) ? (
<Text variant="body3" style={{ lineHeight: 1.8 }}>
<Tooltips type={item.type} label={item.label} color="textSecondary" />
<Tooltips type={item.type} label={item.label} color="textSecondary" size="sm" />
</Text>
) : (
<Text color="textSecondary" variant="body3" style={{ lineHeight: 1.8 }}>
Expand Down
12 changes: 5 additions & 7 deletions centrifuge-app/src/components/LayoutBase/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ export const Inner = styled(Grid)`
background-color: ${({ theme }) => theme.colors.backgroundInverted};
overflow: visible;
height: 100vh;
padding-right: 0px;
}

@media (min-width: ${({ theme }) => theme.breakpoints['L']}) {
width: 15vw;
background-color: ${({ theme }) => theme.colors.backgroundInverted};
padding-left: 12px;
padding-left: 20px;
padding-right: 20px;
height: 100vh;
}
Expand All @@ -66,8 +67,6 @@ export const MobileBar = styled(Box)`
z-index: 3;
background-color: ${({ theme }) => theme.colors.backgroundInverted};
padding: 1rem;
border-top: ${({ theme }) => `1px solid ${theme.colors.borderPrimary}`};

display: flex;
justify-content: space-between;
align-items: center;
Expand Down Expand Up @@ -149,6 +148,7 @@ export const WalletInner = styled(Stack)`
justify-content: flex-end;
height: 50px;
margin-right: 30px;
margin-top: 15px;
}
`

Expand Down Expand Up @@ -182,8 +182,6 @@ export const ToolbarContainer = styled(Box)`
bottom: 0;
width: 100%;

border-top: ${({ theme }) => `1px solid ${theme.colors.borderPrimary}`};

@media (min-width: ${({ theme }) => theme.breakpoints[BREAK_POINT_COLUMNS]}) {
top: ${({ theme }) => theme.space[4] + HEADER_HEIGHT}px;
bottom: auto;
Expand All @@ -203,12 +201,12 @@ export const ContentWrapper = styled.div`
theme.breakpoints['L']}) {
margin-left: 7vw;
width: calc(100% - 7vw);
margin-top: 0;
margin-top: 10px;
}

@media (min-width: ${({ theme }) => theme.breakpoints['L']}) {
margin-left: 15vw;
width: calc(100% - 15vw);
margin-top: 0;
margin-top: 10px;
}
`
3 changes: 2 additions & 1 deletion centrifuge-app/src/components/Menu/PageLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Link, LinkProps, useLocation } from 'react-router-dom'
import styled from 'styled-components'
import { useIsAboveBreakpoint } from '../../utils/useIsAboveBreakpoint'
import { prefetchRoute } from '../Root'
import { LIGHT_BACKGROUND } from './Toggle'
import { baseButton, primaryButton } from './styles'

const Root = styled(Text)<{ isActive?: boolean; stacked?: boolean }>`
Expand All @@ -12,7 +13,7 @@ const Root = styled(Text)<{ isActive?: boolean; stacked?: boolean }>`
color: ${({ isActive, theme }) => (isActive ? theme.colors.textGold : theme.colors.textInverted)};
font-size: 14px;
font-weight: 500;
background-color: transparent;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change the margin left to match the margin right?

Screenshot 2024-10-16 at 08 06 29

background-color: ${({ isActive }) => (isActive ? LIGHT_BACKGROUND : 'transparent')};
border-radius: 4px;
&:hover {
color: ${({ theme }) => theme.colors.textGold};
Expand Down
4 changes: 3 additions & 1 deletion centrifuge-app/src/components/Menu/Toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Text } from '@centrifuge/fabric'
import styled from 'styled-components'
import { baseButton, primaryButton } from './styles'

export const LIGHT_BACKGROUND = 'rgba(145, 150, 155, 0.13)'

export const Toggle = styled(Text)<{ isActive?: boolean; stacked?: boolean }>`
${baseButton}
${primaryButton}
Expand All @@ -10,7 +12,7 @@ export const Toggle = styled(Text)<{ isActive?: boolean; stacked?: boolean }>`
stacked ? '1fr' : `${theme.sizes.iconSmall}px 1fr ${theme.sizes.iconSmall}px`};
color: ${({ isActive, theme }) => (isActive ? theme.colors.textGold : theme.colors.textInverted)};
border-radius: 4px;
background-color: transparent;
background-color: ${({ isActive }) => (isActive ? LIGHT_BACKGROUND : 'transparent')};

&:hover {
color: ${({ theme }) => theme.colors.textGold};
Expand Down
29 changes: 21 additions & 8 deletions centrifuge-app/src/components/PoolCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { formatBalance, formatBalanceAbbreviated, formatPercentage } from '../../utils/formatting'
import { CardHeader } from '../ListItemCardStyles'
import { RouterTextLink } from '../TextLink'
import { Tooltips } from '../Tooltips'
import { PoolStatus, PoolStatusKey } from './PoolStatus'

export type InnerMetadata = {
Expand Down Expand Up @@ -56,9 +57,16 @@
}
`

const StyledText = styled(Text)`
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
max-width: 70%;
`

const tinlakeTranches = {
NS2: {
name: 'New Silver 3',
name: 'New Silver Series 2',
tranches: [
{ name: 'Junior', apr: '15%', minInvestment: '-' },
{ name: 'Senior', apr: '7%', minInvestment: '5K' },
Expand Down Expand Up @@ -140,16 +148,21 @@
(key) => tinlakeTranches[key as TinlakeTranchesKey].name === name
) || 'none') as TinlakeTranchesKey

console.log(tinlakeKey, name)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover log


const renderText = (text: string, isApr?: boolean) => {
if (isApr && poolId === NS3_POOL_ID) {
return (
<Box display="flex">
<Text fontWeight={500} as="h2" variant={isOneTranche ? 'heading1' : 'body1'} style={{ width: 35 }}>
<Text
fontWeight={500}
as="h2"
variant={isOneTranche ? 'heading1' : 'body1'}
style={{ width: 35, marginRight: 4 }}
>
{text}
</Text>
<Text variant="label2" style={{ alignSelf: 'flex-end', marginLeft: '4px' }}>
Target
</Text>
<Tooltips type="targetAPY" color="textSecondary" label="Target" size="xs" />
</Box>
)
}
Expand All @@ -160,7 +173,7 @@
)
}

const calculateApy = (tranche: TrancheWithCurrency) => {

Check warning on line 176 in centrifuge-app/src/components/PoolCard/index.tsx

View workflow job for this annotation

GitHub Actions / build-app

The 'calculateApy' function makes the dependencies of useMemo Hook (at line 213) change on every render. Move it inside the useMemo callback. Alternatively, wrap the definition of 'calculateApy' in its own useCallback() Hook

Check warning on line 176 in centrifuge-app/src/components/PoolCard/index.tsx

View workflow job for this annotation

GitHub Actions / ff-prod / build-app

The 'calculateApy' function makes the dependencies of useMemo Hook (at line 213) change on every render. Move it inside the useMemo callback. Alternatively, wrap the definition of 'calculateApy' in its own useCallback() Hook
const daysSinceCreation = createdAt ? daysBetween(createdAt, new Date()) : 0
if (poolId === DYF_POOL_ID) return centrifugeTargetAPYs[DYF_POOL_ID][0]
if (poolId === NS3_POOL_ID && tranche.seniority === 0) return centrifugeTargetAPYs[NS3_POOL_ID][0]
Expand Down Expand Up @@ -273,13 +286,13 @@

<Box display="flex" justifyContent="space-between" mt={1}>
<Text variant="body3">Asset type</Text>
<Text variant="body3">{assetClass ?? '-'}</Text>
<StyledText variant="body3">{assetClass ?? '-'}</StyledText>
</Box>
<Box display="flex" justifyContent="space-between">
<Text variant="body3">Investor type</Text>
<Text variant="body3">
<StyledText variant="body3">
{isTinlakePool ? tinlakeTranches[tinlakeKey].investorType : metaData?.pool?.investorType ?? '-'}
</Text>
</StyledText>
</Box>
</StyledCard>
</RouterTextLink>
Expand Down
11 changes: 7 additions & 4 deletions centrifuge-app/src/components/PoolOverview/KeyMetrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ type Tranche = Pick<DailyTrancheState, 'id'> & {
type TinlakeDataKey = keyof typeof tinlakeData

const tinlakeData = {
'0x53b2d22d07E069a3b132BfeaaD275b10273d381E': '7% - 15% target',
'0x55d86d51Ac3bcAB7ab7d2124931FbA106c8b60c7': '4% - 15% target',
'0x90040F96aB8f291b6d43A8972806e977631aFFdE': '4% - 15% target',
'0x53b2d22d07E069a3b132BfeaaD275b10273d381E': '7% - 15%',
'0x55d86d51Ac3bcAB7ab7d2124931FbA106c8b60c7': '4% - 15%',
'0x90040F96aB8f291b6d43A8972806e977631aFFdE': '4% - 15%',
}

const getTodayValue = (data: DailyTrancheStateArr | null | undefined): DailyTrancheStateArr | undefined => {
Expand Down Expand Up @@ -117,7 +117,10 @@ export const KeyMetrics = ({ poolId }: Props) => {
value: `${capitalize(startCase(metadata?.pool?.asset?.class))} - ${metadata?.pool?.asset?.subClass}`,
},
{
metric: centrifugeTargetAPYs[poolId as keyof typeof centrifugeTargetAPYs] ? 'Target APY' : '30-day APY',
metric:
centrifugeTargetAPYs[poolId as keyof typeof centrifugeTargetAPYs] || tinlakeData[poolId as TinlakeDataKey]
? 'Target APY'
: '30-day APY',
value: tinlakeData[poolId as TinlakeDataKey]
? tinlakeData[poolId as TinlakeDataKey]
: centrifugeTargetAPYs[poolId as keyof typeof centrifugeTargetAPYs]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
trancheId: string
}

const NS2 = '0x53b2d22d07E069a3b132BfeaaD275b10273d381E'

export const TrancheTokenCards = ({
trancheTokens,
poolId,
Expand All @@ -41,6 +43,7 @@

const calculateApy = (trancheToken: Token) => {
if (isTinlakePool && getTrancheText(trancheToken) === 'senior') return formatPercentage(trancheToken.apy)
if (poolId === NS2 && trancheToken.seniority === 0) return '15%'
if (poolId === DYF_POOL_ID) return centrifugeTargetAPYs[poolId as CentrifugeTargetAPYs][0]
if (poolId === NS3_POOL_ID && trancheToken.seniority === 0)
return centrifugeTargetAPYs[poolId as CentrifugeTargetAPYs][0]
Expand Down Expand Up @@ -68,7 +71,7 @@
},
},
{
header: 'APY',
header: poolId === DYF_POOL_ID || poolId === NS3_POOL_ID ? 'Target' : 'APY',
align: 'left',
cell: (row: Row) => {
return (
Expand Down Expand Up @@ -123,7 +126,7 @@
},
},
]
}, [pool.tranches, metadata, poolId])

Check warning on line 129 in centrifuge-app/src/components/PoolOverview/TrancheTokenCards.tsx

View workflow job for this annotation

GitHub Actions / build-app

React Hook useMemo has a missing dependency: 'pool?.currency.symbol'. Either include it or remove the dependency array

Check warning on line 129 in centrifuge-app/src/components/PoolOverview/TrancheTokenCards.tsx

View workflow job for this annotation

GitHub Actions / ff-prod / build-app

React Hook useMemo has a missing dependency: 'pool?.currency.symbol'. Either include it or remove the dependency array

const dataTable = useMemo(() => {
return trancheTokens.map((tranche) => {
Expand All @@ -136,7 +139,7 @@
trancheId: tranche.id,
}
})
}, [trancheTokens])

Check warning on line 142 in centrifuge-app/src/components/PoolOverview/TrancheTokenCards.tsx

View workflow job for this annotation

GitHub Actions / build-app

React Hook useMemo has a missing dependency: 'calculateApy'. Either include it or remove the dependency array

Check warning on line 142 in centrifuge-app/src/components/PoolOverview/TrancheTokenCards.tsx

View workflow job for this annotation

GitHub Actions / ff-prod / build-app

React Hook useMemo has a missing dependency: 'calculateApy'. Either include it or remove the dependency array

return (
<Shelf gap={3}>
Expand Down
4 changes: 2 additions & 2 deletions centrifuge-app/src/components/Tooltips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export type TooltipsProps = {
type?: keyof typeof tooltipText
label?: string | React.ReactNode
props?: any
size?: 'med' | 'sm'
size?: 'med' | 'sm' | 'xs'
color?: string
} & Partial<Pick<TextProps, 'style' | 'body'>>

Expand All @@ -359,7 +359,7 @@ export function Tooltips({ type, label: labelOverride, size = 'sm', props, color
{typeof label === 'string' ? (
<Text
textAlign="left"
variant={size === 'sm' ? 'label2' : 'label1'}
variant={size === 'sm' ? 'label2' : size === 'xs' ? 'body4' : 'label1'}
color={size === 'sm' && !color ? 'textPrimary' : 'textSecondary'}
fontWeight={size === 'sm' ? 'inherit' : 400}
>
Expand Down
4 changes: 2 additions & 2 deletions fabric/src/theme/tokens/theme.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { black, blueScale, gold, grayScale, yellowScale } from './colors'

const statusDefault = grayScale[800]
const statusInfo = blueScale[500]
const statusInfo = yellowScale[800]
const statusOk = '#519b10'
const statusWarning = yellowScale[800]
const statusCritical = '#d43f2b'
const statusPromote = '#f81071'

const statusDefaultBg = grayScale[100]
const statusInfoBg = blueScale[50]
const statusInfoBg = yellowScale[100]
const statusOkBg = '#f1f7ec'
const statusWarningBg = yellowScale[50]
const statusCriticalBg = '#fcf0ee'
Expand Down
Loading