-
Notifications
You must be signed in to change notification settings - Fork 44
refactor: generic loan components #1684
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
base: feat/forms
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the loan creation components to make them more generic and reusable for other loan management forms. The main changes include renaming BorrowTabContents to CreateLoanForm, extracting common form components into a widgets/manage-loan directory, and simplifying the gas estimation query structure to return single values instead of nested objects.
Key changes:
- Renamed components and feature flags for clarity (
BorrowTabContents→CreateLoanForm,useBorrowUnifiedForm→useCreateLoanMuiForm) - Created generic, reusable loan form widgets:
LoanFormWrapper,LoanFormTokenInput,LoanFormAlerts,LoanInfoAccordion, andInputDivider - Simplified gas estimation queries to return direct values instead of wrapped objects, making them more consistent with the
Query<T>pattern
Reviewed Changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
tests/cypress/component/llamalend/borrow-tab-contents.rpc.cy.tsx |
Updated test to use renamed CreateLoanForm component and new test IDs |
packages/curve-ui-kit/src/hooks/useFeatureFlags.ts |
Renamed feature flag from useBorrowUnifiedForm to useCreateLoanMuiForm with updated comment |
apps/main/src/loan/components/PageLoanCreate/index.tsx |
Updated to use renamed component and feature flag |
apps/main/src/lend/components/PageLoanCreate/index.tsx |
Updated to use renamed component and feature flag |
apps/main/src/llamalend/widgets/manage-loan/loan.types.ts |
Added generic Query<T> type for consistent query result handling |
apps/main/src/llamalend/widgets/manage-loan/LoanLeverageActionInfo.tsx |
New component extracting leverage-specific action info display |
apps/main/src/llamalend/widgets/manage-loan/LoanInfoAccordion.tsx |
New generic accordion component for displaying loan information |
apps/main/src/llamalend/widgets/manage-loan/LoanFormWrapper.tsx |
New wrapper component for loan forms with FormProvider and consistent styling |
apps/main/src/llamalend/widgets/manage-loan/LoanFormTokenInput.tsx |
New generic token input component for loan forms with type-safe field names |
apps/main/src/llamalend/widgets/manage-loan/LoanFormAlerts.tsx |
New generic alerts component for loan forms with configurable error handling |
apps/main/src/llamalend/widgets/InputDivider.tsx |
New divider component moved from feature to shared widgets |
apps/main/src/llamalend/queries/repay/repay-gas-estimate.query.ts |
Simplified to return single gas value instead of wrapped object |
apps/main/src/llamalend/queries/remove-collateral/remove-collateral-gas-estimate.query.ts |
Simplified to return single gas value instead of wrapped object |
apps/main/src/llamalend/queries/create-loan/create-loan-approve-estimate-gas.query.ts |
Simplified to return single gas value and added error handling |
apps/main/src/llamalend/queries/add-collateral/add-collateral-gas-estimate.query.ts |
Simplified to return single gas value instead of wrapped object |
apps/main/src/llamalend/hooks/useEstimateGas.ts |
Refactored to accept single estimate value and return error information |
apps/main/src/llamalend/features/borrow/components/CreateLoanInfoAccordion.tsx |
New component adapting generic LoanInfoAccordion for create loan use case |
apps/main/src/llamalend/features/borrow/components/CreateLoanForm.tsx |
Renamed from BorrowTabContents and refactored to use generic widgets |
apps/main/src/llamalend/features/borrow/components/BorrowTabContents.tsx |
Removed (renamed to CreateLoanForm) |
apps/main/src/llamalend/features/borrow/components/BorrowLeverageActionInfos.tsx |
Removed (replaced by generic LoanLeverageActionInfo) |
apps/main/src/llamalend/features/borrow/components/BorrowFormTokenInput.tsx |
Removed (replaced by generic LoanFormTokenInput) |
apps/main/src/llamalend/features/borrow/components/BorrowFormAlert.tsx |
Removed (replaced by generic LoanFormAlerts) |
apps/main/src/llamalend/features/borrow/components/BorrowActionInfoAccordion.tsx |
Removed (replaced by CreateLoanInfoAccordion + generic LoanInfoAccordion) |
apps/main/src/llamalend/features/borrow/components/CreateLoanForm.tsx
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.