Rename address field to street and change to text input

Changes the user settings address field to street with the following updates:
- Renames database field from 'address' to 'street' in UserSettings type
- Changes form input from textarea to single-line text input
- Updates validation logic and error messages
- Updates translations in both Croatian and English
- Removes deprecated AppSettingsForm component

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Knee Cola
2025-11-22 15:00:12 +01:00
parent 701b9b5d58
commit 795d9c690b
7 changed files with 32 additions and 261 deletions

View File

@@ -16,7 +16,7 @@ export type State = {
errors?: {
firstName?: string[];
lastName?: string[];
address?: string[];
street?: string[];
iban?: string[];
show2dCodeInMonthlyStatement?: string[];
};
@@ -30,7 +30,7 @@ export type State = {
const FormSchema = (t: IntlTemplateFn) => z.object({
firstName: z.string().optional(),
lastName: z.string().optional(),
address: z.string().optional(),
street: z.string().optional(),
iban: z.string()
.optional()
.refine(
@@ -64,12 +64,12 @@ const FormSchema = (t: IntlTemplateFn) => z.object({
})
.refine((data) => {
if (data.show2dCodeInMonthlyStatement) {
return !!data.address && data.address.trim().length > 0;
return !!data.street && data.street.trim().length > 0;
}
return true;
}, {
message: t("address-required"),
path: ["address"],
message: t("street-required"),
path: ["street"],
})
.refine((data) => {
if (data.show2dCodeInMonthlyStatement) {
@@ -112,7 +112,7 @@ export const updateUserSettings = withUser(async (user: AuthenticatedUser, prevS
const validatedFields = FormSchema(t).safeParse({
firstName: formData.get('firstName') || undefined,
lastName: formData.get('lastName') || undefined,
address: formData.get('address') || undefined,
street: formData.get('street') || undefined,
iban: formData.get('iban') || undefined,
show2dCodeInMonthlyStatement: formData.get('generateTenantCode') === 'on',
});
@@ -126,7 +126,7 @@ export const updateUserSettings = withUser(async (user: AuthenticatedUser, prevS
};
}
const { firstName, lastName, address, iban, show2dCodeInMonthlyStatement } = validatedFields.data;
const { firstName, lastName, street, iban, show2dCodeInMonthlyStatement } = validatedFields.data;
// Normalize IBAN: remove spaces and convert to uppercase
const normalizedIban = iban ? iban.replace(/\s/g, '').toUpperCase() : null;
@@ -139,7 +139,7 @@ export const updateUserSettings = withUser(async (user: AuthenticatedUser, prevS
userId,
firstName: firstName || null,
lastName: lastName || null,
address: address || null,
street: street || null,
iban: normalizedIban,
show2dCodeInMonthlyStatement: show2dCodeInMonthlyStatement ?? false,
};

View File

@@ -22,8 +22,8 @@ export interface UserSettings {
firstName?: string | null;
/** last name */
lastName?: string | null;
/** address */
address?: string | null;
/** street */
street?: string | null;
/** IBAN */
iban?: string | null;
/** whether to show 2D code in monthly statement */