Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 4x 4x | import { getPropertyTypeLabel } from "./api/helpers";
/**
* The fixed-format code line printed on every project swatch:
* "3 BHK · Apartment · Chennai". Same order everywhere so a visitor reads
* the same field in the same place on every card. Missing fields drop out.
*/
export function swatchTicket(project: {
bhkCount?: number | null;
propertyType?: string | null;
pro?: { city?: string | null } | null;
}): string {
const bhk =
typeof project.bhkCount === "number" && project.bhkCount > 0
? `${project.bhkCount} BHK`
: null;
return [bhk, getPropertyTypeLabel(project.propertyType ?? null), project.pro?.city]
.filter(Boolean)
.join(" · ");
}
|