All files / src/app/teacher-page/page/dashboard/components QuickActionsPanel.jsx

100% Statements 7/7
100% Branches 2/2
100% Functions 5/5
100% Lines 7/7

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 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55                43x   43x           43x           1x 1x 1x                             24x                              
import { useNavigate } from "react-router-dom";
import { Box, Divider, Stack, Typography } from "@mui/material";
import AddIcon from "@mui/icons-material/Add";
import StarIcon from "@mui/icons-material/Star";
import ListAltIcon from "@mui/icons-material/ListAlt";
import QuickAction from "./QuickAction";
 
export default function QuickActionsPanel({ totalClasses, totalEnrolled, totalPending }) {
    const navigate = useNavigate();
 
    const classOverviewRows = [
        { label: "Total Classes", value: totalClasses, color: "primary.main" },
        { label: "Enrolled Students", value: totalEnrolled, color: "success.main" },
        { label: "Pending Enrollments", value: totalPending, color: "warning.main" },
    ];
 
    return (
        <Box>
            <Typography variant="h6" fontWeight={700} color="text.primary" sx={{ fontSize: "1rem", mb: 2 }}>
                Quick Actions
            </Typography>
            <Stack spacing={1.5}>
                <QuickAction icon={<AddIcon />} label="Create New Class" desc="Set up a new class section" color="primary" onClick={() => navigate("/teacher/classes")} />
                <QuickAction icon={<StarIcon />} label="Create New Test" desc="Build and assign a test" color="warning" onClick={() => navigate("/teacher/tests")} />
                <QuickAction icon={<ListAltIcon />} label="My Questions" desc="Manage your questions" color="info" onClick={() => navigate("/teacher/question-bank")} />
            </Stack>
 
            {totalClasses > 0 && (
                <Box sx={{ mt: 2.5 }}>
                    <Divider sx={{ mb: 2 }} />
                    <Typography
                        variant="subtitle2"
                        fontWeight={700}
                        sx={{ mb: 1.5, fontSize: "0.8rem", color: "text.secondary", textTransform: "uppercase", letterSpacing: "0.08em" }}
                    >
                        Class Overview
                    </Typography>
                    <Stack spacing={1}>
                        {classOverviewRows.map((row) => (
                            <Box key={row.label} sx={{ display: "flex", justifyContent: "space-between", alignItems: "center" }}>
                                <Typography variant="body2" color="text.secondary" sx={{ fontSize: "0.8rem" }}>
                                    {row.label}
                                </Typography>
                                <Typography variant="body2" fontWeight={700} sx={{ color: row.color, fontSize: "0.8rem" }}>
                                    {row.value}
                                </Typography>
                            </Box>
                        ))}
                    </Stack>
                </Box>
            )}
        </Box>
    );
}