Skip to content

Commit 4474abf

Browse files
Make size of countdown window be based on number of buttons
1 parent ac2e546 commit 4474abf

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

app/main/lib/breaks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,9 @@ export function scheduleNextBreak(isPostpone = false): void {
154154
: settings.breakFrequencySeconds;
155155

156156
breakTime = moment().add(seconds, "seconds");
157-
157+
158158
log.info(
159-
`Scheduling next break [isPostpone=${isPostpone}] [seconds=${seconds}] [postponeLength=${settings.postponeLengthSeconds}] [frequency=${settings.breakFrequencySeconds}] [scheduledFor=${breakTime.format('HH:mm:ss')}]`,
159+
`Scheduling next break [isPostpone=${isPostpone}] [seconds=${seconds}] [postponeLength=${settings.postponeLengthSeconds}] [frequency=${settings.breakFrequencySeconds}] [scheduledFor=${breakTime.format("HH:mm:ss")}]`,
160160
);
161161

162162
buildTray();

app/main/lib/windows.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { app, BrowserWindow, screen } from "electron";
22
import log from "electron-log";
33
import path from "path";
44
import { endPopupBreak } from "./breaks";
5+
import { getSettings } from "./store";
56

67
let settingsWindow: BrowserWindow | null = null;
78
let soundsWindow: BrowserWindow | null = null;
@@ -97,10 +98,17 @@ export function createSoundsWindow(): void {
9798
}
9899

99100
export function createBreakWindows(): void {
101+
const settings = getSettings();
102+
103+
let buttonCount = 1;
104+
if (settings.postponeBreakEnabled) buttonCount++;
105+
if (settings.skipBreakEnabled) buttonCount++;
106+
107+
const notificationWidth = 450 + (buttonCount - 1) * 50;
108+
100109
const displays = screen.getAllDisplays();
101110
for (let windowIndex = 0; windowIndex < displays.length; windowIndex++) {
102111
const display = displays[windowIndex];
103-
const notificationWidth = 500;
104112
const notificationHeight = 80;
105113
const breakWindow = new BrowserWindow({
106114
show: false,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export function BreakNotification({
6262

6363
const secondsRemaining = Math.ceil(msRemaining / 1000);
6464
const progressValue =
65-
phase === "countdown" ? ((120000 - msRemaining) / 60000) * 100 : 0;
65+
phase === "countdown" ? ((60000 - msRemaining) / 60000) * 100 : 0;
6666

6767
return (
6868
<motion.div

0 commit comments

Comments
 (0)