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:
@@ -29,7 +29,7 @@ const FormFields: FC<FormFieldsProps> = ({ userSettings, errors, message }) => {
|
||||
const [formValues, setFormValues] = useState({
|
||||
firstName: userSettings?.firstName ?? "",
|
||||
lastName: userSettings?.lastName ?? "",
|
||||
address: userSettings?.address ?? "",
|
||||
street: userSettings?.street ?? "",
|
||||
iban: formatIban(userSettings?.iban) ?? "",
|
||||
});
|
||||
|
||||
@@ -39,7 +39,7 @@ const FormFields: FC<FormFieldsProps> = ({ userSettings, errors, message }) => {
|
||||
|
||||
// Check if any required field is missing (clean IBAN of spaces for validation)
|
||||
const cleanedIban = formValues.iban.replace(/\s/g, '');
|
||||
const hasMissingData = !formValues.firstName || !formValues.lastName || !formValues.address || !cleanedIban;
|
||||
const hasMissingData = !formValues.firstName || !formValues.lastName || !formValues.street || !cleanedIban;
|
||||
|
||||
// Track whether to generate 2D code for tenant (use persisted value from database)
|
||||
const [show2dCodeInMonthlyStatement, setShow2dCodeInMonthlyStatement] = useState(
|
||||
@@ -118,20 +118,21 @@ const FormFields: FC<FormFieldsProps> = ({ userSettings, errors, message }) => {
|
||||
|
||||
<div className="form-control w-full">
|
||||
<label className="label">
|
||||
<span className="label-text">{t("address-label")}</span>
|
||||
<span className="label-text">{t("street-label")} </span>
|
||||
</label>
|
||||
<textarea
|
||||
id="address"
|
||||
name="address"
|
||||
className="textarea textarea-bordered w-full placeholder:text-gray-600"
|
||||
placeholder={t("address-placeholder")}
|
||||
defaultValue={userSettings?.address ?? ""}
|
||||
onChange={(e) => handleInputChange("address", e.target.value)}
|
||||
<input
|
||||
id="street"
|
||||
name="street"
|
||||
type="text"
|
||||
placeholder={t("street-placeholder")}
|
||||
className="input input-bordered w-full placeholder:text-gray-600"
|
||||
defaultValue={userSettings?.street ?? ""}
|
||||
onChange={(e) => handleInputChange("street", e.target.value)}
|
||||
disabled={pending}
|
||||
></textarea>
|
||||
<div id="address-error" aria-live="polite" aria-atomic="true">
|
||||
{errors?.address &&
|
||||
errors.address.map((error: string) => (
|
||||
/>
|
||||
<div id="street-error" aria-live="polite" aria-atomic="true">
|
||||
{errors?.street &&
|
||||
errors.street.map((error: string) => (
|
||||
<p className="mt-2 text-sm text-red-500" key={error}>
|
||||
{error}
|
||||
</p>
|
||||
|
||||
Reference in New Issue
Block a user