import { FaMicrophoneSlash, FaUserTimes } from 'react-icons/fa' import { VideoPlayer } from './VideoPlayer' import { VideoroomParticipantDto, VideoroomLayoutDto } from '@/proxy/videoroom/models' import { Button } from '@/components/ui' interface RoomParticipantProps { participants: VideoroomParticipantDto[] localStream?: MediaStream | null currentUserId: string currentUserName: string isTeacher: boolean isAudioEnabled: boolean isVideoEnabled: boolean onMuteParticipant?: (participantId: string, isMuted: boolean, isTeacher: boolean) => void layout: VideoroomLayoutDto focusedParticipant?: string onParticipantFocus?: (participantId: string | undefined) => void onKickParticipant?: (participantId: string) => void hasSidePanel?: boolean } export const RoomParticipant = ({ participants, localStream, currentUserId, currentUserName, isTeacher, isAudioEnabled, isVideoEnabled, onMuteParticipant, layout, focusedParticipant, onParticipantFocus, onKickParticipant, hasSidePanel = false, }: RoomParticipantProps) => { // Only show current user's video once const currentUserParticipant = { id: currentUserId, name: currentUserName, isTeacher, stream: localStream ?? undefined, } as unknown as VideoroomParticipantDto // Eğer hiç katılımcı yoksa ve localStream de yoksa hiçbir şey render etme if (!localStream && (!participants || participants.length === 0)) { return null } const allParticipants = [currentUserParticipant, ...participants] // Ortak ana video kutusu container class'ı const mainVideoContainerClass = 'w-full h-full flex flex-col justify-center' const renderGridLayout = () => { const getGridClass = (participantCount: number) => { if (participantCount === 1) return 'grid-cols-1' if (participantCount <= 2) return 'grid-cols-1 sm:grid-cols-2' if (participantCount <= 4) return 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-2' if (participantCount <= 6) return 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3' if (participantCount <= 9) return 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3' return 'grid-cols-2 sm:grid-cols-3 lg:grid-cols-4' } const getGridRows = (participantCount: number) => { if (participantCount === 1) return 'grid-rows-1' if (participantCount <= 2) return 'grid-rows-1 sm:grid-rows-1' if (participantCount <= 4) return 'grid-rows-2 lg:grid-rows-2' if (participantCount <= 6) return 'grid-rows-3 sm:grid-rows-2' if (participantCount <= 9) return 'grid-rows-3' return 'grid-rows-4 sm:grid-rows-3' } const getPadding = (participantCount: number) => { if (participantCount === 1) return '' if (participantCount <= 4) return 'p-2 sm:p-4' return 'p-1 sm:p-2' } const getGap = (participantCount: number) => { if (participantCount === 1) return 'gap-0' if (participantCount <= 4) return 'gap-2 sm:gap-3' return 'gap-1 sm:gap-2' } // Mobilde: En üstte öğretmen, altında katılımcılar 2'li grid ve dikey scroll const mainParticipant = allParticipants[0] const otherParticipants = allParticipants.slice(1) return ( <> {/* Mobil özel layout */}