import {PlaceCategory} from '@o2o/shared';
import {HeroCatchphrase, HeroRotator} from '@site/sections/HeroCatchphrase';
import {useSite} from '@site/lib/site-context';
import {galleryImages, isSectionEnabled} from '@site/lib/derive';
import {useLiveWeather} from '@site/lib/use-live-weather';
import {Car} from '../paper/Car';
import {MoodIcon, Weather} from './Weather';
const MAX_SLIDES = 5;
export function Hero() {
const payload = useSite();
const {place, narrative} = payload;
const slides = [...payload.media]
.filter((image) => image.alt?.trim())
.sort((a, b) => Number(b.isPrimary) - Number(a.isPrimary))
.slice(0, MAX_SLIDES);
const fixed = narrative.tagline ?? narrative.heroSubline;
const lodging = place.category === PlaceCategory.LODGING;
const where = place.addressLocality ?? place.addressRegion;
const sub = [where, fixed].filter(Boolean).join(' · ');
const showWeather = isSectionEnabled(payload, 'weather');
const weather = useLiveWeather({
initial: payload.local.weather,
regionCode: payload.place.regionCode,
latitude: payload.place.latitude,
longitude: payload.place.longitude,
});
const backdrop = galleryImages(payload).find((image) => !image.isPrimary);
return (
<>
{where} {sub}
))}
/>
)}
{place.name}
{where && {place.name}
{sub &&