fix: TypeScript null check in StockStatusBadge
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
- Use != null to handle both null and undefined for optional daysUntilOOS prop 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This commit is contained in:
@@ -38,10 +38,10 @@ export function StockStatusBadge({
|
|||||||
if (!inStock) {
|
if (!inStock) {
|
||||||
bgColor = 'bg-red-600';
|
bgColor = 'bg-red-600';
|
||||||
label = 'Out of Stock';
|
label = 'Out of Stock';
|
||||||
} else if (daysUntilOOS !== null && daysUntilOOS <= 3) {
|
} else if (daysUntilOOS != null && daysUntilOOS <= 3) {
|
||||||
bgColor = 'bg-orange-600';
|
bgColor = 'bg-orange-600';
|
||||||
label = `Low (${daysUntilOOS}d)`;
|
label = `Low (${daysUntilOOS}d)`;
|
||||||
} else if (daysUntilOOS !== null && daysUntilOOS <= 7) {
|
} else if (daysUntilOOS != null && daysUntilOOS <= 7) {
|
||||||
bgColor = 'bg-yellow-600';
|
bgColor = 'bg-yellow-600';
|
||||||
textColor = 'text-black';
|
textColor = 'text-black';
|
||||||
label = `Moderate (${daysUntilOOS}d)`;
|
label = `Moderate (${daysUntilOOS}d)`;
|
||||||
|
|||||||
Reference in New Issue
Block a user