Update carousels, card hover, and IranBay branding.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import type { AuthUser } from "@/types/auth";
|
||||
|
||||
/** Prefer Meshkee English name fields; fall back to cell. */
|
||||
export function getDisplayName(user: AuthUser | null | undefined): string {
|
||||
if (!user) return "Admin";
|
||||
|
||||
const english = [user.firstNameEn, user.lastNameEn]
|
||||
.filter(Boolean)
|
||||
.join(" ")
|
||||
.trim();
|
||||
if (english) return english;
|
||||
|
||||
const local = [user.firstName, user.lastName].filter(Boolean).join(" ").trim();
|
||||
if (local && !/[\u0600-\u06FF]/.test(local)) return local;
|
||||
|
||||
return user.cellNumber || "User";
|
||||
}
|
||||
|
||||
export function getFirstName(user: AuthUser | null | undefined): string {
|
||||
if (!user) return "there";
|
||||
const raw =
|
||||
user.firstNameEn?.trim() ||
|
||||
(user.firstName?.trim() && !/[\u0600-\u06FF]/.test(user.firstName)
|
||||
? user.firstName.trim()
|
||||
: "");
|
||||
if (!raw) return "there";
|
||||
return raw.split(/\s+/)[0] || raw;
|
||||
}
|
||||
Reference in New Issue
Block a user