-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# 16 of N pull requests. This pull request refactors the `EarnVaultOpenManagePage` and introduces new components to streamline the code and improve maintainability. The most important changes include the removal of hardcoded data, the creation of reusable components, and the dynamic import of the `VaultOpenView` component. Refactoring and Code Simplification: * `apps/earn-protocol/app/earn/[network]/position/[vaultId]/page.tsx`: Removed hardcoded data and replaced the `VaultGridPreview` component with the new `VaultOpenView` component. ([apps/earn-protocol/app/earn/[network]/position/[vaultId]/page.tsxL1-R6](diffhunk://#diff-eaafa83dbaa20354e007ae0e12db9f7a702c4eda62f13e8ac7f97562a32e633cL1-R6), [apps/earn-protocol/app/earn/[network]/position/[vaultId]/page.tsxL37-R36](diffhunk://#diff-eaafa83dbaa20354e007ae0e12db9f7a702c4eda62f13e8ac7f97562a32e633cL37-R36)) * [`apps/earn-protocol/components/layout/VaultOpenView/VaultOpenView.tsx`](diffhunk://#diff-a40498ddbf1bf5830448800c7d93442c21fc90a4f6c4eed0b672478679ce71a9R1-R7): Added dynamic import for `VaultOpenViewComponent` to improve performance. * [`apps/earn-protocol/components/layout/VaultOpenView/VaultOpenViewComponent.tsx`](diffhunk://#diff-af80e33b59ddc7605e3d3e1491d67643a7110bc68039c4d1cf0bac4460249f8fR1-R196): Created `VaultOpenViewComponent` to encapsulate the vault details and form logic, replacing the hardcoded values with props. New Components: * [`apps/earn-protocol/components/layout/VaultOpenView/VaultOpenHeaderBlock.tsx`](diffhunk://#diff-ca9a839cffb2c5b720697f11a6a985772b1b62d3a6e2309b07db100c2c18baf2R1-R58): Added `VaultOpenHeaderBlock` to handle the header section of the vault details. * [`apps/earn-protocol/components/layout/VaultOpenView/VaultSimulationGraph.tsx`](diffhunk://#diff-7945a03c3f8b5b12f09ffb1b94e252a46d09e9bee9b3c70645556363d11dc442R1-R66): Added `VaultSimulationGraph` to display the simulated earnings graph. Data Management: * [`apps/earn-protocol/components/layout/VaultOpenView/mocks.ts`](diffhunk://#diff-46d20597c12759f5cee0663182225eec1847899207974d804a2e33cc7751feb6R1-R95): Moved mock data for vault exposure, user activity, and details links to a separate file for better data management. --------- Co-authored-by: Marcin Ciarka <marcin@oazoapps.com>
- Loading branch information
1 parent
6382d8e
commit 8c83cbf
Showing
44 changed files
with
1,285 additions
and
451 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { RebalanceActivityView } from '@/features/rebalance-activity/components/RebalanceActivityView/RebalanceActivityView' | ||
import { rebalancingActivityRawData } from '@/features/rebalance-activity/table/dummyData' | ||
|
||
const RebalanceActivityPage = () => { | ||
return <RebalanceActivityView rawData={rebalancingActivityRawData} /> | ||
} | ||
|
||
export default RebalanceActivityPage |
58 changes: 58 additions & 0 deletions
58
apps/earn-protocol/components/layout/VaultOpenView/VaultOpenHeaderBlock.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { getVaultDetailsUrl, Text, WithArrow } from '@summerfi/app-earn-ui' | ||
import { type SDKVaultishType } from '@summerfi/app-types' | ||
import Link from 'next/link' | ||
|
||
export const VaultOpenHeaderBlock = ({ | ||
vault, | ||
detailsLinks, | ||
}: { | ||
vault: SDKVaultishType | ||
detailsLinks: { label: string; id: string }[] | ||
}) => { | ||
return ( | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
gap: 'var(--spacing-space-medium)', | ||
}} | ||
> | ||
<Text variant="h5">About the vault</Text> | ||
<Text | ||
variant="p2" | ||
style={{ | ||
color: 'var(--color-text-secondary)', | ||
}} | ||
> | ||
The Summer Earn Protocol is a permissionless passive lending product, which sets out to | ||
offer effortless and secure optimised yield, while diversifying risk. | ||
</Text> | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'row', | ||
justifyContent: 'flex-start', | ||
flexWrap: 'wrap', | ||
gap: 'var(--general-space-24)', | ||
}} | ||
> | ||
{detailsLinks.map(({ label, id }) => ( | ||
<Link key={label} href={`${getVaultDetailsUrl(vault)}#${id}`}> | ||
<Text | ||
as="p" | ||
variant="p3semi" | ||
style={{ | ||
color: 'var(--color-text-link)', | ||
textDecoration: 'none', | ||
cursor: 'pointer', | ||
paddingRight: 'var(--spacing-space-medium)', | ||
}} | ||
> | ||
<WithArrow>{label}</WithArrow> | ||
</Text> | ||
</Link> | ||
))} | ||
</div> | ||
</div> | ||
) | ||
} |
6 changes: 6 additions & 0 deletions
6
apps/earn-protocol/components/layout/VaultOpenView/VaultOpenView.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.leftContentWrapper { | ||
display: flex; | ||
flex-direction: column; | ||
gap: var(--spacing-space-x-large); | ||
width: 100%; | ||
} |
7 changes: 7 additions & 0 deletions
7
apps/earn-protocol/components/layout/VaultOpenView/VaultOpenView.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import dynamic from 'next/dynamic' | ||
|
||
export const VaultOpenView = dynamic(() => | ||
import('@/components/layout/VaultOpenView/VaultOpenViewComponent').then( | ||
(mod) => mod.VaultOpenViewWrapper, | ||
), | ||
) |
Oops, something went wrong.