mirror of
https://github.com/ets-cfuhrman-pfe/EvalueTonSavoir.git
synced 2025-08-11 21:23:54 -04:00
Added active students in LiveResultsTable
This commit is contained in:
parent
7abd8b8019
commit
4ee0fd5b17
3 changed files with 13 additions and 2 deletions
|
|
@ -11,4 +11,5 @@ export interface StudentType {
|
||||||
id: string;
|
id: string;
|
||||||
room?: string;
|
room?: string;
|
||||||
answers: Answer[];
|
answers: Answer[];
|
||||||
|
isActive?: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,12 @@ const LiveResultsTableFooter: React.FC<LiveResultsFooterProps> = ({
|
||||||
return (
|
return (
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{students.map((student) => (
|
{students.map((student) => (
|
||||||
<TableRow key={student.id}>
|
<TableRow
|
||||||
|
key={student.id}
|
||||||
|
style={{
|
||||||
|
opacity: student.isActive === false ? 0.5 : 1,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<TableCell
|
<TableCell
|
||||||
className="sticky-column"
|
className="sticky-column"
|
||||||
sx={{
|
sx={{
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,12 @@ const ManageRoom: React.FC = () => {
|
||||||
|
|
||||||
socket.on('user-disconnected', (userId: string) => {
|
socket.on('user-disconnected', (userId: string) => {
|
||||||
console.log(`Student left: id = ${userId}`);
|
console.log(`Student left: id = ${userId}`);
|
||||||
setStudents((prevUsers) => prevUsers.filter((user) => user.id !== userId));
|
//setStudents((prevUsers) => prevUsers.filter((user) => user.id !== userId));
|
||||||
|
setStudents(prevStudents =>
|
||||||
|
prevStudents.map(student =>
|
||||||
|
student.id === userId ? { ...student, isActive: false } : student
|
||||||
|
)
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
setSocket(socket);
|
setSocket(socket);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue