From 7ab44d9ffe0e38e2c05b867302dc4eb84324707a Mon Sep 17 00:00:00 2001 From: Allison Shultes Date: Mon, 17 May 2021 10:59:37 +0100 Subject: [PATCH] refactor(transcripts): #230 Update Workspace index --- src/Components/Workspace/index.js | 12 +----------- src/Util/time/index.js | 13 ++++++++++++- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/Components/Workspace/index.js b/src/Components/Workspace/index.js index d01db3bc..9fd32827 100644 --- a/src/Components/Workspace/index.js +++ b/src/Components/Workspace/index.js @@ -22,6 +22,7 @@ import { formReducer, incrementCopyName, initialFormState, } from '../../Util/fo import { createCollectionItem, createOrUpdateCollectionItem, deleteCollectionItem, handleDeleteItem, handleDuplicateItem, updateCollectionItem, updateItems } from '../../Util/collection'; +import { formatDuration } from '../../Util/time'; const WorkspaceView = props => { const UPLOADFOLDER = 'uploads'; @@ -284,17 +285,6 @@ const WorkspaceView = props => { // general - const formatDuration = async (duration) => { - const seconds = Number(duration); - const m = Math.floor((seconds % 3600) / 60); - const s = Math.floor(seconds % 60); - - const mDisplay = m > 0 ? m + (m === 1 ? ' min ' : ' mins ') : ''; - const sDisplay = s > 0 ? s + (s === 1 ? ' s' : ' s') : ''; - - return mDisplay + sDisplay; - }; - const finishCreateOrUpdateTranscript = async (transcript, duration, video) => { video.remove(); const file = transcript.file; diff --git a/src/Util/time/index.js b/src/Util/time/index.js index ef7901e9..0bfb6354 100644 --- a/src/Util/time/index.js +++ b/src/Util/time/index.js @@ -55,4 +55,15 @@ const formatDates = (item) => { }; -export { ToHumanReadable, ToDhmsCompact, getISOTime, updateDescOrder, formatDates }; +const formatDuration = async (duration) => { + const seconds = Number(duration); + const m = Math.floor((seconds % 3600) / 60); + const s = Math.floor(seconds % 60); + + const mDisplay = m > 0 ? m + (m === 1 ? ' min ' : ' mins ') : ''; + const sDisplay = s > 0 ? s + (s === 1 ? ' s' : ' s') : ''; + + return mDisplay + sDisplay; +}; + +export { ToHumanReadable, ToDhmsCompact, getISOTime, updateDescOrder, formatDates, formatDuration };