All files / src/utils/components/submission-review CommentCard.jsx

33.33% Statements 1/3
0% Branches 0/1
0% Functions 0/1
33.33% Lines 1/3

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                          3x                                                        
import React from "react";
import { Box, Paper, Typography } from "@mui/material";
import { useTheme } from "@mui/material/styles";
import CommentIcon from "@mui/icons-material/Comment";
import CommentBox from "./CommentBox";
 
/**
 * Standalone card for a question's teacher comment — rendered as its own
 * Paper alongside (not nested inside) the matching SubmissionQuestionCard, so
 * the two read as separate, same-height cards in a row. Used by both the
 * teacher's "Individual Answers" tab (editable) and the student's own
 * submission page (`readOnly`).
 */
const CommentCard = ({ comment, isSaving, isDeleting, onSave, onDelete, readOnly = false }) => {
    const theme = useTheme();
 
    return (
        <Paper
            elevation={0}
            variant="outlined"
            sx={{ p: 3, borderRadius: 2, borderColor: theme.palette.divider, height: "100%" }}
        >
            <Box sx={{ display: "flex", alignItems: "center", gap: 1, mb: 2 }}>
                <CommentIcon color="primary" fontSize="small" />
                <Typography variant="caption" fontWeight={600}>
                    Teacher's Comment
                </Typography>
            </Box>
            <CommentBox
                comment={comment}
                isSaving={isSaving}
                isDeleting={isDeleting}
                onSave={onSave}
                onDelete={onDelete}
                readOnly={readOnly}
            />
        </Paper>
    );
};
 
export default CommentCard;