import { useQuery } from "@tanstack/react-query"; import { queryClient } from "@/client/rpc-client"; interface ProfileLandingProps { onNavigateToBooking: () => void; } function StarRating({ rating }: { rating: number }) { return (
{[1, 2, 3, 4, 5].map((star) => ( ))}
); } function getDayName(dayOfWeek: number): string { const days = [ "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", ]; return days[dayOfWeek]; } function formatDate(date: Date): string { return date.toLocaleDateString("de-DE", { day: "2-digit", month: "2-digit", year: "numeric", }); } export function ProfileLanding({ onNavigateToBooking }: ProfileLandingProps) { // Data fetching with live queries const { data: galleryPhotos = [] } = useQuery( queryClient.gallery.live.listPhotos.experimental_liveOptions() ); const sortedPhotos = ([...galleryPhotos] as any[]).sort((a, b) => (a.order || 0) - (b.order || 0)); const featuredPhoto = sortedPhotos[0]; const { data: reviews = [] } = useQuery( queryClient.reviews.live.listPublishedReviews.experimental_liveOptions() ); const { data: recurringRules = [] } = useQuery( queryClient.recurringAvailability.live.listRules.experimental_liveOptions() ); // Calculate next 7 days for opening hours const getNext7Days = () => { const days: Date[] = []; const today = new Date(); for (let i = 0; i < 7; i++) { const date = new Date(today); date.setDate(today.getDate() + i); days.push(date); } return days; }; const next7Days = getNext7Days(); return (
{/* Hero Section */}

Stargirlnails Kiel

Professionelles Nageldesign und -Pflege in Kiel

Lass dich von mir verwöhnen und genieße hochwertige Nail Art und Pflegebehandlungen.

{/* Featured Section: Erstes Foto (Reihenfolge 0) */} {featuredPhoto && (
{(featuredPhoto {(featuredPhoto as any).title && (

{(featuredPhoto as any).title}

)}
)} {/* Photo Gallery Section */}

Unsere Arbeiten

{galleryPhotos.length > 0 ? (
{(sortedPhotos as typeof galleryPhotos) .filter((p) => (featuredPhoto ? (p as any).id !== (featuredPhoto as any).id : true)) .slice(0, 9) .map((photo, index) => ( {photo.title ))}
) : (

Galerie wird bald aktualisiert

)}
{/* Opening Hours Section */}

Öffnungszeiten (Nächste 7 Tage)

{next7Days.map((date, index) => { const dayOfWeek = date.getDay(); const dayRules = recurringRules.filter( (rule) => rule.isActive && rule.dayOfWeek === dayOfWeek ); const sorted = [...dayRules].sort((a, b) => a.startTime.localeCompare(b.startTime) ); return (
{getDayName(dayOfWeek)}, {formatDate(date)}
{dayRules.length > 0 ? (
{sorted.map((rule) => (
{rule.startTime} - {rule.endTime} Uhr
))}
) : ( Geschlossen )}
); })}
{/* Customer Reviews Section */}

Kundenbewertungen

{reviews.length > 0 ? (
{reviews.slice(0, 10).map((review) => (

{review.customerName}

{new Date(review.createdAt).toLocaleDateString("de-DE")}
{review.comment && (

{review.comment}

)}
))}
) : (

Noch keine Bewertungen vorhanden

)}
); }