diff --git a/wwwroot/app.js b/wwwroot/app.js index 4b55855..066d1dc 100644 --- a/wwwroot/app.js +++ b/wwwroot/app.js @@ -53,9 +53,14 @@ function setAuthMode(mode) { document.querySelectorAll(".auth-form").forEach(form => { form.classList.toggle("hidden", form.dataset.mode !== mode); }); - document.querySelectorAll("[data-auth-tab]").forEach(btn => { - btn.classList.toggle("active", btn.dataset.authTab === mode); - }); + const title = $("auth-title"); + const toggleBtn = $("auth-toggle"); + if (title) { + title.textContent = mode === "login" ? t("auth.loginHeading") : t("auth.registerHeading"); + } + if (toggleBtn) { + toggleBtn.textContent = mode === "login" ? t("auth.switchToRegister") : t("auth.switchToLogin"); + } } function clearUserState() { @@ -299,9 +304,10 @@ function renderPhaseTitles() { } function setupHandlers() { - document.querySelectorAll("[data-auth-tab]").forEach(btn => { - btn.addEventListener("click", () => setAuthMode(btn.dataset.authTab)); - }); + const toggleAuth = $("auth-toggle"); + if (toggleAuth) { + toggleAuth.addEventListener("click", () => setAuthMode(state.authMode === "login" ? "register" : "login")); + } setAuthMode(state.authMode); const langSelects = Array.from(document.querySelectorAll(".lang-select")); diff --git a/wwwroot/index.html b/wwwroot/index.html index f798211..3a8e0c5 100644 --- a/wwwroot/index.html +++ b/wwwroot/index.html @@ -16,9 +16,9 @@