- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 753
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
fix(1-3377): handle singular counts in project status lifecycle boxes #9317
fix(1-3377): handle singular counts in project status lifecycle boxes #9317
Conversation
If the average number of days in a stage is 1, use `1 day` instead of `1 days`. Likewise, if your total number of archived flags is 1, use `1 flag archived` instead of `1 flags archived`.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files |
const totalArchivedStat = () => { | ||
const count = data?.lifecycleSummary.archived.last30Days ?? 0; | ||
return `${count} ${count === 1 ? 'flag' : 'flags'} archived`; | ||
}; |
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 can be a variable, not a function
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.
It can be, but I'm not sure what you get from it. doing it as a function gives you scope to name variables and separate it from other stuff. I don't mind, though 🤷🏼
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.
Scoping is a for of an abstraction - to me it makes this code less declarative, less "linear" to read if you need to understand everything that's going on, instead of trusting the function name
If the average number of days in a stage is 1, use
1 day
instead of1 days
.Likewise, if your total number of archived flags is 1, use
1 flag archived
instead of1 flags archived
.I grepped through the file, but couldn't find any other hardcoded instances of "flags" or "days", so I think this is everything.