Skip to content

Commit

Permalink
refactor(transcripts): #230 Update Workspace index
Browse files Browse the repository at this point in the history
  • Loading branch information
allishultes committed May 17, 2021
1 parent bd6464f commit 7ab44d9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
12 changes: 1 addition & 11 deletions src/Components/Workspace/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down
13 changes: 12 additions & 1 deletion src/Util/time/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };

0 comments on commit 7ab44d9

Please sign in to comment.