NextWks/src/core/ui/launcher_templ.go

192 lines
14 KiB
Go

// Code generated by templ - DO NOT EDIT.
// templ: version: v0.3.1020
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"
import "fmt"
func LauncherPage(userName string, apps []AppTile) 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 = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<!doctype html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Next Workspace</title><link rel=\"manifest\" href=\"/static/manifest.json\"><meta name=\"theme-color\" content=\"#3b82f6\"><meta name=\"apple-mobile-web-app-capable\" content=\"yes\"><meta name=\"apple-mobile-web-app-status-bar-style\" content=\"black-translucent\"><script src=\"https://unpkg.com/htmx.org@2.0.4\"></script><style>{ workspaceStyles() }</style></head><body><div class=\"workspace\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = headerBar(userName).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 2, "<main class=\"main\"><div class=\"greeting\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = greetingHeading(userName).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 3, "<p>Your workspace is ready</p></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = AppGrid(apps).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = PWAInstallPrompt().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 4, "</main></div><div id=\"pwa-modal\" class=\"modal-overlay\" style=\"display:none;\" hx-target=\"this\" hx-swap=\"innerHTML\"></div><script>\n\t\t\t\t// PWA install prompt handler\n\t\t\t\tlet deferredPrompt = null;\n\t\t\t\twindow.addEventListener('beforeinstallprompt', (e) => {\n\t\t\t\t\te.preventDefault();\n\t\t\t\t\tdeferredPrompt = e;\n\t\t\t\t\tdocument.getElementById('pwa-install-btn').style.display = 'inline-flex';\n\t\t\t\t});\n\n\t\t\t\tfunction installPWA() {\n\t\t\t\t\tif (deferredPrompt) {\n\t\t\t\t\t\tdeferredPrompt.prompt();\n\t\t\t\t\t\tdeferredPrompt.userChoice.then(() => { deferredPrompt = null; });\n\t\t\t\t\t} else {\n\t\t\t\t\t\thtmx.ajax('GET', '/pwa-guide', { target: '#pwa-modal', swap: 'innerHTML' });\n\t\t\t\t\t\tdocument.getElementById('pwa-modal').style.display = 'flex';\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfunction closePWAModal() {\n\t\t\t\t\tdocument.getElementById('pwa-modal').style.display = 'none';\n\t\t\t\t}\n\n\t\t\t\t// Close modal on overlay click\n\t\t\t\tdocument.addEventListener('click', (e) => {\n\t\t\t\t\tif (e.target.classList.contains('modal-overlay')) {\n\t\t\t\t\t\tclosePWAModal();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t</script></body></html>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
func greetingHeading(userName string) 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_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 5, "<h1>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if userName != "" {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("Welcome, %s", userName))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `core/ui/launcher.templ`, Line: 73, Col: 41}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs("Welcome")
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `core/ui/launcher.templ`, Line: 75, Col: 14}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 6, "</h1>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
func headerBar(userName string) 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_Var5 := templ.GetChildren(ctx)
if templ_7745c5c3_Var5 == nil {
templ_7745c5c3_Var5 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 7, "<header class=\"header\"><div class=\"header-left\"><span class=\"logo\">NextWks</span></div><div class=\"header-right\"><button id=\"pwa-install-btn\" class=\"btn-icon\" onclick=\"installPWA()\" title=\"Install to Desktop\" style=\"display:none;\"><svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4\"></path> <polyline points=\"7 10 12 15 17 10\"></polyline> <line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"></line></svg></button> ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if userName != "" {
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 8, "<a href=\"/auth/logout\" class=\"btn-icon\" title=\"Sign out\"><svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><path d=\"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4\"></path> <polyline points=\"16 17 21 12 16 7\"></polyline> <line x1=\"21\" y1=\"12\" x2=\"9\" y2=\"12\"></line></svg></a>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 9, "</div></header>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
func workspaceStyles() 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_Var6 := templ.GetChildren(ctx)
if templ_7745c5c3_Var6 == nil {
templ_7745c5c3_Var6 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 10, "<style type=\"text/css\">\n\t\t*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n\t\t:root {\n\t\t\t--bg: #0f172a;\n\t\t\t--surface: #1e293b;\n\t\t\t--surface-2: #334155;\n\t\t\t--border: #475569;\n\t\t\t--text: #f1f5f9;\n\t\t\t--text-muted: #94a3b8;\n\t\t\t--primary: #3b82f6;\n\t\t\t--primary-hover: #2563eb;\n\t\t\t--radius: 12px;\n\t\t}\n\t\thtml { font-size: 14px; }\n\t\tbody {\n\t\t\tfont-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n\t\t\tbackground: var(--bg);\n\t\t\tcolor: var(--text);\n\t\t\tmin-height: 100vh;\n\t\t}\n\t\t.workspace { display: flex; flex-direction: column; min-height: 100vh; }\n\t\t.header {\n\t\t\tdisplay: flex; justify-content: space-between; align-items: center;\n\t\t\tpadding: 0.75rem 1.5rem;\n\t\t\tbackground: var(--surface);\n\t\t\tborder-bottom: 1px solid var(--border);\n\t\t}\n\t\t.logo { font-size: 1.25rem; font-weight: 700; color: var(--primary); }\n\t\t.header-right { display: flex; gap: 0.5rem; align-items: center; }\n\t\t.btn-icon {\n\t\t\tdisplay: inline-flex; align-items: center; justify-content: center;\n\t\t\twidth: 36px; height: 36px;\n\t\t\tborder: none; border-radius: 8px;\n\t\t\tbackground: transparent; color: var(--text-muted);\n\t\t\tcursor: pointer; transition: all 0.15s;\n\t\t}\n\t\t.btn-icon:hover { background: var(--surface-2); color: var(--text); }\n\t\t.main {\n\t\t\tflex: 1;\n\t\t\tmax-width: 1200px;\n\t\t\twidth: 100%;\n\t\t\tmargin: 0 auto;\n\t\t\tpadding: 2rem 1.5rem;\n\t\t}\n\t\t.greeting { margin-bottom: 2rem; }\n\t\t.greeting h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; }\n\t\t.greeting p { color: var(--text-muted); font-size: 1rem; }\n\t\t.app-grid {\n\t\t\tdisplay: grid;\n\t\t\tgrid-template-columns: repeat(auto-fill, minmax(240px, 1fr));\n\t\t\tgap: 1rem;\n\t\t\tmargin-bottom: 2rem;\n\t\t}\n\t\t.app-card {\n\t\t\tbackground: var(--surface);\n\t\t\tborder: 1px solid var(--border);\n\t\t\tborder-radius: var(--radius);\n\t\t\tpadding: 1.5rem;\n\t\t\ttransition: all 0.15s;\n\t\t\tcursor: pointer;\n\t\t\ttext-decoration: none;\n\t\t\tcolor: inherit;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\tgap: 0.75rem;\n\t\t}\n\t\t.app-card:hover {\n\t\t\tborder-color: var(--primary);\n\t\t\ttransform: translateY(-2px);\n\t\t\tbox-shadow: 0 8px 24px rgba(0,0,0,0.2);\n\t\t}\n\t\t.app-card .app-icon {\n\t\t\twidth: 48px; height: 48px;\n\t\t\tborder-radius: 12px;\n\t\t\tdisplay: flex; align-items: center; justify-content: center;\n\t\t\tfont-size: 1.25rem;\n\t\t}\n\t\t.app-card .app-name { font-size: 1rem; font-weight: 600; }\n\t\t.app-card .app-desc { font-size: 0.875rem; color: var(--text-muted); line-height: 1.4; }\n\t\t.app-card .app-badge {\n\t\t\tfont-size: 0.75rem;\n\t\t\tcolor: var(--text-muted);\n\t\t\tmargin-top: auto;\n\t\t\tpadding-top: 0.5rem;\n\t\t}\n\t\t.pwa-prompt {\n\t\t\tbackground: linear-gradient(135deg, var(--surface), var(--surface-2));\n\t\t\tborder: 1px solid var(--border);\n\t\t\tborder-radius: var(--radius);\n\t\t\tpadding: 1.5rem;\n\t\t\ttext-align: center;\n\t\t}\n\t\t.pwa-prompt h3 { margin-bottom: 0.5rem; }\n\t\t.pwa-prompt p { color: var(--text-muted); margin-bottom: 1rem; font-size: 0.875rem; }\n\t\t.btn {\n\t\t\tdisplay: inline-flex; align-items: center;\n\t\t\tpadding: 0.625rem 1.25rem;\n\t\t\tborder: none; border-radius: 8px;\n\t\t\tcursor: pointer; font-size: 0.875rem; font-weight: 500;\n\t\t\ttransition: background 0.15s;\n\t\t\ttext-decoration: none;\n\t\t}\n\t\t.btn-primary { background: var(--primary); color: white; }\n\t\t.btn-primary:hover { background: var(--primary-hover); }\n\t\t.modal-overlay {\n\t\t\tposition: fixed; inset: 0;\n\t\t\tbackground: rgba(0,0,0,0.6);\n\t\t\tdisplay: flex; align-items: center; justify-content: center;\n\t\t\tz-index: 1000;\n\t\t}\n\t\t.modal {\n\t\t\tbackground: var(--surface);\n\t\t\tborder: 1px solid var(--border);\n\t\t\tborder-radius: var(--radius);\n\t\t\tpadding: 2rem;\n\t\t\tmax-width: 480px;\n\t\t\twidth: 90%;\n\t\t\tmax-height: 80vh;\n\t\t\toverflow-y: auto;\n\t\t}\n\t\t.modal h2 { margin-bottom: 1rem; }\n\t\t.modal p { color: var(--text-muted); margin-bottom: 1rem; font-size: 0.875rem; }\n\t\t.modal ol { margin-left: 1.25rem; margin-bottom: 1rem; }\n\t\t.modal li { margin-bottom: 0.5rem; font-size: 0.875rem; color: var(--text); }\n\t\t.modal code {\n\t\t\tbackground: var(--bg);\n\t\t\tpadding: 0.125rem 0.375rem;\n\t\t\tborder-radius: 4px;\n\t\t\tfont-size: 0.8125rem;\n\t\t}\n\t\t.modal-close {\n\t\t\tfloat: right;\n\t\t\tbackground: none; border: none;\n\t\t\tcolor: var(--text-muted); cursor: pointer;\n\t\t\tfont-size: 1.25rem;\n\t\t}\n\t\t.modal-close:hover { color: var(--text); }\n\t</style>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return nil
})
}
var _ = templruntime.GeneratedTemplate