Files
aia-website/www/src/layouts/PageLayout.astro
T

74 lines
3.5 KiB
Plaintext

---
import BaseLayout from './BaseLayout.astro';
import FormShell from '../components/FormShell.astro';
import TeamPage from '../components/pages/TeamPage.astro';
import AboutPage from '../components/pages/AboutPage.astro';
import ServicesPage from '../components/pages/ServicesPage.astro';
import CareersPage from '../components/pages/CareersPage.astro';
import ContactPage from '../components/pages/ContactPage.astro';
import FaqPage from '../components/pages/FaqPage.astro';
import PageHero from '../components/PageHero.astro';
import { pageHeroImages } from '../data/page-visuals';
const { entry } = Astro.props;
const showForm = ['client-consultation', 'schedule-consultation', 'referrals'].includes(entry.data.slug);
const serviceTitles: Record<string, Record<string, string>> = {
en: {
'aba-therapy': 'Behavioral',
'autism-evaluations': 'Psychological',
'learner-social-club': 'Sociological'
},
es: {
'aba-therapy': 'Conductual',
'autism-evaluations': 'Psicológicos',
'learner-social-club': 'Sociológico'
}
};
const pageTitles: Record<string, Record<string, string>> = {
en: {
'aba-therapy-intake-process': 'Learner Intake Process',
about: 'About AIA',
careers: 'Employment Opportunities',
'client-consultation': 'Schedule Your Free Consultation',
'client-forms': 'Client Forms',
contact: 'Contact AIA',
'donate-autism-giveback': 'Giveback & Donate',
'employee-portal': 'Employee Portal',
faqs: 'ABA Therapy Helpline',
insurance: 'Insurance Guide',
'privacy-policy': 'Privacy Policy',
referrals: 'Physician & Insurer Referrals',
'schedule-consultation': 'Reach Out for Your Free Consultation',
services: 'ABA & Educational Services',
team: 'Meet the Team',
tour: 'Schedule a Guided Tour'
},
es: {
'aba-therapy-intake-process': 'Proceso de admisión de estudiantes',
'client-consultation': 'Programa tu consulta gratuita',
contact: 'Contactar a AIA',
services: 'Servicios ABA y Educativos'
}
};
const bannerTitle = serviceTitles[entry.data.lang]?.[entry.data.slug] || pageTitles[entry.data.lang]?.[entry.data.slug] || entry.data.title.split('|')[0].trim();
const isService = Boolean(serviceTitles[entry.data.lang]?.[entry.data.slug]);
const heroImage = pageHeroImages[entry.data.slug];
---
<BaseLayout title={entry.data.title} description={entry.data.description} canonical={entry.data.canonical} image={entry.data.featuredImage || heroImage} lang={entry.data.lang}>
{entry.data.slug === 'contact' && <Fragment slot="head"><link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="" /></Fragment>}
<PageHero title={bannerTitle} subtitle={entry.data.slug === 'faqs' ? 'FAQs' : undefined} image={heroImage} constrain />
{entry.data.slug === 'team' && entry.data.lang === 'en'
? <TeamPage />
: entry.data.slug === 'about' && entry.data.lang === 'en'
? <AboutPage />
: entry.data.slug === 'services' && entry.data.lang === 'en'
? <ServicesPage />
: entry.data.slug === 'careers' && entry.data.lang === 'en'
? <CareersPage />
: entry.data.slug === 'faqs' && entry.data.lang === 'en'
? <FaqPage><slot /></FaqPage>
: entry.data.slug === 'contact'
? <ContactPage title={bannerTitle}><slot /></ContactPage>
: <article class:list={['prose', 'source-page', 'container', { 'service-page': isService }]}><slot /></article>}
{showForm && <FormShell title={bannerTitle} showBackground={entry.data.slug === 'client-consultation'} />}
</BaseLayout>