hazo_auth 10.19.0 → 10.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/SETUP_CHECKLIST.md +27 -0
- package/cli-src/lib/already_logged_in_config.server.ts +11 -7
- package/cli-src/lib/auth_hooks.ts +52 -0
- package/cli-src/lib/config/config_loader.server.ts +34 -0
- package/cli-src/lib/email_verification_config.server.ts +2 -2
- package/cli-src/lib/forgot_password_config.server.ts +2 -2
- package/cli-src/lib/login_config.server.ts +25 -19
- package/cli-src/lib/my_settings_config.server.ts +22 -15
- package/cli-src/lib/navbar_config.server.ts +12 -8
- package/cli-src/lib/oauth_config.server.ts +14 -22
- package/cli-src/lib/otp_config.server.ts +11 -4
- package/cli-src/lib/profile_pic_menu_config.server.ts +16 -5
- package/cli-src/lib/register_config.server.ts +21 -16
- package/cli-src/lib/reset_password_config.server.ts +11 -17
- package/cli-src/lib/services/oauth_service.ts +16 -0
- package/cli-src/lib/services/otp_service.ts +7 -0
- package/cli-src/lib/services/registration_service.ts +8 -0
- package/cli-src/lib/ui_shell_config.server.ts +11 -13
- package/dist/components/layouts/create_firm/index.d.ts.map +1 -1
- package/dist/components/layouts/create_firm/index.js +4 -3
- package/dist/components/layouts/dev_lock/index.d.ts.map +1 -1
- package/dist/components/layouts/dev_lock/index.js +4 -2
- package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts +5 -4
- package/dist/components/layouts/email_verification/config/email_verification_field_config.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/config/email_verification_field_config.js +20 -20
- package/dist/components/layouts/email_verification/hooks/use_email_verification.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/hooks/use_email_verification.js +5 -7
- package/dist/components/layouts/email_verification/index.d.ts.map +1 -1
- package/dist/components/layouts/email_verification/index.js +13 -12
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts +3 -2
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/config/forgot_password_field_config.js +16 -16
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/hooks/use_forgot_password_form.js +5 -7
- package/dist/components/layouts/forgot_password/index.d.ts.map +1 -1
- package/dist/components/layouts/forgot_password/index.js +15 -9
- package/dist/components/layouts/legal/legal_acceptance_gate.d.ts.map +1 -1
- package/dist/components/layouts/legal/legal_acceptance_gate.js +5 -3
- package/dist/components/layouts/legal/legal_doc_checkbox_list.d.ts.map +1 -1
- package/dist/components/layouts/legal/legal_doc_checkbox_list.js +3 -1
- package/dist/components/layouts/legal/legal_doc_combined_view.d.ts.map +1 -1
- package/dist/components/layouts/legal/legal_doc_combined_view.js +3 -1
- package/dist/components/layouts/login/config/login_field_config.d.ts +3 -2
- package/dist/components/layouts/login/config/login_field_config.d.ts.map +1 -1
- package/dist/components/layouts/login/config/login_field_config.js +24 -24
- package/dist/components/layouts/login/hooks/use_login_form.d.ts.map +1 -1
- package/dist/components/layouts/login/hooks/use_login_form.js +5 -7
- package/dist/components/layouts/login/index.d.ts +4 -4
- package/dist/components/layouts/login/index.d.ts.map +1 -1
- package/dist/components/layouts/login/index.js +30 -22
- package/dist/components/layouts/my_settings/components/connected_accounts_section.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/connected_accounts_section.js +5 -5
- package/dist/components/layouts/my_settings/components/danger_zone_section.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/danger_zone_section.js +12 -6
- package/dist/components/layouts/my_settings/components/editable_field.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/editable_field.js +4 -2
- package/dist/components/layouts/my_settings/components/language_picker_section.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/language_picker_section.js +7 -3
- package/dist/components/layouts/my_settings/components/password_change_dialog.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/password_change_dialog.js +28 -21
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_dialog.js +12 -9
- package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.js +3 -1
- package/dist/components/layouts/my_settings/components/profile_picture_library_tab.js +14 -11
- package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/profile_picture_upload_tab.js +26 -15
- package/dist/components/layouts/my_settings/components/set_password_section.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/components/set_password_section.js +9 -6
- package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts +2 -1
- package/dist/components/layouts/my_settings/config/my_settings_field_config.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/config/my_settings_field_config.js +4 -7
- package/dist/components/layouts/my_settings/index.d.ts.map +1 -1
- package/dist/components/layouts/my_settings/index.js +35 -27
- package/dist/components/layouts/otp/index.d.ts.map +1 -1
- package/dist/components/layouts/otp/index.js +8 -6
- package/dist/components/layouts/register/config/register_field_config.d.ts +3 -2
- package/dist/components/layouts/register/config/register_field_config.d.ts.map +1 -1
- package/dist/components/layouts/register/config/register_field_config.js +40 -40
- package/dist/components/layouts/register/hooks/use_register_form.d.ts.map +1 -1
- package/dist/components/layouts/register/hooks/use_register_form.js +7 -9
- package/dist/components/layouts/register/index.d.ts +4 -4
- package/dist/components/layouts/register/index.d.ts.map +1 -1
- package/dist/components/layouts/register/index.js +22 -19
- package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts +4 -3
- package/dist/components/layouts/reset_password/config/reset_password_field_config.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/config/reset_password_field_config.js +7 -10
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/hooks/use_reset_password_form.js +4 -6
- package/dist/components/layouts/reset_password/index.d.ts.map +1 -1
- package/dist/components/layouts/reset_password/index.js +12 -10
- package/dist/components/layouts/shared/components/already_logged_in_guard.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/already_logged_in_guard.js +6 -5
- package/dist/components/layouts/shared/components/auth_navbar.d.ts +1 -1
- package/dist/components/layouts/shared/components/auth_navbar.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/auth_navbar.js +7 -2
- package/dist/components/layouts/shared/components/facebook_sign_in_button.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/facebook_sign_in_button.js +5 -5
- package/dist/components/layouts/shared/components/floating_home_link.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/floating_home_link.js +6 -3
- package/dist/components/layouts/shared/components/form_action_buttons.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/form_action_buttons.js +9 -7
- package/dist/components/layouts/shared/components/google_sign_in_button.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/google_sign_in_button.js +5 -5
- package/dist/components/layouts/shared/components/logout_button.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/logout_button.js +2 -4
- package/dist/components/layouts/shared/components/oauth_divider.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/oauth_divider.js +8 -6
- package/dist/components/layouts/shared/components/password_field.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/password_field.js +2 -3
- package/dist/components/layouts/shared/components/profile_pic_menu.d.ts +4 -0
- package/dist/components/layouts/shared/components/profile_pic_menu.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/profile_pic_menu.js +26 -18
- package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.d.ts +1 -0
- package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/profile_pic_menu_wrapper.js +1 -1
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/sidebar_layout_wrapper.js +3 -1
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/standalone_layout_wrapper.js +6 -2
- package/dist/components/layouts/shared/components/unauthorized_guard.d.ts.map +1 -1
- package/dist/components/layouts/shared/components/unauthorized_guard.js +6 -5
- package/dist/components/layouts/shared/config/layout_customization.d.ts +2 -1
- package/dist/components/layouts/shared/config/layout_customization.d.ts.map +1 -1
- package/dist/components/layouts/shared/config/layout_customization.js +18 -7
- package/dist/components/layouts/shared/utils/validation.d.ts +5 -2
- package/dist/components/layouts/shared/utils/validation.d.ts.map +1 -1
- package/dist/components/layouts/shared/utils/validation.js +4 -8
- package/dist/components/layouts/user_management/components/roles_matrix.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/roles_matrix.js +2 -4
- package/dist/components/layouts/user_management/components/scope_hierarchy_tab.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/scope_hierarchy_tab.js +6 -8
- package/dist/components/layouts/user_management/components/user_scopes_tab.d.ts.map +1 -1
- package/dist/components/layouts/user_management/components/user_scopes_tab.js +2 -4
- package/dist/components/layouts/user_management/index.d.ts.map +1 -1
- package/dist/components/layouts/user_management/index.js +2 -4
- package/dist/components/otp/OTPRequestForm.d.ts.map +1 -1
- package/dist/components/otp/OTPRequestForm.js +7 -5
- package/dist/components/otp/OTPVerifyForm.d.ts.map +1 -1
- package/dist/components/otp/OTPVerifyForm.js +7 -5
- package/dist/components/permission_denied_dialog.client.d.ts.map +1 -1
- package/dist/components/permission_denied_dialog.client.js +6 -6
- package/dist/components/ui/sheet.d.ts +1 -1
- package/dist/components/ui/sidebar.js +5 -5
- package/dist/contexts/hazo_auth_config.d.ts +13 -0
- package/dist/contexts/hazo_auth_config.d.ts.map +1 -1
- package/dist/contexts/hazo_auth_config.js +4 -1
- package/dist/contexts/hazo_auth_provider.d.ts +22 -2
- package/dist/contexts/hazo_auth_provider.d.ts.map +1 -1
- package/dist/contexts/hazo_auth_provider.js +18 -2
- package/dist/lib/already_logged_in_config.server.d.ts +4 -2
- package/dist/lib/already_logged_in_config.server.d.ts.map +1 -1
- package/dist/lib/already_logged_in_config.server.js +7 -5
- package/dist/lib/auth_hooks.d.ts +20 -0
- package/dist/lib/auth_hooks.d.ts.map +1 -0
- package/dist/lib/auth_hooks.js +32 -0
- package/dist/lib/config/config_loader.server.d.ts +23 -0
- package/dist/lib/config/config_loader.server.d.ts.map +1 -1
- package/dist/lib/config/config_loader.server.js +29 -0
- package/dist/lib/email_verification_config.server.d.ts +2 -2
- package/dist/lib/email_verification_config.server.d.ts.map +1 -1
- package/dist/lib/forgot_password_config.server.d.ts +2 -2
- package/dist/lib/forgot_password_config.server.d.ts.map +1 -1
- package/dist/lib/login_config.server.d.ts +8 -5
- package/dist/lib/login_config.server.d.ts.map +1 -1
- package/dist/lib/login_config.server.js +13 -6
- package/dist/lib/my_settings_config.server.d.ts.map +1 -1
- package/dist/lib/my_settings_config.server.js +22 -15
- package/dist/lib/navbar_config.server.d.ts +3 -2
- package/dist/lib/navbar_config.server.d.ts.map +1 -1
- package/dist/lib/navbar_config.server.js +4 -2
- package/dist/lib/oauth_config.server.d.ts +6 -6
- package/dist/lib/oauth_config.server.d.ts.map +1 -1
- package/dist/lib/oauth_config.server.js +8 -4
- package/dist/lib/otp_config.server.d.ts +2 -2
- package/dist/lib/otp_config.server.d.ts.map +1 -1
- package/dist/lib/otp_config.server.js +4 -2
- package/dist/lib/profile_pic_menu_config.server.d.ts +6 -2
- package/dist/lib/profile_pic_menu_config.server.d.ts.map +1 -1
- package/dist/lib/profile_pic_menu_config.server.js +5 -3
- package/dist/lib/register_config.server.d.ts +7 -6
- package/dist/lib/register_config.server.d.ts.map +1 -1
- package/dist/lib/register_config.server.js +8 -4
- package/dist/lib/reset_password_config.server.d.ts +6 -4
- package/dist/lib/reset_password_config.server.d.ts.map +1 -1
- package/dist/lib/reset_password_config.server.js +5 -5
- package/dist/lib/services/oauth_service.d.ts.map +1 -1
- package/dist/lib/services/oauth_service.js +13 -0
- package/dist/lib/services/otp_service.d.ts.map +1 -1
- package/dist/lib/services/otp_service.js +6 -0
- package/dist/lib/services/registration_service.d.ts.map +1 -1
- package/dist/lib/services/registration_service.js +7 -0
- package/dist/lib/ui_shell_config.server.d.ts +6 -2
- package/dist/lib/ui_shell_config.server.d.ts.map +1 -1
- package/dist/lib/ui_shell_config.server.js +5 -3
- package/dist/locales/en.json +135 -1
- package/dist/server-lib.d.ts +2 -0
- package/dist/server-lib.d.ts.map +1 -1
- package/dist/server-lib.js +2 -0
- package/dist/server_pages/forgot_password.d.ts +3 -2
- package/dist/server_pages/forgot_password.d.ts.map +1 -1
- package/dist/server_pages/forgot_password.js +8 -7
- package/dist/server_pages/forgot_password_client_wrapper.d.ts +2 -1
- package/dist/server_pages/forgot_password_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/forgot_password_client_wrapper.js +3 -1
- package/dist/server_pages/login.d.ts.map +1 -1
- package/dist/server_pages/login.js +9 -7
- package/dist/server_pages/login_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/login_client_wrapper.js +3 -1
- package/dist/server_pages/otp.d.ts +6 -3
- package/dist/server_pages/otp.d.ts.map +1 -1
- package/dist/server_pages/otp.js +11 -8
- package/dist/server_pages/register.d.ts.map +1 -1
- package/dist/server_pages/register.js +7 -6
- package/dist/server_pages/register_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/register_client_wrapper.js +3 -1
- package/dist/server_pages/reset_password.d.ts.map +1 -1
- package/dist/server_pages/reset_password.js +7 -6
- package/dist/server_pages/reset_password_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/reset_password_client_wrapper.js +3 -1
- package/dist/server_pages/verify_email.d.ts.map +1 -1
- package/dist/server_pages/verify_email.js +6 -5
- package/dist/server_pages/verify_email_client_wrapper.d.ts.map +1 -1
- package/dist/server_pages/verify_email_client_wrapper.js +4 -2
- package/dist/strings/default_strings.d.ts +15 -0
- package/dist/strings/default_strings.d.ts.map +1 -1
- package/dist/strings/default_strings.js +53 -0
- package/dist/strings/index.d.ts +1 -1
- package/dist/strings/index.d.ts.map +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/strings/strings_context.d.ts +20 -3
- package/dist/strings/strings_context.d.ts.map +1 -1
- package/dist/strings/strings_context.js +39 -5
- package/dist/strings/strings_provider.d.ts +1 -5
- package/dist/strings/strings_provider.d.ts.map +1 -1
- package/dist/strings/strings_provider.js +5 -1
- package/package.json +10 -6
|
@@ -15,10 +15,7 @@ import { Input } from "../../../ui/input.js";
|
|
|
15
15
|
import { AlertDialog, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "../../../ui/alert-dialog.js";
|
|
16
16
|
import { FormFieldWrapper } from "../../shared/components/form_field_wrapper.js";
|
|
17
17
|
import { trigger_auth_status_refresh } from "../../shared/hooks/use_auth_status.js";
|
|
18
|
-
import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
|
|
19
|
-
import en from "../../../../locales/en.json" with { type: "json" };
|
|
20
|
-
import { createPackageT } from "hazo_core/i18n";
|
|
21
|
-
const t = createPackageT("hazo_auth", en);
|
|
18
|
+
import { useHazoAuthConfig, useAuthT } from "../../../../contexts/hazo_auth_provider.js";
|
|
22
19
|
// section: component
|
|
23
20
|
/**
|
|
24
21
|
* Danger Zone Section for My Settings
|
|
@@ -28,9 +25,18 @@ const t = createPackageT("hazo_auth", en);
|
|
|
28
25
|
* account-deletion API route and signs the user out on success.
|
|
29
26
|
* Renders nothing when `enabled` is false (config-gated, default off).
|
|
30
27
|
*/
|
|
31
|
-
export function DangerZoneSection({ email, enabled = false, heading
|
|
28
|
+
export function DangerZoneSection({ email, enabled = false, heading, description, deleteButtonLabel, dialogTitle, dialogDescription, confirmInputLabel, confirmButtonLabel, cancelButtonLabel, redirectPath = "/hazo_auth/login", }) {
|
|
32
29
|
const { apiBasePath } = useHazoAuthConfig();
|
|
30
|
+
const t = useAuthT();
|
|
33
31
|
const router = useRouter();
|
|
32
|
+
const resolvedHeading = heading !== null && heading !== void 0 ? heading : t("my_settings.danger_zone.heading");
|
|
33
|
+
const resolvedDescription = description !== null && description !== void 0 ? description : t("my_settings.danger_zone.description");
|
|
34
|
+
const resolvedDeleteButtonLabel = deleteButtonLabel !== null && deleteButtonLabel !== void 0 ? deleteButtonLabel : t("my_settings.danger_zone.delete_button");
|
|
35
|
+
const resolvedDialogTitle = dialogTitle !== null && dialogTitle !== void 0 ? dialogTitle : t("my_settings.danger_zone.dialog_title");
|
|
36
|
+
const resolvedDialogDescription = dialogDescription !== null && dialogDescription !== void 0 ? dialogDescription : t("my_settings.danger_zone.dialog_description");
|
|
37
|
+
const resolvedConfirmInputLabel = confirmInputLabel !== null && confirmInputLabel !== void 0 ? confirmInputLabel : t("my_settings.danger_zone.confirm_input_label");
|
|
38
|
+
const resolvedConfirmButtonLabel = confirmButtonLabel !== null && confirmButtonLabel !== void 0 ? confirmButtonLabel : t("my_settings.danger_zone.confirm_button");
|
|
39
|
+
const resolvedCancelButtonLabel = cancelButtonLabel !== null && cancelButtonLabel !== void 0 ? cancelButtonLabel : t("shared.cancel_button");
|
|
34
40
|
const [dialogOpen, setDialogOpen] = useState(false);
|
|
35
41
|
const [confirmEmail, setConfirmEmail] = useState("");
|
|
36
42
|
const [loading, setLoading] = useState(false);
|
|
@@ -92,5 +98,5 @@ export function DangerZoneSection({ email, enabled = false, heading = t("my_sett
|
|
|
92
98
|
if (!enabled) {
|
|
93
99
|
return null;
|
|
94
100
|
}
|
|
95
|
-
return (_jsxs("div", { className: "cls_my_settings_danger_zone_section bg-white rounded-lg border border-red-200 p-6", children: [_jsxs("div", { className: "cls_danger_zone_header flex items-center gap-2 mb-2", children: [_jsx(AlertTriangle, { className: "h-5 w-5 text-red-600", "aria-hidden": "true" }), _jsx("h2", { className: "cls_danger_zone_heading text-lg font-semibold text-red-700", children:
|
|
101
|
+
return (_jsxs("div", { className: "cls_my_settings_danger_zone_section bg-white rounded-lg border border-red-200 p-6", children: [_jsxs("div", { className: "cls_danger_zone_header flex items-center gap-2 mb-2", children: [_jsx(AlertTriangle, { className: "h-5 w-5 text-red-600", "aria-hidden": "true" }), _jsx("h2", { className: "cls_danger_zone_heading text-lg font-semibold text-red-700", children: resolvedHeading })] }), _jsx("p", { className: "cls_danger_zone_description text-sm text-[var(--hazo-text-muted)] mb-4", children: resolvedDescription }), _jsx("div", { className: "cls_danger_zone_actions flex justify-end", children: _jsx(Button, { type: "button", onClick: () => setDialogOpen(true), variant: "destructive", className: "cls_danger_zone_delete_button", "aria-label": resolvedDeleteButtonLabel, children: resolvedDeleteButtonLabel }) }), _jsx(AlertDialog, { open: dialogOpen, onOpenChange: handleOpenChange, children: _jsxs(AlertDialogContent, { className: "cls_delete_account_dialog", children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { className: "cls_delete_account_dialog_title", children: resolvedDialogTitle }), _jsx(AlertDialogDescription, { className: "cls_delete_account_dialog_description", children: resolvedDialogDescription })] }), _jsx("div", { className: "cls_delete_account_dialog_content py-2", children: _jsx(FormFieldWrapper, { fieldId: "delete-account-confirm-email", label: resolvedConfirmInputLabel, input: _jsx(Input, { id: "delete-account-confirm-email", type: "email", value: confirmEmail, onChange: (event) => setConfirmEmail(event.target.value), placeholder: email, autoComplete: "off", disabled: loading, "aria-label": resolvedConfirmInputLabel, className: "cls_delete_account_confirm_input" }) }) }), _jsxs(AlertDialogFooter, { children: [_jsx(Button, { type: "button", onClick: handleDeleteAccount, disabled: !emailMatches || loading, variant: "destructive", className: "cls_delete_account_confirm_button", "aria-label": resolvedConfirmButtonLabel, children: loading ? t("my_settings.danger_zone.deleting") : resolvedConfirmButtonLabel }), _jsx(Button, { type: "button", onClick: () => handleOpenChange(false), disabled: loading, variant: "outline", className: "cls_delete_account_cancel_button", "aria-label": resolvedCancelButtonLabel, children: resolvedCancelButtonLabel })] })] }) })] }));
|
|
96
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editable_field.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/editable_field.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"editable_field.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/editable_field.tsx"],"names":[],"mappings":"AAaA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,CAAC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,KAAK,EACL,IAAa,EACb,WAAW,EACX,MAAM,EACN,QAAQ,EACR,UAAU,EACV,QAAgB,EAChB,SAAS,GACV,EAAE,kBAAkB,+BAuIpB"}
|
|
@@ -8,6 +8,7 @@ import { Input } from "../../../ui/input.js";
|
|
|
8
8
|
import { Label } from "../../../ui/label.js";
|
|
9
9
|
import { Button } from "../../../ui/button.js";
|
|
10
10
|
import { Pencil, CheckCircle2, XCircle } from "lucide-react";
|
|
11
|
+
import { useAuthT } from "../../../../contexts/hazo_auth_provider.js";
|
|
11
12
|
// section: component
|
|
12
13
|
/**
|
|
13
14
|
* Editable field component with pencil icon for edit mode
|
|
@@ -16,6 +17,7 @@ import { Pencil, CheckCircle2, XCircle } from "lucide-react";
|
|
|
16
17
|
* @returns Editable field component
|
|
17
18
|
*/
|
|
18
19
|
export function EditableField({ label, value, type = "text", placeholder, onSave, onCancel, validation, disabled = false, ariaLabel, }) {
|
|
20
|
+
const t = useAuthT();
|
|
19
21
|
const [isEditing, setIsEditing] = useState(false);
|
|
20
22
|
const [editValue, setEditValue] = useState(value);
|
|
21
23
|
const [error, setError] = useState(null);
|
|
@@ -54,7 +56,7 @@ export function EditableField({ label, value, type = "text", placeholder, onSave
|
|
|
54
56
|
setIsEditing(false);
|
|
55
57
|
}
|
|
56
58
|
catch (error) {
|
|
57
|
-
const errorMessage = error instanceof Error ? error.message : "
|
|
59
|
+
const errorMessage = error instanceof Error ? error.message : t("my_settings.editable_field.save_error_default");
|
|
58
60
|
setError(errorMessage);
|
|
59
61
|
}
|
|
60
62
|
finally {
|
|
@@ -69,5 +71,5 @@ export function EditableField({ label, value, type = "text", placeholder, onSave
|
|
|
69
71
|
handleCancel();
|
|
70
72
|
}
|
|
71
73
|
};
|
|
72
|
-
return (_jsxs("div", { className: "cls_editable_field flex flex-col gap-2", children: [_jsx(Label, { htmlFor: `editable-field-${label}`, className: "cls_editable_field_label text-sm font-medium text-[var(--hazo-text-secondary)]", children: label }), _jsx("div", { className: "cls_editable_field_input_container flex items-center gap-2", children: isEditing ? (_jsxs(_Fragment, { children: [_jsx(Input, { id: `editable-field-${label}`, type: type, value: editValue, onChange: (e) => setEditValue(e.target.value), onKeyDown: handleKeyDown, placeholder: placeholder, disabled: isSaving, "aria-label": ariaLabel || label, className: "cls_editable_field_input flex-1" }), _jsx(Button, { type: "button", onClick: handleSave, disabled: isSaving, variant: "ghost", size: "icon", className: "cls_editable_field_save_button text-green-600 hover:text-green-700 hover:bg-green-50", "aria-label": "
|
|
74
|
+
return (_jsxs("div", { className: "cls_editable_field flex flex-col gap-2", children: [_jsx(Label, { htmlFor: `editable-field-${label}`, className: "cls_editable_field_label text-sm font-medium text-[var(--hazo-text-secondary)]", children: label }), _jsx("div", { className: "cls_editable_field_input_container flex items-center gap-2", children: isEditing ? (_jsxs(_Fragment, { children: [_jsx(Input, { id: `editable-field-${label}`, type: type, value: editValue, onChange: (e) => setEditValue(e.target.value), onKeyDown: handleKeyDown, placeholder: placeholder, disabled: isSaving, "aria-label": ariaLabel || label, className: "cls_editable_field_input flex-1" }), _jsx(Button, { type: "button", onClick: handleSave, disabled: isSaving, variant: "ghost", size: "icon", className: "cls_editable_field_save_button text-green-600 hover:text-green-700 hover:bg-green-50", "aria-label": t("my_settings.editable_field.save_aria_default"), children: _jsx(CheckCircle2, { className: "h-5 w-5", "aria-hidden": "true" }) }), _jsx(Button, { type: "button", onClick: handleCancel, disabled: isSaving, variant: "ghost", size: "icon", className: "cls_editable_field_cancel_button text-red-600 hover:text-red-700 hover:bg-red-50", "aria-label": t("my_settings.editable_field.cancel_aria_default"), children: _jsx(XCircle, { className: "h-5 w-5", "aria-hidden": "true" }) })] })) : (_jsxs(_Fragment, { children: [_jsx(Input, { id: `editable-field-${label}`, type: type, value: value || "", readOnly: true, disabled: true, placeholder: value ? undefined : placeholder || t("my_settings.editable_field.not_set_placeholder"), "aria-label": ariaLabel || label, className: "cls_editable_field_display flex-1 bg-[var(--hazo-bg-subtle)] cursor-not-allowed" }), !disabled && (_jsx(Button, { type: "button", onClick: handleEdit, variant: "ghost", size: "icon", className: "cls_editable_field_edit_button text-[var(--hazo-text-muted)] hover:text-[var(--hazo-text-secondary)] hover:bg-[var(--hazo-bg-subtle)]", "aria-label": t("my_settings.editable_field.edit_aria_default", { label }), children: _jsx(Pencil, { className: "h-5 w-5", "aria-hidden": "true" }) }))] })) }), error && (_jsx("p", { className: "cls_editable_field_error text-sm text-red-600", role: "alert", children: error }))] }));
|
|
73
75
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language_picker_section.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/language_picker_section.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"language_picker_section.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/language_picker_section.tsx"],"names":[],"mappings":"AAmBA,MAAM,MAAM,eAAe,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,0BAA0B,GAAG;IACvC,sFAAsF;IACtF,gBAAgB,CAAC,EAAE,eAAe,EAAE,CAAC;IACrC,8EAA8E;IAC9E,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,6EAA6E;IAC7E,cAAc,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,aAAa,EACb,cAAc,EACd,QAAgB,EAChB,KAAK,EACL,WAAW,GACZ,EAAE,0BAA0B,sCAsD5B"}
|
|
@@ -8,6 +8,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
import { useState } from "react";
|
|
9
9
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "../../../ui/select.js";
|
|
10
10
|
import { FormFieldWrapper } from "../../shared/components/form_field_wrapper.js";
|
|
11
|
+
import { useAuthT } from "../../../../contexts/hazo_auth_provider.js";
|
|
11
12
|
// section: component
|
|
12
13
|
/**
|
|
13
14
|
* Renders a Select for choosing a preferred locale.
|
|
@@ -15,7 +16,10 @@ import { FormFieldWrapper } from "../../shared/components/form_field_wrapper.js"
|
|
|
15
16
|
* @param props - Component props
|
|
16
17
|
* @returns Language picker field, or null when not applicable
|
|
17
18
|
*/
|
|
18
|
-
export function LanguagePickerSection({ availableLocales, currentLocale, onLocaleChange, disabled = false, label
|
|
19
|
+
export function LanguagePickerSection({ availableLocales, currentLocale, onLocaleChange, disabled = false, label, placeholder, }) {
|
|
20
|
+
const t = useAuthT();
|
|
21
|
+
const resolvedLabel = label !== null && label !== void 0 ? label : t("my_settings.language_picker.label");
|
|
22
|
+
const resolvedPlaceholder = placeholder !== null && placeholder !== void 0 ? placeholder : t("my_settings.language_picker.placeholder");
|
|
19
23
|
const [saving, setSaving] = useState(false);
|
|
20
24
|
if (!availableLocales || availableLocales.length < 2) {
|
|
21
25
|
return null;
|
|
@@ -34,7 +38,7 @@ export function LanguagePickerSection({ availableLocales, currentLocale, onLocal
|
|
|
34
38
|
setSaving(false);
|
|
35
39
|
}
|
|
36
40
|
};
|
|
37
|
-
return (_jsx("div", { className: "cls_language_picker_section", children: _jsx(FormFieldWrapper, { fieldId: "preferred-locale", label:
|
|
41
|
+
return (_jsx("div", { className: "cls_language_picker_section", children: _jsx(FormFieldWrapper, { fieldId: "preferred-locale", label: resolvedLabel, input: _jsxs(Select, { value: currentLocale !== null && currentLocale !== void 0 ? currentLocale : undefined, onValueChange: (value) => {
|
|
38
42
|
void handleValueChange(value);
|
|
39
|
-
}, disabled: disabled || saving, children: [_jsx(SelectTrigger, { id: "preferred-locale", className: "cls_language_picker_section_trigger", "aria-label":
|
|
43
|
+
}, disabled: disabled || saving, children: [_jsx(SelectTrigger, { id: "preferred-locale", className: "cls_language_picker_section_trigger", "aria-label": resolvedLabel, children: _jsx(SelectValue, { placeholder: resolvedPlaceholder }) }), _jsx(SelectContent, { children: availableLocales.map((locale) => (_jsx(SelectItem, { value: locale.code, children: locale.label }, locale.code))) })] }) }) }));
|
|
40
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"password_change_dialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/password_change_dialog.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"password_change_dialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/password_change_dialog.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAI3F,MAAM,MAAM,aAAa,GAAG;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,oBAAoB,EAAE,0BAA0B,CAAC;IACjD,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAGF;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,GAClB,EAAE,yBAAyB,+BAuP3B"}
|
|
@@ -8,6 +8,7 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, }
|
|
|
8
8
|
import { Button } from "../../../ui/button.js";
|
|
9
9
|
import { PasswordField } from "../../shared/components/password_field.js";
|
|
10
10
|
import { FormFieldWrapper } from "../../shared/components/form_field_wrapper.js";
|
|
11
|
+
import { useAuthT } from "../../../../contexts/hazo_auth_provider.js";
|
|
11
12
|
// section: component
|
|
12
13
|
/**
|
|
13
14
|
* Dialog component for changing password
|
|
@@ -16,7 +17,13 @@ import { FormFieldWrapper } from "../../shared/components/form_field_wrapper.js"
|
|
|
16
17
|
* @param props - Component props including open state, onSave callback, password requirements
|
|
17
18
|
* @returns Password change dialog component
|
|
18
19
|
*/
|
|
19
|
-
export function PasswordChangeDialog({ open, onOpenChange, onSave, passwordRequirements, buttonPalette, currentPasswordLabel
|
|
20
|
+
export function PasswordChangeDialog({ open, onOpenChange, onSave, passwordRequirements, buttonPalette, currentPasswordLabel, newPasswordLabel, confirmPasswordLabel, saveButtonLabel, cancelButtonLabel, }) {
|
|
21
|
+
const t = useAuthT();
|
|
22
|
+
const resolvedCurrentPasswordLabel = currentPasswordLabel !== null && currentPasswordLabel !== void 0 ? currentPasswordLabel : t("my_settings.password_change_dialog.current_password_label_default");
|
|
23
|
+
const resolvedNewPasswordLabel = newPasswordLabel !== null && newPasswordLabel !== void 0 ? newPasswordLabel : t("my_settings.password_change_dialog.new_password_label_default");
|
|
24
|
+
const resolvedConfirmPasswordLabel = confirmPasswordLabel !== null && confirmPasswordLabel !== void 0 ? confirmPasswordLabel : t("my_settings.password_change_dialog.confirm_password_label_default");
|
|
25
|
+
const resolvedSaveButtonLabel = saveButtonLabel !== null && saveButtonLabel !== void 0 ? saveButtonLabel : t("shared.save_button");
|
|
26
|
+
const resolvedCancelButtonLabel = cancelButtonLabel !== null && cancelButtonLabel !== void 0 ? cancelButtonLabel : t("shared.cancel_button");
|
|
20
27
|
const [currentPassword, setCurrentPassword] = useState("");
|
|
21
28
|
const [newPassword, setNewPassword] = useState("");
|
|
22
29
|
const [confirmPassword, setConfirmPassword] = useState("");
|
|
@@ -27,40 +34,40 @@ export function PasswordChangeDialog({ open, onOpenChange, onSave, passwordRequi
|
|
|
27
34
|
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
28
35
|
const validatePassword = (password) => {
|
|
29
36
|
if (!password || password.length < passwordRequirements.minimum_length) {
|
|
30
|
-
return
|
|
37
|
+
return t("my_settings.set_password.validation.min_length", { length: passwordRequirements.minimum_length });
|
|
31
38
|
}
|
|
32
39
|
const errors = [];
|
|
33
40
|
if (passwordRequirements.require_uppercase && !/[A-Z]/.test(password)) {
|
|
34
|
-
errors.push("
|
|
41
|
+
errors.push(t("my_settings.set_password.validation.uppercase_item"));
|
|
35
42
|
}
|
|
36
43
|
if (passwordRequirements.require_lowercase && !/[a-z]/.test(password)) {
|
|
37
|
-
errors.push("
|
|
44
|
+
errors.push(t("my_settings.set_password.validation.lowercase_item"));
|
|
38
45
|
}
|
|
39
46
|
if (passwordRequirements.require_number && !/[0-9]/.test(password)) {
|
|
40
|
-
errors.push("
|
|
47
|
+
errors.push(t("my_settings.set_password.validation.number_item"));
|
|
41
48
|
}
|
|
42
49
|
if (passwordRequirements.require_special && !/[^A-Za-z0-9]/.test(password)) {
|
|
43
|
-
errors.push("
|
|
50
|
+
errors.push(t("my_settings.set_password.validation.special_item"));
|
|
44
51
|
}
|
|
45
52
|
if (errors.length > 0) {
|
|
46
|
-
return
|
|
53
|
+
return t("my_settings.set_password.validation.missing_requirements", { list: errors.join(", ") });
|
|
47
54
|
}
|
|
48
55
|
return null;
|
|
49
56
|
};
|
|
50
57
|
const validateForm = () => {
|
|
51
58
|
const newErrors = {};
|
|
52
59
|
if (!currentPassword) {
|
|
53
|
-
newErrors.currentPassword = "
|
|
60
|
+
newErrors.currentPassword = t("my_settings.password_change_dialog.current_password_required");
|
|
54
61
|
}
|
|
55
62
|
const newPasswordError = validatePassword(newPassword);
|
|
56
63
|
if (newPasswordError) {
|
|
57
64
|
newErrors.newPassword = newPasswordError;
|
|
58
65
|
}
|
|
59
66
|
if (!confirmPassword) {
|
|
60
|
-
newErrors.confirmPassword = "
|
|
67
|
+
newErrors.confirmPassword = t("my_settings.set_password.validation.confirm_required");
|
|
61
68
|
}
|
|
62
69
|
else if (newPassword !== confirmPassword) {
|
|
63
|
-
newErrors.confirmPassword = "
|
|
70
|
+
newErrors.confirmPassword = t("my_settings.set_password.validation.mismatch");
|
|
64
71
|
}
|
|
65
72
|
setErrors(newErrors);
|
|
66
73
|
return Object.keys(newErrors).length === 0;
|
|
@@ -80,7 +87,7 @@ export function PasswordChangeDialog({ open, onOpenChange, onSave, passwordRequi
|
|
|
80
87
|
onOpenChange(false);
|
|
81
88
|
}
|
|
82
89
|
catch (error) {
|
|
83
|
-
const errorMessage = error instanceof Error ? error.message : "
|
|
90
|
+
const errorMessage = error instanceof Error ? error.message : t("my_settings.password_change_dialog.error_default");
|
|
84
91
|
setErrors({ currentPassword: errorMessage });
|
|
85
92
|
}
|
|
86
93
|
finally {
|
|
@@ -97,33 +104,33 @@ export function PasswordChangeDialog({ open, onOpenChange, onSave, passwordRequi
|
|
|
97
104
|
// Format password requirements for display
|
|
98
105
|
const getPasswordRequirements = () => {
|
|
99
106
|
const requirements = [];
|
|
100
|
-
requirements.push(
|
|
107
|
+
requirements.push(t("my_settings.password_change_dialog.requirements.min_length", { length: passwordRequirements.minimum_length }));
|
|
101
108
|
if (passwordRequirements.require_uppercase) {
|
|
102
|
-
requirements.push("
|
|
109
|
+
requirements.push(t("my_settings.password_change_dialog.requirements.uppercase"));
|
|
103
110
|
}
|
|
104
111
|
if (passwordRequirements.require_lowercase) {
|
|
105
|
-
requirements.push("
|
|
112
|
+
requirements.push(t("my_settings.password_change_dialog.requirements.lowercase"));
|
|
106
113
|
}
|
|
107
114
|
if (passwordRequirements.require_number) {
|
|
108
|
-
requirements.push("
|
|
115
|
+
requirements.push(t("my_settings.password_change_dialog.requirements.number"));
|
|
109
116
|
}
|
|
110
117
|
if (passwordRequirements.require_special) {
|
|
111
|
-
requirements.push("
|
|
118
|
+
requirements.push(t("my_settings.password_change_dialog.requirements.special"));
|
|
112
119
|
}
|
|
113
120
|
return requirements;
|
|
114
121
|
};
|
|
115
122
|
const passwordRequirementsList = getPasswordRequirements();
|
|
116
|
-
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "cls_password_change_dialog max-w-md", children: [_jsxs(DialogHeader, { className: "cls_password_change_dialog_header", children: [_jsx(DialogTitle, { className: "cls_password_change_dialog_title", children: "
|
|
123
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "cls_password_change_dialog max-w-md", children: [_jsxs(DialogHeader, { className: "cls_password_change_dialog_header", children: [_jsx(DialogTitle, { className: "cls_password_change_dialog_title", children: t("my_settings.password_change_dialog.title") }), _jsx(DialogDescription, { className: "cls_password_change_dialog_description", children: t("my_settings.password_change_dialog.description") })] }), _jsxs("div", { className: "cls_password_change_dialog_content flex flex-col gap-4 py-4", children: [_jsx(FormFieldWrapper, { fieldId: "current-password", label: resolvedCurrentPasswordLabel, input: _jsx(PasswordField, { inputId: "current-password", ariaLabel: resolvedCurrentPasswordLabel, value: currentPassword, placeholder: t("my_settings.current_password_placeholder_default"), autoComplete: "current-password", isVisible: currentPasswordVisible, onChange: (value) => {
|
|
117
124
|
setCurrentPassword(value);
|
|
118
125
|
if (errors.currentPassword) {
|
|
119
126
|
setErrors(Object.assign(Object.assign({}, errors), { currentPassword: undefined }));
|
|
120
127
|
}
|
|
121
|
-
}, onToggleVisibility: () => setCurrentPasswordVisible(!currentPasswordVisible), errorMessage: errors.currentPassword }) }), _jsx(FormFieldWrapper, { fieldId: "new-password", label:
|
|
128
|
+
}, onToggleVisibility: () => setCurrentPasswordVisible(!currentPasswordVisible), errorMessage: errors.currentPassword }) }), _jsx(FormFieldWrapper, { fieldId: "new-password", label: resolvedNewPasswordLabel, input: _jsx(PasswordField, { inputId: "new-password", ariaLabel: resolvedNewPasswordLabel, value: newPassword, placeholder: t("my_settings.set_password.new_password_placeholder"), autoComplete: "new-password", isVisible: newPasswordVisible, onChange: (value) => {
|
|
122
129
|
setNewPassword(value);
|
|
123
130
|
if (errors.newPassword) {
|
|
124
131
|
setErrors(Object.assign(Object.assign({}, errors), { newPassword: undefined }));
|
|
125
132
|
}
|
|
126
|
-
}, onToggleVisibility: () => setNewPasswordVisible(!newPasswordVisible), errorMessage: errors.newPassword }) }), passwordRequirementsList.length > 0 && (_jsxs("div", { className: "cls_password_change_dialog_requirements text-xs text-[var(--hazo-text-muted)]", children: [_jsx("p", { className: "cls_password_change_dialog_requirements_label font-medium mb-1", children: "
|
|
133
|
+
}, onToggleVisibility: () => setNewPasswordVisible(!newPasswordVisible), errorMessage: errors.newPassword }) }), passwordRequirementsList.length > 0 && (_jsxs("div", { className: "cls_password_change_dialog_requirements text-xs text-[var(--hazo-text-muted)]", children: [_jsx("p", { className: "cls_password_change_dialog_requirements_label font-medium mb-1", children: t("my_settings.password_change_dialog.requirements_label") }), _jsx("ul", { className: "cls_password_change_dialog_requirements_list list-disc list-inside space-y-0.5", children: passwordRequirementsList.map((req, index) => (_jsx("li", { children: req }, index))) })] })), _jsx(FormFieldWrapper, { fieldId: "confirm-password", label: resolvedConfirmPasswordLabel, input: _jsx(PasswordField, { inputId: "confirm-password", ariaLabel: resolvedConfirmPasswordLabel, value: confirmPassword, placeholder: t("my_settings.set_password.confirm_password_placeholder"), autoComplete: "new-password", isVisible: confirmPasswordVisible, onChange: (value) => {
|
|
127
134
|
setConfirmPassword(value);
|
|
128
135
|
if (errors.confirmPassword) {
|
|
129
136
|
setErrors(Object.assign(Object.assign({}, errors), { confirmPassword: undefined }));
|
|
@@ -131,8 +138,8 @@ export function PasswordChangeDialog({ open, onOpenChange, onSave, passwordRequi
|
|
|
131
138
|
}, onToggleVisibility: () => setConfirmPasswordVisible(!confirmPasswordVisible), errorMessage: errors.confirmPassword }) })] }), _jsxs("div", { className: "cls_password_change_dialog_actions flex justify-end gap-3 pt-4 border-t", children: [_jsx(Button, { type: "button", onClick: handleSave, disabled: isSubmitting, className: "cls_password_change_dialog_save_button", style: buttonPalette ? {
|
|
132
139
|
backgroundColor: buttonPalette.submitBackground,
|
|
133
140
|
color: buttonPalette.submitText,
|
|
134
|
-
} : undefined, "aria-label":
|
|
141
|
+
} : undefined, "aria-label": resolvedSaveButtonLabel, children: resolvedSaveButtonLabel }), _jsx(Button, { type: "button", onClick: handleCancel, disabled: isSubmitting, variant: "outline", className: "cls_password_change_dialog_cancel_button", style: buttonPalette ? {
|
|
135
142
|
borderColor: buttonPalette.cancelBorder,
|
|
136
143
|
color: buttonPalette.cancelText,
|
|
137
|
-
} : undefined, "aria-label":
|
|
144
|
+
} : undefined, "aria-label": resolvedCancelButtonLabel, children: resolvedCancelButtonLabel })] })] }) }));
|
|
138
145
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile_picture_dialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/profile_picture_dialog.tsx"],"names":[],"mappings":"AAuBA,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,CAAC,iBAAiB,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvG,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,oBAAoB,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IACpE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE;QACR,6BAA6B,EAAE,MAAM,CAAC;QACtC,sBAAsB,EAAE,MAAM,CAAC;QAC/B,2BAA2B,EAAE,MAAM,CAAC;QACpC,uBAAuB,EAAE,MAAM,CAAC;KACjC,CAAC;IACF,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,yBAAyB,EAAE,MAAM,CAAC;QAClC,uBAAuB,EAAE,MAAM,CAAC;QAChC,0BAA0B,EAAE,MAAM,CAAC;QACnC,0BAA0B,EAAE,MAAM,CAAC;QACnC,+BAA+B,EAAE,MAAM,CAAC;QACxC,4BAA4B,EAAE,MAAM,CAAC;KACtC,CAAC;IACF,SAAS,EAAE;QACT,wBAAwB,EAAE,MAAM,EAAE,CAAC;QACnC,wBAAwB,EAAE,MAAM,EAAE,CAAC;KACpC,CAAC;CACH,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,KAAK,EACL,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"profile_picture_dialog.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/profile_picture_dialog.tsx"],"names":[],"mappings":"AAuBA,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,CAAC,iBAAiB,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvG,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,OAAO,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,oBAAoB,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,QAAQ,CAAC;IACpE,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE;QACR,6BAA6B,EAAE,MAAM,CAAC;QACtC,sBAAsB,EAAE,MAAM,CAAC;QAC/B,2BAA2B,EAAE,MAAM,CAAC;QACpC,uBAAuB,EAAE,MAAM,CAAC;KACjC,CAAC;IACF,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,oBAAoB,EAAE,MAAM,CAAC;QAC7B,yBAAyB,EAAE,MAAM,CAAC;QAClC,uBAAuB,EAAE,MAAM,CAAC;QAChC,0BAA0B,EAAE,MAAM,CAAC;QACnC,0BAA0B,EAAE,MAAM,CAAC;QACnC,+BAA+B,EAAE,MAAM,CAAC;QACxC,4BAA4B,EAAE,MAAM,CAAC;KACtC,CAAC;IACF,SAAS,EAAE;QACT,wBAAwB,EAAE,MAAM,EAAE,CAAC;QACnC,wBAAwB,EAAE,MAAM,EAAE,CAAC;KACpC,CAAC;CACH,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,YAAY,EACZ,MAAM,EACN,KAAK,EACL,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,QAAgB,EAChB,QAAQ,EACR,OAAO,EACP,SAAS,GACV,EAAE,yBAAyB,+BAmT3B"}
|
|
@@ -12,7 +12,7 @@ import { ProfilePictureLibraryTab } from "./profile_picture_library_tab.js";
|
|
|
12
12
|
import { ProfilePictureGravatarTab } from "./profile_picture_gravatar_tab.js";
|
|
13
13
|
import { toast } from "sonner";
|
|
14
14
|
import { cn } from "../../../../lib/utils.js";
|
|
15
|
-
import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
|
|
15
|
+
import { useHazoAuthConfig, useAuthT } from "../../../../contexts/hazo_auth_provider.js";
|
|
16
16
|
// section: component
|
|
17
17
|
/**
|
|
18
18
|
* Profile picture dialog component with tabs for Upload, Library, and Gravatar
|
|
@@ -20,8 +20,11 @@ import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
|
|
|
20
20
|
* @param props - Component props including open state, save handler, and configuration
|
|
21
21
|
* @returns Profile picture dialog component
|
|
22
22
|
*/
|
|
23
|
-
export function ProfilePictureDialog({ open, onOpenChange, onSave, email, allowPhotoUpload, maxPhotoSize, libraryPhotoPath, currentProfilePictureUrl, currentProfileSource, saveButtonLabel
|
|
23
|
+
export function ProfilePictureDialog({ open, onOpenChange, onSave, email, allowPhotoUpload, maxPhotoSize, libraryPhotoPath, currentProfilePictureUrl, currentProfileSource, saveButtonLabel, cancelButtonLabel, disabled = false, messages, uiSizes, fileTypes, }) {
|
|
24
24
|
const { apiBasePath } = useHazoAuthConfig();
|
|
25
|
+
const t = useAuthT();
|
|
26
|
+
const resolvedSaveLabel = saveButtonLabel !== null && saveButtonLabel !== void 0 ? saveButtonLabel : t("my_settings.profile_picture_dialog.save_button");
|
|
27
|
+
const resolvedCancelLabel = cancelButtonLabel !== null && cancelButtonLabel !== void 0 ? cancelButtonLabel : t("my_settings.profile_picture_dialog.cancel_button");
|
|
25
28
|
const [useUpload, setUseUpload] = useState(false);
|
|
26
29
|
const [useLibrary, setUseLibrary] = useState(false);
|
|
27
30
|
const [useGravatar, setUseGravatar] = useState(false);
|
|
@@ -135,16 +138,16 @@ export function ProfilePictureDialog({ open, onOpenChange, onSave, email, allowP
|
|
|
135
138
|
});
|
|
136
139
|
const data = await response.json();
|
|
137
140
|
if (!response.ok || !data.success) {
|
|
138
|
-
const errorMessage = data.error || "
|
|
141
|
+
const errorMessage = data.error || t("my_settings.profile_picture_dialog.upload_failed");
|
|
139
142
|
toast.error(errorMessage);
|
|
140
143
|
setUploadedFile(null);
|
|
141
144
|
return;
|
|
142
145
|
}
|
|
143
146
|
setSelectedPhotoUrl(data.profile_picture_url);
|
|
144
|
-
toast.success("
|
|
147
|
+
toast.success(t("my_settings.profile_picture_dialog.upload_success"));
|
|
145
148
|
}
|
|
146
149
|
catch (error) {
|
|
147
|
-
const errorMessage = error instanceof Error ? error.message : "
|
|
150
|
+
const errorMessage = error instanceof Error ? error.message : t("my_settings.profile_picture_dialog.upload_failed");
|
|
148
151
|
toast.error(errorMessage);
|
|
149
152
|
setUploadedFile(null);
|
|
150
153
|
}
|
|
@@ -161,15 +164,15 @@ export function ProfilePictureDialog({ open, onOpenChange, onSave, email, allowP
|
|
|
161
164
|
};
|
|
162
165
|
const handleSave = async () => {
|
|
163
166
|
if (!selectedSource) {
|
|
164
|
-
toast.error("
|
|
167
|
+
toast.error(t("my_settings.profile_picture_dialog.select_source"));
|
|
165
168
|
return;
|
|
166
169
|
}
|
|
167
170
|
if (selectedSource === "upload" && !selectedPhotoUrl) {
|
|
168
|
-
toast.error("
|
|
171
|
+
toast.error(t("my_settings.profile_picture_dialog.upload_first"));
|
|
169
172
|
return;
|
|
170
173
|
}
|
|
171
174
|
if (selectedSource === "library" && !selectedPhotoUrl) {
|
|
172
|
-
toast.error("
|
|
175
|
+
toast.error(t("my_settings.profile_picture_dialog.select_library_photo"));
|
|
173
176
|
return;
|
|
174
177
|
}
|
|
175
178
|
if (selectedSource === "gravatar") {
|
|
@@ -196,5 +199,5 @@ export function ProfilePictureDialog({ open, onOpenChange, onSave, email, allowP
|
|
|
196
199
|
setUploadedFile(null);
|
|
197
200
|
onOpenChange(false);
|
|
198
201
|
};
|
|
199
|
-
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "cls_profile_picture_dialog max-w-4xl max-h-[90vh] overflow-y-auto", children: [_jsxs(DialogHeader, { className: "cls_profile_picture_dialog_header", children: [_jsx(DialogTitle, { className: "cls_profile_picture_dialog_title", children: "
|
|
202
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { className: "cls_profile_picture_dialog max-w-4xl max-h-[90vh] overflow-y-auto", children: [_jsxs(DialogHeader, { className: "cls_profile_picture_dialog_header", children: [_jsx(DialogTitle, { className: "cls_profile_picture_dialog_title", children: t("my_settings.profile_picture_dialog.title") }), _jsx(DialogDescription, { className: "cls_profile_picture_dialog_description", children: t("my_settings.profile_picture_dialog.description") })] }), _jsxs(Tabs, { value: activeTab, onValueChange: setActiveTab, className: "cls_profile_picture_dialog_tabs", children: [_jsxs(TabsList, { className: "cls_profile_picture_dialog_tabs_list", children: [allowPhotoUpload && (_jsx(TabsTrigger, { value: "upload", className: cn("cls_profile_picture_dialog_tabs_trigger", useUpload && "!text-blue-600 font-semibold data-[state=active]:!text-blue-600"), children: t("my_settings.profile_picture_dialog.tab_upload") })), _jsx(TabsTrigger, { value: "library", className: cn("cls_profile_picture_dialog_tabs_trigger", useLibrary && "!text-blue-600 font-semibold data-[state=active]:!text-blue-600"), children: t("my_settings.profile_picture_dialog.tab_library") }), _jsx(TabsTrigger, { value: "gravatar", className: cn("cls_profile_picture_dialog_tabs_trigger", useGravatar && "!text-blue-600 font-semibold data-[state=active]:!text-blue-600"), children: t("my_settings.profile_picture_dialog.tab_gravatar") })] }), allowPhotoUpload && (_jsx(TabsContent, { value: "upload", className: "cls_profile_picture_dialog_tabs_content", children: _jsx(ProfilePictureUploadTab, { useUpload: useUpload, onUseUploadChange: handleUseUploadChange, onFileSelect: handleFileSelect, maxSize: maxPhotoSize, uploadEnabled: allowPhotoUpload, disabled: disabled || uploading, currentPreview: currentProfilePictureUrl || selectedPhotoUrl || undefined, photoUploadDisabledMessage: messages.photo_upload_disabled_message, imageCompressionMaxDimension: uiSizes.image_compression_max_dimension, uploadFileHardLimitBytes: uiSizes.upload_file_hard_limit_bytes, allowedImageMimeTypes: fileTypes.allowed_image_mime_types }) })), _jsx(TabsContent, { value: "library", className: "cls_profile_picture_dialog_tabs_content", children: _jsx(ProfilePictureLibraryTab, { useLibrary: useLibrary, onUseLibraryChange: handleUseLibraryChange, onPhotoSelect: handlePhotoSelect, disabled: disabled, libraryPhotoPath: libraryPhotoPath, currentPhotoUrl: selectedPhotoUrl || undefined, libraryTooltipMessage: messages.library_tooltip_message, tooltipIconSizeSmall: uiSizes.tooltip_icon_size_small, libraryPhotoGridColumns: uiSizes.library_photo_grid_columns, libraryPhotoPreviewSize: uiSizes.library_photo_preview_size }) }), _jsx(TabsContent, { value: "gravatar", className: "cls_profile_picture_dialog_tabs_content", children: _jsx(ProfilePictureGravatarTab, { email: email, useGravatar: useGravatar, onUseGravatarChange: handleUseGravatarChange, disabled: disabled, gravatarSetupMessage: messages.gravatar_setup_message, gravatarNoAccountMessage: messages.gravatar_no_account_message, gravatarSize: uiSizes.gravatar_size }) })] }), _jsxs("div", { className: "cls_profile_picture_dialog_actions flex justify-end gap-3 pt-4 border-t", children: [_jsx(Button, { type: "button", onClick: handleSave, disabled: disabled || uploading || !selectedSource, className: "cls_profile_picture_dialog_save_button", "aria-label": resolvedSaveLabel, children: resolvedSaveLabel }), _jsx(Button, { type: "button", onClick: handleCancel, disabled: disabled || uploading, variant: "outline", className: "cls_profile_picture_dialog_cancel_button", "aria-label": resolvedCancelLabel, children: resolvedCancelLabel })] })] }) }));
|
|
200
203
|
}
|
package/dist/components/layouts/my_settings/components/profile_picture_gravatar_tab.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile_picture_gravatar_tab.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/profile_picture_gravatar_tab.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profile_picture_gravatar_tab.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/profile_picture_gravatar_tab.tsx"],"names":[],"mappings":"AAcA,MAAM,MAAM,8BAA8B,GAAG;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,wBAAwB,EAAE,MAAM,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAGF;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,EACxC,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,QAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,YAAY,GACb,EAAE,8BAA8B,+BAwGhC"}
|
|
@@ -9,6 +9,7 @@ import { Label } from "../../../ui/label.js";
|
|
|
9
9
|
import { Avatar, AvatarImage, AvatarFallback } from "../../../ui/avatar.js";
|
|
10
10
|
import { Info } from "lucide-react";
|
|
11
11
|
import gravatarUrl from "gravatar-url";
|
|
12
|
+
import { useAuthT } from "../../../../contexts/hazo_auth_provider.js";
|
|
12
13
|
// section: component
|
|
13
14
|
/**
|
|
14
15
|
* Gravatar tab component for profile picture dialog
|
|
@@ -17,6 +18,7 @@ import gravatarUrl from "gravatar-url";
|
|
|
17
18
|
* @returns Gravatar tab component
|
|
18
19
|
*/
|
|
19
20
|
export function ProfilePictureGravatarTab({ email, useGravatar, onUseGravatarChange, disabled = false, gravatarSetupMessage, gravatarNoAccountMessage, gravatarSize, }) {
|
|
21
|
+
const t = useAuthT();
|
|
20
22
|
const [gravatarUrlState, setGravatarUrlState] = useState("");
|
|
21
23
|
const [gravatarExists, setGravatarExists] = useState(null);
|
|
22
24
|
useEffect(() => {
|
|
@@ -44,5 +46,5 @@ export function ProfilePictureGravatarTab({ email, useGravatar, onUseGravatarCha
|
|
|
44
46
|
}
|
|
45
47
|
return "?";
|
|
46
48
|
};
|
|
47
|
-
return (_jsxs("div", { className: "cls_profile_picture_gravatar_tab flex flex-col gap-4", children: [_jsxs("div", { className: "cls_profile_picture_gravatar_tab_switch flex items-center gap-3", children: [_jsx(Switch, { id: "use-gravatar", checked: useGravatar, onCheckedChange: onUseGravatarChange, disabled: disabled, className: "cls_profile_picture_gravatar_tab_switch_input", "aria-label": "
|
|
49
|
+
return (_jsxs("div", { className: "cls_profile_picture_gravatar_tab flex flex-col gap-4", children: [_jsxs("div", { className: "cls_profile_picture_gravatar_tab_switch flex items-center gap-3", children: [_jsx(Switch, { id: "use-gravatar", checked: useGravatar, onCheckedChange: onUseGravatarChange, disabled: disabled, className: "cls_profile_picture_gravatar_tab_switch_input", "aria-label": t("my_settings.gravatar_tab.use_gravatar_label") }), _jsx(Label, { htmlFor: "use-gravatar", className: "cls_profile_picture_gravatar_tab_switch_label text-sm font-medium text-[var(--hazo-text-secondary)] cursor-pointer", children: t("my_settings.gravatar_tab.use_gravatar_label") })] }), _jsx("div", { className: "cls_profile_picture_gravatar_tab_preview flex flex-col items-center gap-4 p-6 border border-[var(--hazo-border)] rounded-lg bg-[var(--hazo-bg-subtle)]", children: gravatarExists === true ? (_jsxs(_Fragment, { children: [_jsxs(Avatar, { className: "cls_profile_picture_gravatar_tab_avatar h-32 w-32", children: [_jsx(AvatarImage, { src: gravatarUrlState, alt: t("my_settings.gravatar_tab.avatar_alt"), className: "cls_profile_picture_gravatar_tab_avatar_image" }), _jsx(AvatarFallback, { className: "cls_profile_picture_gravatar_tab_avatar_fallback bg-[var(--hazo-bg-emphasis)] text-[var(--hazo-text-muted)] text-3xl", children: getInitials() })] }), _jsx("p", { className: "cls_profile_picture_gravatar_tab_success_text text-sm text-[var(--hazo-text-muted)] text-center", children: t("my_settings.gravatar_tab.success_text") })] })) : gravatarExists === false ? (_jsx(_Fragment, { children: _jsxs("div", { className: "cls_profile_picture_gravatar_tab_no_gravatar flex flex-col items-center gap-4", children: [_jsx("div", { className: "cls_profile_picture_gravatar_tab_no_gravatar_icon flex items-center justify-center w-16 h-16 rounded-full bg-[var(--hazo-bg-muted)]", children: _jsx(Info, { className: "h-8 w-8 text-[var(--hazo-text-subtle)]", "aria-hidden": "true" }) }), _jsxs("div", { className: "cls_profile_picture_gravatar_tab_no_gravatar_content flex flex-col gap-2 text-center", children: [_jsx("p", { className: "cls_profile_picture_gravatar_tab_no_gravatar_title text-sm font-medium text-[var(--hazo-text-primary)]", children: t("my_settings.gravatar_tab.not_found_title") }), _jsxs("p", { className: "cls_profile_picture_gravatar_tab_no_gravatar_message text-sm text-[var(--hazo-text-muted)]", children: [gravatarSetupMessage, " ", _jsx("span", { className: "font-semibold", children: email }), ":"] }), _jsxs("ol", { className: "cls_profile_picture_gravatar_tab_no_gravatar_steps text-sm text-[var(--hazo-text-muted)] list-decimal list-inside space-y-1 mt-2", children: [_jsxs("li", { children: [t("my_settings.gravatar_tab.visit_prefix"), " ", _jsx("a", { href: "https://gravatar.com", target: "_blank", rel: "noopener noreferrer", className: "text-blue-600 hover:text-blue-700 underline", children: "gravatar.com" })] }), _jsxs("li", { children: [t("my_settings.gravatar_tab.step_sign_in"), " ", _jsx("span", { className: "font-mono text-xs", children: email })] }), _jsx("li", { children: t("my_settings.gravatar_tab.step_upload") }), _jsx("li", { children: t("my_settings.gravatar_tab.step_return") })] })] })] }) })) : (_jsx(_Fragment, { children: _jsx("div", { className: "cls_profile_picture_gravatar_tab_loading flex items-center justify-center", children: _jsx("p", { className: "cls_profile_picture_gravatar_tab_loading_text text-sm text-[var(--hazo-text-muted)]", children: t("my_settings.gravatar_tab.checking") }) }) })) })] }));
|
|
48
50
|
}
|
|
@@ -20,7 +20,7 @@ import { useHazoAuthConfig } from "../../../../contexts/hazo_auth_provider.js";
|
|
|
20
20
|
* @returns Library tab component
|
|
21
21
|
*/
|
|
22
22
|
export function ProfilePictureLibraryTab({ useLibrary, onUseLibraryChange, onPhotoSelect, disabled = false, libraryPhotoPath, currentPhotoUrl, libraryTooltipMessage, tooltipIconSizeSmall, libraryPhotoGridColumns, libraryPhotoPreviewSize, }) {
|
|
23
|
-
const { apiBasePath } = useHazoAuthConfig();
|
|
23
|
+
const { apiBasePath, t } = useHazoAuthConfig();
|
|
24
24
|
const [categories, setCategories] = useState([]);
|
|
25
25
|
const [selectedCategory, setSelectedCategory] = useState(null);
|
|
26
26
|
const [photos, setPhotos] = useState([]);
|
|
@@ -45,7 +45,7 @@ export function ProfilePictureLibraryTab({ useLibrary, onUseLibraryChange, onPho
|
|
|
45
45
|
catch (error) {
|
|
46
46
|
// Client-side error handling - show toast notification
|
|
47
47
|
import("sonner").then(({ toast }) => {
|
|
48
|
-
toast.error("
|
|
48
|
+
toast.error(t("my_settings.library_tab.toast_load_categories_failed"));
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
finally {
|
|
@@ -96,7 +96,7 @@ export function ProfilePictureLibraryTab({ useLibrary, onUseLibraryChange, onPho
|
|
|
96
96
|
catch (error) {
|
|
97
97
|
// Client-side error handling - show toast notification
|
|
98
98
|
import("sonner").then(({ toast }) => {
|
|
99
|
-
toast.error("
|
|
99
|
+
toast.error(t("my_settings.library_tab.toast_load_photos_failed"));
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
finally {
|
|
@@ -120,21 +120,24 @@ export function ProfilePictureLibraryTab({ useLibrary, onUseLibraryChange, onPho
|
|
|
120
120
|
gridTemplateColumns: `repeat(${validColumns}, minmax(0, 1fr))`,
|
|
121
121
|
};
|
|
122
122
|
};
|
|
123
|
-
return (_jsxs("div", { className: "cls_profile_picture_library_tab flex flex-col gap-4", children: [_jsxs("div", { className: "cls_profile_picture_library_tab_switch flex items-center gap-3", children: [_jsx(Switch, { id: "use-library", checked: useLibrary, onCheckedChange: onUseLibraryChange, disabled: disabled, className: "cls_profile_picture_library_tab_switch_input", "aria-label": "
|
|
123
|
+
return (_jsxs("div", { className: "cls_profile_picture_library_tab flex flex-col gap-4", children: [_jsxs("div", { className: "cls_profile_picture_library_tab_switch flex items-center gap-3", children: [_jsx(Switch, { id: "use-library", checked: useLibrary, onCheckedChange: onUseLibraryChange, disabled: disabled, className: "cls_profile_picture_library_tab_switch_input", "aria-label": t("my_settings.library_tab.use_library_label") }), _jsxs(Label, { htmlFor: "use-library", className: "cls_profile_picture_library_tab_switch_label text-sm font-medium text-[var(--hazo-text-secondary)] cursor-pointer", children: [t("my_settings.library_tab.use_library_label"), _jsx(HazoUITooltip, { message: libraryTooltipMessage, iconSize: tooltipIconSizeSmall, side: "top" })] })] }), _jsxs("div", { className: "cls_profile_picture_library_tab_content grid grid-cols-12 gap-4", children: [_jsxs("div", { className: "cls_profile_picture_library_tab_categories_container flex flex-col gap-2 col-span-3", children: [_jsx(Label, { className: "cls_profile_picture_library_tab_categories_label text-sm font-medium text-[var(--hazo-text-secondary)]", children: t("my_settings.library_tab.categories_label") }), loadingCategories ? (_jsx("div", { className: "cls_profile_picture_library_tab_loading flex items-center justify-center p-8 border border-[var(--hazo-border)] rounded-lg bg-[var(--hazo-bg-subtle)] min-h-[400px]", children: _jsx(Loader2, { className: "h-6 w-6 text-[var(--hazo-text-subtle)] animate-spin", "aria-hidden": "true" }) })) : categories.length > 0 ? (_jsx(VerticalTabs, { value: selectedCategory || categories[0], onValueChange: setSelectedCategory, className: "cls_profile_picture_library_tab_vertical_tabs", children: _jsx(VerticalTabsList, { className: "cls_profile_picture_library_tab_vertical_tabs_list w-full", children: categories.map((category) => (_jsx(VerticalTabsTrigger, { value: category, className: "cls_profile_picture_library_tab_vertical_tabs_trigger w-full justify-start", children: category }, category))) }) })) : (_jsx("div", { className: "cls_profile_picture_library_tab_no_categories flex items-center justify-center p-8 border border-[var(--hazo-border)] rounded-lg bg-[var(--hazo-bg-subtle)] min-h-[400px]", children: _jsx("p", { className: "cls_profile_picture_library_tab_no_categories_text text-sm text-[var(--hazo-text-muted)]", children: t("my_settings.library_tab.no_categories_text") }) }))] }), _jsxs("div", { className: "cls_profile_picture_library_tab_photos_container flex flex-col gap-2 col-span-6", children: [_jsx(Label, { className: "cls_profile_picture_library_tab_photos_label text-sm font-medium text-[var(--hazo-text-secondary)]", children: t("my_settings.library_tab.photos_label") }), loadingPhotos ? (_jsx("div", { className: "cls_profile_picture_library_tab_photos_loading flex items-center justify-center p-8 border border-[var(--hazo-border)] rounded-lg bg-[var(--hazo-bg-subtle)] min-h-[400px]", children: _jsx(Loader2, { className: "h-6 w-6 text-[var(--hazo-text-subtle)] animate-spin", "aria-hidden": "true" }) })) : photos.length > 0 ? (_jsx("div", { className: "cls_profile_picture_library_tab_photos_grid grid gap-3 overflow-y-auto p-4 border border-[var(--hazo-border)] rounded-lg bg-[var(--hazo-bg-subtle)] min-h-[400px] max-h-[400px]", style: getGridColumnsStyle(libraryPhotoGridColumns), children: photos.map((photoUrl) => {
|
|
124
|
+
var _a, _b;
|
|
125
|
+
return (_jsx("button", { type: "button", onClick: () => handlePhotoClick(photoUrl), className: `
|
|
124
126
|
cls_profile_picture_library_tab_photo_thumbnail
|
|
125
127
|
w-full aspect-square rounded-lg overflow-hidden border-2 transition-colors cursor-pointer
|
|
126
128
|
${selectedPhoto === photoUrl ? "border-blue-500 ring-2 ring-blue-200" : "border-[var(--hazo-border)] hover:border-[var(--hazo-border-emphasis)]"}
|
|
127
|
-
`, style: { minHeight: '80px', minWidth: '80px', aspectRatio: '1/1' }, "aria-label":
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
`, style: { minHeight: '80px', minWidth: '80px', aspectRatio: '1/1' }, "aria-label": t("my_settings.library_tab.select_photo_aria", { name: (_a = photoUrl.split('/').pop()) !== null && _a !== void 0 ? _a : "" }), children: _jsx("img", { src: photoUrl, alt: t("my_settings.library_tab.photo_alt", { name: (_b = photoUrl.split('/').pop()) !== null && _b !== void 0 ? _b : "" }), className: "cls_profile_picture_library_tab_photo_thumbnail_image w-full h-full object-cover", loading: "lazy", onError: (e) => {
|
|
130
|
+
// Fallback if image fails to load
|
|
131
|
+
const target = e.target;
|
|
132
|
+
target.style.display = 'none';
|
|
133
|
+
} }) }, photoUrl));
|
|
134
|
+
}) })) : (_jsx("div", { className: "cls_profile_picture_library_tab_no_photos flex items-center justify-center p-8 border border-[var(--hazo-border)] rounded-lg bg-[var(--hazo-bg-subtle)] min-h-[400px]", children: _jsx("p", { className: "cls_profile_picture_library_tab_no_photos_text text-sm text-[var(--hazo-text-muted)]", children: t("my_settings.library_tab.no_photos_text") }) }))] }), _jsxs("div", { className: "cls_profile_picture_library_tab_preview_container flex flex-col gap-2 col-span-3", children: [_jsx(Label, { className: "cls_profile_picture_library_tab_preview_label text-sm font-medium text-[var(--hazo-text-secondary)]", children: t("my_settings.library_tab.preview_label") }), selectedPhoto ? (_jsxs("div", { className: "cls_profile_picture_library_tab_preview flex flex-col items-center gap-4 p-4 border border-[var(--hazo-border)] rounded-lg bg-[var(--hazo-bg-subtle)] min-h-[400px] justify-center", children: [_jsx("div", { className: "cls_profile_picture_library_tab_preview_image_wrapper w-full flex items-center justify-center", children: _jsx("img", { src: selectedPhoto, alt: t("my_settings.library_tab.preview_alt"), className: "cls_profile_picture_library_tab_preview_image max-w-full max-h-[350px] rounded-lg object-contain", onError: (e) => {
|
|
132
135
|
// Fallback if preview image fails to load
|
|
133
136
|
const target = e.target;
|
|
134
137
|
target.style.display = 'none';
|
|
135
138
|
const wrapper = target.parentElement;
|
|
136
139
|
if (wrapper) {
|
|
137
|
-
wrapper.innerHTML =
|
|
140
|
+
wrapper.innerHTML = `<p class="text-sm text-red-500">${t("my_settings.library_tab.preview_load_failed")}</p>`;
|
|
138
141
|
}
|
|
139
|
-
} }) }), _jsx("p", { className: "cls_profile_picture_library_tab_preview_text text-sm text-[var(--hazo-text-muted)] text-center", children: "
|
|
142
|
+
} }) }), _jsx("p", { className: "cls_profile_picture_library_tab_preview_text text-sm text-[var(--hazo-text-muted)] text-center", children: t("my_settings.library_tab.preview_selected_text") })] })) : (_jsxs("div", { className: "cls_profile_picture_library_tab_preview_empty flex flex-col items-center justify-center gap-2 p-8 border border-[var(--hazo-border)] rounded-lg bg-[var(--hazo-bg-subtle)] min-h-[400px]", children: [_jsx(Avatar, { className: "cls_profile_picture_library_tab_preview_empty_avatar h-32 w-32", children: _jsx(AvatarFallback, { className: "cls_profile_picture_library_tab_preview_empty_avatar_fallback bg-[var(--hazo-bg-emphasis)] text-[var(--hazo-text-muted)] text-3xl", children: getInitials() }) }), _jsx("p", { className: "cls_profile_picture_library_tab_preview_empty_text text-sm text-[var(--hazo-text-muted)] text-center", children: t("my_settings.library_tab.preview_empty_text") })] }))] })] })] }));
|
|
140
143
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile_picture_upload_tab.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/profile_picture_upload_tab.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profile_picture_upload_tab.d.ts","sourceRoot":"","sources":["../../../../../src/components/layouts/my_settings/components/profile_picture_upload_tab.tsx"],"names":[],"mappings":"AA4BA,MAAM,MAAM,4BAA4B,GAAG;IACzC,SAAS,EAAE,OAAO,CAAC;IACnB,iBAAiB,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;IAC1C,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAGF;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,EACtC,SAAS,EACT,iBAAiB,EACjB,YAAY,EACZ,OAAO,EACP,aAAa,EACb,QAAgB,EAChB,cAAc,EACd,0BAA0B,EAC1B,4BAAkC,EAClC,wBAAmC,EAAE,eAAe;AACpD,qBAAgE,EAChE,SAAS,EACT,gBAAgB,EAChB,eAAe,EACf,aAAa,GACd,EAAE,4BAA4B,+BA0U9B"}
|