From 5b52549404360c85915dff12797c87fe20b6a07f Mon Sep 17 00:00:00 2001 From: Arduinum Date: Thu, 23 Apr 2026 22:18:54 +0300 Subject: [PATCH] feat: added router for Timer --- client/src/router/index.ts | 6 + client/src/views/TimersList/TimersList.html | 150 ++++++++++---------- client/src/views/TimersList/TimersList.ts | 12 +- 3 files changed, 93 insertions(+), 75 deletions(-) diff --git a/client/src/router/index.ts b/client/src/router/index.ts index 81a13c5..fbce953 100644 --- a/client/src/router/index.ts +++ b/client/src/router/index.ts @@ -1,6 +1,7 @@ import { createRouter, createWebHistory } from '@ionic/vue-router'; import type { RouteRecordRaw } from 'vue-router'; import TimersList from '@/views/TimersList/TimersList.vue'; +import Timer from '@/views/Timer/Timer.vue'; const routes: RouteRecordRaw[] = [ { @@ -11,6 +12,11 @@ const routes: RouteRecordRaw[] = [ path: '/timers', name: 'Timers', component: TimersList + }, + { + path: '/timer/:id', + name: 'Timer', + component: Timer } ]; diff --git a/client/src/views/TimersList/TimersList.html b/client/src/views/TimersList/TimersList.html index 56281fd..c656447 100644 --- a/client/src/views/TimersList/TimersList.html +++ b/client/src/views/TimersList/TimersList.html @@ -1,81 +1,85 @@ -
- + + +
+ -
- -
-

Загрузка таймеров...

-
- - -
-

{{ error }}

-
- - -
-

Нет таймеров

-
- - -
-
- -
-
- -
-
-

{{ timer.title }}

-

{{ timer.count_pomodoro }} помидоров по {{ timer.pomodoro_time }} минут

-
-
- -
+
+ +
+

Загрузка таймеров...

- -
-
-
- Название: - {{ timer.title }} -
-
- Длительность помидора: - {{ timer.pomodoro_time }} минут -
-
- Количество помидоров: - {{ timer.count_pomodoro }} -
-
+ +
+

{{ error }}

+
-
- - - + +
+

Нет таймеров

+
+ + +
+
+ +
+
+ +
+
+

{{ timer.title }}

+

{{ timer.count_pomodoro }} помидоров по {{ timer.pomodoro_time }} минут

+
+
+ +
+
+ + +
+
+
+ Название: + {{ timer.title }} +
+
+ Длительность помидора: + {{ timer.pomodoro_time }} минут +
+
+ Количество помидоров: + {{ timer.count_pomodoro }} +
+
+ +
+ + + +
+
-
-
+ + diff --git a/client/src/views/TimersList/TimersList.ts b/client/src/views/TimersList/TimersList.ts index 88057dd..61ea5dd 100644 --- a/client/src/views/TimersList/TimersList.ts +++ b/client/src/views/TimersList/TimersList.ts @@ -1,5 +1,6 @@ import { defineComponent, onMounted, ref } from 'vue' -import { IonIcon } from '@ionic/vue' +import { IonIcon, IonPage, IonContent } from '@ionic/vue' +import { useRouter } from 'vue-router'; import { timerOutline, chevronUp, @@ -14,13 +15,19 @@ import type { TimersRow } from '@/types/timerType' export default defineComponent({ name: 'TimersList', - components: { IonIcon }, + components: { IonIcon, IonPage, IonContent }, setup() { const timers = ref([]) const loading = ref(true) const error = ref(null) const expandedId = ref(null) + const router = useRouter(); + + const goToTimer = (id: number) => { + router.push(`/timer/${id}`); + }; + const loadTimers = async (): Promise => { loading.value = true error.value = null @@ -55,6 +62,7 @@ export default defineComponent({ playCircleOutline, pencilOutline, trashOutline, + goToTimer } }, })