feat(ui): implement profile page

This commit is contained in:
Prad Nukala
2024-09-22 02:51:52 -04:00
parent df96e8d562
commit ee7c4531c2
31 changed files with 214 additions and 198 deletions
+29
View File
@@ -0,0 +1,29 @@
package view
import (
"bytes"
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/pkg/nebula/routes"
)
// render renders a templ.Component
func Render(r routes.Route) echo.HandlerFunc {
return func(c echo.Context) error {
// Create a buffer to store the rendered HTML
buf := bytes.NewBuffer(nil)
// Render the component to the buffer
err := r.Component(c).Render(c.Request().Context(), buf)
if err != nil {
return err
}
// Set the content type
c.Response().Header().Set(echo.HeaderContentType, echo.MIMETextHTML)
// Write the buffered content to the response
_, err = c.Response().Write(buf.Bytes())
return err
}
}