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

100% Statements 6/6
100% Branches 2/2
100% Functions 4/4
100% Lines 6/6

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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76              6x   6x           6x                     1x             1x                                         18x                                          
import { useNavigate } from "react-router-dom";
import { Box, Divider, Stack, Typography } from "@mui/material";
import SchoolIcon from "@mui/icons-material/School";
import SettingsIcon from "@mui/icons-material/Settings";
import QuickAction from "./QuickAction";
 
export default function QuickActionsPanel({ totalClasses, totalAssignments, totalSubmissions }) {
    const navigate = useNavigate();
 
    const summaryRows = [
        { label: "Enrolled Classes", value: totalClasses, color: "primary.main" },
        { label: "Total Assignments", value: totalAssignments, color: "warning.main" },
        { label: "Total Submissions", value: totalSubmissions, color: "success.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={<SchoolIcon />}
                    label="My Classes"
                    desc="View your enrolled classes"
                    color="primary"
                    onClick={() => navigate("/student/classes")}
                />
                <QuickAction
                    icon={<SettingsIcon />}
                    label="Account Settings"
                    desc="Manage your profile"
                    color="info"
                    onClick={() => navigate("/student/settings")}
                />
            </Stack>
 
            <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",
                    }}
                >
                    Summary
                </Typography>
                <Stack spacing={1}>
                    {summaryRows.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>
    );
}