first commit

This commit is contained in:
Matthias Hinrichs
2025-07-05 03:10:41 +02:00
commit 9b7bdcbc53
39 changed files with 5109 additions and 0 deletions
@@ -0,0 +1,103 @@
// Code generated by templ - DO NOT EDIT.
// templ: version: v0.2.778
package components
//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"
"portfolio-tracker/internal/model"
)
func Navigation(authenticated bool, portfolios []model.Portfolio) 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("<aside class=\"navbar navbar-vertical navbar-expand-lg\" data-bs-theme=\"dark\"><div class=\"container-fluid\"><a class=\"navbar-brand\" href=\"#\"><span class=\"navbar-brand-text\">Portfolio Tracker</span></a><div class=\"collapse navbar-collapse show\"><ul class=\"navbar-nav pt-lg-3\"><li class=\"nav-item\"><a class=\"nav-link active\" href=\"/\"><span class=\"nav-link-icon\"><svg xmlns=\"http://www.w3.org/2000/svg\" class=\"icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path> <rect x=\"3\" y=\"12\" width=\"6\" height=\"8\" rx=\"1\"></rect> <rect x=\"9\" y=\"8\" width=\"6\" height=\"12\" rx=\"1\"></rect> <rect x=\"15\" y=\"4\" width=\"6\" height=\"16\" rx=\"1\"></rect></svg></span> <span class=\"nav-link-title\">Dashboard</span></a></li><li class=\"nav-item dropdown\"><a class=\"nav-link dropdown-toggle\" href=\"#\" id=\"portfolioDropdown\" role=\"button\" data-bs-toggle=\"dropdown\" aria-expanded=\"false\"><span class=\"nav-link-icon\"><svg xmlns=\"http://www.w3.org/2000/svg\" class=\"icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path> <path d=\"M9 5H7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2V7a2 2 0 0 0 -2 -2h-2\"></path> <path d=\"M9 3m0 2a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v0a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2z\"></path> <path d=\"M9 12l2 2l4 -4\"></path></svg></span> <span class=\"nav-link-title\">Portfolio</span></a><ul class=\"dropdown-menu\" aria-labelledby=\"portfolioDropdown\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if len(portfolios) > 0 {
for _, portfolio := range portfolios {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<li><a class=\"dropdown-item\" href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 templ.SafeURL = templ.URL("/portfolio/" + templ.EscapeString(fmt.Sprintf("%d", portfolio.ID)))
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(string(templ_7745c5c3_Var2)))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(portfolio.Name)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/web/templates/components/navigation.templ`, Line: 44, Col: 142}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a></li>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" <li><hr class=\"dropdown-divider\"></li>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<li><span class=\"dropdown-item-text text-muted\">Keine Portfolios vorhanden</span></li><li><hr class=\"dropdown-divider\"></li>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<li><a class=\"dropdown-item\" href=\"/portfolio/new\" data-bs-toggle=\"modal\" data-bs-target=\"#createPortfolioModal\"><svg xmlns=\"http://www.w3.org/2000/svg\" class=\"icon icon-sm me-2\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path> <path d=\"M12 5l0 14\"></path> <path d=\"M5 12l14 0\"></path></svg> Neues Portfolio erstellen</a></li></ul></li><li class=\"nav-item\"><a class=\"nav-link\" href=\"#\"><span class=\"nav-link-icon\"><svg xmlns=\"http://www.w3.org/2000/svg\" class=\"icon\" width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" stroke-width=\"2\" stroke=\"currentColor\" fill=\"none\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\"></path> <path d=\"M3 21l18 0\"></path> <path d=\"M3 10l18 0\"></path> <path d=\"M5 6l7 -3l7 3\"></path> <path d=\"M4 10l0 11\"></path> <path d=\"M20 10l0 11\"></path> <path d=\"M8 14l0 3\"></path> <path d=\"M12 14l0 3\"></path> <path d=\"M16 14l0 3\"></path></svg></span> <span class=\"nav-link-title\">Wertpapiere</span></a></li><!-- Weitere Menüpunkte hier --></ul><div id=\"login_buttons\" class=\"mt-4\" style=\"padding-left:10px; padding-bottom:10px;\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if authenticated == true {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<form method=\"post\" action=\"/user/logout\"><button type=\"submit\" class=\"btn btn-danger w-100\">Logout</button></form>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} else {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button type=\"button\" class=\"btn btn-outline-primary w-100 mb-2\" data-bs-toggle=\"modal\" data-bs-target=\"#loginModal\">Login</button> <button type=\"button\" class=\"btn btn-primary w-100\" data-bs-toggle=\"modal\" data-bs-target=\"#registerModal\">Registrieren</button>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div></aside><!-- Create Portfolio Modal --><div class=\"modal modal-blur fade\" id=\"createPortfolioModal\" tabindex=\"-1\" aria-labelledby=\"createPortfolioModalLabel\" aria-hidden=\"true\"><div class=\"modal-dialog\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\" id=\"createPortfolioModalLabel\">Neues Portfolio erstellen</h5><button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Schließen\"></button></div><form method=\"post\" action=\"/portfolio/create\"><div class=\"modal-body\"><div class=\"mb-3\"><label for=\"portfolio-name\" class=\"form-label\">Portfolio Name</label> <input type=\"text\" class=\"form-control\" id=\"portfolio-name\" name=\"name\" placeholder=\"z.B. Mein Hauptportfolio\" required></div><div class=\"mb-3\"><label for=\"portfolio-currency\" class=\"form-label\">Basiswährung</label> <select class=\"form-select\" id=\"portfolio-currency\" name=\"base_currency\" required><option value=\"\">Wählen Sie eine Währung</option> <option value=\"EUR\">EUR - Euro</option> <option value=\"USD\">USD - US Dollar</option> <option value=\"GBP\">GBP - Britisches Pfund</option> <option value=\"CHF\">CHF - Schweizer Franken</option> <option value=\"JPY\">JPY - Japanischer Yen</option></select></div><div class=\"mb-3\"><label for=\"portfolio-description\" class=\"form-label\">Beschreibung (optional)</label> <textarea class=\"form-control\" id=\"portfolio-description\" name=\"description\" rows=\"3\" placeholder=\"Beschreibung des Portfolios...\"></textarea></div></div><div class=\"modal-footer\"><button type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Abbrechen</button> <button type=\"submit\" class=\"btn btn-primary\">Portfolio erstellen</button></div></form></div></div></div><!-- Login Modal --><div class=\"modal modal-blur fade\" id=\"loginModal\" tabindex=\"-1\" aria-labelledby=\"loginModalLabel\" aria-hidden=\"true\"><div class=\"modal-dialog\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\" id=\"loginModalLabel\">Anmelden</h5><button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Schließen\"></button></div><form method=\"post\" action=\"/user/login\"><div class=\"modal-body\"><div class=\"mb-3\"><label for=\"login-username\" class=\"form-label\">Benutzername</label> <input type=\"text\" class=\"form-control\" id=\"login-username\" name=\"username\" required></div><div class=\"mb-3\"><label for=\"login-password\" class=\"form-label\">Passwort</label> <input type=\"password\" class=\"form-control\" id=\"login-password\" name=\"password\" required></div></div><div class=\"modal-footer d-flex justify-content-between align-items-center\"><a href=\"#\" class=\"text-secondary small\" data-bs-dismiss=\"modal\" style=\"text-decoration:none;\">Abbrechen</a> <button type=\"submit\" class=\"btn btn-primary\">Anmelden</button></div></form></div></div></div><!-- Register Modal --><div class=\"modal modal-blur fade\" id=\"registerModal\" tabindex=\"-1\" aria-labelledby=\"registerModalLabel\" aria-hidden=\"true\"><div class=\"modal-dialog\"><div class=\"modal-content\"><div class=\"modal-header\"><h5 class=\"modal-title\" id=\"registerModalLabel\">Registrieren</h5><button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Schließen\"></button></div><form method=\"post\" action=\"/user/register\"><div class=\"modal-body\"><div class=\"mb-3\"><label for=\"register-username\" class=\"form-label\">Benutzername</label> <input type=\"text\" class=\"form-control\" id=\"register-username\" name=\"username\" required></div><div class=\"mb-3\"><label for=\"register-email\" class=\"form-label\">E-Mail</label> <input type=\"email\" class=\"form-control\" id=\"register-email\" name=\"email\" required></div><div class=\"mb-3\"><label for=\"register-password\" class=\"form-label\">Passwort</label> <input type=\"password\" class=\"form-control\" id=\"register-password\" name=\"password\" required></div></div><div class=\"modal-footer d-flex justify-content-between align-items-center\"><a href=\"#\" class=\"text-secondary small\" data-bs-dismiss=\"modal\" style=\"text-decoration:none;\">Abbrechen</a> <button type=\"submit\" class=\"btn btn-primary\">Registrieren</button></div></form></div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
return templ_7745c5c3_Err
})
}
var _ = templruntime.GeneratedTemplate