diff --git a/src/api/types/messages.ts b/src/api/types/messages.ts index e5ff6896d..d6a3da8a2 100644 --- a/src/api/types/messages.ts +++ b/src/api/types/messages.ts @@ -288,7 +288,7 @@ export type ApiReplyKeyboard = { [K in 'inlineButtons' | 'keyboardButtons']?: ApiKeyboardButtons; }; -export type ApiMessageSearchType = 'text' | 'media' | 'documents' | 'links' | 'audio' | 'profilePhoto'; +export type ApiMessageSearchType = 'text' | 'media' | 'documents' | 'links' | 'audio' | 'voice' | 'profilePhoto'; export type ApiGlobalMessageSearchType = 'text' | 'media' | 'documents' | 'links' | 'audio' | 'voice'; export type ApiReportReason = 'spam' | 'violence' | 'pornography' | 'childAbuse' diff --git a/src/components/common/Audio.tsx b/src/components/common/Audio.tsx index fe0cafdd9..cf0beb5e8 100644 --- a/src/components/common/Audio.tsx +++ b/src/components/common/Audio.tsx @@ -279,7 +279,7 @@ const Audio: FC = ({ const contentClassName = buildClassName('content', withSeekline && 'with-seekline'); - function renderSearchResult() { + function renderWithTitle() { return ( <>
@@ -355,12 +355,13 @@ const Audio: FC = ({ )} - {origin === AudioOrigin.Search && renderSearchResult()} + {origin === AudioOrigin.Search && renderWithTitle()} {origin !== AudioOrigin.Search && audio && renderAudio( lang, audio, duration, isPlaying, playProgress, bufferedProgress, seekerRef, (isDownloadStarted || isUploading), date, transferProgress, onDateClick ? handleDateClick : undefined, )} - {origin !== AudioOrigin.Search && voice && renderVoice(voice, renderedWaveform, playProgress, isMediaUnread)} + {origin === AudioOrigin.SharedMedia && voice && renderWithTitle()} + {origin === AudioOrigin.Inline && voice && renderVoice(voice, renderedWaveform, playProgress, isMediaUnread)}
); }; diff --git a/src/components/right/Profile.scss b/src/components/right/Profile.scss index b4255d2bf..f3f2ed93b 100644 --- a/src/components/right/Profile.scss +++ b/src/components/right/Profile.scss @@ -57,7 +57,7 @@ z-index: 1; .Tab { - padding: 1rem .25rem; + padding: 1rem .75rem; i { bottom: -1rem; } @@ -105,7 +105,8 @@ } } - &.audio-list { + &.audio-list, + &.voice-list { padding: 1.25rem; & .Audio { diff --git a/src/components/right/Profile.tsx b/src/components/right/Profile.tsx index 71bbd507b..da843c834 100644 --- a/src/components/right/Profile.tsx +++ b/src/components/right/Profile.tsx @@ -7,7 +7,7 @@ import { ApiMessage, ApiChatMember, ApiUser, - MAIN_THREAD_ID, + MAIN_THREAD_ID, ApiChat, } from '../../api/types'; import { GlobalActions } from '../../global/types'; import { @@ -33,6 +33,7 @@ import { } from '../../modules/selectors'; import { pick } from '../../util/iteratees'; import { captureEvents, SwipeDirection } from '../../util/captureEvents'; +import { getSenderName } from '../left/search/helpers/getSenderName'; import useCacheBuster from '../../hooks/useCacheBuster'; import useProfileViewportIds from './hooks/useProfileViewportIds'; import useProfileState from './hooks/useProfileState'; @@ -78,7 +79,8 @@ type StateProps = { canAddMembers?: boolean; canDeleteMembers?: boolean; members?: ApiChatMember[]; - usersById?: Record; + chatsById: Record; + usersById: Record; isRightColumnShown: boolean; isRestricted?: boolean; lastSyncTime?: number; @@ -95,6 +97,7 @@ const TABS = [ { type: 'documents', title: 'SharedFilesTab2' }, { type: 'links', title: 'SharedLinksTab2' }, { type: 'audio', title: 'SharedMusicTab2' }, + { type: 'voice', title: 'SharedVoiceTab2' }, ]; const HIDDEN_RENDER_DELAY = 1000; @@ -116,6 +119,7 @@ const Profile: FC = ({ canDeleteMembers, members, usersById, + chatsById, isRightColumnShown, isRestricted, lastSyncTime, @@ -272,6 +276,7 @@ const Profile: FC = ({ case 'links': text = lang('lng_media_link_empty_search'); break; + case 'voice': case 'audio': text = lang('lng_media_song_empty_search'); break; @@ -333,6 +338,21 @@ const Profile: FC = ({ onDateClick={handleMessageFocus} /> )) + ) : resultType === 'voice' ? ( + viewportIds!.map((id) => chatMessages[id] && ( +