diff --git a/src/components/Chatbox.css b/src/components/Chatbox.css index bf69b7a..a1f973e 100644 --- a/src/components/Chatbox.css +++ b/src/components/Chatbox.css @@ -9,20 +9,6 @@ ion-textarea { margin: 0; } -.input-card-row { - position: fixed; - width: 100%; -} - -.input-card-col { - margin: 0; - border-top: solid 1px #999; -} - -.input-card-content { - padding: 0; -} - .send-msg { align-items: center; justify-content: center; @@ -33,6 +19,23 @@ ion-textarea { width: 100%; } -.text-area { +.message-input { height: 100%; + border: 1px solid #999; + border-radius: 5px; +} + +@media (max-width: 576px) { + .message-input { + border-radius: 10px; + height: 35px; + } + + .send-msg { + display: none; + } + + .native-input.sc-ion-input-ios { + padding-inline-start: 5px; + } } diff --git a/src/components/Chatbox.tsx b/src/components/Chatbox.tsx index 0c637cd..782a66b 100644 --- a/src/components/Chatbox.tsx +++ b/src/components/Chatbox.tsx @@ -1,4 +1,4 @@ -import { IonButton, IonCard, IonCardContent, IonCol, IonRow, IonTextarea } from '@ionic/react'; +import { IonButton, IonCard, IonCol, IonFooter, IonInput, IonRow } from '@ionic/react'; import React, { useState } from 'react'; import { db, timestamp } from '../services/firebase'; import './Chatbox.css'; @@ -14,40 +14,47 @@ const Chat: React.FC = ({ roomId, userId }) => { // Send message to database const sendMessage = async () => { - await db.collection('rooms').doc(roomId).collection('messages').add({ - createdAt: timestamp, - senderId: userId, - content: message, - type: 'user', - }); + if (message !== '') { + await db.collection('rooms').doc(roomId).collection('messages').add({ + createdAt: timestamp, + senderId: userId, + content: message, + type: 'user', + }); + } // Reset textarea field setMessage(''); }; + const onEnter = (e: React.KeyboardEvent) => { + if (e.key === 'Enter') { + sendMessage(); + } + }; + return ( - - - - - - setMessage(e.detail.value!)} - value={message} - class="textarea" - > - - - - Send - - - - - - + + + + setMessage(e.detail.value!)} + onKeyDown={(e) => onEnter(e)} + value={message} + placeholder="Send message" + enterkeyhint="send" + class="message-input" + > + + + + Send + + + + ); }; diff --git a/src/components/Messages.tsx b/src/components/Messages.tsx index 8f7e303..4805acb 100644 --- a/src/components/Messages.tsx +++ b/src/components/Messages.tsx @@ -1,4 +1,4 @@ -import { IonCol, IonContent, IonGrid, IonRow } from '@ionic/react'; +import { IonCol, IonGrid, IonRow, IonContent } from '@ionic/react'; import React, { useEffect, useState } from 'react'; import { currTime, db } from '../services/firebase'; import './Messages.css'; diff --git a/src/components/VideoPlayer.tsx b/src/components/VideoPlayer.tsx index 7a003ff..d2f55bb 100644 --- a/src/components/VideoPlayer.tsx +++ b/src/components/VideoPlayer.tsx @@ -111,6 +111,13 @@ const VideoPlayer: React.FC = ({ ownerId, userId, roomId }) => onPause={onPause} playing={playing} muted={true} + config={{ + youtube: { + playerVars: { + showinfo: 1, // Keeps mute/full screen controls at bottom for iOS + }, + }, + }} > ); };