Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Settings v2] Use history back for settings v2 pages navbar #4804

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .make-lint-translation-keys-expect
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@ resources/authgear/templates/en/web/authflowv2/forgot_password.html:159:26: temp
resources/authgear/templates/en/web/authflowv2/layout.html:5:14: template translation is forbidden: `widget`
resources/authgear/templates/en/web/authflowv2/login.html:252:37: translation key not defined: "%s-icon"
resources/authgear/templates/en/web/authflowv2/settings_layout.html:3:14: template translation is forbidden: `widget`
resources/authgear/templates/en/web/authflowv2/settings_oob_otp.html:39:31: translation key not defined: "/settings/mfa/new_oob_otp_%s"
resources/authgear/templates/en/web/authflowv2/settings_profile.html:139:22: translation key not defined: "custom-attribute-label-%s"
resources/authgear/templates/en/web/authflowv2/settings_profile.html:140:20: invalid translation key: "$labelKey"
resources/authgear/templates/en/web/authflowv2/settings_profile.html:144:21: invalid translation key: "$labelKey"
resources/authgear/templates/en/web/authflowv2/settings_profile.html:196:22: invalid translation key: "$label"
resources/authgear/templates/en/web/authflowv2/settings_oob_otp.html:38:31: translation key not defined: "/settings/mfa/new_oob_otp_%s"
resources/authgear/templates/en/web/authflowv2/settings_profile.html:138:22: translation key not defined: "custom-attribute-label-%s"
resources/authgear/templates/en/web/authflowv2/settings_profile.html:139:20: invalid translation key: "$labelKey"
resources/authgear/templates/en/web/authflowv2/settings_profile.html:143:21: invalid translation key: "$labelKey"
resources/authgear/templates/en/web/authflowv2/settings_profile.html:195:22: invalid translation key: "$label"
resources/authgear/templates/en/web/authflowv2/settings_profile_edit_custom.html:6:18: translation key not defined: "custom-attribute-label-%s"
resources/authgear/templates/en/web/authflowv2/settings_profile_edit_custom.html:7:16: invalid translation key: "$labelKey"
resources/authgear/templates/en/web/authflowv2/settings_profile_edit_custom.html:11:17: invalid translation key: "$labelKey"
resources/authgear/templates/en/web/authflowv2/settings_profile_edit_custom.html:91:30: translation key not defined: "custom-attribute-enum-label-%s-%s"
resources/authgear/templates/en/web/authflowv2/settings_profile_edit_custom.html:92:28: invalid translation key: "$enum_label_key"
resources/authgear/templates/en/web/authflowv2/settings_profile_edit_custom.html:95:28: invalid translation key: "$enum_label_key"
resources/authgear/templates/en/web/authflowv2/settings_profile_edit_custom.html:90:30: translation key not defined: "custom-attribute-enum-label-%s-%s"
resources/authgear/templates/en/web/authflowv2/settings_profile_edit_custom.html:91:28: invalid translation key: "$enum_label_key"
resources/authgear/templates/en/web/authflowv2/settings_profile_edit_custom.html:94:28: invalid translation key: "$enum_label_key"
resources/authgear/templates/en/web/authflowv2/signup.html:93:26: translation key not defined: "v2.page.signup-login.continue.subtitle-%v"
resources/authgear/templates/en/web/authflowv2/signup.html:102:26: translation key not defined: "v2.page.signup.continue.subtitle-%v"
resources/authgear/templates/en/web/authflowv2/signup.html:275:35: translation key not defined: "%s-icon"
Expand Down
2 changes: 2 additions & 0 deletions authui/src/authflowv2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ import { BotProtectionStandalonePageController } from "./authflowv2/botprotectio
import { ImagePickerController } from "./imagepicker";
import { SelectInputController } from "./authflowv2/selectInput";
import { AccountDeletionController } from "./accountdeletion";
import { BackController } from "./authflowv2/back";

axios.defaults.withCredentials = true;

Expand Down Expand Up @@ -136,5 +137,6 @@ Stimulus.register("bot-protection-dialog", BotProtectionDialogController);
Stimulus.register("select-input", SelectInputController);

Stimulus.register("account-deletion", AccountDeletionController);
Stimulus.register("back-button", BackController);

injectCSSAttrs(document.documentElement);
16 changes: 16 additions & 0 deletions authui/src/authflowv2/back.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Controller } from "@hotwired/stimulus";

export class BackController extends Controller {
connect(): void {
this.element.classList.remove("hidden");
this.element.addEventListener("click", this.back);
}

disconnect(): void {
this.element.removeEventListener("click", this.back);
}

back = () => {
window.history.back();
};
}
4 changes: 4 additions & 0 deletions authui/src/authflowv2/components/navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@

.navbar__item {
@apply relative;
@apply inline-flex;
@apply items-center;
@apply justify-center;
@apply gap-x-3;

color: var(--navbar__item-text-color);
font-family: var(--navbar__item-font-family);
Expand Down
8 changes: 4 additions & 4 deletions resources/authgear/templates/en/web/authflowv2/__navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<nav class="navbar">
<h1 class="navbar__title">{{ $.Title }}</h1>

<a
class="navbar__item inline-flex items-center justify-center gap-x-3"
<button
class="navbar__item hidden"
title="{{ .BackTitle }}"
href="{{ .BackHref }}"
data-controller="back-button"
data-turbo-action="replace"
>
<span class="hidden tablet:inline-block">{{ .BackTitle }}</span>
</a>
</button>
</nav>
{{ end }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings")
"Title" (translate "v2.page.settings-advanced-settings.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings")
"Title" (translate "v2.page.settings-biometric.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings")
"Title" (translate "v2.page.settings-change-password.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings")
"Title" (translate "v2.page.settings-delete-account.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/identity/email" "q_login_id_key" $.LoginIDKey)
"Title" (translate "v2.page.settings-identity-add-email.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/identity/phone" "q_login_id_key" $.LoginIDKey)
"Title" (translate "v2.page.settings-identity-add-phone.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/identity/email" "q_login_id_key" $.LoginIDKey)
"Title" (translate "v2.page.settings-identity-change-primary-email.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/identity/phone" "q_login_id_key" $.LoginIDKey)
"Title" (translate "v2.page.settings-identity-change-primary-phone.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/identity/email" "q_login_id_key" $.LoginIDKey)
"Title" (translate "v2.page.settings-identity-edit-email.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/identity/phone" "q_login_id_key" $.LoginIDKey)
"Title" (translate "v2.page.settings-identity-edit-phone.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/identity/view_username" "q_login_id" $.Identity.ID)
"Title" (translate "v2.page.settings-identity-edit-username.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings" "q_login_id_key" $.LoginIDKey)
"Title" (translate "v2.page.settings-identity-email.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings")
"Title" (translate "v2.page.settings-identity-phone.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings")
"Title" (translate "v2.page.settings-identity-list-username.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/identity/username" "q_login_id_key" $.LoginIDKey)
"Title" (translate "v2.page.settings-identity-new-username.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/identity/email" "q_login_id_key" $.LoginIDKey)
"Title" (translate "v2.page.settings-identity-verify-email.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/identity/phone" "q_login_id_key" $.LoginIDKey)
"Title" (translate "v2.page.settings-identity-verify-phone.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/identity/email" "q_login_id_key" $.LoginIDKey)
"Title" (translate "v2.page.settings-identity-email.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/identity/phone" "q_login_id_key" $.LoginIDKey)
"Title" (translate "v2.page.settings-identity-phone.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/identity/username" "q_login_id_key" $.LoginIDKey)
"Title" (translate "v2.page.settings-identity-view-username.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings")
"Title" (translate "v2.page.settings-mfa.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/mfa")
"Title" (translate "v2.page.settings-mfa-create-password.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/mfa")
"Title" (translate "v2.page.settings-mfa-password.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/mfa")
"Title" $title
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings")
"Title" (translate "v2.page.settings-passkey.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/profile")
"Title" (translate "v2.page.settings-profile.default.profile-picture-title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings")
"Title" (translate "v2.page.settings-profile.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{{ define "page-navbar" }}
{{ template "authflowv2/__navbar.html"
(dict
"BackHref" (call $.MakeURL "/settings/profile")
"Title" (translate "v2.page.settings-profile-edit-address.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{{ define "page-navbar" }}
{{ template "authflowv2/__navbar.html"
(dict
"BackHref" (call $.MakeURL "/settings/profile")
"Title" (translate "v2.page.settings-profile-edit-birthdate.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/profile")
"Title" $label
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html" (dict
"Title" (include "v2.page.settings-profile-edit-gender.default.title" nil )
"BackTitle" (include "v2.component.navbar.default.item-back-button-label" nil )
"BackHref" (call $.MakeURL "/settings/profile")
)
}}
{{ end }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/profile")
"Title" (translate "v2.page.settings-profile-edit-locale.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/profile")
"Title" (translate "v2.page.settings-profile-edit-name.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/profile")
"Title" (translate "v2.page.settings-profile-edit-zoneinfo.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings")
"Title" (translate "v2.page.settings-sessions.default.title" nil)
)
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ template "authflowv2/__navbar.html"
(dict
"BackTitle" (translate "v2.component.navbar.default.item-back-button-label" nil)
"BackHref" (call $.MakeURL "/settings/mfa")
"Title" (translate "v2.page.settings-totp.default.title" nil)
)
}}
Expand Down
Loading