Skip to content

Commit 8dd8f2f

Browse files
Add seconds to break window progress
1 parent 2bc9987 commit 8dd8f2f

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

app/renderer/components/break/break-progress.tsx

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,30 @@ interface BreakProgressProps {
1616
sharedBreakEndTime?: number | null;
1717
}
1818

19+
function TimeDisplay({
20+
seconds,
21+
textColor,
22+
}: {
23+
seconds: number;
24+
textColor: string;
25+
}) {
26+
const minutes = Math.floor(seconds / 60);
27+
const remainingSeconds = seconds % 60;
28+
29+
return (
30+
<div
31+
className="text-sm font-medium opacity-60 flex-shrink-0 tabular-nums flex items-center gap-0.5"
32+
style={{ color: textColor }}
33+
>
34+
<span style={{ color: textColor }}>{minutes}</span>
35+
<span style={{ color: textColor }}>:</span>
36+
<span style={{ color: textColor }}>
37+
{String(remainingSeconds).padStart(2, "0")}
38+
</span>
39+
</div>
40+
);
41+
}
42+
1943
export function BreakProgress({
2044
breakMessage,
2145
breakTitle,
@@ -126,6 +150,12 @@ export function BreakProgress({
126150

127151
const progressPercentage = (progress || 0) * 100;
128152

153+
const elapsedSeconds =
154+
settings.breakLengthSeconds -
155+
(timeRemaining?.hours || 0) * 3600 -
156+
(timeRemaining?.minutes || 0) * 60 -
157+
Math.floor(timeRemaining?.seconds || 0);
158+
129159
return (
130160
<motion.div
131161
className="flex flex-col h-full w-full z-10 relative space-y-6"
@@ -162,8 +192,14 @@ export function BreakProgress({
162192
{breakMessage}
163193
</div>
164194

165-
{/* Progress bar */}
166-
<div className="w-full mt-3">
195+
<div className="w-full">
196+
<div className="flex justify-between items-center mb-2">
197+
<TimeDisplay seconds={elapsedSeconds} textColor={textColor} />
198+
<TimeDisplay
199+
seconds={settings.breakLengthSeconds}
200+
textColor={textColor}
201+
/>
202+
</div>
167203
<div
168204
className="w-full h-2 rounded-full overflow-hidden"
169205
style={{ backgroundColor: "rgba(255, 255, 255, 0.2)" }}

0 commit comments

Comments
 (0)