Skip to content

Commit

Permalink
added a message to tell the user to take a break if the chronometer i…
Browse files Browse the repository at this point in the history
…s > 12h
  • Loading branch information
Didiloy committed Jan 13, 2025
1 parent 7512f73 commit baaa853
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
18 changes: 18 additions & 0 deletions src/renderer/src/components/TitleBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
</div>
</div>
</div>
<Toast />
</div>
</template>
<script setup>
Expand All @@ -101,6 +102,10 @@ import InputText from "primevue/inputtext";
import { useSearchStore, useSearchTeamStore } from "../store/store";
import { useTotalTime } from "../composables/total_time";
const { total_time_hours, calculateTotalTime } = useTotalTime();
import { useToast } from "primevue/usetoast";
const toast = useToast();
import { useI18n } from "vue-i18n";
const i18n = useI18n();
const icon = ref(BaseIcon);
Expand Down Expand Up @@ -146,12 +151,25 @@ const duration_seconds = ref(0);
const is_chrono_running = ref(false);
const background_color = ref("var(--primary-500)");
const last_chrono_value = ref(getPreferences("last_chronometer_value"));
const twelve_hours_in_second = 12 * 60 * 60;
let take_a_break_not_shown = true;
setInterval(() => {
if (is_chrono_running.value) {
duration_seconds.value =
(Date.now() - timestamp_start_chrono.value) / 1000 +
chrono_before_pause.value;
if (
duration_seconds.value > twelve_hours_in_second &&
take_a_break_not_shown
) {
toast.add({
severity: "info",
summary: "",
detail: i18n.t("TitleBar.take_a_break"),
});
take_a_break_not_shown = false;
}
}
}, 1000);
Expand Down
6 changes: 4 additions & 2 deletions src/renderer/src/i18n/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"error_loading_data": "Erreur lors du chargement des données: "
},
"TitleBar": {
"last_chronometer_value": "Clic gauche pour démarrer/stopper et clic droit pour mettre en pause. Dernière valeur du chronomètre: "
"last_chronometer_value": "Clic gauche pour démarrer/stopper et clic droit pour mettre en pause. Dernière valeur du chronomètre: ",
"take_a_break": "Cela fait longtemps depuis le début de la session. Tu devrais penser a faire une pause"
},
"Sidebar": {
"version": "Version",
Expand Down Expand Up @@ -389,7 +390,8 @@
"error_loading_data": "Error loading data: "
},
"TitleBar": {
"last_chronometer_value": "Left click to start/stop and right click to pause. Last value of the chronometer: "
"last_chronometer_value": "Left click to start/stop and right click to pause. Last value of the chronometer: ",
"take_a_break": "It's been long since you started. You should consider taking a break"
},
"Sidebar": {
"version": "Version",
Expand Down

0 comments on commit baaa853

Please sign in to comment.