refactor: improve email status display and messaging

LocationCard:
- Include email status in card info section display condition
- Remove emoji suffixes (icons already convey status visually)

LocationEditForm:
- Enable autoBillFwd and rentDueNotification toggles
- Only show email status when displayed email matches saved email
- Show unverified status when email is changed or for new emails
- Remove emoji suffixes from status messages
- Add left margin to status display

Messages (EN/HR):
- More descriptive email status messages in both languages
- LocationCard: "tenant email not verified" vs "Email not verified"
- LocationEditForm: Clearer explanations like "this e-mail address
  will need to be verified by the tenant"

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

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Knee Cola
2025-12-29 21:58:02 +01:00
parent fea0f48cec
commit b20d68405c
4 changed files with 29 additions and 26 deletions

View File

@@ -70,7 +70,7 @@ export const LocationCard: FC<LocationCardProps> = ({ location, currency }) => {
</Link> </Link>
<ShareIcon className="h-[1em] w-[1em] cursor-pointer text-2xl inline hover:text-red-500" title="create sharable link" onClick={handleCopyLinkClick} /> <ShareIcon className="h-[1em] w-[1em] cursor-pointer text-2xl inline hover:text-red-500" title="create sharable link" onClick={handleCopyLinkClick} />
</div> </div>
{ totalUnpaid > 0 || totalPayed > 0 || seenByTenantAt || utilBillsProofOfPayment?.uploadedAt ? { totalUnpaid > 0 || totalPayed > 0 || seenByTenantAt || utilBillsProofOfPayment?.uploadedAt || (tenantEmail && tenantEmailStatus && tenantEmailStatus !== EmailStatus.Verified) ?
<> <>
<div className="flex ml-1"> <div className="flex ml-1">
<div className="divider divider-horizontal p-0 m-0"></div> <div className="divider divider-horizontal p-0 m-0"></div>
@@ -108,9 +108,9 @@ export const LocationCard: FC<LocationCardProps> = ({ location, currency }) => {
tenantEmailStatus === EmailStatus.VerificationPending ? "text-info" : tenantEmailStatus === EmailStatus.VerificationPending ? "text-info" :
"text-error" "text-error"
}> }>
{tenantEmailStatus === EmailStatus.Unverified && `${t("email-status.unverified")} ⚠️`} {tenantEmailStatus === EmailStatus.Unverified && `${t("email-status.unverified")}`}
{tenantEmailStatus === EmailStatus.VerificationPending && `${t("email-status.verification-pending")}`} {tenantEmailStatus === EmailStatus.VerificationPending && `${t("email-status.verification-pending")}`}
{tenantEmailStatus === EmailStatus.Unsubscribed && `${t("email-status.unsubscribed")} ✉️`} {tenantEmailStatus === EmailStatus.Unsubscribed && `${t("email-status.unsubscribed")}`}
</span> </span>
</div> </div>
)} )}

View File

@@ -265,7 +265,6 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
<fieldset className="fieldset"> <fieldset className="fieldset">
<label className="label cursor-pointer justify-start gap-3"> <label className="label cursor-pointer justify-start gap-3">
<input <input
disabled={true}
type="checkbox" type="checkbox"
name="autoBillFwd" name="autoBillFwd"
className="toggle toggle-primary" className="toggle toggle-primary"
@@ -294,7 +293,6 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
<fieldset className="fieldset"> <fieldset className="fieldset">
<label className="label cursor-pointer justify-start gap-3"> <label className="label cursor-pointer justify-start gap-3">
<input <input
disabled={true}
type="checkbox" type="checkbox"
name="rentDueNotification" name="rentDueNotification"
className="toggle toggle-primary" className="toggle toggle-primary"
@@ -357,33 +355,38 @@ export const LocationEditForm: FC<LocationEditFormProps> = ({ location, yearMont
defaultValue={formValues.tenantEmail} defaultValue={formValues.tenantEmail}
onChange={(e) => handleInputChange("tenantEmail", e.target.value)} onChange={(e) => handleInputChange("tenantEmail", e.target.value)}
/> />
{location?.tenantEmail && location?.tenantEmailStatus && ( {location?.tenantEmail && location?.tenantEmail === formValues.tenantEmail && location?.tenantEmailStatus ? (
<div className="flex items-center gap-2 mt-2"> <div className="flex items-center gap-2 mt-2 ml-2">
{location.tenantEmailStatus === EmailStatus.Unverified && ( {location.tenantEmailStatus === EmailStatus.Unverified && (
<> <>
<ExclamationTriangleIcon className="h-5 w-5 text-warning" /> <ExclamationTriangleIcon className="h-5 w-5 text-warning" />
<span className="text-sm text-warning">{t("email-status.unverified")} </span> <span className="text-sm text-warning">{t("email-status.unverified")}</span>
</> </>
)} )}
{location.tenantEmailStatus === EmailStatus.VerificationPending && ( {location.tenantEmailStatus === EmailStatus.VerificationPending && (
<> <>
<ClockIcon className="h-5 w-5 text-info" /> <ClockIcon className="h-5 w-5 text-info" />
<span className="text-sm text-info">{t("email-status.verification-pending")} </span> <span className="text-sm text-info">{t("email-status.verification-pending")}</span>
</> </>
)} )}
{location.tenantEmailStatus === EmailStatus.Verified && ( {location.tenantEmailStatus === EmailStatus.Verified && (
<> <>
<CheckCircleIcon className="h-5 w-5 text-success" /> <CheckCircleIcon className="h-5 w-5 text-success" />
<span className="text-sm text-success">{t("email-status.verified")} </span> <span className="text-sm text-success">{t("email-status.verified")}</span>
</> </>
)} )}
{location.tenantEmailStatus === EmailStatus.Unsubscribed && ( {location.tenantEmailStatus === EmailStatus.Unsubscribed && (
<> <>
<EnvelopeIcon className="h-5 w-5 text-error" /> <EnvelopeIcon className="h-5 w-5 text-error" />
<span className="text-sm text-error">{t("email-status.unsubscribed")} </span> <span className="text-sm text-error">{t("email-status.unsubscribed")}</span>
</> </>
)} )}
</div> </div>
):(
<div className="flex items-center gap-2 mt-2 ml-2">
<ExclamationTriangleIcon className="h-5 w-5 text-warning" />
<span className="text-sm text-warning">{t("email-status.unverified")}</span>
</div>
)} )}
<div id="tenantEmail-error" aria-live="polite" aria-atomic="true"> <div id="tenantEmail-error" aria-live="polite" aria-atomic="true">
{state.errors?.tenantEmail && {state.errors?.tenantEmail &&

View File

@@ -62,9 +62,9 @@
"seen-by-tenant-label": "seen by tenant", "seen-by-tenant-label": "seen by tenant",
"download-proof-of-payment-label": "proof-of-payment.PDF", "download-proof-of-payment-label": "proof-of-payment.PDF",
"email-status": { "email-status": {
"unverified": "Email not verified", "unverified": "tenant email not verified",
"verification-pending": "Email verification pending", "verification-pending": "waiting for tenant to verify email",
"unsubscribed": "Email unsubscribed" "unsubscribed": "tenant unsubscribed from receiving emails"
}, },
"payment-info-header": "You can pay the utility bills for this month using the following information:", "payment-info-header": "You can pay the utility bills for this month using the following information:",
"payment-amount-label": "Amount:", "payment-amount-label": "Amount:",
@@ -196,10 +196,10 @@
"tenant-email-legend": "TENANT EMAIL", "tenant-email-legend": "TENANT EMAIL",
"tenant-email-placeholder": "enter tenant's email", "tenant-email-placeholder": "enter tenant's email",
"email-status": { "email-status": {
"unverified": "Email not verified", "unverified": "this e-mail address will need to be verified by the tenant",
"verification-pending": "Email verification pending", "verification-pending": "waiting for tenant to verify this email address",
"verified": "Email verified", "verified": "this e-mail address has been verified",
"unsubscribed": "Email unsubscribed" "unsubscribed": "tenant unsubscribed this address e-mail address from receiving emails"
}, },
"warning-missing-tenant-names": "Warning: Tenant first and last name are missing. The 2D barcode will not be displayed to the tenant when they open the shared link until both fields are filled in.", "warning-missing-tenant-names": "Warning: Tenant first and last name are missing. The 2D barcode will not be displayed to the tenant when they open the shared link until both fields are filled in.",
"save-button": "Save", "save-button": "Save",

View File

@@ -62,9 +62,9 @@
"seen-by-tenant-label": "viđeno od strane podstanara", "seen-by-tenant-label": "viđeno od strane podstanara",
"download-proof-of-payment-label": "potvrda-o-uplati.PDF", "download-proof-of-payment-label": "potvrda-o-uplati.PDF",
"email-status": { "email-status": {
"unverified": "Email nije potvrđen", "unverified": "e-mail podstanara nije potvrđen",
"verification-pending": "Čeka se potvrda emaila", "verification-pending": "čeka se da podstanar potvrdi e-mail",
"unsubscribed": "Email odjavljen" "unsubscribed": "podstanar odjavio e-mail adresu"
}, },
"payment-info-header": "Režije za ovaj mjesec možete uplatiti koristeći slijedeće podatke:", "payment-info-header": "Režije za ovaj mjesec možete uplatiti koristeći slijedeće podatke:",
"payment-amount-label": "Iznos:", "payment-amount-label": "Iznos:",
@@ -195,10 +195,10 @@
"tenant-email-legend": "EMAIL PODSTANARA", "tenant-email-legend": "EMAIL PODSTANARA",
"tenant-email-placeholder": "unesite email podstanara", "tenant-email-placeholder": "unesite email podstanara",
"email-status": { "email-status": {
"unverified": "Email nije potvrđen", "unverified": "podstanar će morati potvrditi ovu e-mail adresu",
"verification-pending": "Čeka se potvrda emaila", "verification-pending": "čeka se da podstanar potvrdi e-mail",
"verified": "Email potvrđen", "verified": "podstanar je potvrdio ovu e-mail adresu",
"unsubscribed": "Email odjavljen" "unsubscribed": "podstanar je odjavio ovu e-mail adresu"
}, },
"warning-missing-tenant-names": "Upozorenje: Ime i prezime podstanara nedostaju. 2D barkod neće biti prikazan podstanaru kada otvori podijeljenu poveznicu dok oba polja ne budu popunjena.", "warning-missing-tenant-names": "Upozorenje: Ime i prezime podstanara nedostaju. 2D barkod neće biti prikazan podstanaru kada otvori podijeljenu poveznicu dok oba polja ne budu popunjena.",
"save-button": "Spremi", "save-button": "Spremi",