Fix math logic for timeline

This commit is contained in:
jason
2026-05-19 00:33:08 -05:00
parent ba2b631e23
commit e2c352d518
44 changed files with 7660 additions and 22 deletions
@@ -0,0 +1,36 @@
import React from 'react';
import { getTier, getNextTier } from './CpasBadge';
/**
* Shows a warning banner if adding `addingPoints` to `currentPoints`
* would cross into a new CPAS tier.
*/
export default function TierWarning({ currentPoints, addingPoints }) {
if (!currentPoints && currentPoints !== 0) return null;
const current = getTier(currentPoints);
const projected = getTier(currentPoints + addingPoints);
if (current.label === projected.label) return null;
const tierUp = getNextTier(currentPoints);
return (
<div style={{
background: '#3b2e00',
border: '2px solid #d4af37',
borderRadius: '6px',
padding: '12px 16px',
margin: '12px 0',
fontSize: '13px',
color: '#ffdf8a',
}}>
<strong style={{ color: '#ffd666' }}> Tier Escalation Warning</strong><br />
Adding <strong>{addingPoints} point{addingPoints !== 1 ? 's' : ''}</strong> will move this employee
from <strong>{current.label}</strong> to <strong>{projected.label}</strong>.
{tierUp && (
<span> Tier threshold crossed at <strong>{tierUp.min} points</strong>.</span>
)}
</div>
);
}