37 lines
1.2 KiB
JavaScript
Executable File
37 lines
1.2 KiB
JavaScript
Executable File
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>
|
|
);
|
|
}
|