From 6dbad4dbc8702e3e09de118e17ceadae201a66f3 Mon Sep 17 00:00:00 2001
From: Steven Le Rouzic
Date: Tue, 16 Apr 2024 23:34:20 +0200
Subject: Rework addTime
---
view/timer.templ | 85 ++++++++++++++++++++++++++++++++++----------------------
1 file changed, 52 insertions(+), 33 deletions(-)
(limited to 'view/timer.templ')
diff --git a/view/timer.templ b/view/timer.templ
index 76bd7ba..45194c5 100644
--- a/view/timer.templ
+++ b/view/timer.templ
@@ -21,41 +21,60 @@ templ TimerTokenForm(timer model.Timer) {
}
+func renderTimeString(value int, unit string) string {
+ s := ""
+ if value > 1 { s = "s" }
+ return fmt.Sprint(value, " ", unit, s)
+}
+
+templ timeButton(id model.UUID, value int, unit string) {
+
-
Timer "{ timer.Name }"
-
Back to list
-
Start time: { timer.StartTime.AsUTCString() }
-
End time: { timer.EndTime.AsUTCString() }
-
- Total time:
-
-
+
+ @TimerInfo(timer)
+
+ if !timer.IsFinished() {
+
Add time
- Remaining time:
-
+ @timeButton(timer.Id, 15, "minute")
+ @timeButton(timer.Id, 30, "minute")
+ @timeButton(timer.Id, 1, "hour")
+ @timeButton(timer.Id, 2, "hour")
+ @timeButton(timer.Id, 6, "hour")
+ @timeButton(timer.Id, 12, "hour")
+ @timeButton(timer.Id, 1, "day")
+ @timeButton(timer.Id, 1, "week")
+ @timeButton(timer.Id, 4, "week")
- if !timer.IsFinished() {
-
Add time
-
-
-
-
-
-
-
-
-
-
-
- }
-
API token
- @TimerTokenForm(timer)
-
+ }
+