Use local fonts and API primary phone across the site.

Serve Iran Yekan and Oswald from public/fonts, drive contact numbers from business-info phoneNumbers, and tighten the products mega menu with two-column lists.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-09-15 15:27:27 +03:30
co-authored by Cursor
parent d249d958eb
commit b36c07e28f
21 changed files with 165 additions and 74 deletions
+21 -1
View File
@@ -1,5 +1,6 @@
import { site } from "@/data/home";
import { apiGet } from "./client";
import type { BusinessInfo } from "./types";
import type { BusinessInfo, BusinessPhoneNumber } from "./types";
export async function getBusinessInfo() {
try {
@@ -9,3 +10,22 @@ export async function getBusinessInfo() {
return null;
}
}
export function toPhoneText(phone: string | BusinessPhoneNumber | null | undefined) {
if (!phone) return "";
if (typeof phone === "string") return phone.trim();
return String(phone.number ?? "").trim();
}
/** First entry in business `phoneNumbers`, or site fallback. */
export function getPrimaryPhone(
info: BusinessInfo | null | undefined,
fallback: string = site.phone,
) {
const first = info?.phoneNumbers?.[0];
return toPhoneText(first) || fallback;
}
export async function getPrimaryPhoneNumber() {
return getPrimaryPhone(await getBusinessInfo());
}
+11 -1
View File
@@ -100,6 +100,12 @@ export type CategoryTreeNode = Category & {
children: CategoryTreeNode[];
};
export type BusinessPhoneNumber = {
label?: string | null;
type?: string | null;
number: string;
};
export type BusinessInfo = {
id: string;
name: string;
@@ -109,7 +115,8 @@ export type BusinessInfo = {
logoUrl: string | null;
faviconUrl: string | null;
emails: string[];
phoneNumbers: string[];
/** API returns objects; older payloads may use plain strings. */
phoneNumbers: Array<string | BusinessPhoneNumber>;
socialMedia?: {
whatsapp?: string;
telegram?: string;
@@ -123,6 +130,9 @@ export type BusinessInfo = {
address?: string | null;
cityName?: string | null;
cityNameFa?: string | null;
city?: string | null;
province?: string | null;
landline?: string | null;
}>;
};