Files
extrovert/routes/index.templ
2024-07-30 11:51:31 -03:00

60 lines
1.4 KiB
Plaintext

package routes
import (
"extrovert/templates/layouts"
"extrovert/components"
"extrovert/internals/app"
"net/http"
"extrovert/internals/router/errors"
e "errors"
)
type Homepage struct{}
func (h Homepage) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
err := h.page().Render(context.Background(), w)
if err != nil {
errors.NewErrInternal(e.New("Unable to render dashboard"), err).ServeHTTP(w, r)
}
}
templ (h Homepage) page() {
@layouts.Page("Project Extrovert") {
<div style="max-width:50rem;">
<div style="display:flex;flex-direction:column;gap:1rem;">
<main
style="height:15rem"
>
<aside
style="height:100%;display:flex;gap:2rem;"
>
<div style="display:flex;flex-direction:column;gap:1rem;width:15rem;">
@app.TWITTER_APP.LoginButton()
@app.MASTODON_APP.LoginButton()
</div>
<fieldset>
<textarea
style="height:100%;resize:none;"
name="post"
placeholder="Write a post..."
aria-label="Post input"
></textarea>
</fieldset>
</aside>
</main>
<footer>
@components.Warning("In Development") {
<strong>
This application is in active development and should not be used in production.
</strong>
Expect bugs, lost data, logouts, etc. Use it at your own risk.
This software is provided "as is", without any warranty of any kind.
}
</footer>
</div>
</div>
}
}