add not found page
This commit is contained in:
parent
e6f4621767
commit
db3e3192e2
2 changed files with 21 additions and 2 deletions
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"git.juancwu.dev/juancwu/budgit/internal/ctxkeys"
|
"git.juancwu.dev/juancwu/budgit/internal/ctxkeys"
|
||||||
|
"git.juancwu.dev/juancwu/budgit/internal/ui"
|
||||||
|
"git.juancwu.dev/juancwu/budgit/internal/ui/pages"
|
||||||
)
|
)
|
||||||
|
|
||||||
type homeHandler struct{}
|
type homeHandler struct{}
|
||||||
|
|
@ -23,6 +25,5 @@ func (h *homeHandler) HomePage(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (home *homeHandler) NotFoundPage(w http.ResponseWriter, r *http.Request) {
|
func (home *homeHandler) NotFoundPage(w http.ResponseWriter, r *http.Request) {
|
||||||
w.WriteHeader(http.StatusNotFound)
|
ui.Render(w, r, pages.NotFound())
|
||||||
w.Write([]byte("404 Page Not Found"))
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
internal/ui/pages/public_notfound.templ
Normal file
18
internal/ui/pages/public_notfound.templ
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
package pages
|
||||||
|
|
||||||
|
import "git.juancwu.dev/juancwu/budgit/internal/ui/layouts"
|
||||||
|
|
||||||
|
templ NotFound() {
|
||||||
|
@layouts.Base() {
|
||||||
|
<div class="min-h-screen flex items-center justify-center">
|
||||||
|
<div class="text-center">
|
||||||
|
<h1 class="text-8xl font-bold text-muted-foreground/30 mb-4">404</h1>
|
||||||
|
<h2 class="text-2xl font-semibold mb-2">Page Not Found</h2>
|
||||||
|
<p class="text-muted-foreground mb-8">The page you are looking for does not exist.</p>
|
||||||
|
<a href="/" class="text-primary hover:underline">
|
||||||
|
← Back to Home
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue