All files / src/utils/components/feature-access TeacherMadeAssignmentQuotaHint.jsx

100% Statements 7/7
100% Branches 9/9
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19        3x 21x   21x 20x   19x                
import Typography from "@mui/material/Typography";
import useTeacherMadeAssignmentQuota from "@/utils/hooks/useTeacherMadeAssignmentQuota";
 
/** Usage caption for limit_10 plans; hidden when unlimited or loading without quota. */
const TeacherMadeAssignmentQuotaHint = ({ classAssignmentCount = null, sx }) => {
    const { ui, loading, quota } = useTeacherMadeAssignmentQuota(classAssignmentCount);
 
    if (loading && !quota) return null;
    if (!ui.message || quota?.max_assignments === null) return null;
 
    return (
        <Typography variant="caption" color="text.secondary" sx={{ lineHeight: 1.4, ...sx }}>
            {ui.message}
        </Typography>
    );
};
 
export default TeacherMadeAssignmentQuotaHint;