feat: add start-tui command for interactive mode

This commit is contained in:
Prad Nukala
2024-12-11 12:32:22 -05:00
parent 23f077ce75
commit 305efbea5d
5 changed files with 15 additions and 80 deletions
@@ -8,14 +8,11 @@ import (
"github.com/labstack/echo/v4"
"github.com/onsonr/sonr/crypto/mpc"
"github.com/onsonr/sonr/pkg/common/response"
"golang.org/x/exp/rand"
)
func HandleCreateProfile(c echo.Context) error {
dat := CreateProfileData{
FirstNumber: 1,
LastNumber: 2,
}
return response.TemplEcho(c, ProfileFormView(dat))
return response.TemplEcho(c, ProfileFormView(randomCreateProfileData()))
}
func HandlePasskeyStart(c echo.Context) error {
@@ -50,3 +47,10 @@ func HandlePasskeyFinish(c echo.Context) error {
}
return response.TemplEcho(c, LoadingVaultView())
}
func randomCreateProfileData() CreateProfileData {
return CreateProfileData{
FirstNumber: rand.Intn(5) + 1,
LastNumber: rand.Intn(4) + 1,
}
}
@@ -1,30 +0,0 @@
package ui
// Styles for form controls
templ LabelOnLeft() {
<style>
.label-on-left {
--label-width: 3.75rem;
--gap-width: 1rem;
}
.label-on-left + .label-on-left {
margin-top: var(--sl-spacing-medium);
}
.label-on-left::part(form-control) {
display: grid;
grid: auto / var(--label-width) 1fr;
gap: var(--sl-spacing-3x-small) var(--gap-width);
align-items: center;
}
.label-on-left::part(form-control-label) {
text-align: right;
}
.label-on-left::part(form-control-help-text) {
grid-column-start: 2;
}
</style>
}
@@ -1,41 +0,0 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.793
package ui
//lint:file-ignore SA4006 This context is only used if a nested component is present.
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
// Styles for form controls
func LabelOnLeft() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
return templ_7745c5c3_CtxErr
}
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templruntime.GetBuffer(templ_7745c5c3_W)
if !templ_7745c5c3_IsBuffer {
defer func() {
templ_7745c5c3_BufErr := templruntime.ReleaseBuffer(templ_7745c5c3_Buffer)
if templ_7745c5c3_Err == nil {
templ_7745c5c3_Err = templ_7745c5c3_BufErr
}
}()
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var1 := templ.GetChildren(ctx)
if templ_7745c5c3_Var1 == nil {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<style>\n .label-on-left {\n --label-width: 3.75rem;\n --gap-width: 1rem;\n }\n\n .label-on-left + .label-on-left {\n margin-top: var(--sl-spacing-medium);\n }\n\n .label-on-left::part(form-control) {\n display: grid;\n grid: auto / var(--label-width) 1fr;\n gap: var(--sl-spacing-3x-small) var(--gap-width);\n align-items: center;\n }\n\n .label-on-left::part(form-control-label) {\n text-align: right;\n }\n\n .label-on-left::part(form-control-help-text) {\n grid-column-start: 2;\n }\n </style>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate