Rename UserType -> StudentType

This commit is contained in:
C. Fuhrman 2024-09-25 13:05:36 -04:00
parent 35770dd105
commit 68d7d8c0a9
6 changed files with 28 additions and 28 deletions

View file

@ -1,4 +1,4 @@
export interface UserType {
export interface StudentType {
name: string;
id: string;
}

View file

@ -0,0 +1,15 @@
//StudentType.test.tsx
import { StudentType } from "../../Types/StudentType";
const user : StudentType = {
name: 'Student',
id: '123'
}
describe('StudentType', () => {
test('creates a student with name and id', () => {
expect(user.name).toBe('Student');
expect(user.id).toBe('123');
});
});

View file

@ -1,15 +0,0 @@
//UserTyper.test.tsx
import { UserType } from "../../Types/UserType";
const user : UserType = {
name: 'Student',
id: '123'
}
describe('UserType', () => {
test('creates a user with name and id', () => {
expect(user.name).toBe('Student');
expect(user.id).toBe('123');
});
});

View file

@ -19,7 +19,7 @@ import {
TableHead,
TableRow
} from '@mui/material';
import { UserType } from '../../Types/UserType';
import { StudentType } from '../../Types/StudentType';
import { formatLatex } from '../GiftTemplate/templates/TextType';
interface LiveResultsProps {
@ -27,7 +27,7 @@ interface LiveResultsProps {
questions: QuestionType[];
showSelectedQuestion: (index: number) => void;
quizMode: 'teacher' | 'student';
students: UserType[]
students: StudentType[]
}
interface Answer {
@ -64,7 +64,7 @@ const LiveResults: React.FC<LiveResultsProps> = ({ socket, questions, showSelect
useEffect(() => {
// studentResultsMap is inconsistent with students -- need to update
for (const student of students as UserType[]) {
for (const student of students as StudentType[]) {
if (!studentResultsMap.has(student.id)) {
studentResultsMap.set(student.id, { username: student.name, idUser: student.id, answers: [] });
}

View file

@ -1,12 +1,12 @@
import { Button, Chip, Grid } from '@mui/material';
import { UserType } from '../../Types/UserType';
import { StudentType } from '../../Types/StudentType';
import { PlayArrow } from '@mui/icons-material';
import LaunchQuizDialog from '../LaunchQuizDialog/LaunchQuizDialog';
import { useState } from 'react';
import './userWaitPage.css';
interface Props {
users: UserType[];
users: StudentType[];
launchQuiz: () => void;
setQuizMode: (mode: 'student' | 'teacher') => void;
}

View file

@ -11,7 +11,7 @@ import { QuizType } from '../../../Types/QuizType';
import './manageRoom.css';
import { ENV_VARIABLES } from '../../../constants';
import { UserType } from '../../../Types/UserType';
import { StudentType } from '../../../Types/StudentType';
import { Button } from '@mui/material';
import LoadingCircle from '../../../components/LoadingCircle/LoadingCircle';
import { Refresh, Error } from '@mui/icons-material';
@ -25,7 +25,7 @@ const ManageRoom: React.FC = () => {
const navigate = useNavigate();
const [roomName, setRoomName] = useState<string>('');
const [socket, setSocket] = useState<Socket | null>(null);
const [students, setStudents] = useState<UserType[]>([]);
const [students, setStudents] = useState<StudentType[]>([]);
const quizId = useParams<{ id: string }>();
const [quizQuestions, setQuizQuestions] = useState<QuestionType[] | undefined>();
const [quiz, setQuiz] = useState<QuizType | null>(null);
@ -96,7 +96,7 @@ const ManageRoom: React.FC = () => {
socket.on('create-failure', () => {
console.log('Error creating room.');
});
socket.on('user-joined', (student: UserType) => {
socket.on('user-joined', (student: StudentType) => {
setStudents((prevStudents) => [...prevStudents, student]);
@ -119,7 +119,7 @@ const ManageRoom: React.FC = () => {
useEffect(() => {
// This is here to make sure the correct value is sent when user join
if (socket) {
socket.on('user-joined', (_student: UserType) => {
socket.on('user-joined', (_student: StudentType) => {
// setUsers((prevUsers) => [...prevUsers, user]);