|
|
@@ -15,11 +15,11 @@ import {
|
|
|
} from '@/client/components/ui/alert-dialog';
|
|
|
|
|
|
export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
- const { students, toggleMuteMember, kickStudent } = useClassroomContext();
|
|
|
+ const { students, toggleMuteMember, kickStudent, muteStudentIM, unmuteStudentIM } = useClassroomContext();
|
|
|
const [showPanel, setShowPanel] = useState(false);
|
|
|
const [confirmDialog, setConfirmDialog] = useState<{
|
|
|
open: boolean;
|
|
|
- action: 'mute' | 'unmute' | 'kick' | null;
|
|
|
+ action: 'mute' | 'unmute' | 'kick' | 'mute_im' | 'unmute_im' | null;
|
|
|
studentId: string;
|
|
|
studentName: string;
|
|
|
}>({
|
|
|
@@ -29,7 +29,7 @@ export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
studentName: '',
|
|
|
});
|
|
|
|
|
|
- const openConfirmDialog = (action: 'mute' | 'unmute' | 'kick', studentId: string, studentName: string) => {
|
|
|
+ const openConfirmDialog = (action: 'mute' | 'unmute' | 'kick' | 'mute_im' | 'unmute_im', studentId: string, studentName: string) => {
|
|
|
setConfirmDialog({
|
|
|
open: true,
|
|
|
action,
|
|
|
@@ -51,6 +51,12 @@ export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
case 'kick':
|
|
|
kickStudent(studentId);
|
|
|
break;
|
|
|
+ case 'mute_im':
|
|
|
+ muteStudentIM(studentId);
|
|
|
+ break;
|
|
|
+ case 'unmute_im':
|
|
|
+ unmuteStudentIM(studentId);
|
|
|
+ break;
|
|
|
}
|
|
|
|
|
|
setConfirmDialog({
|
|
|
@@ -114,14 +120,14 @@ export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
{students.map((student) => (
|
|
|
<div key={student.id} className="flex items-center justify-between p-2 border rounded text-sm">
|
|
|
<span>{student.name}</span>
|
|
|
- <div className="flex gap-1">
|
|
|
+ <div className="flex gap-1 flex-wrap">
|
|
|
<Button
|
|
|
onClick={() => openConfirmDialog('mute', student.id, student.name)}
|
|
|
variant="outline"
|
|
|
size="sm"
|
|
|
className="text-xs bg-yellow-100 text-yellow-700 hover:bg-yellow-200 border-yellow-300"
|
|
|
>
|
|
|
- 静音
|
|
|
+ 音频静音
|
|
|
</Button>
|
|
|
<Button
|
|
|
onClick={() => openConfirmDialog('unmute', student.id, student.name)}
|
|
|
@@ -129,7 +135,23 @@ export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
size="sm"
|
|
|
className="text-xs bg-green-100 text-green-700 hover:bg-green-200 border-green-300"
|
|
|
>
|
|
|
- 取消
|
|
|
+ 取消音频
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ onClick={() => openConfirmDialog('mute_im', student.id, student.name)}
|
|
|
+ variant="outline"
|
|
|
+ size="sm"
|
|
|
+ className="text-xs bg-purple-100 text-purple-700 hover:bg-purple-200 border-purple-300"
|
|
|
+ >
|
|
|
+ IM禁言
|
|
|
+ </Button>
|
|
|
+ <Button
|
|
|
+ onClick={() => openConfirmDialog('unmute_im', student.id, student.name)}
|
|
|
+ variant="outline"
|
|
|
+ size="sm"
|
|
|
+ className="text-xs bg-blue-100 text-blue-700 hover:bg-blue-200 border-blue-300"
|
|
|
+ >
|
|
|
+ 取消IM禁言
|
|
|
</Button>
|
|
|
<Button
|
|
|
onClick={() => openConfirmDialog('kick', student.id, student.name)}
|
|
|
@@ -154,8 +176,10 @@ export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
<AlertDialogHeader>
|
|
|
<AlertDialogTitle>操作确认</AlertDialogTitle>
|
|
|
<AlertDialogDescription>
|
|
|
- {confirmDialog.action === 'mute' && `确定要静音 ${confirmDialog.studentName} 吗?`}
|
|
|
- {confirmDialog.action === 'unmute' && `确定要取消静音 ${confirmDialog.studentName} 吗?`}
|
|
|
+ {confirmDialog.action === 'mute' && `确定要静音 ${confirmDialog.studentName} 吗?(RTC音频)`}
|
|
|
+ {confirmDialog.action === 'unmute' && `确定要取消静音 ${confirmDialog.studentName} 吗?(RTC音频)`}
|
|
|
+ {confirmDialog.action === 'mute_im' && `确定要禁言 ${confirmDialog.studentName} 吗?(IM聊天)`}
|
|
|
+ {confirmDialog.action === 'unmute_im' && `确定要取消禁言 ${confirmDialog.studentName} 吗?(IM聊天)`}
|
|
|
{confirmDialog.action === 'kick' && `确定要移出 ${confirmDialog.studentName} 吗?`}
|
|
|
</AlertDialogDescription>
|
|
|
</AlertDialogHeader>
|