|
|
@@ -13,13 +13,14 @@ import {
|
|
|
AlertDialogHeader,
|
|
|
AlertDialogTitle,
|
|
|
} from '@/client/components/ui/alert-dialog';
|
|
|
+import { IMToggleMuteButton } from './IMToggleMuteButton';
|
|
|
|
|
|
export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
- const { students, toggleMuteMember, kickStudent, muteStudentIM, unmuteStudentIM } = useClassroomContext();
|
|
|
+ const { students, toggleMuteMember, kickStudent } = useClassroomContext();
|
|
|
const [showPanel, setShowPanel] = useState(false);
|
|
|
const [confirmDialog, setConfirmDialog] = useState<{
|
|
|
open: boolean;
|
|
|
- action: 'mute' | 'unmute' | 'kick' | 'mute_im' | 'unmute_im' | null;
|
|
|
+ action: 'mute' | 'unmute' | 'kick' | null;
|
|
|
studentId: string;
|
|
|
studentName: string;
|
|
|
}>({
|
|
|
@@ -29,7 +30,7 @@ export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
studentName: '',
|
|
|
});
|
|
|
|
|
|
- const openConfirmDialog = (action: 'mute' | 'unmute' | 'kick' | 'mute_im' | 'unmute_im', studentId: string, studentName: string) => {
|
|
|
+ const openConfirmDialog = (action: 'mute' | 'unmute' | 'kick', studentId: string, studentName: string) => {
|
|
|
setConfirmDialog({
|
|
|
open: true,
|
|
|
action,
|
|
|
@@ -51,12 +52,6 @@ export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
case 'kick':
|
|
|
kickStudent(studentId);
|
|
|
break;
|
|
|
- case 'mute_im':
|
|
|
- muteStudentIM(studentId);
|
|
|
- break;
|
|
|
- case 'unmute_im':
|
|
|
- unmuteStudentIM(studentId);
|
|
|
- break;
|
|
|
}
|
|
|
|
|
|
setConfirmDialog({
|
|
|
@@ -137,22 +132,7 @@ export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
>
|
|
|
取消音频
|
|
|
</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>
|
|
|
+ <IMToggleMuteButton userId={student.id} userName={student.name} />
|
|
|
<Button
|
|
|
onClick={() => openConfirmDialog('kick', student.id, student.name)}
|
|
|
variant="outline"
|
|
|
@@ -178,8 +158,6 @@ export const TeacherStudentManagementButton: React.FC = () => {
|
|
|
<AlertDialogDescription>
|
|
|
{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>
|