diff options
author | Sophie Zhang <sophie_zhang@brown.edu> | 2023-07-18 12:21:17 -0400 |
---|---|---|
committer | Sophie Zhang <sophie_zhang@brown.edu> | 2023-07-18 12:21:17 -0400 |
commit | 8410cd330b676ce50948b2ec1011a72b219ee87b (patch) | |
tree | 2009a9cd1942cf9662786fdbc2b20c6f0713cb60 /src/Utils.ts | |
parent | 2bfad0eb9e3d8f8d26f66cf8e6daa801a694cab0 (diff) | |
parent | 4e1bc2547787e9b1978c23da2045eb46407e1e3c (diff) |
Merge branch 'master' into sophie-report-manager
Diffstat (limited to 'src/Utils.ts')
-rw-r--r-- | src/Utils.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/Utils.ts b/src/Utils.ts index 2e06b5631..e03632c8b 100644 --- a/src/Utils.ts +++ b/src/Utils.ts @@ -6,6 +6,7 @@ import { Socket } from 'socket.io'; import { Colors } from './client/views/global/globalEnums'; import { Message } from './server/Message'; import Color = require('color'); +import { DocumentType } from './client/documents/DocumentTypes'; export namespace Utils { export let CLICK_TIME = 300; @@ -15,6 +16,21 @@ export namespace Utils { return Date.now() - downTime < Utils.CLICK_TIME && Math.abs(x - downX) < Utils.DRAG_THRESHOLD && Math.abs(y - downY) < Utils.DRAG_THRESHOLD; } + export function cleanDocumentType(type: DocumentType) { + switch(type) { + case DocumentType.IMG: + return "Image" + case DocumentType.AUDIO: + return "Audio" + case DocumentType.COL: + return "Collection" + case DocumentType.RTF: + return "Text" + default: + return type.charAt(0).toUpperCase() + type.slice(1) + } + } + export function readUploadedFileAsText(inputFile: File) { const temporaryFileReader = new FileReader(); |