Added a basic homepage
This commit is contained in:
parent
d40640a648
commit
12fd3c04ca
113 changed files with 414 additions and 506 deletions
41
internal/ui/pages/task.go
Normal file
41
internal/ui/pages/task.go
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
package pages
|
||||
|
||||
import (
|
||||
"github.com/labstack/echo/v4"
|
||||
"github.com/camzawacki/personal-site/internal/ui"
|
||||
. "github.com/camzawacki/personal-site/internal/ui/components"
|
||||
"github.com/camzawacki/personal-site/internal/ui/forms"
|
||||
"github.com/camzawacki/personal-site/internal/ui/layouts"
|
||||
. "maragu.dev/gomponents"
|
||||
. "maragu.dev/gomponents/html"
|
||||
)
|
||||
|
||||
func AddTask(ctx echo.Context, form *forms.Task) error {
|
||||
r := ui.NewRequest(ctx)
|
||||
r.Title = "Create a task"
|
||||
r.Metatags.Description = "Test creating a task to see how it works."
|
||||
|
||||
g := Group{
|
||||
Iff(r.Htmx.Target != "task", func() Node {
|
||||
return Group{
|
||||
P(Raw("Submitting this form will create an <i>ExampleTask</i> in the task queue. After the specified delay, the message will be logged by the queue processor.")),
|
||||
P(Raw("See <i>pkg/tasks</i> and the README for more information.")),
|
||||
}
|
||||
}),
|
||||
form.Render(r),
|
||||
Iff(r.Htmx.Target != "task", func() Node {
|
||||
var text string
|
||||
if r.IsAdmin {
|
||||
text = "View all queued tasks by clicking on the Tasks link in the sidebar."
|
||||
} else {
|
||||
text = "Log in as an admin in order to access the task and queue monitoring UI."
|
||||
}
|
||||
return Group{
|
||||
Div(Class("mt-5")),
|
||||
Alert(ColorWarning, text),
|
||||
}
|
||||
}),
|
||||
}
|
||||
|
||||
return r.Render(layouts.Primary, g)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue