Started work on queueEntries for active livestreams.
This commit is contained in:
parent
a927b31919
commit
afa57e8080
4 changed files with 227 additions and 79 deletions
|
|
@ -99,6 +99,63 @@ class canopyUXUtils{
|
|||
return outString;
|
||||
}
|
||||
|
||||
humieFriendlyDuration(seconds){
|
||||
//If we have an invalid duration
|
||||
if(seconds <= 0){
|
||||
//bitch, moan, and complain!
|
||||
return('Invalid input duration');
|
||||
}
|
||||
|
||||
//Create an empty array to hold the time strings
|
||||
const timeStrings = [];
|
||||
|
||||
//Pull hours from time
|
||||
const hours = Math.floor(seconds / 3600);
|
||||
//Remove recorded hours
|
||||
seconds -= hours * 3600;
|
||||
|
||||
//Pull minutes from time
|
||||
const minutes = Math.floor(seconds / 60);
|
||||
//Remove recorded minutes
|
||||
seconds -= minutes * 60;
|
||||
|
||||
//If we have an hour
|
||||
if(hours == 1){
|
||||
//Add the string
|
||||
timeStrings.push('1 Hour');
|
||||
//If we have hours
|
||||
}else if(hours > 0){
|
||||
//Add the string
|
||||
timeStrings.push(`${hours} Hours`);
|
||||
}
|
||||
|
||||
//If we have a minute
|
||||
if(minutes == 1){
|
||||
//Add the string
|
||||
timeStrings.push('1 Minute');
|
||||
//If we have minutes
|
||||
}else if(minutes > 0){
|
||||
//Add the string
|
||||
timeStrings.push(`${minutes} Minutes`);
|
||||
}
|
||||
|
||||
//Add the 'and ' if we need it
|
||||
const secondsPrefix = timeStrings.length > 0 ? 'and ' : '';
|
||||
|
||||
//If we have a second
|
||||
if(seconds == 1){
|
||||
//Add the string
|
||||
timeStrings.push(`${secondsPrefix}1 Second`);
|
||||
//If we have more than a second
|
||||
}else if(seconds > 1){
|
||||
//Add the string
|
||||
timeStrings.push(`${secondsPrefix}${Math.round(seconds)} Seconds`);
|
||||
}
|
||||
|
||||
//Join the time strings together
|
||||
return timeStrings.join(', ');
|
||||
}
|
||||
|
||||
//Update this and popup class to use nodes
|
||||
//and display multiple errors in one popup
|
||||
displayResponseError(body){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue