diff options
author | James Hu <51237606+jameshu111@users.noreply.github.com> | 2023-07-26 12:15:46 -0400 |
---|---|---|
committer | James Hu <51237606+jameshu111@users.noreply.github.com> | 2023-07-26 12:15:46 -0400 |
commit | 4a8cf5ee3fd6f01ff2d28ccc0a456e9782bd261b (patch) | |
tree | a1a4ac7200a38f55227fff941d8d7246cb85eebf /src/Utils.ts | |
parent | 7c1017f15b9c0ad09d3e0185e310733ab7c10c09 (diff) | |
parent | c87024c06941920f1df689d54d82cc309891e3d2 (diff) |
Merge branch 'master' into james-azure-image
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(); |