From 89681980452a665f77ecbe4843a032683baa6a7f Mon Sep 17 00:00:00 2001 From: Ruidy Date: Fri, 9 Feb 2024 11:07:36 +0100 Subject: [PATCH] add navigation items --- Makefile | 5 +- internal/views/base.templ | 4 + internal/views/base_templ.go | 24 +++- internal/views/booking_by_id.templ | 13 ++- internal/views/booking_by_id_templ.go | 157 ++++++++++++++------------ 5 files changed, 120 insertions(+), 83 deletions(-) diff --git a/Makefile b/Makefile index 4122f7a..4794817 100644 --- a/Makefile +++ b/Makefile @@ -3,14 +3,15 @@ PORT=8000 DB_USER=ruidy DB_NAME=villafleurie -build: format lint templ +build: format lint + @templ generate @docker build -t ${NAME}:latest . run: build @docker run -p ${PORT}:${PORT} -e DATABASE_URL="host=docker.for.mac.host.internal user=${DB_USER} database=${DB_NAME}" -e PORT=${PORT} ${NAME} dev: templ @air cmd/main.go templ: - @templ generate + @templ generate --watch & format: @templ fmt . @go fmt ./... diff --git a/internal/views/base.templ b/internal/views/base.templ index 5bbbf68..42cd6e7 100644 --- a/internal/views/base.templ +++ b/internal/views/base.templ @@ -17,6 +17,10 @@ templ BaseLayout() { +
{ children... } diff --git a/internal/views/base_templ.go b/internal/views/base_templ.go index 4244b6b..381272f 100644 --- a/internal/views/base_templ.go +++ b/internal/views/base_templ.go @@ -41,7 +41,25 @@ func BaseLayout() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -53,8 +71,8 @@ func BaseLayout() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Var4 := `🏨 RentEase © 2024` - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var4) + templ_7745c5c3_Var6 := `🏨 RentEase © 2024` + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/views/booking_by_id.templ b/internal/views/booking_by_id.templ index 3f1418e..d4eb800 100644 --- a/internal/views/booking_by_id.templ +++ b/internal/views/booking_by_id.templ @@ -9,10 +9,15 @@ import ( templ BookingById(booking *booking.Booking, items, platforms, paymentMethods []string) { @BaseLayout() { -
-

Booking ID VFNI#{ fmt.Sprintf("%04s", strconv.Itoa(booking.Id)) }

-

Manage a booking

-
+
+
+

Booking ID VFNI#{ fmt.Sprintf("%04s", strconv.Itoa(booking.Id)) }

+

Manage a booking

+
+
+ +
+