-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
49 changed files
with
1,486 additions
and
217 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
export const isImageFile = (file: File) => { | ||
// photoshop files begin with 'image/' | ||
return file.type.startsWith('image/') && !file.type.endsWith('.photoshop'); | ||
}; | ||
|
||
export const readBlobAsArrayBuffer = (blob: Blob): Promise<ArrayBuffer> => | ||
new Promise((resolve, reject) => { | ||
const fileReader = new FileReader(); | ||
fileReader.onload = () => { | ||
resolve(fileReader.result as ArrayBuffer); | ||
}; | ||
|
||
fileReader.onerror = () => { | ||
reject(fileReader.error); | ||
}; | ||
|
||
fileReader.readAsArrayBuffer(blob); | ||
}); | ||
|
||
export const createFileFromBlobs = ({ | ||
blobsArray, | ||
fileName, | ||
mimeType, | ||
}: { | ||
blobsArray: Blob[]; | ||
fileName: string; | ||
mimeType: string; | ||
}) => { | ||
const concatenatedBlob = new Blob(blobsArray, { type: mimeType }); | ||
return new File([concatenatedBlob], fileName, { | ||
type: concatenatedBlob.type, | ||
}); | ||
}; | ||
|
||
export const getExtensionFromMimeType = (mimeType: string) => { | ||
const match = mimeType.match(/\/([^/;]+)/); | ||
return match && match[1]; | ||
}; | ||
|
||
export const createUriFromBlob = (blob: Blob) => { | ||
return new Promise<string | ArrayBuffer | undefined>((resolve, reject) => { | ||
const reader = new FileReader(); | ||
reader.onload = (event) => { | ||
resolve(event.target?.result ?? undefined); | ||
}; | ||
reader.onerror = (e) => reject(e); | ||
reader.readAsDataURL(blob); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export const formatDuration = (durationInSeconds?: number) => { | ||
if (durationInSeconds === undefined || durationInSeconds <= 0) return '00:00'; | ||
|
||
const [hours, hoursLeftover] = divMod(durationInSeconds, 3600); | ||
const [minutes, seconds] = divMod(hoursLeftover, 60); | ||
const roundedSeconds = Math.ceil(seconds); | ||
|
||
const prependHrsZero = hours.toString().length === 1 ? '0' : ''; | ||
const prependMinZero = minutes.toString().length === 1 ? '0' : ''; | ||
const prependSecZero = roundedSeconds.toString().length === 1 ? '0' : ''; | ||
const minSec = `${prependMinZero}${minutes}:${prependSecZero}${roundedSeconds}`; | ||
|
||
return hours ? `${prependHrsZero}${hours}:` + minSec : minSec; | ||
}; | ||
|
||
const divMod = (num: number, divisor: number) => { | ||
return [Math.floor(num / divisor), num % divisor]; | ||
}; |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...holder/icon-placeholder.component.spec.ts → ...holder/icon-placeholder.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...placeholder/icon-placeholder.component.ts → ...placeholder/icon-placeholder.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.