diff --git a/.github/release-body.md b/.github/release-body.md index 405bf4c..f0880d6 100644 --- a/.github/release-body.md +++ b/.github/release-body.md @@ -1,19 +1,10 @@ -### 2022-12-19 +### 2022-12-20 ### Docs -+ readme updated, [8f763839c278f6ddbd7cc1a705c4cd89180ae371] - -* ### Features -+ implement start on boot setting, [56362f89167532b8f3e8f4205f65c11dd6f4d5e8] -+ add checks to database, [a1fbe972752e38ab5726f25eb35e1db6a46c41e5] -+ tooltip on close/minimize button, [a12838d6305ba472949a6a4ef76ac19105ee3d2c], [debc23fb74fa280dc980028cdb86dc956da5be50] - -### Fixes -+ only write logs on file on debug mode, [836052deff23102d75aa774c7e0ae7d5f4abb04e] ++ readme screenshot updated, [911a529440a1d20012912aba8be4d5334f3385b3] ### Refactors -+ remove tick method, use an Instant in ApplicationState, [bc948aab49f8c1ce7fee8ddf8de7069d93552884] -+ exit request match simplified, [ce9b407aedce708b16087dd7d10d1eff80680c6b] ++ tick process in application state, [dce8cae18f8359f21ffdbc5c3bb6aa28b0a8303a], [b9fdb6a37020894d57470586b7f58adc94628523] see CHANGELOG.md for more details diff --git a/.github/screenshot_01.png b/.github/screenshot_01.png index c33d423..8f7fb3a 100644 Binary files a/.github/screenshot_01.png and b/.github/screenshot_01.png differ diff --git a/.github/screenshot_03.png b/.github/screenshot_03.png new file mode 100644 index 0000000..0ef6aef Binary files /dev/null and b/.github/screenshot_03.png differ diff --git a/CHANGELOG.md b/CHANGELOG.md index 4159ec8..ff709bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# v0.0.4 +### 2022-12-20 + +### Docs ++ readme screenshot updated, [911a5294](https://wwwhub.com/mrjackwills/obliqoro/commit/911a529440a1d20012912aba8be4d5334f3385b3) + +### Refactors ++ tick process in application state, [dce8cae1](https://wwwhub.com/mrjackwills/obliqoro/commit/dce8cae18f8359f21ffdbc5c3bb6aa28b0a8303a), [b9fdb6a3](https://wwwhub.com/mrjackwills/obliqoro/commit/b9fdb6a37020894d57470586b7f58adc94628523) + # v0.0.3 ### 2022-12-19 diff --git a/README.md b/README.md index 2427571..961b812 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,11 @@

+

+ + + +


### About @@ -51,6 +56,7 @@ See the =3.0.0 <4.0.0", @@ -3580,13 +3580,13 @@ } }, "node_modules/vue-tsc": { - "version": "1.0.14", - "resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-1.0.14.tgz", - "integrity": "sha512-HeqtyxMrSRUCnU5nxB0lQc3o7zirMppZ/V6HLL3l4FsObGepH3A3beNmNehpLQs0Gt7DkSWVi3CpVCFgrf+/sQ==", + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-1.0.16.tgz", + "integrity": "sha512-yZaiJBbcKR1rSLhiF9KryAFH7R63po+N/invr2EAHGXxMzZksE5j1zyQKvrYiqK47ZHLAlCR+re/PHqWp/UzTg==", "dev": true, "dependencies": { - "@volar/vue-language-core": "1.0.14", - "@volar/vue-typescript": "1.0.14" + "@volar/vue-language-core": "1.0.16", + "@volar/vue-typescript": "1.0.16" }, "bin": { "vue-tsc": "bin/vue-tsc.js" @@ -3596,9 +3596,9 @@ } }, "node_modules/vuetify": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.0.5.tgz", - "integrity": "sha512-ciX+9XuHQ4zx27dEceHrs6xuCeqPgo91DhvCm+udbp0Qg95phad03uVcdHvyv1XW/stgdZGneiqg5dxQvLGzPw==", + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/vuetify/-/vuetify-3.0.6.tgz", + "integrity": "sha512-Illtc9t8PExlKqUEIivNNMpDif4/tvn+04ZEAwrxpQAG75x6V7oUFOF1kVKAFZ2ryuLnBpscXBR85GwFBmLeMQ==", "engines": { "node": "^12.20 || >=14.13" }, diff --git a/package.json b/package.json index 7d26662..651bd81 100644 --- a/package.json +++ b/package.json @@ -12,12 +12,12 @@ "@tauri-apps/api": "^1.2.0", "@vuelidate/core": "^2.0.0", "@vuelidate/validators": "^2.0.0", - "@vueuse/core": "^9.7.0", + "@vueuse/core": "^9.8.2", "@vueuse/head": "^1.0.22", "pinia": "^2.0.28", "vue": "^3.2.45", "vue-router": "^4.1.6", - "vuetify": "^3.0.5" + "vuetify": "^3.0.6" }, "devDependencies": { "@mdi/js": "^7.1.96", @@ -30,11 +30,11 @@ "@vue/tsconfig": "^0.1.3", "eslint": "^8.30.0", "eslint-plugin-vue": "^9.8.0", - "sass": "^1.57.0", + "sass": "^1.57.1", "typescript": "^4.9.4", "unplugin-auto-import": "^0.12.1", "vite": "^4.0.2", "vite-plugin-vuetify": "^1.0.1", - "vue-tsc": "^1.0.14" + "vue-tsc": "^1.0.16" } } \ No newline at end of file diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index a7384f8..7966438 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -1139,9 +1139,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.19" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" dependencies = [ "libc", ] @@ -1693,9 +1693,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ "hermit-abi", "libc", @@ -1772,7 +1772,7 @@ dependencies = [ [[package]] name = "obliqoro" -version = "0.0.2" +version = "0.0.4" dependencies = [ "auto-launch", "dunce", @@ -1811,9 +1811,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.44" +version = "0.10.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29d971fd5722fec23977260f6e81aa67d2f22cadbdc2aa049f1022d9a3be1566" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" dependencies = [ "bitflags", "cfg-if", @@ -1852,9 +1852,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.79" +version = "0.9.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5454462c0eced1e97f2ec09036abc8da362e66802f66fd20f86854d9d8cbcbc4" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" dependencies = [ "autocfg", "cc", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 5c58013..ec8a81f 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "obliqoro" -version = "0.0.3" +version = "0.0.4" description = "Oblique strategies meets pomodoro" authors = ["Jack Wills "] license = "MIT" diff --git a/src-tauri/src/application_state.rs b/src-tauri/src/application_state.rs index 5191bbb..863acb9 100644 --- a/src-tauri/src/application_state.rs +++ b/src-tauri/src/application_state.rs @@ -7,7 +7,7 @@ use tokio::{sync::broadcast::Sender, task::JoinHandle}; use crate::{ app_error::AppError, db::{self, ModelSettings}, - internal_message_handler::InternalMessage, + internal_message_handler::{BreakMessage, Emitter, InternalMessage}, setup_tracing, }; @@ -32,6 +32,32 @@ pub enum SessionStatus { Break(Break), } +#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Hash)] +pub enum Timer { + Paused((Instant, Instant)), + Work(Instant), +} +impl Default for Timer { + fn default() -> Self { + Self::Work(std::time::Instant::now()) + } +} + +impl Timer { + fn toggle(self) -> Self { + match self { + Self::Paused((original, paused)) => Self::Work(original + paused.elapsed()), + Self::Work(original) => Self::Paused((original, std::time::Instant::now())), + } + } + fn reset(self) -> Self { + match self { + Self::Work(_) => Self::default(), + Self::Paused(_) => Self::Paused((std::time::Instant::now(), std::time::Instant::now())), + } + } +} + #[derive(Debug)] pub struct ApplicationState { pub session_status: SessionStatus, @@ -40,11 +66,10 @@ pub struct ApplicationState { pub tick_process: Option>, // TODO button on frontend to open this location _data_location: PathBuf, - timer_start: Instant, - paused: bool, session_count: u8, settings: ModelSettings, strategies: Vec, + timer: Timer, } impl ApplicationState { @@ -69,8 +94,7 @@ impl ApplicationState { _data_location: local_dir, session_count: 0, strategies, - timer_start: std::time::Instant::now(), - paused: false, + timer: Timer::default(), session_status: SessionStatus::Work, settings, sqlite, @@ -89,10 +113,10 @@ impl ApplicationState { /// fuzzy second to minutes conversion fn format_sec_to_min(sec: u16) -> String { - if sec < 60 { + if sec <= 60 { String::from("less than 1 minute") } else { - let minutes = (f64::try_from(sec).unwrap_or(0.0) / 60.0).round(); + let minutes = (f64::try_from(sec).unwrap_or(0.0) / 60.0).ceil(); format!("{minutes} minutes") } } @@ -110,14 +134,15 @@ impl ApplicationState { (self.current_timer_left(), self.random_strategy()) } - // Return, in seconds, the current amount left of the onoing work - or break - session + /// Return, in seconds, the current amount left of the onoing work - or break - session pub fn current_timer_left(&self) -> u16 { - let taken_since = u16::try_from( - std::time::Instant::now() - .duration_since(self.timer_start) - .as_secs(), - ) - .unwrap_or(0); + let taken_since = match self.timer { + Timer::Paused(_) => 0, + Timer::Work(timer) => { + u16::try_from(std::time::Instant::now().duration_since(timer).as_secs()) + .unwrap_or(0) + } + }; match self.session_status { SessionStatus::Break(break_type) => match break_type { Break::Short => { @@ -131,16 +156,19 @@ impl ApplicationState { /// Toggle the pause status pub fn toggle_pause(&mut self) { - self.paused = !self.paused; + self.timer = self.timer.toggle(); } /// Check if the timer (tick process) is paused pub const fn get_paused(&self) -> bool { - self.paused + match self.timer { + Timer::Paused(_) => true, + Timer::Work(_) => false, + } } pub fn reset_timer(&mut self) { - self.timer_start = std::time::Instant::now(); + self.timer = self.timer.reset(); } /// Start the timer, by saetting the next_break_in value pub fn start_work_session(&mut self) { @@ -229,6 +257,32 @@ impl ApplicationState { self.settings.short_break_as_sec = i; } + pub fn tick_process(&self) { + if !self.get_paused() { + match self.session_status { + SessionStatus::Break(_) => { + self.sx + .send(InternalMessage::Emit(Emitter::OnBreak)) + .unwrap_or_default(); + if self.current_timer_left() < 1 { + self.sx + .send(InternalMessage::Break(BreakMessage::End)) + .unwrap_or_default(); + } + } + SessionStatus::Work => { + self.sx + .send(InternalMessage::UpdateMenuTimer) + .unwrap_or_default(); + if self.current_timer_left() < 1 { + self.sx + .send(InternalMessage::Break(BreakMessage::Start)) + .unwrap_or_default(); + } + } + } + } + } // /// close the sql connection in a tokio thead // /// Honestly think this is pointless // pub fn close_sql(&mut self) { diff --git a/src-tauri/src/db/mod.rs b/src-tauri/src/db/mod.rs index eb30238..f1339d8 100644 --- a/src-tauri/src/db/mod.rs +++ b/src-tauri/src/db/mod.rs @@ -28,7 +28,7 @@ async fn create_tables(db: &SqlitePool) { Ok(_) => (), Err(e) => { println!("{e:?}"); - // todo!("handle this better"); + // TODO - handle this better std::process::exit(1); } } diff --git a/src-tauri/src/internal_message_handler/mod.rs b/src-tauri/src/internal_message_handler/mod.rs index ca757ed..e4fa76c 100644 --- a/src-tauri/src/internal_message_handler/mod.rs +++ b/src-tauri/src/internal_message_handler/mod.rs @@ -62,15 +62,15 @@ pub enum WindowVisibility { #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Hash)] pub enum Emitter { + AutoStart(bool), GoToSettings, + NextBreak, OnBreak, PackageInfo, Paused, SendError, - SendAutoStart(bool), - SendSettings, - NextBreak, SessionsBeforeLong, + Settings, Timer, } @@ -107,8 +107,8 @@ impl WindowAction { } window.set_resizable(true).unwrap_or(()); window.set_fullscreen(fullscreen).unwrap_or(()); - // This is the linux fix - std::thread::sleep(std::time::Duration::from_millis(25)); + // This is the linux fix - dirty, but it seems to work + std::thread::sleep(std::time::Duration::from_millis(50)); } else if window.is_resizable().unwrap_or(false) { window.set_resizable(false).unwrap_or(()); } @@ -231,9 +231,9 @@ fn update_menu( } /// Stop the tick process, and start a new one -fn reset_timer(state: &Arc>, sx: &Sender) { +fn reset_timer(state: &Arc>) { state.lock().reset_timer(); - tick_process(state, sx.clone()); + tick_process(state); } /// Update the database setting data, and self.setting, and if necessary reset timers etc @@ -269,8 +269,10 @@ async fn handle_settings( let sqlite = state.lock().sqlite.clone(); let settings = ModelSettings::reset_settings(&sqlite).await?; state.lock().reset_settings(settings); - reset_timer(state, sx); - sx.send(InternalMessage::Emit(Emitter::SendSettings)) + reset_timer(state); + sx.send(InternalMessage::Emit(Emitter::Settings)) + .unwrap_or_default(); + sx.send(InternalMessage::Emit(Emitter::Paused)) .unwrap_or_default(); } SettingChange::ShortBreakLength(value) => { @@ -285,7 +287,7 @@ async fn handle_settings( let sqlite = state.lock().sqlite.clone(); ModelSettings::update_session(&sqlite, value).await?; state.lock().set_session_as_sec(value); - reset_timer(state, sx); + reset_timer(state); } } } @@ -360,7 +362,7 @@ fn handle_emitter(app: &AppHandle, emitter: Emitter, state: &Arc { + Emitter::AutoStart(value) => { let on_break = state.lock().on_break(); if !on_break { app.emit_to( @@ -381,7 +383,7 @@ fn handle_emitter(app: &AppHandle, emitter: Emitter, state: &Arc { + Emitter::Settings => { app.emit_to( ObliqoroWindow::Main.as_str(), EmitMessages::GetSettings.as_str(), diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 1eb3bec..93e654e 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -117,7 +117,7 @@ async fn main() -> Result<(), ()> { let internal_state = Arc::clone(&state); let event_sx = sx.clone(); - let timer_sx = sx.clone(); + // let timer_sx = sx.clone(); let close_sx = sx.clone(); let handler_sx = sx.clone(); let tray_sx = sx.clone(); @@ -161,6 +161,7 @@ async fn main() -> Result<(), ()> { request_handlers::reset_settings, request_handlers::get_autostart, request_handlers::set_autostart, + request_handlers::toggle_pause, request_handlers::set_setting_fullscreen, request_handlers::set_setting_longbreak, request_handlers::set_setting_number_sessions, @@ -170,7 +171,7 @@ async fn main() -> Result<(), ()> { .build(tauri::generate_context!()) { Ok(s) => { - tick_process(&init_state, timer_sx); + tick_process(&init_state); start_message_handler(&s, internal_state, rx, handler_sx); s.run(move |_app, event| { if let tauri::RunEvent::ExitRequested { api, .. } = event { diff --git a/src-tauri/src/request_handlers/mod.rs b/src-tauri/src/request_handlers/mod.rs index 9646a4d..19c181f 100644 --- a/src-tauri/src/request_handlers/mod.rs +++ b/src-tauri/src/request_handlers/mod.rs @@ -27,7 +27,7 @@ pub fn init(state: TauriState<'_>) { state .lock() .sx - .send(InternalMessage::Emit(Emitter::SendSettings)) + .send(InternalMessage::Emit(Emitter::Settings)) .unwrap_or_default(); state .lock() @@ -72,6 +72,17 @@ pub fn set_autostart(state: TauriState<'_>, value: bool) { get_autostart(state); } +/// Toggle the autostart option +#[tauri::command] +#[allow(clippy::needless_pass_by_value)] +pub fn toggle_pause(state: TauriState<'_>) { + state + .lock() + .sx + .send(InternalMessage::Pause) + .unwrap_or_default(); +} + /// Get the current status of the autostart setting #[tauri::command] #[allow(clippy::needless_pass_by_value)] @@ -79,7 +90,7 @@ pub fn get_autostart(state: TauriState<'_>) { state .lock() .sx - .send(InternalMessage::Emit(Emitter::SendAutoStart( + .send(InternalMessage::Emit(Emitter::AutoStart( auto_launch().map_or(false, |i| i.is_enabled().unwrap_or_default()), ))) .unwrap_or_default(); diff --git a/src-tauri/src/tick/mod.rs b/src-tauri/src/tick/mod.rs index 9aca5cf..d789b2a 100644 --- a/src-tauri/src/tick/mod.rs +++ b/src-tauri/src/tick/mod.rs @@ -1,26 +1,16 @@ use parking_lot::Mutex; use std::sync::Arc; -use tokio::sync::broadcast::Sender; -use crate::{ - application_state::{ApplicationState, SessionStatus}, - internal_message_handler::{BreakMessage, Emitter, InternalMessage}, -}; - -const ONE_SECOND_AS_MS: u64 = 1000; -const ONE_MINUTE_AS_MS: u64 = ONE_SECOND_AS_MS * 60; +use crate::{application_state::ApplicationState, internal_message_handler::InternalMessage}; /// Spawn off a tokio thread, that loops continually, well with a 250ms pause between each loop /// The timer checking is then spawned off into another thread /// The outer tread is saved into ApplicationState, so that it can be cancelled at any time -pub fn tick_process(state: &Arc>, sx: Sender) { +pub fn tick_process(state: &Arc>) { if let Some(x) = &state.lock().tick_process { x.abort(); } - - let menu_updated = Arc::new(Mutex::new(std::time::Instant::now())); let spawn_state = Arc::clone(state); - state .lock() .sx @@ -28,50 +18,12 @@ pub fn tick_process(state: &Arc>, sx: Sender { - spawn_state - .lock() - .sx - .send(InternalMessage::Emit(Emitter::OnBreak)) - .unwrap_or_default(); - if session_time_left < 1 { - spawn_state - .lock() - .sx - .send(InternalMessage::Break(BreakMessage::End)) - .unwrap_or_default(); - } - } - SessionStatus::Work => { - if menu_updated.lock().elapsed().as_millis() - >= u128::from(ONE_MINUTE_AS_MS) - { - spawn_state - .lock() - .sx - .send(InternalMessage::UpdateMenuTimer) - .unwrap_or_default(); - *menu_updated.lock() = std::time::Instant::now(); - } - if session_time_left < 1 { - sx.send(InternalMessage::Break(BreakMessage::Start)) - .unwrap_or_default(); - } - } - } - }); - } - tokio::time::sleep(std::time::Duration::from_millis(250)).await; + let spawn_state = Arc::clone(&spawn_state); + tokio::spawn(async move { + spawn_state.lock().tick_process(); + }); + // 500ms? + tokio::time::sleep(std::time::Duration::from_millis(1000)).await; } })); } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 8b0d37e..0daf0b2 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -9,7 +9,7 @@ }, "package": { "productName": "obliqoro", - "version": "0.0.3" + "version": "0.0.4" }, "tauri": { "allowlist": { diff --git a/src/App.vue b/src/App.vue index 846d000..7b15331 100644 --- a/src/App.vue +++ b/src/App.vue @@ -29,8 +29,8 @@ const on_settings = computed(():boolean => { return route.fullPath === FrontEndRoutes.Settings; }); -onBeforeMount(async () => { - +/// Disable refreshing the page, via F5 or rightlick menu +const disable_reload = (): void => { /// disable right click window.addEventListener('contextmenu', (event) => event.preventDefault()); @@ -39,6 +39,10 @@ onBeforeMount(async () => { if (event.key.toLowerCase() === 'f5') event.preventDefault(); }, true); +}; +onBeforeMount(async () => { + disable_reload(); + await listen(ListenMessage.NumberSessionsBeforeLong, async (event: Event) => { settingStore.set_session_before_next_long_break(event.payload); }); diff --git a/src/Views/SettingsView.vue b/src/Views/SettingsView.vue index 80ab34d..446d232 100644 --- a/src/Views/SettingsView.vue +++ b/src/Views/SettingsView.vue @@ -4,7 +4,7 @@ - + @@ -15,24 +15,40 @@ - - + + - + - - - - - {{ next_in }} - + + - - + + + + + + + + {{ pauseText }} + + + + - + + {{ sessions_before_long }} @@ -42,21 +58,8 @@ - - - - - - - currently paused - - - - - - - + @@ -87,9 +90,10 @@ - + @@ -99,9 +103,11 @@ - + - reset settings + reset settings + + @@ -117,7 +123,8 @@ import { sec_to_minutes, sec_to_minutes_only } from '../vanillaTS/second'; import { invoke } from '@tauri-apps/api/tauri'; import { InvokeMessage } from '../types'; import { snackError } from '../services/snack'; -import { mdiCogRefresh, mdiCoffeeOutline, mdiWeatherNight } from '@mdi/js'; +import { mdiCogRefresh, mdiCoffeeOutline, mdiWeatherNight, mdiPlay, mdiPause } from '@mdi/js'; +import ResumeTooltip from '../components/ResumeTooltip.vue'; const settingStore = settingModule(); const next_in = computed((): string => { @@ -131,6 +138,15 @@ const sessions_before_long = computed((): string => { const paused = computed((): boolean => { return settingStore.paused; }); +const pauseIcon = computed((): string => { + return paused.value? mdiPlay:mdiPause; +}); +const pauseVairant = computed((): undefined | 'outlined' => { + return paused.value? undefined :'outlined'; +}); +const pauseText = computed((): string => { + return paused.value? 'resume':'pause'; +}); const switches = computed(() => { return [ @@ -242,6 +258,10 @@ const reset_settings = async (): Promise => { await invoke(InvokeMessage.ResetSettings); }; +const toggle_pause = async (): Promise => { + await invoke(InvokeMessage.TogglePause); +}; + const send_settings = async (message: InvokeMessage, value: number | boolean): Promise => { saveTimeout.value = window.setTimeout(async () => { try { diff --git a/src/Views/TimerView.vue b/src/Views/TimerView.vue index 4322fa7..dd29bdd 100644 --- a/src/Views/TimerView.vue +++ b/src/Views/TimerView.vue @@ -3,14 +3,14 @@ - + {{ strategy }} - {{ sec_to_minutes(timeout) }} + {{ sec_to_minutes(interval) }} @@ -27,7 +27,7 @@ import { FrontEndRoutes } from '../types'; import { sec_to_minutes } from '../vanillaTS/second'; const store = intervalModule(); -const timeout = computed(() => store.interval); +const interval = computed(() => store.interval); const circ_value = computed(() => { return store.interval * (100 / store.original_interval); }); @@ -45,7 +45,7 @@ const text_size = computed((): string => { const router = useRouter(); -watch(timeout, (i) => { +watch(interval, (i) => { if (i <= 0) { // set a 200ms timeout? router.push(FrontEndRoutes.Settings); diff --git a/src/components/ResumeTooltip.vue b/src/components/ResumeTooltip.vue new file mode 100644 index 0000000..15d5cd4 --- /dev/null +++ b/src/components/ResumeTooltip.vue @@ -0,0 +1,16 @@ + + + \ No newline at end of file diff --git a/src/types/index.ts b/src/types/index.ts index 0a89ade..f35635b 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -3,6 +3,7 @@ export enum InvokeMessage { Minimize = 'minimize', Init = 'init', ResetSettings = 'reset_settings', + TogglePause = 'toggle_pause', SetSettingFullscreen = 'set_setting_fullscreen', SetSettingLongBreak = 'set_setting_longbreak', SetSettingNumberSession = 'set_setting_number_sessions',