Refactor: rename account-form to settings-form and update translations

This commit is contained in:
Knee Cola
2025-11-18 12:33:24 +01:00
parent 6b5fb6c44d
commit b03f0574cd
5 changed files with 11 additions and 11 deletions

View File

@@ -107,7 +107,7 @@ export const getUserProfile = withUser(async (user: AuthenticatedUser) => {
export const updateUserProfile = withUser(async (user: AuthenticatedUser, prevState: State, formData: FormData) => { export const updateUserProfile = withUser(async (user: AuthenticatedUser, prevState: State, formData: FormData) => {
noStore(); noStore();
const t = await getTranslations("account-form.validation"); const t = await getTranslations("settings-form.validation");
const validatedFields = FormSchema(t).safeParse({ const validatedFields = FormSchema(t).safeParse({
firstName: formData.get('firstName') || undefined, firstName: formData.get('firstName') || undefined,

View File

@@ -6,7 +6,7 @@ import { updateUserProfile } from "../lib/actions/userProfileActions";
import { useFormState, useFormStatus } from "react-dom"; import { useFormState, useFormStatus } from "react-dom";
import { useLocale, useTranslations } from "next-intl"; import { useLocale, useTranslations } from "next-intl";
import Link from "next/link"; import Link from "next/link";
import AccountCircleIcon from "@mui/icons-material/AccountCircle"; import SettingsIcon from "@mui/icons-material/Settings";
import { formatIban } from "../lib/formatStrings"; import { formatIban } from "../lib/formatStrings";
import { InfoBox } from "./InfoBox"; import { InfoBox } from "./InfoBox";
@@ -22,7 +22,7 @@ type FormFieldsProps = {
const FormFields: FC<FormFieldsProps> = ({ profile, errors, message }) => { const FormFields: FC<FormFieldsProps> = ({ profile, errors, message }) => {
const { pending } = useFormStatus(); const { pending } = useFormStatus();
const t = useTranslations("account-form"); const t = useTranslations("settings-form");
const locale = useLocale(); const locale = useLocale();
// Track current form values for real-time validation // Track current form values for real-time validation
@@ -194,12 +194,12 @@ const FormFields: FC<FormFieldsProps> = ({ profile, errors, message }) => {
export const AccountForm: FC<AccountFormProps> = ({ profile }) => { export const AccountForm: FC<AccountFormProps> = ({ profile }) => {
const initialState = { message: null, errors: {} }; const initialState = { message: null, errors: {} };
const [state, dispatch] = useFormState(updateUserProfile, initialState); const [state, dispatch] = useFormState(updateUserProfile, initialState);
const t = useTranslations("account-form"); const t = useTranslations("settings-form");
return ( return (
<div className="card card-compact card-bordered min-w-[20em] max-w-[90em] bg-base-100 shadow-s my-1"> <div className="card card-compact card-bordered min-w-[20em] max-w-[90em] bg-base-100 shadow-s my-1">
<div className="card-body"> <div className="card-body">
<h2 className="card-title"><AccountCircleIcon className="w-6 h-6" /> {t("title")}</h2> <h2 className="card-title"><SettingsIcon className="w-6 h-6" /> {t("title")}</h2>
<form action={dispatch}> <form action={dispatch}>
<FormFields <FormFields
profile={profile} profile={profile}

View File

@@ -1,7 +1,7 @@
import Image from "next/image"; import Image from "next/image";
import Link from "next/link"; import Link from "next/link";
import { SelectLanguage } from "./SelectLanguage"; import { SelectLanguage } from "./SelectLanguage";
import AccountCircleIcon from "@mui/icons-material/AccountCircle"; import Settings from "@mui/icons-material/Settings";
export const PageHeader = () => export const PageHeader = () =>
<div className="navbar bg-base-100 mb-6"> <div className="navbar bg-base-100 mb-6">
@@ -9,6 +9,6 @@ export const PageHeader = () =>
<span className="grow">&nbsp;</span> <span className="grow">&nbsp;</span>
<SelectLanguage /> <SelectLanguage />
<Link href="/account/" className="btn btn-ghost btn-circle"> <Link href="/account/" className="btn btn-ghost btn-circle">
<AccountCircleIcon className="w-6 h-6" /> <Settings className="w-6 h-6" />
</Link> </Link>
</div> </div>

View File

@@ -164,8 +164,8 @@
"validation-failed": "Validation failed. Please check the form and try again." "validation-failed": "Validation failed. Please check the form and try again."
} }
}, },
"account-form": { "settings-form": {
"title": "Profile Information", "title": "Settings",
"info-box-message": "By activating this option, a 2D barcode will be included in the monthly statement sent to the tenant, allowing them to make a direct payment to your bank account.", "info-box-message": "By activating this option, a 2D barcode will be included in the monthly statement sent to the tenant, allowing them to make a direct payment to your bank account.",
"tenant-2d-code-legend": "TENANT 2D CODE", "tenant-2d-code-legend": "TENANT 2D CODE",
"tenant-2d-code-toggle-label": "include 2D code in monthly statements", "tenant-2d-code-toggle-label": "include 2D code in monthly statements",

View File

@@ -163,8 +163,8 @@
"validation-failed": "Validacija nije uspjela. Molimo provjerite formu i pokušajte ponovno." "validation-failed": "Validacija nije uspjela. Molimo provjerite formu i pokušajte ponovno."
} }
}, },
"account-form": { "settings-form": {
"title": "Podaci o profilu", "title": "Postavke",
"info-box-message": "Ako uključite ovu opciji na mjesečnom obračunu koji se šalje podstanaru biti će prikazan 2D bar kod, putem kojeg će moći izvršiti izravnu uplatu na vaš bankovni račun.", "info-box-message": "Ako uključite ovu opciji na mjesečnom obračunu koji se šalje podstanaru biti će prikazan 2D bar kod, putem kojeg će moći izvršiti izravnu uplatu na vaš bankovni račun.",
"tenant-2d-code-legend": "2D BARKOD ZA PODSTANARA", "tenant-2d-code-legend": "2D BARKOD ZA PODSTANARA",
"tenant-2d-code-toggle-label": "prikazuj 2D barkod u mjesečnom obračunu", "tenant-2d-code-toggle-label": "prikazuj 2D barkod u mjesečnom obračunu",