mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
feat(focus-mode): show coffee cup icon during breaks
Display the free_breakfast icon in the header focus button when a break is active, along with the remaining break time and progress circle. Closes #5957
This commit is contained in:
parent
cc5063a0d3
commit
b2be64ef7b
2 changed files with 13 additions and 4 deletions
|
|
@ -14,7 +14,11 @@
|
|||
(contextmenu)="openFocusSessionDialog(); $event.preventDefault()"
|
||||
(longPress)="openFocusSessionDialog()"
|
||||
>
|
||||
<mat-icon>center_focus_strong</mat-icon>
|
||||
@if (isBreakActive()) {
|
||||
<mat-icon>free_breakfast</mat-icon>
|
||||
} @else {
|
||||
<mat-icon>center_focus_strong</mat-icon>
|
||||
}
|
||||
</button>
|
||||
|
||||
@if (runningTimeMs(); as runningMs) {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ export class FocusButtonComponent {
|
|||
});
|
||||
|
||||
readonly isSessionRunning = this.focusModeService.isSessionRunning;
|
||||
readonly isBreakActive = this.focusModeService.isBreakActive;
|
||||
readonly progress = this.focusModeService.progress;
|
||||
readonly mode = this.focusModeService.mode;
|
||||
readonly FocusModeMode = FocusModeMode;
|
||||
|
|
@ -62,7 +63,9 @@ export class FocusButtonComponent {
|
|||
return shortcut ? ` [${shortcut}]` : '';
|
||||
});
|
||||
|
||||
readonly circleVisible = computed(() => this.isSessionRunning());
|
||||
readonly circleVisible = computed(
|
||||
() => this.isSessionRunning() || this.isBreakActive(),
|
||||
);
|
||||
|
||||
readonly isCountdownMode = computed(() => {
|
||||
const mode = this.mode();
|
||||
|
|
@ -73,7 +76,8 @@ export class FocusButtonComponent {
|
|||
if (!this.circleVisible()) {
|
||||
return null;
|
||||
}
|
||||
if (this.isCountdownMode()) {
|
||||
// Show progress for both work sessions and breaks in countdown modes
|
||||
if (this.isCountdownMode() || this.isBreakActive()) {
|
||||
const progress = this.progress();
|
||||
return typeof progress === 'number' ? Math.min(100, Math.max(0, progress)) : 0;
|
||||
}
|
||||
|
|
@ -90,7 +94,8 @@ export class FocusButtonComponent {
|
|||
if (!this.circleVisible()) {
|
||||
return null;
|
||||
}
|
||||
if (this.isCountdownMode()) {
|
||||
// Breaks always use countdown
|
||||
if (this.isBreakActive() || this.isCountdownMode()) {
|
||||
const remaining = this.focusModeService.timeRemaining();
|
||||
return typeof remaining === 'number' ? Math.max(0, remaining) : 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue