Closed greinard closed 1 month ago
The changes in this pull request introduce several new components and functionalities related to goal visualization within the application. A new CSS file provides styling for goal-related elements, while a React component (Goal.tsx
) is added to visualize goal progress using a pie chart. Additionally, a preview data file defines types and functions for managing goal states. Storybook configurations are created to showcase the Goal
component in various scenarios. Helper functions for value providers are also implemented to support different goal states, enhancing the overall functionality and structure of the goal-related features.
File Path | Change Summary |
---|---|
src/components/container/Goal/Goal.css |
New CSS file added with classes for styling goal components. |
src/components/container/Goal/Goal.previewData.ts |
New file defining GoalPreviewState type and createPreviewValueProvider function. |
src/components/container/Goal/Goal.stories.tsx |
New Storybook configuration with stories for the Goal component. |
src/components/container/Goal/Goal.tsx |
New React component for visualizing goal progress with a pie chart. |
src/components/container/Goal/index.ts |
Added exports for the default Goal component and GoalPreviewState type. |
src/components/container/index.ts |
Export statement added for Goal and GoalPreviewState . |
src/helpers/index.ts |
New export statement for all members from single-value-providers . |
src/helpers/single-value-providers.ts |
Comprehensive implementation of single-value providers and related factory functions. |
sequenceDiagram
participant User
participant GoalComponent
participant ValueProvider
User->>GoalComponent: Request to view goal
GoalComponent->>ValueProvider: Get current value
ValueProvider-->>GoalComponent: Return value
GoalComponent->>User: Display goal progress
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?
This feels more like a presentation than container component.
Per our README, here is the differentiation between presentational and container components:
### Presentational Components
Presentational components do NOT fetch data to populate themselves. They are the underlying UI building blocks of the views and connected components. These are things such as buttons, cards, and a display for a single survey task.
### Container Components
Container components fetch data via the MyDataHelps.js SDK. These components will only function if used in a view inside MyDataHelps or via manually passing an access token to the SDK.
Since the Goal
component fetches data for itself using the MDH.js SDK (among other sources), I think it fits best with the container components.
For example, this could not be dropped into vb without a wrapper. Unless I am missing something?
The Goal
component can be dropped into the ViewBuilder anywhere and it should function appropriately. A user may wish to place it within a Card
or a Section
component, but that wouldn't be necessary.
I think I have addressed all of the feedback thus far. Please let me know if I have not alleviated a concern or if you would like me to address anything else/further.
I have reverted the snapshot version numbers. I would like to merge this today, if possible.
Are there any further objections or requests for delay?
Thanks!
Overview
This branch adds a new Goal component.
The component supports the following configuration:
label
- The label to display next to the progress indicator.targetValue
- The value at which the goal has been "met" or "completed".maxValue
- The maximum value to use for the progress indicator (the denominator).valueProvider
- ASingleValueProvider<number>
implementation that provides a single numeric progress value. Current implementations include static, random, and custom field value providers.icon
- An optional FontAwesome icon override. By default thestar
(solid) icon is used.notStartedColor
- Optionally override the color used when no progress has been made toward the goal.inProgressColor
- Optionally override the color used when the value is greater than 0, but still less than thetargetValue
.completedColor
- Optionally override the color used when the value is greater than or equal to thetargetValue
(i.e. once the goal has been met).Here are a few samples from the storybook:
I will reset the snapshot version numbers prior to merging.
Security
REMINDER: All file contents are public.
[x] I have ensured no secure credentials or sensitive information remain in code, metadata, comments, etc.
[x] These changes do not introduce any security risks, or any such risks have been properly mitigated.
No new security risks. This branch just adds a new UI component for visualizing progress toward a goal.
Checklist
Testing
Documentation
Summary by CodeRabbit
Release Notes
New Features
Goal
component for visualizing goal progress with a pie chart.Goal
component, showcasing different scenarios.Chores