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

Feat/continue develop scrvusd #610

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2c6eee0
styling: fix input wallet balance font color
OnlyJousting Jan 8, 2025
7e04efe
Merge branch 'main' into feat/continue-develop-scrvusd
OnlyJousting Jan 8, 2025
e7819d0
set up statistics component
OnlyJousting Jan 9, 2025
a5d796e
set up historical scrvusd yield fetch
OnlyJousting Jan 9, 2025
044c1e3
Merge branch 'main' into feat/continue-develop-scrvusd
OnlyJousting Jan 12, 2025
f101e8d
add scrvusd historical revenue query
OnlyJousting Jan 12, 2025
d41a150
set up scrvusd metrics stack
OnlyJousting Jan 13, 2025
577d7bd
feat: add chart
OnlyJousting Jan 16, 2025
42d63e5
Merge branch 'main' into feat/continue-develop-scrvusd
OnlyJousting Jan 17, 2025
38da516
styling: configure MuiSelect
OnlyJousting Jan 19, 2025
30e8347
set up TimeOption
OnlyJousting Jan 19, 2025
67dfd0b
Line chart tooltip
OnlyJousting Jan 19, 2025
3f48ac6
move types
OnlyJousting Jan 20, 2025
9faab04
remove chart animation
OnlyJousting Jan 20, 2025
a50269a
Merge branch 'main' into feat/continue-develop-scrvusd
OnlyJousting Jan 20, 2025
f4aa942
update import paths
OnlyJousting Jan 20, 2025
e30ca22
calc revenue epochs
OnlyJousting Jan 20, 2025
6b07ac7
distributions bar chart
OnlyJousting Jan 22, 2025
6368ddc
Merge branch 'main' into feat/continue-develop-scrvusd
OnlyJousting Jan 22, 2025
fad34b3
chore: resolve merge from main issues
OnlyJousting Jan 22, 2025
e0cd0e8
distributions bar chart tooltip
OnlyJousting Jan 22, 2025
e9fada3
weekly accum revenue stat
OnlyJousting Jan 22, 2025
b9f13dc
Merge branch 'main' into feat/continue-develop-scrvusd
OnlyJousting Jan 22, 2025
f22db8c
set up advanced section
OnlyJousting Jan 27, 2025
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
@@ -0,0 +1,28 @@
import { Card, CardHeader, Stack, Typography } from '@mui/material'
import { SizesAndSpaces } from '@ui-kit/themes/design/1_sizes_spaces'
import { t } from '@lingui/macro'

const { Spacing } = SizesAndSpaces

const AdvancedDetails = () => (
<Card>
<CardHeader
size="small"
title={t`Advanced Details`}
slotProps={{ title: { variant: 'small' }, root: { variant: 'small' } }}
sx={{
padding: {
mobile: `${Spacing.lg.mobile} ${Spacing.md.mobile} ${Spacing.sm.mobile}`,
tablet: `${Spacing.lg.tablet} ${Spacing.md.tablet} ${Spacing.sm.tablet}`,
desktop: `${Spacing.lg.desktop} ${Spacing.md.desktop} ${Spacing.sm.desktop}`,
},
Comment on lines +14 to +18
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this is a bit simpler?

Suggested change
padding: {
mobile: `${Spacing.lg.mobile} ${Spacing.md.mobile} ${Spacing.sm.mobile}`,
tablet: `${Spacing.lg.tablet} ${Spacing.md.tablet} ${Spacing.sm.tablet}`,
desktop: `${Spacing.lg.desktop} ${Spacing.md.desktop} ${Spacing.sm.desktop}`,
},
paddingBlockStart: Spacing.lg,
paddingInlineEnd: Spacing.md,
paddingBlockStart: Spacing.sm,

alignItems: 'end',
}}
/>
<Stack direction="column" spacing={Spacing.md}>
<Typography variant="bodyMBold">{t`Advanced Details`}</Typography>
</Stack>
</Card>
)

export default AdvancedDetails
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import type { TimeOption } from '@ui-kit/lib/types/scrvusd'
import { SizesAndSpaces } from '@ui-kit/themes/design/1_sizes_spaces'
import { Card, CardHeader, Box } from '@mui/material'
import { Stack, Card, CardHeader, Box } from '@mui/material'
import { useState } from 'react'
import StatsStack from './StatsStack'
import ChartHeader, { ChartOption } from '@ui-kit/shared/ui/ChartHeader'
import { useScrvUsdYield } from '@loan/entities/scrvusdYield'
import { useScrvUsdRevenue } from '@loan/entities/scrvusdRevenue'
import RevenueLineChart from './RevenueLineChart'
import DistributionsBarChart from './DistributionsBarChart'
import AdvancedDetails from './AdvancedDetails'

const { Spacing, MaxWidth } = SizesAndSpaces

Expand All @@ -25,31 +26,41 @@ const Statistics = () => {
const { data: revenueData } = useScrvUsdRevenue({})

return (
<Card
sx={{
backgroundColor: (t) => t.design.Layer[1].Fill,
width: '100%',
maxWidth: MaxWidth.statistics,
}}
>
<CardHeader
title="Statistics"
sx={{ padding: `0 ${Spacing.md.desktop} ${Spacing.sm.desktop}`, alignItems: 'end' }}
/>
<Box sx={{ padding: Spacing.md }}>
<StatsStack />
</Box>
<ChartHeader
activeChartOption={activeChartOption}
setActiveChartOption={setActiveChartOption}
activeTimeOption={activeTimeOption}
setActiveTimeOption={setActiveTimeOption}
chartOptions={chartOptions}
timeOptions={timeOptions}
/>
{activeChartOption.label === 'Savings Rate' && <RevenueLineChart data={yieldData ?? []} />}
{activeChartOption.label === 'Distributions' && <DistributionsBarChart data={revenueData ?? null} />}
</Card>
<Stack direction="column" spacing={0}>
<Card
sx={{
backgroundColor: (t) => t.design.Layer[1].Fill,
width: '100%',
maxWidth: MaxWidth.statistics,
}}
>
<CardHeader
title="Statistics"
sx={{
padding: {
mobile: `${Spacing.lg.mobile} ${Spacing.md.mobile} ${Spacing.sm.mobile}`,
tablet: `${Spacing.lg.tablet} ${Spacing.md.tablet} ${Spacing.sm.tablet}`,
desktop: `${Spacing.lg.desktop} ${Spacing.md.desktop} ${Spacing.sm.desktop}`,
},
alignItems: 'end',
}}
/>
<Box sx={{ padding: Spacing.md }}>
<StatsStack />
</Box>
<ChartHeader
activeChartOption={activeChartOption}
setActiveChartOption={setActiveChartOption}
activeTimeOption={activeTimeOption}
setActiveTimeOption={setActiveTimeOption}
chartOptions={chartOptions}
timeOptions={timeOptions}
/>
{activeChartOption.label === 'Savings Rate' && <RevenueLineChart data={yieldData ?? []} />}
{activeChartOption.label === 'Distributions' && <DistributionsBarChart data={revenueData ?? null} />}
</Card>
<AdvancedDetails />
</Stack>
)
}

Expand Down
9 changes: 7 additions & 2 deletions packages/curve-ui-kit/src/shared/ui/ChartHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ const ChartHeader = ({
<Icon name="Maximize" size={20} />
</IconButton>
</ToggleButtonGroup>
<Select value={activeTimeOption} onChange={handleTimeOption} size="small" sx={{ width: '100px' }}>
<Select
value={activeTimeOption}
onChange={handleTimeOption}
size="small"
sx={{ width: '100px', textTransform: 'uppercase' }}
>
{timeOptions.map((option) => (
<MenuItem value={option} key={option}>
<MenuItem value={option} key={option} sx={{ textTransform: 'uppercase' }}>
{option}
</MenuItem>
))}
Expand Down
24 changes: 21 additions & 3 deletions packages/curve-ui-kit/src/themes/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,29 @@ export const createComponents = (design: DesignSystem, typography: TypographyOpt
paddingBlock: SizesAndSpaces.Spacing.sm.desktop + ' 0',
paddingInline: SizesAndSpaces.Spacing.md.desktop + ' 0',
borderBottom: `1px solid ${design.Layer[3].Outline}`,
height: '4rem',
minHeight: `calc(${SizesAndSpaces.ButtonSize.lg} + 1px)`, // 1px for the border
minHeight: `calc(${SizesAndSpaces.ButtonSize.lg} + 1px)`,
variants: [
{
props: { size: 'small' }, // todo: currently not working, applying styles inline
style: {
minHeight: SizesAndSpaces.Sizing.md.desktop,
padding: `0 ${SizesAndSpaces.Spacing.md.desktop} ${SizesAndSpaces.Spacing.sm.desktop}`,
},
},
],
},
action: { alignContent: 'center', margin: 0 },
title: { ...typography.headingSBold },
title: {
...typography.headingSBold,
variants: [
{
props: { size: 'small' },
style: {
...typography.headingXsBold,
},
},
],
},
},
},
MuiCardActions: {
Expand Down
6 changes: 6 additions & 0 deletions packages/curve-ui-kit/src/themes/mui-overrides.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ declare module '@mui/material/styles' {
highlight: string
}
}

declare module '@mui/material/CardHeader' {
interface CardHeaderPropsVariantOverrides {
size?: true
}
}
Loading