-
Notifications
You must be signed in to change notification settings - Fork 25
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
Kuwait Theme: Progress Wheel Component #2558
base: master
Are you sure you want to change the base?
Conversation
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.
@esmeetewinkel I think that can be done in a separate styling file for the facilitator app. That seems to be the styling architecture we are using. |
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.
This looks really nice, and the logic is nice and straightforward.
Currently, you've exposed the task_total
and task_progress
parameters to set the completion percentage of the component. This would mean that an author would have to add their own logic for evaluating which tasks have been completed and pass that to the component. Instead, the component should be able to take two parameters and calculate the completion percentage itself:
data_list
– the name of a data list containing rows that relate to tasks that can be completedcompleted_column
– the name of the column within that data list that stores the completed status of the task row
From these values, the component can then look up the data list with that name, look at the completed column and compare the total number of tasks to the number that have been completed to calculate the total progress itself.
For this reason, I think it would make sense for this component to be a variant of the existing task-progress-bar
component, which already contains this logic. The task-progress-bar
component does contain some other logic to support a legacy system for handling tasks, but that can be ignored.
In order to implement this wheel as a variant of the task-progress-bar
component, you'll need to do the following:
- Configure the
task-progress-bar
component to have variants, e.g.bar
andwheel
, wherebar
is default.src/app/shared/components/template/components/audio/audio.component.ts
could be a good example of how to implement variants with a default- Likewise, the
audio.component.html
template can be used as an example – you'll want to wrap most of the existing template code oftask-progress-bar.component.html
in an@if(params.variant.includes("bar"))
block, and add your code fromprogress-wheel.component.html
in another@if()
block underneath.
- Move most of your component logic into
task-progress-bar.component.ts
and refactor to use the existing properties- i.e.
subtasksCompleted
andsubtasksTotal
can be used to calculate the completion percentage in yourgetStrokeOffset()
method
- i.e.
…pp-builder into feature-kw-progress-wheel-component
Thanks @jfmcquade |
…pp-builder into feature-kw-progress-wheel-component
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.
Thanks for refactoring, I think the logic fits in pretty well to the task progress bar component. I really like the animation when updating the progress on the debug template.
I have a couple of further comments (plus some minor suggestions inline):
- I think that the component styles should be moved to
src/app/shared/components/template/components/task-progress-bar/task-progress-bar.component.scss
, out of the theme-level overrides (this will also allow you to merge master in without merge conflicts). It's a grey area, but I think it makes sense to expose that variant to other deployments, even though the styling is quite theme-specific for now. - On initial load, the component shows briefly with "10000%" completion and the animation glitches. I think you'll need to add a timeout to only display the progress once it has been calculated. See demo:
progress.wheel.glitch.mov
@@ -85,6 +89,9 @@ export class TmplTaskProgressBarComponent | |||
standalone: boolean = false; | |||
useDynamicData: boolean; | |||
private dataQuery$: Subscription; | |||
radius = 16; // Radius of the circle |
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.
Could be good to add a comment above these three properties to indicate that they relate to the "wheel" variant
@@ -147,6 +158,14 @@ export class TmplTaskProgressBarComponent | |||
return (this.subtasksCompleted / this.subtasksTotal) * 100; | |||
} | |||
|
|||
getStrokeOffset(): number { |
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.
Again, would be good to have a comment here (JSDoc style) to indicate that this method relates to the "wheel" variant. It should also be explicitly tagged as public
.
…pp-builder into feature-kw-progress-wheel-component
@jfmcquade For the glitching, I've added the |
PR Checklist
Description
plh_progress_wheel
created and styled. Corresponding debug sheet: LinkAuthor Notes
task_progress_bar
component with the following additionalparameter_list
:wheel_title
: The title attached at the bottom of the progress wheel.variant
: Choose either a bar or wheel to track progress. Default isbar
Git Issues
Closes #2538
Screenshots