The brand/project name overlaid on gallery cards (GalleryOverview.jsx and the identical pattern in GalleryBrandPage.jsx) was always left- aligned with no way to change it - flagged against the brand-overview page specifically, but the same hard-coded markup exists on the brand detail page's project cards too, so both get the fix together as one setting rather than two. New app_settings.gallery_card_text_align (left/center/right, default left - no visual change until an admin picks something else), same site-wide-design-setting pattern as the existing package_card_theme/ package_card_layout. New "Bildergalerie-Kacheln" section in Website settings renders an actual live preview card - using a real uploaded gallery image and brand name when one exists, not just a placeholder - that updates immediately when a button is clicked, rather than a free-drag positioner: cheaper to build reliably and keeps the label inside the three positions the design's bottom gradient overlay is actually built to support. New shared hifi-src/src/utils/galleryCardAlign.js provides the class lookup both public pages and the admin preview use - a fixed map rather than a template-string class name, same reasoning as the Home.jsx section alignment work: Tailwind's build-time scanner needs literal class names in the source or it purges them from the production CSS. Verified against the local database directly via PHP CLI: the new column backfilled to 'left' on the existing app_settings row, and SiteSettingsController::show() returns it correctly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
63 lines
2.6 KiB
JavaScript
63 lines
2.6 KiB
JavaScript
import { useEffect, useState } from 'react';
|
|
import { Link } from 'react-router-dom';
|
|
import { api } from '../../api/client.js';
|
|
import usePageMeta from '../../hooks/usePageMeta.js';
|
|
import { useLanguage } from '../../context/LanguageContext.jsx';
|
|
import { useSiteSettings } from '../../context/SiteSettingsContext.jsx';
|
|
import { GALLERY_CARD_ALIGN } from '../../utils/galleryCardAlign.js';
|
|
|
|
export default function GalleryOverview() {
|
|
const [brands, setBrands] = useState(null);
|
|
const [error, setError] = useState('');
|
|
const { t } = useLanguage();
|
|
const { gallery_card_text_align: cardAlign } = useSiteSettings();
|
|
|
|
usePageMeta({
|
|
title: t('galleryOverview.metaTitle'),
|
|
description: t('galleryOverview.metaDescription'),
|
|
path: '/galerie',
|
|
});
|
|
|
|
useEffect(() => {
|
|
api.get('/gallery-brands').then(setBrands).catch((e) => setError(e.message));
|
|
}, []);
|
|
|
|
return (
|
|
<div className="mx-auto max-w-6xl px-4 py-12 sm:px-6">
|
|
<h1 className="mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl">{t('galleryOverview.title')}</h1>
|
|
<p className="mb-8 text-neutral-600 dark:text-neutral-300">
|
|
{t('galleryOverview.intro')}
|
|
</p>
|
|
|
|
{error && <p className="text-red-600">{error}</p>}
|
|
{!brands && !error && <p className="text-neutral-500 dark:text-neutral-400">{t('galleryOverview.loading')}</p>}
|
|
{brands && brands.length === 0 && (
|
|
<p className="text-neutral-500 dark:text-neutral-400">{t('galleryOverview.empty')}</p>
|
|
)}
|
|
|
|
<div className="grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4">
|
|
{brands?.map((brand) => (
|
|
<Link
|
|
key={brand.id}
|
|
to={`/galerie/${brand.slug}`}
|
|
className="group relative block aspect-[4/3] overflow-hidden rounded-xl bg-neutral-900 shadow-sm transition hover:shadow-lg"
|
|
>
|
|
{brand.cover_image_path ? (
|
|
<img
|
|
src={brand.cover_image_path}
|
|
alt={brand.name}
|
|
className="h-full w-full object-cover transition duration-300 group-hover:scale-105"
|
|
/>
|
|
) : (
|
|
<div className="flex h-full w-full items-center justify-center bg-neutral-200 dark:bg-neutral-800" />
|
|
)}
|
|
<div className="absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95" />
|
|
<span className={`absolute inset-x-0 bottom-0 p-4 text-lg font-extrabold text-white ${GALLERY_CARD_ALIGN[cardAlign] || GALLERY_CARD_ALIGN.left}`}>
|
|
{brand.name}
|
|
</span>
|
|
</Link>
|
|
))}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|