@@ -0,0 +1,10 @@
|
||||
import { usePage } from '@inertiajs/react';
|
||||
import { portfolio } from '@/data/projects';
|
||||
import type { Project } from '@/types';
|
||||
|
||||
/** Portfolio helpers for pages that receive a `projects` prop. */
|
||||
export function usePortfolio() {
|
||||
const { projects } = usePage<{ projects: Project[] }>().props;
|
||||
|
||||
return portfolio(projects ?? []);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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),
|
||||
})),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user