"use client"; import React from "react"; import { CardFooter, Spinner } from "@nextui-org/react"; import { Search, ShoppingBag, Tag, TrendingUp } from "lucide-react"; import { Input, Button, Pagination, Card, CardBody, Chip, } 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"; import { TagFilter } from "@/shared/components/marketplace/TagFilter"; import { ThemeType } from "@/shared/types/system"; interface HomeProps { // 状态 searchQuery: string; services: ServiceData[]; isTagBarDisplay: boolean; availableTags: string[]; selectedTag: string; handleTagChange: (tag: string) => void; currentTheme: ThemeType; 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, isTagBarDisplay, availableTags, selectedTag, handleTagChange, currentTheme, currentPage, total, pageSize, loading, error, onSearchChange, onSearch, onPageChange, navItems = [], }) => { const { platformConfig } = usePlatformConfig(); const { t } = useTranslation(); const totalPages = Math.ceil(total / pageSize); // 如果有错误,显示错误信息 if (error) { return (
Error: {error}
); } return (
{/* Temu Style Hero Section */}
{/* Icon */}
{/* Title */}

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

{/* Subtitle */}

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

{/* Search Bar */}
onSearchChange(e.target.value)} onKeyDown={(e) => e.key === "Enter" && onSearch()} startContent={} className="flex-1" classNames={{ input: "text-lg", inputWrapper: "h-14 bg-white shadow-lg border-0", }} radius="lg" />
{/* filter section */} { isTagBarDisplay && (
) } {/* Products Section */}
{/* Section Header */}

{searchQuery ? t("Search Results") : t("Featured Products")}

{searchQuery && ( {total} {t("results")} )}
{/* Loading State */} {loading && (
)} {/* Products Grid */} {!loading && ( <>
{services.map((service) => ( {/* Product Info */}

{service.name}

{service.short_description || service.long_description || "No description available"}

{/* Price */}
))}
{/* Pagination */} {totalPages > 1 && (
)} )}
); };