File tree Expand file tree Collapse file tree
src/components/MessageComposer Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { QuotedMessagePreviewUI } from './QuotedMessagePreview' ;
33import type { LocalMessage } from 'stream-chat' ;
4+ import { useTranslationContext } from '../../context' ;
45
56export type EditedMessagePreviewProps = {
67 message : LocalMessage ;
@@ -10,6 +11,14 @@ export type EditedMessagePreviewProps = {
1011export const EditedMessagePreview = ( {
1112 message,
1213 onCancel,
13- } : EditedMessagePreviewProps ) => (
14- < QuotedMessagePreviewUI onRemove = { onCancel } quotedMessage = { message } />
15- ) ;
14+ } : EditedMessagePreviewProps ) => {
15+ const { t } = useTranslationContext ( ) ;
16+
17+ return (
18+ < QuotedMessagePreviewUI
19+ authorLabel = { t ( 'Edit Message' ) }
20+ onRemove = { onCancel }
21+ quotedMessage = { message }
22+ />
23+ ) ;
24+ } ;
Original file line number Diff line number Diff line change @@ -311,11 +311,15 @@ export const QuotedMessagePreview = ({
311311
312312type QuotedMessagePreviewUIProps = QuotedMessagePreviewProps & {
313313 quotedMessage : LocalMessageBase ;
314+ authorLabel ?: ReactNode ;
315+ className ?: string ;
314316 onClick ?: MouseEventHandler < HTMLDivElement > ;
315317 onRemove ?: ( ) => void ;
316318} ;
317319
318320export const QuotedMessagePreviewUI = ( {
321+ authorLabel,
322+ className,
319323 getQuotedMessageAuthor,
320324 onClick,
321325 onRemove,
@@ -412,7 +416,7 @@ export const QuotedMessagePreviewUI = ({
412416 return (
413417 < div
414418 aria-label = { isInteractive ? t ( 'aria/Jump to quoted message' ) : undefined }
415- className = { clsx ( 'str-chat__quoted-message-preview' , {
419+ className = { clsx ( 'str-chat__quoted-message-preview' , className , {
416420 'str-chat__quoted-message-preview--own' : isOwnMessage ,
417421 } ) }
418422 data-testid = 'quoted-message-preview'
@@ -424,11 +428,12 @@ export const QuotedMessagePreviewUI = ({
424428 < QuotedMessageIndicator isOwnMessage = { isOwnMessage } />
425429 < div className = 'str-chat__quoted-message-preview__content' >
426430 < div className = 'str-chat__quoted-message-preview__author' >
427- { isOwnMessage
428- ? t ( 'You' )
429- : authorName
430- ? t ( 'Reply to {{ authorName }}' , { authorName } )
431- : t ( 'Reply' ) }
431+ { authorLabel ??
432+ ( isOwnMessage
433+ ? t ( 'You' )
434+ : authorName
435+ ? t ( 'Reply to {{ authorName }}' , { authorName } )
436+ : t ( 'Reply' ) ) }
432437 </ div >
433438
434439 < div
You can’t perform that action at this time.
0 commit comments