From aaabd398f89833de807d89e2544b58574b964d4d Mon Sep 17 00:00:00 2001 From: Efrain Date: Sat, 11 Dec 2021 21:33:23 -0500 Subject: [PATCH] [CastIt.Server.ClientApp] Added a copy button --- .../src/components/file/file_item.tsx | 18 ++++++++++++++++-- .../ClientApp/src/services/translations.ts | 3 +++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CastIt.Server/ClientApp/src/components/file/file_item.tsx b/CastIt.Server/ClientApp/src/components/file/file_item.tsx index 89c7f669..ebe82556 100644 --- a/CastIt.Server/ClientApp/src/components/file/file_item.tsx +++ b/CastIt.Server/ClientApp/src/components/file/file_item.tsx @@ -15,7 +15,7 @@ import { } from '@material-ui/core'; import { IFileItemResponseDto } from '../../models'; import { onFileChanged, onFileEndReached, onPlayerStatusChanged } from '../../services/castithub.service'; -import { Add, ClearAll, Delete, Loop, PlayArrow, Refresh } from '@material-ui/icons'; +import { Add, ClearAll, Delete, FileCopy, Loop, PlayArrow, Refresh } from '@material-ui/icons'; import translations from '../../services/translations'; import AddFilesDialog from '../dialogs/add_files_dialog'; import { Draggable } from 'react-beautiful-dnd'; @@ -216,6 +216,16 @@ function FileItem(props: Props) { await castItHub.connection.removeAllMissingFiles(props.file.playListId); }; + const handleShowAddFilesDialog = (): void => { + handleCloseContextMenu(); + setShowAddFilesDialog(true); + }; + + const handleCopy = (): void => { + handleCloseContextMenu(); + navigator.clipboard.writeText(props.file.path); + }; + const title = ( {state.filename} @@ -287,10 +297,14 @@ function FileItem(props: Props) { {toggleLoopMenuItem} - setShowAddFilesDialog(true)}> + + + + + {/* TODO: REMOVE ALL SELECTED AND SELECT ALL */} diff --git a/CastIt.Server/ClientApp/src/services/translations.ts b/CastIt.Server/ClientApp/src/services/translations.ts index 2f08abf9..c34ec32d 100644 --- a/CastIt.Server/ClientApp/src/services/translations.ts +++ b/CastIt.Server/ClientApp/src/services/translations.ts @@ -92,6 +92,7 @@ interface ITranslations { connectionFailedMsg: string; retry: string; sort: string; + copyPath: string; errorCodes: IAppMessageTranslations; } @@ -166,6 +167,7 @@ const enTrans: ITranslations = { connectionFailedMsg: 'Connection failed. The server may not be running', retry: 'Retry', sort: 'Sort', + copyPath: 'Copy path', errorCodes: { unknownErrorOccurred: 'Unknown error occurred', invalidRequest: 'Invalid request', @@ -258,6 +260,7 @@ const esTrans: ITranslations = { connectionFailedMsg: 'La conexión falló. El servidor podria no estar ejecutandose', retry: 'Reintentar', sort: 'Ordenar', + copyPath: 'Copiar ruta', errorCodes: { unknownErrorOccurred: 'Un error inesperado ha ocurrido', invalidRequest: 'Petición no válida',