"use client"; import React from "react"; import { Spinner } from "@nextui-org/react"; import { Search, Star, Grid, ArrowRight } 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"; 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, onSearchChange, onSearch, onPageChange, searchSuggestions = [], navItems = [], }) => { const { platformConfig } = usePlatformConfig(); const { t } = useTranslation(); const totalPages = Math.ceil(total / pageSize); return (
{/* Classic Hero Section */}
{/* Classic Icon */}
{/* Classic Title */}

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

{/* Classic Subtitle */}

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

{/* Classic Search Bar */}
0 ? t(searchSuggestions[0]) : t("Search MCP servers") } value={searchQuery} onChange={(e) => onSearchChange(e.target.value)} onKeyDown={(e) => e.key === "Enter" && onSearch()} startContent={ } className="w-full" classNames={{ input: "text-lg text-gray-900 placeholder:text-gray-500", inputWrapper: "h-14 shadow-none px-4 bg-white border-0", }} variant="flat" radius="none" />
{/* filter section */} { isTagBarDisplay && (
) } {/* Server List Section */} {loading ? (
) : (
{/* Server Grid */}
{services.map((service) => ( {/* Header */}

{service.name}

{/* Description */}

{service.short_description || t("No description available")}

{/* Footer */}
{/* Tools count */}
{t("{{count}} Tools", { count: service.tools.length, })}
{/* Price */}
))}
{/* Classic Pagination */} {totalPages > 1 && (
)}
)}
); };