From a55cfe8205d5cb2fb0948c173f23ad71d6614d13 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Sat, 27 Apr 2024 23:55:31 +0200 Subject: Rename everything to locker/lock --- view/lock.templ | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++ view/locks_list.templ | 51 ++++++++++++++++++++++++++++++++ view/login.templ | 2 +- view/main.templ | 4 +-- view/timer.templ | 80 -------------------------------------------------- view/timers_list.templ | 51 -------------------------------- 6 files changed, 134 insertions(+), 134 deletions(-) create mode 100644 view/lock.templ create mode 100644 view/locks_list.templ delete mode 100644 view/timer.templ delete mode 100644 view/timers_list.templ (limited to 'view') diff --git a/view/lock.templ b/view/lock.templ new file mode 100644 index 0000000..4dd0516 --- /dev/null +++ b/view/lock.templ @@ -0,0 +1,80 @@ +package view + +import ( + "fmt" + "stevenlr.com/locker/model" +) + +templ LockTokenForm(lock model.Lock) { +

+ + +

+} + +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) { + + +} + +templ LockInfo(lock model.Lock) { +

Lock "{ lock.Name }"

+

Start time: { lock.StartTime.AsUTCString() }

+

End time: { lock.EndTime.AsUTCString() }

+

+ Total time: + +

+

+ Remaining time: + +

+} + +templ LockView(lock model.Lock) { +

Back to list

+
+ @LockInfo(lock) +
+ if !lock.IsFinished() { +

Add time

+

+ @timeButton(lock.Id, 15, "minute") + @timeButton(lock.Id, 30, "minute") + @timeButton(lock.Id, 1, "hour") + @timeButton(lock.Id, 2, "hour") + @timeButton(lock.Id, 6, "hour") + @timeButton(lock.Id, 12, "hour") + @timeButton(lock.Id, 1, "day") + @timeButton(lock.Id, 1, "week") + @timeButton(lock.Id, 4, "week") +

+ } +

API token

+ @LockTokenForm(lock) +} + diff --git a/view/locks_list.templ b/view/locks_list.templ new file mode 100644 index 0000000..e940b88 --- /dev/null +++ b/view/locks_list.templ @@ -0,0 +1,51 @@ +package view + +import ( + "stevenlr.com/locker/model" + "fmt" +) + +templ lock(t model.Lock) { +

+ { t.Name } + - + Delete +

+} + +templ LockCreateForm(lockName string, err string) { +
+

+ + + + +

+ if err != "" { +

{ err }

+ } +
+} + +templ LocksList(locks []model.Lock, isSignedIn bool) { +
+ if isSignedIn { +

Locks

+ for _, t := range locks { + @lock(t) + } +

Create lock

+ @LockCreateForm("", "") + } +
+} + diff --git a/view/login.templ b/view/login.templ index 3450e01..56e003c 100644 --- a/view/login.templ +++ b/view/login.templ @@ -1,7 +1,7 @@ package view import ( - "stevenlr.com/timer/model" + "stevenlr.com/locker/model" ) templ LoginFormError(currentUser *model.User, err string) { diff --git a/view/main.templ b/view/main.templ index 06cb872..4ae917b 100644 --- a/view/main.templ +++ b/view/main.templ @@ -1,14 +1,14 @@ package view import ( - "stevenlr.com/timer/model" + "stevenlr.com/locker/model" ) templ Main(contents templ.Component, currentUser *model.User) { - Cool timer app + Cool locker app diff --git a/view/timer.templ b/view/timer.templ deleted file mode 100644 index 09b1345..0000000 --- a/view/timer.templ +++ /dev/null @@ -1,80 +0,0 @@ -package view - -import ( - "fmt" - "stevenlr.com/timer/model" -) - -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) { - - -} - -templ TimerInfo(timer model.Timer) { -

Timer "{ timer.Name }"

-

Start time: { timer.StartTime.AsUTCString() }

-

End time: { timer.EndTime.AsUTCString() }

-

- Total time: - -

-

- Remaining time: - -

-} - -templ TimerView(timer model.Timer) { -

Back to list

-
- @TimerInfo(timer) -
- if !timer.IsFinished() { -

Add 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") -

- } -

API token

- @TimerTokenForm(timer) -} - diff --git a/view/timers_list.templ b/view/timers_list.templ deleted file mode 100644 index 69a8e53..0000000 --- a/view/timers_list.templ +++ /dev/null @@ -1,51 +0,0 @@ -package view - -import ( - "stevenlr.com/timer/model" - "fmt" -) - -templ timer(t model.Timer) { -

- { t.Name } - - - Delete -

-} - -templ TimerCreateForm(timerName string, err string) { -
-

- - - - -

- if err != "" { -

{ err }

- } -
-} - -templ TimersList(timers []model.Timer, isSignedIn bool) { -
- if isSignedIn { -

Timers

- for _, t := range timers { - @timer(t) - } -

Create timer

- @TimerCreateForm("", "") - } -
-} - -- cgit