@@ -20,13 +20,13 @@ import MessageDeleteDialog from '@/components/UI/MessageDeleteDialog';
2020import MessageContextMenu from '@/components/UI/MessageContextMenu' ;
2121import ChatIcon from '@/components/UI/ChatIcon' ;
2222import ChatRoomContextMenu from '@/components/UI/ChatRoomContextMenu' ;
23- import { VoipButton , VoipControlBar } from '@/components/Voip' ;
23+ import { VoipButton } from '@/components/Voip' ;
24+ import { Mic , Send , Bell , BellOff , Volume2 , VolumeX , Trash2 , Image , Paperclip , Share2 , Square , X } from 'lucide-react' ;
25+ import AudioPlayer from '@/components/UI/AudioPlayer' ;
2426import { api , API_ENDPOINTS } from '@/utils/api' ;
2527import { toast } from 'react-hot-toast' ;
2628import { getAnonymousModeState , saveAnonymousModeState , getLastAnonymousName } from '@/utils/anonymousStorage' ;
2729import { analyzeImageBrightness , getTextColorClass } from '@/utils/imageBrightness' ;
28- import AudioPlayer from '@/components/UI/AudioPlayer' ;
29- import { Mic , Square , Send , X , Trash2 , Image , Paperclip , Share2 , Bell , BellOff } from 'lucide-react' ;
3030
3131interface Message {
3232 id : string ;
@@ -177,8 +177,9 @@ const ChatRoomContainer: React.FC<ChatRoomContainerProps> = ({
177177 const [ mentionUsers , setMentionUsers ] = useState < Array < { id : string , username : string } > > ( [ ] ) ;
178178 const [ showMentionDropdown , setShowMentionDropdown ] = useState ( false ) ;
179179 const [ mentionSearch , setMentionSearch ] = useState ( '' ) ;
180- const [ selectedMentionIndex , setSelectedMentionIndex ] = useState ( 0 ) ;
180+ const [ selectedMentionIndex , setSelectedMentionIndex ] = useState ( 0 ) ; // State for mention selection
181181 const [ mentionCursorPosition , setMentionCursorPosition ] = useState ( 0 ) ;
182+ const [ hiddenMessageIds , setHiddenMessageIds ] = useState < string [ ] > ( [ ] ) ;
182183
183184 // Debounced global search for mentions
184185 useEffect ( ( ) => {
@@ -802,7 +803,7 @@ const ChatRoomContainer: React.FC<ChatRoomContainerProps> = ({
802803 }
803804
804805 const response = await api . post ( API_ENDPOINTS . CHAT_ROOMS . SEND_MESSAGE ( room . id ) , {
805- content : messageInput . trim ( ) || ( selectedGifUrl ? '[GIF]' : '' ) || ( audioBlob ? ( t ( 'voip.audioMessage' ) || 'Voice Message' ) : '' ) || ( attachments . length > 0 ? '[Attachment]' : '' ) ,
806+ content : messageInput . trim ( ) ,
806807 message_type : messageType ,
807808 gif_url : selectedGifUrl ,
808809 attachments : attachments . length > 0 ? attachments : undefined ,
@@ -1082,7 +1083,7 @@ const ChatRoomContainer: React.FC<ChatRoomContainerProps> = ({
10821083 < p > { t ( 'chat.noMessages' ) } </ p >
10831084 </ div >
10841085 ) : (
1085- messages . map ( message => (
1086+ messages . filter ( m => ! hiddenMessageIds . includes ( m . id ) ) . map ( message => (
10861087 < div
10871088 key = { message . id }
10881089 className = "flex gap-3"
@@ -1221,6 +1222,15 @@ const ChatRoomContainer: React.FC<ChatRoomContainerProps> = ({
12211222 } }
12221223 />
12231224 ) ;
1225+ } else if ( attachment . type === 'audio' ) {
1226+ return (
1227+ < div key = { idx } className = "w-full max-w-md min-w-[200px]" >
1228+ < AudioPlayer
1229+ src = { attachment . url }
1230+ filename = { attachment . filename }
1231+ />
1232+ </ div >
1233+ ) ;
12241234 } else {
12251235 return (
12261236 < FileCard
@@ -1653,6 +1663,10 @@ const ChatRoomContainer: React.FC<ChatRoomContainerProps> = ({
16531663 x = { messageContextMenu . x }
16541664 y = { messageContextMenu . y }
16551665 onClose = { ( ) => setMessageContextMenu ( null ) }
1666+ onHide = { ( ) => {
1667+ setHiddenMessageIds ( prev => [ ...prev , messageContextMenu . messageId ] ) ;
1668+ setMessageContextMenu ( null ) ;
1669+ } }
16561670 onReportMessage = { ( messageId , userId , username ) => {
16571671 if ( userId && username ) {
16581672 handleReportUserFromMessage ( messageId , userId , username ) ;
0 commit comments