Closed MatanYadaev closed 1 month ago
Latest commit: 529702f9ca7e8f54e66f31de9fd0d21c8da55ffc
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
The recent changes enhance the Statistics
feature by implementing a structured approach to data management and UI rendering. Key updates include the integration of custom hooks for data fetching, improved type safety through Zod schemas, and conditional loading states. These modifications create a more responsive and user-friendly experience, facilitating better visualization and analysis of risk statistics while ensuring clarity and maintainability.
Files | Change Summary |
---|---|
apps/backoffice-v2/src/pages/Statistics/Statistics.page.tsx |
Enhanced the Statistics component by integrating useHomeMetricsQuery for data fetching, introducing a loading state and conditional rendering to improve user experience. |
apps/backoffice-v2/src/pages/Statistics/components/PortfolioRiskStatistics/PortfolioRiskStatistics.tsx |
Updated to accept riskIndicators and reports props, improving functionality and clarity in data handling and UI rendering. |
apps/backoffice-v2/src/pages/Statistics/components/PortfolioRiskStatistics/hooks/usePortfolioRiskStatisticsLogic/usePortfolioRiskStatisticsLogic.tsx |
Refactored to accept typed parameters, optimize sorting logic, and improve performance with useMemo , streamlining risk indicator calculations. |
apps/backoffice-v2/src/domains/metrics/hooks/queries/useHomeMetricsQuery/useHomeMetricsQuery.ts |
Introduced a new custom hook for fetching home metrics data with schema validation using Zod, enhancing error handling and data structure integrity. |
services/workflows-service/src/metrics/metrics.controller.ts |
Added a new endpoint getHomeMetrics to retrieve metrics based on the current project ID, improving API capabilities and data validation. |
services/workflows-service/src/metrics/repository/metrics.repository.ts |
Introduced methods for retrieving risk indicators and reports categorized by risk levels, enhancing data analysis capabilities within the repository. |
services/workflows-service/src/metrics/schemas/home-metrics.schema.ts |
Established new schemas for structured data validation related to home metrics, improving the robustness of data handling. |
services/workflows-service/src/metrics/service/metrics.service.ts |
Added getHomeMetrics method to aggregate metrics related to risk indicators and reports, enhancing service functionality. |
sequenceDiagram
participant User
participant StatisticsPage
participant HomeMetricsQuery
participant PortfolioRiskStatistics
User->>StatisticsPage: Request statistics
StatisticsPage->>HomeMetricsQuery: Fetch home metrics
HomeMetricsQuery->>API: Request metrics from API
API-->>HomeMetricsQuery: Return metrics data
HomeMetricsQuery-->>StatisticsPage: Return fetched data
StatisticsPage->>PortfolioRiskStatistics: Render with metrics
PortfolioRiskStatistics-->>StatisticsPage: Display metrics
🐰 Hopping through the fields so bright,
New stats and figures bring delight!
With data fetching smooth and clear,
Our risks are tamed, let’s give a cheer!
In lines of code, our joy unfolds,
A tale of stats, forever told! 🌟
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Summary by CodeRabbit
New Features
Improvements