Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(file-sharing): added author display name (#16059)
Calinteodor392d69456336
diff --git a/react/features/file-sharing/components/web/FileSharing.tsx b/react/features/file-sharing/components/web/FileSharing.tsxindex daee00b7c8..72d9fc91fa 100644--- a/react/features/file-sharing/components/web/FileSharing.tsx+++ b/react/features/file-sharing/components/web/FileSharing.tsx@@ -4,6 +4,7 @@ import { useDispatch, useSelector } from 'react-redux';import { makeStyles } from 'tss-react/mui';import { IReduxState } from '../../../app/types';+import Avatar from '../../../base/avatar/components/Avatar';import { IconCloudUpload, IconDownload, IconTrash } from '../../../base/icons/svg';import Button from '../../../base/ui/components/web/Button';import { BUTTON_TYPES } from '../../../base/ui/constants.web';@@ -118,15 +119,29 @@ const useStyles = makeStyles()(theme => {whiteSpace: 'nowrap'},+ fileAuthorParticipant: {+ alignItems: 'center',+ display: 'inline-flex',+ gap: theme.spacing(1)+ },++ fileAuthorParticipantName: {+ ...theme.typography.labelBold,+ overflow: 'hidden',+ textOverflow: 'ellipsis',+ whiteSpace: 'nowrap'+ },+fileSize: {...theme.typography.labelRegular},fileTimestamp: {...theme.typography.labelRegular,- alignItems: 'center',display: 'flex',- textAlign: 'center'+ lineHeight: '1.2rem',+ marginTop: theme.spacing(1),+ textAlign: 'center',},hiddenInput: {@@ -151,7 +166,7 @@ const useStyles = makeStyles()(theme => {progressBar: {backgroundColor: theme.palette.ui03,borderRadius: theme.shape.borderRadius,- height: '4px',+ height: 4,overflow: 'hidden',width: '100%'},@@ -191,6 +206,7 @@ const FileSharing = () => {const { t } = useTranslation();const dispatch = useDispatch();const { files } = useSelector((state: IReduxState) => state['features/file-sharing']);+ const sortedFiles = Array.from(files.values()).sort((a, b) => a.fileName.localeCompare(b.fileName));const isModerator = useSelector(isLocalParticipantModerator);const handleDragEnter = useCallback((e: React.DragEvent) => {@@ -264,82 +280,103 @@ const FileSharing = () => {ref = { fileInputRef }type = 'file' /></div>- { files.size === 0 && (- <div className = { classes.noFilesContainer }>- <Icon- className = { classes.uploadIcon }- color = { BaseTheme.palette.icon03 }- size = { 160 }- src = { IconCloudUpload } />- <span className = { classes.noFilesText }>- { t('fileSharing.dragAndDrop') }- </span>- </div>- ) }+ {+ sortedFiles.length === 0 && (+ <div className = { classes.noFilesContainer }>+ <Icon+ className = { classes.uploadIcon }+ color = { BaseTheme.palette.icon03 }+ size = { 160 }+ src = { IconCloudUpload } />+ <span className = { classes.noFilesText }>+ { t('fileSharing.dragAndDrop') }+ </span>+ </div>+ )+ }</>)}- { files.size > 0 && (- <div className = { classes.fileList }>- { Array.from(files.entries()).sort((a, b) => a[1].fileName.localeCompare(b[1].fileName)).map(([ fileId, file ]) => (- <div- className = { classes.fileItem }- key = { fileId }- title = { file.fileName }>- { (file.progress ?? 100) === 100 && (- <>- <div className = { classes.fileIconContainer }>- <Icon- color = { BaseTheme.palette.icon01 }- size = { 64 }- src = { getFileIcon(file.fileType) } />- </div>- <div className = { classes.fileItemDetails }>- <div className = { classes.fileName }>- { file.fileName }- </div>- <div className = { classes.fileSize }>- { formatFileSize(file.fileSize) }- </div>- </div>- <div className = { `${classes.fileTimestamp} timestampVisibility` }>- <pre>- { formatTimestamp(file.timestamp) }- </pre>- </div>- <div className = { classes.buttonContainer }>- <Icon- className = { `${classes.actionIcon} actionIconVisibility` }- color = { BaseTheme.palette.icon01 }-- // eslint-disable-next-line react/jsx-no-bind- onClick = { () => dispatch(downloadFile(file.fileId)) }- size = { 24 }- src = { IconDownload } />- { isModerator && (- <Icon- className = { `${classes.actionIcon} actionIconVisibility` }- color = { BaseTheme.palette.icon01 }-- // eslint-disable-next-line react/jsx-no-bind- onClick = { () => dispatch(removeFile(file.fileId)) }- size = { 24 }- src = { IconTrash } />- ) }- </div>- </>- ) }- { (file.progress ?? 100) < 100 && (- <div className = { classes.progressBar }>- <div- className = { classes.progressFill }- style = {{ width: `${file.progress}%` }} />+ {+ sortedFiles.length > 0 && (+ <div className = { classes.fileList }>+ {+ sortedFiles.map(file => (+ <div+ className = { classes.fileItem }+ key = { file.fileId }+ title = { file.fileName }>+ {+ (file.progress ?? 100) === 100 && (+ <>+ <div className = { classes.fileIconContainer }>+ <Icon+ color = { BaseTheme.palette.icon01 }+ size = { 64 }+ src = { getFileIcon(file.fileType) } />+ </div>+ <div className = { classes.fileItemDetails }>+ <div className = { classes.fileName }>+ { file.fileName }+ </div>+ <div className = { classes.fileSize }>+ { formatFileSize(file.fileSize) }+ </div>+ <div className = { classes.fileAuthorParticipant }>+ <Avatar+ displayName = { file.authorParticipantName }+ participantId = { file.authorParticipantId }+ size = { 16 } />+ <div className = { classes.fileAuthorParticipantName }>+ { file.authorParticipantName }+ </div>+ </div>+ </div>+ <div className = { `${classes.fileTimestamp} timestampVisibility` }>+ <pre>+ { formatTimestamp(file.timestamp) }+ </pre>+ </div>+ <div className = { classes.buttonContainer }>+ <Icon+ className = { `${classes.actionIcon} actionIconVisibility` }+ color = { BaseTheme.palette.icon01 }++ // eslint-disable-next-line react/jsx-no-bind+ onClick = { () => dispatch(downloadFile(file.fileId)) }+ size = { 24 }+ src = { IconDownload } />+ {+ isModerator && (+ <Icon+ className = { `${classes.actionIcon} actionIconVisibility` }+ color = { BaseTheme.palette.icon01 }++ // eslint-disable-next-line react/jsx-no-bind+ onClick = { () => dispatch(removeFile(file.fileId)) }+ size = { 24 }+ src = { IconTrash } />+ )+ }+ </div>+ </>+ )+ }+ {+ (file.progress ?? 100) < 100 && (+ <div className = { classes.progressBar }>+ <div+ className = { classes.progressFill }+ style = {{ width: `${file.progress}%` }} />+ </div>+ )+ }</div>- ) }- </div>- )) }- </div>- )}+ ))+ }+ </div>+ )+ }{isModerator && (<Buttondiff --git a/react/features/file-sharing/middleware.web.ts b/react/features/file-sharing/middleware.web.tsindex 269a5a4bab..ee2c22cb2f 100644--- a/react/features/file-sharing/middleware.web.ts+++ b/react/features/file-sharing/middleware.web.ts@@ -35,6 +35,7 @@ MiddlewareRegistry.register(store => next => action => {const jid = connection!.getJid();const fileId = uuidv4();const fileMetadata: IFileMetadata = {+ authorParticipantId: localParticipant!.id,authorParticipantJid: jid,authorParticipantName: getParticipantDisplayName(state, localParticipant!.id),conferenceFullName: roomJid ?? '',diff --git a/react/features/file-sharing/types.ts b/react/features/file-sharing/types.tsindex 308ea68184..1775f59e31 100644--- a/react/features/file-sharing/types.ts+++ b/react/features/file-sharing/types.ts@@ -1,4 +1,5 @@export interface IFileMetadata {+ authorParticipantId: string;authorParticipantJid: string;authorParticipantName: string;conferenceFullName: string;