Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show test visibility in My Tests #1197

Merged
merged 3 commits into from
Oct 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/app/components/pages/quizzes/MyQuizzes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {AppQuizAssignment} from "../../../../IsaacAppTypes";
import {
extractTeacherName,
isAttempt,
isEventLeaderOrStaff,
isFound,
isTutorOrAbove,
partitionCompleteAndIncompleteQuizzes,
Expand Down Expand Up @@ -150,6 +151,11 @@ const MyQuizzesPageComponent = ({user}: MyQuizzesPageProps) => {
}
};

axlewin marked this conversation as resolved.
Show resolved Hide resolved
const roleVisibilitySummary = (quiz: QuizSummaryDTO) => <>
{isEventLeaderOrStaff(user) && quiz.hiddenFromRoles && quiz.hiddenFromRoles?.includes("TEACHER") && <div className="small text-muted d-block ms-2">hidden from teachers</div>}
{isTutorOrAbove(user) && ((quiz.hiddenFromRoles && !quiz.hiddenFromRoles?.includes("STUDENT")) || quiz.visibleToStudents) && <div className="small text-muted d-block ms-2">visible to students</div>}
</>;

const tabAnchors = ["#in-progress", "#completed", "#practice"];

const anchorMap = tabAnchors.reduce((acc, anchor, index) =>
Expand Down Expand Up @@ -208,8 +214,11 @@ const MyQuizzesPageComponent = ({user}: MyQuizzesPageProps) => {
<RS.ListGroup className="mb-3 quiz-list">
{quizzes.filter((quiz) => showQuiz(quiz) && quiz.title?.toLowerCase().includes(filterText.toLowerCase())).map(quiz => <RS.ListGroupItem className="p-0 bg-transparent" key={quiz.id}>
<div className="d-flex flex-grow-1 flex-column flex-sm-row align-items-center p-3">
<span className="mb-2 mb-sm-0">{quiz.title}</span>
{quiz.summary && <div className="small text-muted d-none d-md-block">{quiz.summary}</div>}
<div>
<span className="mb-2 mb-sm-0 pe-2">{quiz.title}</span>
{roleVisibilitySummary(quiz)}
{quiz.summary && <div className="small text-muted d-none d-md-block">{quiz.summary}</div>}
</div>
<Spacer />
{isTutorOrAbove(user) && <div className="d-none d-md-flex align-items-center me-4">
<Link to={{pathname: `/test/preview/${quiz.id}`}}>
Expand Down