mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-10 04:01:37 +02:00
Add queue output, various bug fixes
This commit is contained in:
parent
0357373123
commit
7f39642c49
8 changed files with 123 additions and 24 deletions
15
src/utils/get-progress-bar.ts
Normal file
15
src/utils/get-progress-bar.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
export default (width: number, progress: number): string => {
|
||||
const dotPosition = Math.floor(width * progress);
|
||||
|
||||
let res = '';
|
||||
|
||||
for (let i = 0; i < width; i++) {
|
||||
if (i === dotPosition) {
|
||||
res += '🔘';
|
||||
} else {
|
||||
res += '▬';
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
15
src/utils/time.ts
Normal file
15
src/utils/time.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
export const prettyTime = (seconds: number): string => {
|
||||
const nSeconds = seconds % 60;
|
||||
const nMinutes = Math.floor(seconds / 60);
|
||||
const nHours = Math.floor(nMinutes / 60);
|
||||
|
||||
let res = '';
|
||||
|
||||
if (nHours !== 0) {
|
||||
res += `${Math.round(nHours).toString().padStart(2, '0')}:`;
|
||||
}
|
||||
|
||||
res += `${Math.round(nMinutes).toString().padStart(2, '0')}:${Math.round(nSeconds).toString().padStart(2, '0')}`;
|
||||
|
||||
return res;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue