From fcf497b1a12e80a982d5fc093184524413f20cb3 Mon Sep 17 00:00:00 2001 From: decentral1se Date: Thu, 11 Apr 2024 15:39:53 +0200 Subject: [PATCH] feat: loader for new site --- app.go | 6 ++++++ components/templates.templ | 3 ++- components/templates_templ.go | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app.go b/app.go index 65a6db4..6d33c94 100644 --- a/app.go +++ b/app.go @@ -139,6 +139,12 @@ func hugoNewSite(w http.ResponseWriter, r *http.Request) { w.Write([]byte(fmt.Sprintf("unable to clone 'nostyleplease' theme: %s", err))) } + sites, err := existingSites() + if err != nil { + w.Write([]byte(fmt.Sprintf("unable to list existing sites: %s", err))) + } + + templ.Handler(components.Homepage(sites)).ServeHTTP(w, r) } // NewRouter creates a new web router. diff --git a/components/templates.templ b/components/templates.templ index 7aa67b7..8df89ee 100644 --- a/components/templates.templ +++ b/components/templates.templ @@ -15,7 +15,8 @@ templ Homepage(sites []string) { }
Create a new Hugo site below 👇
-
+ +

Creating new site...

} diff --git a/components/templates_templ.go b/components/templates_templ.go index bd8484d..ae52446 100644 --- a/components/templates_templ.go +++ b/components/templates_templ.go @@ -65,7 +65,7 @@ func Homepage(sites []string) templ.Component { return templ_7745c5c3_Err } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Create a new Hugo site below 👇
") + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Create a new Hugo site below 👇

Creating new site...

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }