diff --git a/src/frontend/src/features/rooms/utils/generateRoomId.ts b/src/frontend/src/features/rooms/utils/generateRoomId.ts index f8be43bb..dc84dcf1 100644 --- a/src/frontend/src/features/rooms/utils/generateRoomId.ts +++ b/src/frontend/src/features/rooms/utils/generateRoomId.ts @@ -1,5 +1,27 @@ -import { slugify } from '@/utils/slugify' + +const getRandomChar = () => { + // Google Meet uses only letters in a room identifier + const characters = 'abcdefghijklmnopqrstuvwxyz'; + const charactersLength = characters.length; + return characters.charAt(Math.floor(Math.random() * charactersLength)) +} + +const generateSegment = (length: number): string => { + let segment = ''; + for (let i = 0; i < length; i++) { + segment += getRandomChar(); + } + return segment; +}; export const generateRoomId = () => { - return slugify(crypto.randomUUID()) + // Generates a unique room identifier following the Google Meet format + const shortLength = 3; + const longLength = 4; + const parts = [ + generateSegment(shortLength), + generateSegment(longLength), + generateSegment(shortLength) + ]; + return parts.join('-'); }