Merged
Conversation
Reviewer's GuideThis PR standardizes and modernizes the provider and client power report modules by refactoring CSS naming and layouts, migrating fetch and loading logic into service hooks, integrating a reusable ActionButton, updating AI prompt templates for structured JSON output, and reorganizing project documentation. Sequence Diagram for Provider Power Forecast GenerationsequenceDiagram
actor Provider
Provider->>ProviderPowerPredictionPage: Interacts with page
ProviderPowerPredictionPage->>ActionButton: Clicks "Generate Forecast"
ActionButton->>ProviderPowerPredictionPage: Calls onClick handler (fetchProviderPredictionReport)
ProviderPowerPredictionPage->>ProviderPredictionService: fetchProviderPredictionReport(userId, setReportData)
ProviderPredictionService->>ReduxStore: dispatch(toggleLoad(true))
ProviderPredictionService->>BackendAPI: GET /providers/providerReport/{userId}
BackendAPI-->>ProviderPredictionService: Forecast Data / Error
alt Forecast Successful
ProviderPredictionService->>ProviderPowerPredictionPage: setReportData(data)
else Forecast Failed
ProviderPredictionService->>ProviderPowerPredictionPage: setReportData(null)
ProviderPredictionService->>Console: logs error
end
ProviderPredictionService->>ReduxStore: dispatch(toggleLoad(false))
ProviderPowerPredictionPage-->>Provider: Displays Forecast Data or Loading/Error
Sequence Diagram for Client Power Plan GenerationsequenceDiagram
actor Client
Client->>ClientPowerPlanPage: Interacts with page
ClientPowerPlanPage->>ActionButton: Clicks "Generate My Plan"
ActionButton->>ClientPowerPlanPage: Calls onClick handler (fetchPowerPlanReport)
ClientPowerPlanPage->>ClientPowerPlanService: fetchPowerPlanReport(userId, setReportData)
ClientPowerPlanService->>ReduxStore: dispatch(toggleLoad(true))
ClientPowerPlanService->>BackendAPI: GET /clients/clientReport/{userId}
BackendAPI-->>ClientPowerPlanService: Plan Data / Error
alt Plan Successful
ClientPowerPlanService->>ClientPowerPlanPage: setReportData(data)
else Plan Failed
ClientPowerPlanService->>ClientPowerPlanPage: setReportData(null)
ClientPowerPlanService->>Console: logs error
end
ClientPowerPlanService->>ReduxStore: dispatch(toggleLoad(false))
ClientPowerPlanPage-->>Client: Displays Plan Data or Loading/Error
Class Diagram for Updated Provider Power Prediction FeatureclassDiagram
class ProviderPowerPrediction {
<<Component>>
-reportData: Object
-loading: Boolean
-userId: String
+constructor()
+render()
}
ProviderPowerPrediction --|> React.Component
ProviderPowerPrediction ..> ActionButton : uses
ProviderPowerPrediction ..> ProviderPredictionService_Hook : uses "fetchProviderPredictionReport()"
class ActionButton {
<<Component>>
+text: String
+className: String // New prop
+onClick: Function
+backgroundColor: String
+color: String
+width: String
+margin: String
-useInlineStyles: Boolean // New internal logic
+constructor()
+render()
}
ActionButton --|> React.Component
class ProviderPredictionService_Hook {
<<Hook>>
+fetchProviderPredictionReport(userId, setReportData): Promise~void~ // Logic moved here
}
ProviderPredictionService_Hook ..> ReduxStore : dispatches toggleLoad
ProviderPredictionService_Hook ..> BackendAPI : GET /providers/providerReport/{userId}
class ReduxStore {
<<Store>>
+loadingState: Boolean
+toggleLoad(Boolean)
}
class BackendAPI {
<<Service>>
+providerReport(userId): Promise~JSON~
}
Updated Class Diagram for ClientPrompt Utility (PHP)classDiagram
class ClientPrompt {
<<Utility>>
+static clientBuildPromptFromMetrics(slaveId): string // Prompt template updated for JSON output
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Revamp provider and client forecast pages by standardizing styling and layout with reusable ActionButton components, refactor data fetching into service hooks that manage loading state, enhance AI prompt formatting for structured JSON outputs, and update project documentation with refreshed diagrams and feature descriptions
New Features:
Enhancements:
Documentation: