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

refactor: finance sections #391

Merged
merged 52 commits into from
Jan 8, 2025
Merged

refactor: finance sections #391

merged 52 commits into from
Jan 8, 2025

Conversation

cswni
Copy link
Contributor

@cswni cswni commented Jan 8, 2025

This PR integrate several changes

  • Centralized notifications categorized per type
  • Add Earn tokens link
  • Grouped Statistics and Transactions table to tabs in mobile
  • Search contacts to make transfer
  • Integrate request metamask integration in mobile and desktop
  • Refactored hooks and reutilization of codebase
  • Other minor fixes

cswni and others added 30 commits January 2, 2025 13:12
- Updated `finance-deposit-modal.tsx` to enable the 'Stripe' tab.
- Implemented a placeholder UI in `finance-deposit-from-stripe.tsx` with a "coming soon" message, description, and illustration to inform users about the upcoming feature.
- Updated `finance-deposit-from-metamask.tsx` to add `sx={{ m: 4 }}` style prop, ensuring consistent button spacing.
- This improves the UI alignment and visuals for the Metamask connect button.
- Updated `package.json` to include `@metamask/sdk-react` version ^0.31.4.
- This enables integration of MetaMask functionalities in the project.
- Updated `chunkSize` in `FinanceContacts` component from 3 to 2.
- This change ensures better alignment and improved user experience when displaying the contacts list.
- Updated `src/config-global.ts` to include `INFURA_API_KEY` in the global configuration.
- Fetches the key from either `process.env` or `import.meta.env` variables.
This addition enables seamless integration with Infura services.
- Replace the existing wallet connection logic with MetaMask SDK in `finance-deposit-from-metamask.tsx`.
- Add loading state (`loadingMetamask`) and display `LoadingScreen` during MetaMask initialization.
- Implement wallet reconnection logic using localStorage to persist connection state.
- Update UI to handle MetaMask connection and improve error handling via `enqueueSnackbar`.
- **finance-withdraw-from-metamask.tsx**:
  - Added `LoadingScreen` and `loadingMetamask` state for better UX during wallet connection.
  - Replaced alert with `enqueueSnackbar` for error handling.
  - Automatically connect wallet if previously connected using localStorage.
  - Added autofocus to the withdraw amount input.

- **finance-withdraw-from-smart-account.tsx**:
  - Added autofocus to the withdraw amount input.

- **finance-deposit-from-metamask.tsx**:
  - Added autofocus to the deposit amount input.

- **finance-deposit-from-smart-account.tsx**:
  - Added autofocus to the deposit amount input.
  - Minor formatting fix (removed trailing whitespace).
- `src/sections/finance/index.tsx`: Added responsive tab-based layout for smaller viewports and updated grid structure for better UX. Introduced TabsComponent.
- `src/sections/finance/components/finance-overlay-loader.tsx`: Added a new component to display loading overlays consistently.
- `src/sections/finance/components/finance-balance-statistics.tsx`: Integrated `FinanceOverlayLoader` for loading states.
- `src/sections/finance/components/finance-transactions-history.tsx`: Added `FinanceOverlayLoader` and enhanced `TableNoData` integration for loading states.
- `src/components/table/table-no-data.tsx`: Modified content to show "Loading..." dynamically during loading states.
- `src/sections/finance/components/finance-transactions-table-row.tsx`: Removed unused `type` variable and eliminated logging.
- Updated `src/layouts/_common/header-balance.tsx`:
  - Imported `Iconify` for icon usage.
  - Added a new button labeled "Earn tokens" with a trophy icon.
  - Implemented a click handler to open an external link to "tropee.com/watchit" in a new tab.
- **src/sections/finance/index.tsx**: Integrated `FinanceEarnTokens` component for both large and small viewports to enable users to earn MMC tokens.
- **src/layouts/_common/header-balance.tsx**: Removed "Earn Tokens" button and associated logic, delegating functionality to the new component.
- **src/sections/finance/components/finance-earn-tokens.tsx**: Created a reusable `FinanceEarnTokens` component featuring tasks and invitations to earn rewards.
- **src/assets/illustrations/earn.svg**: Added an illustration asset for the `FinanceEarnTokens` component.
- Updated `maxWidth` for container alignment for XS and MD breakpoints in `finance-earn-tokens.tsx`.
- Increased `Typography` width limits for better text readability.
- Added margin-top spacing to `Button` in larger screen sizes (`
- Updated `FinanceQuickTransfer` to conditionally render based on `mdUp` breakpoint in `src/sections/finance/index.tsx`.
- Introduced `mdUp` variable for better readability and alignment with existing responsive logic.
- Simplified conditional rendering for improved maintainability.
…the provider, also made a refactor to finance withdraw and metamask connect and added errors helper
- `finance-quick-actions.tsx`: Structured imports into groups for clarity.
- `finance-balance-statistics.tsx`: Added missing grouping and comments for imports.
- `finance-overlay-loader.tsx`: Reordered imports for better organization.
- `finance-external-wallet.tsx`: Grouped and commented imports for consistency.
- `finance-contacts.tsx`: Adjusted import grouping, moved `react-redux` higher.
- `finance-deposit-from-stripe.tsx`: Added comments for logical grouping of imports.
- `finance-deposit-from-metamask.tsx`: Reorganized imports and annotated types more cleanly.
- `finance-quick-transfer.tsx`: Properly categorized imports for maintainability.
- `finance-deposit-from-smart-account.tsx`: Refactored import structure.
- `finance-earn-tokens.tsx`: Improved grouping and consistency in import placement.
- `finance-dialogs-actions.tsx`: Grouped and added comments for imports.
- `finance-deposit.tsx`: Restructured and logically grouped imports.
- `finance-change-wallet.tsx`: Consolidated and commented imports for better readability.
…efactor/finance

# Conflicts:
#	src/sections/finance/components/finance-deposit-from-metamask.tsx
#	src/sections/finance/components/finance-quick-transfer.tsx
- Moved React and library imports to the top for better structure.
- Grouped and reordered Redux imports for improved readability.
- Removed duplicated import statements to avoid redundancy.
cswni and others added 22 commits January 6, 2025 15:34
- Moved `redux` imports together for better grouping.
- Added `lens-protocol` and `ethers` imports under a new `API Lens and ethers` comment section.
- Reorganized project component imports for clarity and consistency.
- Introduced `internal-notifications.ts` to centralize notifications and remove repeated `enqueueSnackbar` calls across components.
- Replaced `enqueueSnackbar` in `finance-withdraw`, `finance-withdraw-from-metamask`, and `finance-deposit-from-metamask` with the new functions `notifyError`, `notifySuccess`, and `notifyWarning`.
- Updated `finance-deposit` to utilize centralized notifications and success/error definitions.
- Updated `finance-transfer-accounts` by adding placeholder comments for review.
- Replaced `setGlobalErrorNotifier` with `setGlobalNotifier` for generalized handling.

Reduced code duplication, enhanced maintainability, and ensured consistent notification handling throughout the project.
- `src/sections/user/profile-header.tsx`: Replaced snackbar with notification utilities for success/error; adjusted import order.
- `src/sections/finance/components/*`: Standardized imports (quotes, formatting), improved readability with better indentation, and refactored JSX code alignment.
- Updated key wallet/modal components (e.g., `finance-deposit-from-metamask`) with consistent spacing and organized props structure.
- Added 'info' type to `NotificationType` for broader support.
- Removed unused `options` parameter in `notify()` function and updated its usage.
- Improved error message in case of missing `globalEnqueueSnackbar`.
- Updated internal references of `type` to `typeNotification` for clarity.
- Fixed outdated comments to align with the latest notification logic.
- Updated `finance-deposit-from-metamask.tsx` to wrap `LoadingScreen` with a `Box` component from Material-UI and added a margin (`m:2`) for improved spacing.
- This enhances the UI by creating more visual separation and better layout consistency.
- Updated import path for `setGlobalNotifier` in `snackbar-provider.tsx` from `@src/utils/notifications/internal-notifications.ts` to `@notifications/internal-notifications.ts`.
- This improves module resolution consistency and maintains cleaner imports.
- Updated `handleAction` in `follow-unfollow-button.tsx` to support detailed notification messages with `profileName` and `actionLbl`.
- Replaced `getFollowMessage` helper function with direct use of `notifySuccess`.
- Adjusted success message template in `success.ts` for dynamic `actionLbl` and `profileName`.
@cswni cswni requested a review from Jadapema January 8, 2025 00:49
@cswni cswni self-assigned this Jan 8, 2025
Copy link

sonarqubecloud bot commented Jan 8, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@geolffreym geolffreym merged commit 42f904c into next Jan 8, 2025
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants