27 lines
772 B
TypeScript
27 lines
772 B
TypeScript
import { usePage } from '@inertiajs/react';
|
|
import { telHref, whatsappHref } from '@/data/site';
|
|
|
|
/**
|
|
* Editable company contact details and office locations (admin panel →
|
|
* Info Perusahaan), with ready-to-use link targets.
|
|
*/
|
|
export function useSiteInfo() {
|
|
const { contact, offices } = usePage().props.site;
|
|
|
|
return {
|
|
phone: { label: contact.phone, href: telHref(contact.phone) },
|
|
whatsapp: {
|
|
label: contact.whatsapp,
|
|
href: whatsappHref(contact.whatsapp),
|
|
},
|
|
email: {
|
|
busdev: contact.email_busdev,
|
|
support: contact.email_support,
|
|
},
|
|
offices: offices.map((office) => ({
|
|
...office,
|
|
phoneHref: telHref(office.phone),
|
|
})),
|
|
};
|
|
}
|