alpha
Login
or
Join now
flo-bit.dev
/
youtube-party-dj
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
[READ-ONLY] Mirror of https://github.com/flo-bit/youtube-party-dj. democratic youtube player, everyone can vote and add songs, uni project, made with uix
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
Added support for dark mode
author
Tobias Westphal
date
2 years ago
(Jun 29, 2024, 8:36 PM +0200)
commit
eaa38329
eaa383293f152866202a1cd7e7b12902a3e52ab6
parent
614f7edd
614f7edd55b9f69517120eea0bcc056274d21a66
+14
-15
2 changed files
Expand all
Collapse all
Unified
Split
common
helper.tsx
page.tsx
+11
common/helper.tsx
View file
Reviewed
···
1
1
+
export default function addDurations(duration1: string, duration2: string) {
2
2
+
const duration1Partitions = duration1.split(":").map(Number);
3
3
+
const duration2Partitions = duration2.split(":").map(Number);
4
4
+
const duration1Seconds = duration1Partitions[0] * 60 + duration1Partitions[1];
5
5
+
const duration2Seconds = duration2Partitions[0] * 60 + duration2Partitions[1];
6
6
+
const totalSeconds = duration1Seconds + duration2Seconds;
7
7
+
const minutes = Math.floor(totalSeconds / 60);
8
8
+
let seconds = totalSeconds % 60;
9
9
+
seconds = seconds < 10 ? "0" + seconds : seconds;
10
10
+
return `${minutes}:${seconds}`;
11
11
+
}
+3
-15
common/page.tsx
View file
Reviewed
···
4
4
import QRCodeOverlay from "./components/QRCodeOverlay.tsx";
5
5
import { getSessionUserHosts } from "backend/sessions.ts";
6
6
import { NowPlaying } from "./components/NowPlaying.tsx";
7
7
+
import addDurations from "./helper.tsx";
8
8
+
7
9
import ToggleThemeButton, {
8
10
loadInitialTheme,
9
11
} from "./components/ToggleThemeButton.tsx";
···
28
30
}
29
31
});
30
32
31
31
-
function addDurations(duration1, duration2) {
32
32
-
let duration1Partitions = duration1.split(":").map(Number);
33
33
-
let duration2Partitions = duration2.split(":").map(Number);
34
34
-
let duration1Seconds = duration1Partitions[0] * 60 + duration1Partitions[1];
35
35
-
let duration2Seconds = duration2Partitions[0] * 60 + duration2Partitions[1];
36
36
-
let totalSeconds = duration1Seconds + duration2Seconds;
37
37
-
let minutes = Math.floor(totalSeconds / 60);
38
38
-
let seconds = totalSeconds % 60;
39
39
-
seconds = seconds < 10 ? "0" + seconds : seconds;
40
40
-
return `${minutes}:${seconds}`;
41
41
-
}
42
42
-
43
33
const timeLeft = always(() => {
44
34
let timeCounter = "0:00";
45
35
session.queue.forEach((item) => {
···
49
39
});
50
40
51
41
loadInitialTheme();
52
52
-
53
53
-
window.timeLeft = timeLeft;
54
42
55
43
return (
56
44
<main class="w-screen h-screen relative bg-gray-50 dark:bg-gray-950">
···
71
59
</div>
72
60
73
61
{current}
74
74
-
<div class="px-4 py-4 border-t border-black dark:border-white/20 mx-0 overflow-y-scroll flex-grow">
62
62
+
<div class="px-4 py-4 border-t border-black dark:border-white/20 dark:text-white mx-0 overflow-y-scroll flex-grow">
75
63
{always(() =>
76
64
timeLeft.val !== "0:00" ? (
77
65
<p class="mb-4"> Queue will last for {timeLeft} </p>