"use client"; import React from "react"; import { Spinner } from "@nextui-org/react"; import { Sparkles, Palette, SearchIcon } from "lucide-react"; import { Input, Button, Pagination, Card, CardBody, CardFooter, } from "@nextui-org/react"; import { useTranslation } from "react-i18next"; import Link from "next/link"; import { ServiceData } from "@/shared/types/marketplace"; import { Price } from "@/shared/components/marketplace/Price"; import { _DefaultPlatformConfig, usePlatformConfig, } from "@/shared/contexts/PlatformConfigContext"; import { Footer } from "./Footer"; import { Navigation } from "./Navigation"; import { NavigationItem } from "@/shared/components/Navigation"; import { Faq } from "@/components/marketplace/Faq"; interface HomeProps { // 状态 searchQuery: string; services: ServiceData[]; currentPage: number; total: number; pageSize: number; loading: boolean; error: string | null; // 事件处理函数 onSearchChange: (value: string) => void; onSearch: () => void; onPageChange: (page: number) => void; // 可选配置 searchSuggestions?: string[]; // navigation items navItems?: NavigationItem[]; } export const Home: React.FC = ({ searchQuery, services, currentPage, total, pageSize, loading, onSearchChange, onSearch, onPageChange, searchSuggestions = [], navItems = [], }) => { const { platformConfig } = usePlatformConfig(); const { t } = useTranslation(); const totalPages = Math.ceil(total / pageSize); return (
{/* Creative Background decorative elements */}
{/* main decorative circles */}
{/* small decorative circles */}
{/* small decorative points */}
{/* Creative Hero Section */}
{/* Creative Icon */}
{/* Creative Title */}

{t( platformConfig.headline || _DefaultPlatformConfig.headline || "" )}

{/* Creative Subtitle */}

{t( platformConfig.subheadline || _DefaultPlatformConfig.subheadline || "" )}

{/* Creative Search Bar */}
{/* Search container */}
0 ? t(searchSuggestions[0]) : t("✨ Discover amazing services...") } value={searchQuery} onChange={(e) => onSearchChange(e.target.value)} onKeyDown={(e) => e.key === "Enter" && onSearch()} startContent={
} className="w-full" classNames={{ input: "text-lg text-gray-800 placeholder:text-gray-500 font-medium", inputWrapper: "h-16 shadow-none px-4 bg-transparent border-0", }} variant="flat" />
{/* Creative Service List Section */} {loading ? (
) : (
{/* Creative Services Grid */}
{services.map((service, index) => { const gradientBorders = [ "border-pink-200/50", "border-orange-200/50", "border-yellow-200/50", "border-red-200/50", "border-purple-200/50", "border-blue-200/50", ]; const iconGradients = [ "bg-gradient-to-r from-pink-500 via-red-500 to-orange-500", "bg-gradient-to-r from-orange-400 to-yellow-400", "bg-gradient-to-r from-yellow-400 to-pink-400", "bg-gradient-to-r from-red-400 to-pink-500", "bg-gradient-to-r from-purple-400 to-pink-400", "bg-gradient-to-r from-blue-400 to-purple-400", ]; const iconRotations = [ "transform rotate-12", "transform -rotate-12", "transform rotate-6", "transform -rotate-6", "transform rotate-12", "transform -rotate-12", ]; return ( {/* creative icon */}
{/* service title */}
{service.name}
{/* service description */}
{service.short_description || t("No description available")}
{/* decorative elements */}
{/* Footer */}
{/* Tools count */}
{t("{{count}} Tools", { count: service.tools.length, })}
{/* Price */}
); })}
{/* Creative Pagination */} {totalPages > 1 && (
)}
)}
); };