-
Notifications
You must be signed in to change notification settings - Fork 21
Add project status progress bar #77
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
base: staging
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -41,7 +41,123 @@ | |||||
|
|
||||||
| <Head title={data.project.name} /> | ||||||
|
|
||||||
|
|
||||||
|
|
||||||
| <h1 class="mt-5 mb-2 font-hero text-3xl font-medium">{data.project.name}</h1> | ||||||
| <div class="mb-2"> | ||||||
| <p class="text-sm"> | ||||||
| Created | ||||||
| <abbr title={`${data.project.createdAt.toUTCString()}`}> | ||||||
| {relativeDate(data.project.createdAt)} | ||||||
| </abbr> | ||||||
| ∙ Updated | ||||||
| <abbr title={`${new Date(data.project.updatedAt).toUTCString()}`}> | ||||||
| {relativeDate(data.project.updatedAt)} | ||||||
| </abbr> | ||||||
| ∙ {Math.floor(data.project.timeSpent / 60)}h {data.project.timeSpent % 60}min | ||||||
| </p> | ||||||
| </div> | ||||||
|
|
||||||
| <div class="mb-8 w-full px-0 sm:px-2 md:px-4 lg:px-8 xl:px-16 py-6"> | ||||||
| {#key data.project.status} | ||||||
| {#if data.project.status === 'rejected' || data.project.status === 'rejected_locked'} | ||||||
| <div class="flex items-center gap-3 w-full"> | ||||||
| <div class="flex-1 h-4 rounded-full bg-gradient-to-r from-red-200 to-red-100 relative overflow-hidden w-full"> | ||||||
| <div class="absolute left-0 top-0 h-4 rounded-full bg-gradient-to-r from-red-500 to-red-400 animate-pulse" style="width: 22%"></div> | ||||||
| </div> | ||||||
| <span class="ml-2 text-red-700 font-bold text-base tracking-wide flex items-center gap-1 whitespace-nowrap"> | ||||||
| <svg width="18" height="18" fill="none" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" fill="#f87171"/><path d="M12 7v5m0 4h.01" stroke="#fff" stroke-width="2" stroke-linecap="round"/></svg> | ||||||
|
||||||
| <svg width="18" height="18" fill="none" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10" fill="#f87171"/><path d="M12 7v5m0 4h.01" stroke="#fff" stroke-width="2" stroke-linecap="round"/></svg> | |
| <svg width="18" height="18" fill="none" viewBox="0 0 24 24" role="img" aria-label="Rejected status"><circle cx="12" cy="12" r="10" fill="#f87171"/><path d="M12 7v5m0 4h.01" stroke="#fff" stroke-width="2" stroke-linecap="round"/></svg> |
Copilot
AI
Jan 1, 2026
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.
The progress bar width calculation uses a hardcoded divisor of 4, which assumes there are always 5 steps (0-indexed). If the status list changes in the future, this calculation will break. Consider using a dynamic calculation based on the actual array length minus 1, such as (index / (steps.length - 1)) * 100%.
Copilot
AI
Jan 1, 2026
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.
The progress calculation using indexOf() will return -1 if the project status is not in the expected list, resulting in a negative width value. While this may not crash the UI, it could lead to unexpected visual behavior. Consider adding validation to handle unexpected status values gracefully.
Copilot
AI
Jan 1, 2026
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.
The hardcoded divisor of 4 in the positioning calculation assumes there are always 5 steps. This creates the same maintainability issue as the progress bar width calculation. If steps are added or removed, the positioning will be incorrect.
Copilot
AI
Jan 1, 2026
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.
The step color property defined in the loop (line 86-90) is not being used effectively. Line 123 sets the color with class:{step.color}={true}, but since the circles are already conditionally styled with bg-primary-500 or bg-gray-200 based on the status progression, the step.color classes (bg-indigo-400, bg-yellow-400, etc.) will be overridden and have no visible effect. This creates confusion about the intended styling.
Copilot
AI
Jan 1, 2026
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.
The same hardcoded divisor of 4 is used here for label positioning, which will break if the number of steps changes. This should be calculated dynamically based on the array length.
Copilot
AI
Jan 1, 2026
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.
The same array ['submitted', 't1_approved', 'printing', 'printed', 'finalized'] is repeated multiple times throughout the code. This creates significant code duplication and makes maintenance difficult. Consider extracting this array into a constant at the component level to improve maintainability and reduce the risk of inconsistencies.
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.
@copilot open a new pull request to apply changes based on this feedback
Copilot
AI
Jan 1, 2026
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.
The progress indicator circles lack proper ARIA attributes for screen reader users. Consider adding role="progressbar", aria-valuenow, aria-valuemin, aria-valuemax, and aria-label attributes to make the progress bar accessible to users with disabilities.
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.
The rejected status progress bar shows a hardcoded width of 22% which appears to be an arbitrary magic number. This value should either be documented with a comment explaining its significance or extracted as a named constant to improve code clarity.