2024-09-30 21:05:06 +00:00
|
|
|
package pages
|
|
|
|
|
|
|
|
|
|
import (
|
2024-10-01 01:32:42 +00:00
|
|
|
"chat/components"
|
|
|
|
|
"chat/partials"
|
2024-09-30 21:05:06 +00:00
|
|
|
"github.com/maddalax/htmgo/framework/h"
|
|
|
|
|
)
|
|
|
|
|
|
2024-10-01 01:32:42 +00:00
|
|
|
func ChatAppFirstScreen(ctx *h.RequestContext) *h.Page {
|
2024-09-30 21:05:06 +00:00
|
|
|
return h.NewPage(
|
|
|
|
|
RootPage(
|
|
|
|
|
h.Div(
|
2024-10-01 01:32:42 +00:00
|
|
|
h.Class("flex flex-col items-center justify-center min-h-screen bg-neutral-100"),
|
2024-09-30 21:05:06 +00:00
|
|
|
h.Div(
|
2024-10-01 01:32:42 +00:00
|
|
|
h.Class("bg-white p-8 rounded-lg shadow-lg w-full max-w-md"),
|
|
|
|
|
h.H2F("htmgo chat", h.Class("text-3xl font-bold text-center mb-6")),
|
|
|
|
|
h.Form(
|
|
|
|
|
h.Attribute("hx-swap", "none"),
|
|
|
|
|
h.PostPartial(partials.CreateOrJoinRoom),
|
|
|
|
|
h.Class("flex flex-col gap-3"),
|
2024-09-30 21:05:06 +00:00
|
|
|
|
2024-10-01 01:32:42 +00:00
|
|
|
components.Input(components.InputProps{
|
|
|
|
|
Id: "username",
|
|
|
|
|
Name: "username",
|
|
|
|
|
Label: "Username",
|
|
|
|
|
Required: true,
|
|
|
|
|
}),
|
2024-09-30 21:05:06 +00:00
|
|
|
|
2024-10-01 01:32:42 +00:00
|
|
|
h.Div(
|
|
|
|
|
h.Class("mt-6 flex flex-col gap-3"),
|
2024-09-30 21:05:06 +00:00
|
|
|
|
2024-10-01 01:32:42 +00:00
|
|
|
components.Input(components.InputProps{
|
|
|
|
|
Name: "new-chat-room",
|
|
|
|
|
Label: "Create a New Chat Room",
|
|
|
|
|
Placeholder: "Chat Room Name",
|
|
|
|
|
}),
|
2024-09-30 21:05:06 +00:00
|
|
|
|
2024-10-01 01:32:42 +00:00
|
|
|
h.Div(
|
|
|
|
|
h.Class("flex items-center justify-center gap-4"),
|
|
|
|
|
h.Div(h.Class("border-t border-gray-300 flex-grow")),
|
|
|
|
|
h.P(h.Text("OR"), h.Class("text-gray-500")),
|
|
|
|
|
h.Div(h.Class("border-t border-gray-300 flex-grow")),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
components.Input(components.InputProps{
|
|
|
|
|
Id: "join-chat-room",
|
|
|
|
|
Name: "join-chat-room",
|
|
|
|
|
Label: "Join a Chat Room",
|
|
|
|
|
Placeholder: "Chat Room Id",
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
components.FormError(""),
|
|
|
|
|
components.PrimaryButton(components.ButtonProps{
|
|
|
|
|
Type: "submit",
|
|
|
|
|
Text: "Submit",
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
2024-09-30 21:05:06 +00:00
|
|
|
)
|
|
|
|
|
}
|