feat: AI image classification and dynamic fallback assignment
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 44s
Build & Deploy / 🧪 QA (push) Successful in 1m4s
Build & Deploy / 🏗️ Build (push) Successful in 1m54s
Build & Deploy / 🚀 Deploy (push) Successful in 28s
Build & Deploy / 🧪 Post-Deploy Verification (push) Successful in 43s
Build & Deploy / 🔔 Notify (push) Successful in 2s
All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 44s
Build & Deploy / 🧪 QA (push) Successful in 1m4s
Build & Deploy / 🏗️ Build (push) Successful in 1m54s
Build & Deploy / 🚀 Deploy (push) Successful in 28s
Build & Deploy / 🧪 Post-Deploy Verification (push) Successful in 43s
Build & Deploy / 🔔 Notify (push) Successful in 2s
This commit is contained in:
@@ -4,8 +4,9 @@ import * as React from 'react';
|
||||
import { motion } from 'framer-motion';
|
||||
import Link from 'next/link';
|
||||
import Image from 'next/image';
|
||||
import { HoverShineOverlay } from '@/components/ui/HoverShineOverlay';
|
||||
import { HoverShineOverlay } from "@/components/ui/HoverShineOverlay";
|
||||
import { useTranslations, useLocale } from 'next-intl';
|
||||
import { getImageForProject } from '@/lib/image-matcher';
|
||||
|
||||
export interface Reference {
|
||||
id: string;
|
||||
@@ -55,13 +56,15 @@ export function ReferencesSlider(props: ReferencesSliderProps) {
|
||||
|
||||
if (!references || references.length === 0) return null;
|
||||
|
||||
// Fallback images pool if CMS doesn't provide one
|
||||
const fallbacks = [
|
||||
'/assets/photos/DSC01123.JPG',
|
||||
'/assets/photos/DSC00850.JPG',
|
||||
'/assets/photos/DSC01129.JPG',
|
||||
'/assets/photos/DSC00010.JPG',
|
||||
];
|
||||
// Map the display category back to our internal image matcher categories
|
||||
const mapCategoryToInternal = (cat: string) => {
|
||||
const lower = cat.toLowerCase();
|
||||
if (lower.includes('pv') || lower.includes('solar')) return 'pv';
|
||||
if (lower.includes('wind')) return 'wind';
|
||||
if (lower.includes('trasse') || lower.includes('spannung') || lower.includes('power')) return 'power';
|
||||
if (lower.includes('batterie') || lower.includes('bess') || lower.includes('speicher')) return 'battery';
|
||||
return 'fiber'; // fallback for Tiefbau / Breitband
|
||||
};
|
||||
|
||||
const onMouseDown = (e: React.MouseEvent) => {
|
||||
if (!containerRef.current) return;
|
||||
@@ -119,7 +122,9 @@ export function ReferencesSlider(props: ReferencesSliderProps) {
|
||||
{references.map((ref, i) => {
|
||||
const imgSrc = (ref.image && typeof ref.image === 'object' && ref.image.url)
|
||||
? ref.image.url
|
||||
: fallbacks[i % fallbacks.length];
|
||||
: typeof ref.image === 'string'
|
||||
? ref.image
|
||||
: getImageForProject(ref.slug || ref.id, mapCategoryToInternal(ref.category));
|
||||
|
||||
return (
|
||||
<motion.div
|
||||
|
||||
Reference in New Issue
Block a user