|
|
@@ -14,13 +14,14 @@ import {
|
|
|
AlertDialogTitle,
|
|
|
} from '@/client/components/ui/alert-dialog';
|
|
|
import { IMToggleMuteButton } from './IMToggleMuteButton';
|
|
|
+import { RTCToggleMuteButton } from './RTCToggleMuteButton';
|
|
|
|
|
|
export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
- const { students, toggleMuteMember, kickStudent } = useClassroomContext();
|
|
|
+ const { students, kickStudent } = useClassroomContext();
|
|
|
const [showPanel, setShowPanel] = useState(false);
|
|
|
const [confirmDialog, setConfirmDialog] = useState<{
|
|
|
open: boolean;
|
|
|
- action: 'mute' | 'unmute' | 'kick' | null;
|
|
|
+ action: 'kick' | null;
|
|
|
studentId: string;
|
|
|
studentName: string;
|
|
|
}>({
|
|
|
@@ -30,7 +31,7 @@ export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
studentName: '',
|
|
|
});
|
|
|
|
|
|
- const openConfirmDialog = (action: 'mute' | 'unmute' | 'kick', studentId: string, studentName: string) => {
|
|
|
+ const openConfirmDialog = (action: 'kick', studentId: string, studentName: string) => {
|
|
|
setConfirmDialog({
|
|
|
open: true,
|
|
|
action,
|
|
|
@@ -43,12 +44,6 @@ export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
const { action, studentId } = confirmDialog;
|
|
|
|
|
|
switch (action) {
|
|
|
- case 'mute':
|
|
|
- toggleMuteMember(studentId, true);
|
|
|
- break;
|
|
|
- case 'unmute':
|
|
|
- toggleMuteMember(studentId, false);
|
|
|
- break;
|
|
|
case 'kick':
|
|
|
kickStudent(studentId);
|
|
|
break;
|
|
|
@@ -116,22 +111,7 @@ export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
<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 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)}
|
|
|
- variant="outline"
|
|
|
- size="sm"
|
|
|
- className="text-xs bg-green-100 text-green-700 hover:bg-green-200 border-green-300"
|
|
|
- >
|
|
|
- 取消音频
|
|
|
- </Button>
|
|
|
+ <RTCToggleMuteButton userId={student.id} userName={student.name} />
|
|
|
<IMToggleMuteButton userId={student.id} userName={student.name} />
|
|
|
<Button
|
|
|
onClick={() => openConfirmDialog('kick', student.id, student.name)}
|
|
|
@@ -156,8 +136,6 @@ export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
<AlertDialogHeader>
|
|
|
<AlertDialogTitle>操作确认</AlertDialogTitle>
|
|
|
<AlertDialogDescription>
|
|
|
- {confirmDialog.action === 'mute' && `确定要静音 ${confirmDialog.studentName} 吗?(RTC音频)`}
|
|
|
- {confirmDialog.action === 'unmute' && `确定要取消静音 ${confirmDialog.studentName} 吗?(RTC音频)`}
|
|
|
{confirmDialog.action === 'kick' && `确定要移出 ${confirmDialog.studentName} 吗?`}
|
|
|
</AlertDialogDescription>
|
|
|
</AlertDialogHeader>
|