feat: add email status indicators to LocationCard
- Display email status when not Verified - Show appropriate icons and colors for each status - Add bilingual translations for status labels - Use UTF-8 emojis (⚠️ ⏳ ✉️) alongside Heroicons 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { CheckCircleIcon, Cog8ToothIcon, PlusCircleIcon, ShareIcon, BanknotesIcon, EyeIcon, TicketIcon, ShoppingCartIcon } from "@heroicons/react/24/outline";
|
import { CheckCircleIcon, Cog8ToothIcon, PlusCircleIcon, ShareIcon, BanknotesIcon, EyeIcon, TicketIcon, ShoppingCartIcon, EnvelopeIcon, ExclamationTriangleIcon, ClockIcon } from "@heroicons/react/24/outline";
|
||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
import { BillBadge } from "./BillBadge";
|
import { BillBadge } from "./BillBadge";
|
||||||
import { BillingLocation } from "../lib/db-types";
|
import { BillingLocation, EmailStatus } from "../lib/db-types";
|
||||||
import { formatYearMonth } from "../lib/format";
|
import { formatYearMonth } from "../lib/format";
|
||||||
import { formatCurrency } from "../lib/formatStrings";
|
import { formatCurrency } from "../lib/formatStrings";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
@@ -25,6 +25,8 @@ export const LocationCard: FC<LocationCardProps> = ({ location, currency }) => {
|
|||||||
seenByTenantAt,
|
seenByTenantAt,
|
||||||
// NOTE: only the fileName is projected from the DB to reduce data transfer
|
// NOTE: only the fileName is projected from the DB to reduce data transfer
|
||||||
utilBillsProofOfPayment,
|
utilBillsProofOfPayment,
|
||||||
|
tenantEmail,
|
||||||
|
tenantEmailStatus,
|
||||||
} = location;
|
} = location;
|
||||||
|
|
||||||
const t = useTranslations("home-page.location-card");
|
const t = useTranslations("home-page.location-card");
|
||||||
@@ -95,6 +97,24 @@ export const LocationCard: FC<LocationCardProps> = ({ location, currency }) => {
|
|||||||
</div>
|
</div>
|
||||||
: null
|
: null
|
||||||
}
|
}
|
||||||
|
{tenantEmail && tenantEmailStatus && tenantEmailStatus !== EmailStatus.Verified && (
|
||||||
|
<div className="flex ml-1">
|
||||||
|
<span className="w-5 min-w-5 mr-2">
|
||||||
|
{tenantEmailStatus === EmailStatus.Unverified && <ExclamationTriangleIcon className="mt-[.1rem] text-warning" />}
|
||||||
|
{tenantEmailStatus === EmailStatus.VerificationPending && <ClockIcon className="mt-[.1rem] text-info" />}
|
||||||
|
{tenantEmailStatus === EmailStatus.Unsubscribed && <EnvelopeIcon className="mt-[.1rem] text-error" />}
|
||||||
|
</span>
|
||||||
|
<span className={
|
||||||
|
tenantEmailStatus === EmailStatus.Unverified ? "text-warning" :
|
||||||
|
tenantEmailStatus === EmailStatus.VerificationPending ? "text-info" :
|
||||||
|
"text-error"
|
||||||
|
}>
|
||||||
|
{tenantEmailStatus === EmailStatus.Unverified && `${t("email-status.unverified")} ⚠️`}
|
||||||
|
{tenantEmailStatus === EmailStatus.VerificationPending && `${t("email-status.verification-pending")} ⏳`}
|
||||||
|
{tenantEmailStatus === EmailStatus.Unsubscribed && `${t("email-status.unsubscribed")} ✉️`}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
{seenByTenantAt && (
|
{seenByTenantAt && (
|
||||||
<div className="flex mt-1 ml-1">
|
<div className="flex mt-1 ml-1">
|
||||||
<span className="w-5 mr-2 min-w-5"><EyeIcon className="mt-[.1rem]" /></span>
|
<span className="w-5 mr-2 min-w-5"><EyeIcon className="mt-[.1rem]" /></span>
|
||||||
|
|||||||
@@ -61,6 +61,11 @@
|
|||||||
"monthly-statement-legend": "Monthly statement",
|
"monthly-statement-legend": "Monthly statement",
|
||||||
"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": {
|
||||||
|
"unverified": "Email not verified",
|
||||||
|
"verification-pending": "Email verification pending",
|
||||||
|
"unsubscribed": "Email unsubscribed"
|
||||||
|
},
|
||||||
"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:",
|
||||||
"payment-recipient-label": "Recipient:",
|
"payment-recipient-label": "Recipient:",
|
||||||
|
|||||||
@@ -61,6 +61,11 @@
|
|||||||
"monthly-statement-legend": "Obračun",
|
"monthly-statement-legend": "Obračun",
|
||||||
"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": {
|
||||||
|
"unverified": "Email nije potvrđen",
|
||||||
|
"verification-pending": "Čeka se potvrda emaila",
|
||||||
|
"unsubscribed": "Email odjavljen"
|
||||||
|
},
|
||||||
"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:",
|
||||||
"payment-recipient-label": "Primatelj:",
|
"payment-recipient-label": "Primatelj:",
|
||||||
|
|||||||
Reference in New Issue
Block a user