feat/0.2:add theme setting and about page setting and support use email and password login
This commit is contained in:
1 parent
58292b0e6e
commit
ca2b732952
85 files changed
+5797
-816
No files matched your search
@@ -0,0 +1,43 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
|
||||
import { Theme } from "@/shared/types/system";
|
||||
import { About as ModernAbout } from "@/components/theme/modern/About";
|
||||
import { About as ClassicAbout } from "@/components/theme/classic/About";
|
||||
import { About as CreativeAbout } from "@/components/theme/creative/About";
|
||||
import { About as TemuAbout } from "@/components/theme/temu/About";
|
||||
import { Navigation } from "@/shared/components/Navigation";
|
||||
import { Footer } from "@/shared/components/Footer";
|
||||
import { NavigationItems } from "@/components/theme/Theme.const";
|
||||
import { AboutContent } from "@/components/about/AboutContent";
|
||||
|
||||
export const AboutThemeSelector: React.FC = () => {
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
const currentTheme = platformConfig.theme || Theme.DEFAULT;
|
||||
|
||||
// Render the About page based on the current theme
|
||||
switch (currentTheme) {
|
||||
case Theme.MODERN:
|
||||
return <ModernAbout navItems={NavigationItems} />;
|
||||
case Theme.CLASSIC:
|
||||
return <ClassicAbout navItems={NavigationItems} />;
|
||||
case Theme.CREATIVE:
|
||||
return <CreativeAbout navItems={NavigationItems} />;
|
||||
case Theme.TEMU:
|
||||
return <TemuAbout navItems={NavigationItems} />;
|
||||
case Theme.DEFAULT:
|
||||
default:
|
||||
return (
|
||||
<div className="min-h-screen bg-background flex flex-col justify-between">
|
||||
<Navigation items={NavigationItems} />
|
||||
<main className="flex-1 max-w-7xl mx-auto px-4 py-8">
|
||||
<AboutContent />
|
||||
</main>
|
||||
<div>
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,87 @@
|
||||
"use client";
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
|
||||
import { Theme } from "@/shared/types/system";
|
||||
import { Detail as ModernDetail } from "./modern/Detail";
|
||||
import { Detail as ClassicDetail } from "./classic/Detail";
|
||||
import { Detail as CreativeDetail } from "./creative/Detail";
|
||||
import { Detail as TemuDetail } from "./temu/Detail";
|
||||
import { ServiceData } from "@/shared/types/marketplace";
|
||||
import { ProductDetailClient } from "@/shared/components/marketplace/ProductDetail";
|
||||
import { Navigation } from "@/shared/components/Navigation";
|
||||
import { Footer } from "@/shared/components/Footer";
|
||||
import { NavigationItems } from "./Theme.const";
|
||||
|
||||
interface ProductDetailThemeSelectorProps {
|
||||
product: ServiceData;
|
||||
breadcrumbs?: {
|
||||
link: string;
|
||||
name: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
export const ProductDetailThemeSelector: React.FC<
|
||||
ProductDetailThemeSelectorProps
|
||||
> = ({ product, breadcrumbs }) => {
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
const currentTheme = platformConfig.theme || Theme.DEFAULT;
|
||||
const [url, setUrl] = useState<string>(process.env.NEXT_PUBLIC_MCP_URL || "");
|
||||
useEffect(() => {
|
||||
if (url || !product.slug_name) return;
|
||||
setUrl(`${window.location.origin}/mcp/${product.slug_name}`);
|
||||
}, [product.slug_name]);
|
||||
|
||||
//Render the About page based on the current theme
|
||||
switch (currentTheme) {
|
||||
case Theme.MODERN:
|
||||
return (
|
||||
<ModernDetail
|
||||
product={product}
|
||||
breadcrumbs={breadcrumbs}
|
||||
url={url}
|
||||
navItems={NavigationItems}
|
||||
/>
|
||||
);
|
||||
case Theme.CLASSIC:
|
||||
return (
|
||||
<ClassicDetail
|
||||
product={product}
|
||||
breadcrumbs={breadcrumbs}
|
||||
url={url}
|
||||
navItems={NavigationItems}
|
||||
/>
|
||||
);
|
||||
case Theme.CREATIVE:
|
||||
return (
|
||||
<CreativeDetail
|
||||
product={product}
|
||||
breadcrumbs={breadcrumbs}
|
||||
url={url}
|
||||
navItems={NavigationItems}
|
||||
/>
|
||||
);
|
||||
case Theme.TEMU:
|
||||
return (
|
||||
<TemuDetail
|
||||
product={product}
|
||||
breadcrumbs={breadcrumbs}
|
||||
url={url}
|
||||
navItems={NavigationItems}
|
||||
/>
|
||||
);
|
||||
case Theme.DEFAULT:
|
||||
default:
|
||||
return (
|
||||
<div className="min-h-screen bg-background flex flex-col justify-between">
|
||||
<Navigation items={NavigationItems} />
|
||||
<main className="flex-1">
|
||||
<ProductDetailClient product={product} />
|
||||
</main>
|
||||
<div>
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,12 @@
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
export const NavigationItems: NavigationItem[] = [
|
||||
{
|
||||
label: "Home",
|
||||
href: "/",
|
||||
},
|
||||
{
|
||||
label: "About",
|
||||
href: "/about",
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,200 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
|
||||
import { Theme } from "@/shared/types/system";
|
||||
import { Home as ModernHome } from "./modern/Home";
|
||||
import { Home as ClassicHome } from "./classic/Home";
|
||||
import { Home as CreativeHome } from "./creative/Home";
|
||||
import { Home as TemuHome } from "./temu/Home";
|
||||
import { ServiceData } from "@/shared/types/marketplace";
|
||||
import { fetchServices } from "@/services/marketplaceService";
|
||||
import { Navigation } from "@/shared/components/Navigation";
|
||||
import { MarketplaceMain } from "../marketplace/Main";
|
||||
import { Footer } from "@/shared/components/Footer";
|
||||
import { NavigationItems } from "./Theme.const";
|
||||
|
||||
interface ThemeSelectorProps {
|
||||
initialServices: ServiceData[];
|
||||
initialTotal: number;
|
||||
initialPage: number;
|
||||
initialSearch: string;
|
||||
pageSize: number;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export const ThemeSelector: React.FC<ThemeSelectorProps> = ({
|
||||
initialServices,
|
||||
initialTotal,
|
||||
initialPage,
|
||||
initialSearch,
|
||||
pageSize,
|
||||
error,
|
||||
}) => {
|
||||
const router = useRouter();
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
const currentTheme = platformConfig.theme || Theme.DEFAULT;
|
||||
|
||||
// state management for services, search query, pagination, and loading state
|
||||
const [searchQuery, setSearchQuery] = useState(initialSearch);
|
||||
const [services, setServices] = useState<ServiceData[]>(initialServices);
|
||||
const [currentPage, setCurrentPage] = useState(initialPage);
|
||||
const [total, setTotal] = useState(initialTotal);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
// search suggestion
|
||||
const searchSuggestions = ["Search services..."];
|
||||
|
||||
// loading service data
|
||||
const loadServices = async (page: number, search: string) => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const result = await fetchServices({
|
||||
page,
|
||||
page_size: pageSize,
|
||||
keyword: search,
|
||||
});
|
||||
|
||||
setServices(result.data.services);
|
||||
setTotal(result.page.total);
|
||||
setCurrentPage(page);
|
||||
} catch (error) {
|
||||
console.error("Failed to load services:", error);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
// when search and page change,scrolling to the page top
|
||||
useEffect(() => {
|
||||
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||
}, [currentPage, searchQuery]);
|
||||
|
||||
// update url param
|
||||
const updateURL = (page: number, search: string) => {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
if (page > 1) {
|
||||
params.set("page", page.toString());
|
||||
}
|
||||
|
||||
if (search.trim()) {
|
||||
params.set("search", search.trim());
|
||||
}
|
||||
|
||||
const queryString = params.toString();
|
||||
const newURL = queryString ? `?${queryString}` : window.location.pathname;
|
||||
|
||||
router.push(newURL);
|
||||
};
|
||||
|
||||
// page change handler
|
||||
const handlePageChange = (page: number) => {
|
||||
updateURL(page, searchQuery);
|
||||
loadServices(page, searchQuery);
|
||||
};
|
||||
|
||||
// search submit handler
|
||||
const handleSearch = () => {
|
||||
updateURL(1, searchQuery);
|
||||
loadServices(1, searchQuery);
|
||||
};
|
||||
|
||||
// search input change handler
|
||||
const handleSearchChange = (value: string) => {
|
||||
setSearchQuery(value);
|
||||
};
|
||||
|
||||
// render the theme page based on the current theme
|
||||
switch (currentTheme) {
|
||||
case Theme.MODERN:
|
||||
return (
|
||||
<ModernHome
|
||||
searchQuery={searchQuery}
|
||||
services={services}
|
||||
currentPage={currentPage}
|
||||
total={total}
|
||||
pageSize={pageSize}
|
||||
loading={loading}
|
||||
error={error}
|
||||
onSearchChange={handleSearchChange}
|
||||
onSearch={handleSearch}
|
||||
onPageChange={handlePageChange}
|
||||
searchSuggestions={searchSuggestions}
|
||||
navItems={NavigationItems}
|
||||
/>
|
||||
);
|
||||
case Theme.CLASSIC:
|
||||
return (
|
||||
<ClassicHome
|
||||
searchQuery={searchQuery}
|
||||
services={services}
|
||||
currentPage={currentPage}
|
||||
total={total}
|
||||
pageSize={pageSize}
|
||||
loading={loading}
|
||||
error={error}
|
||||
onSearchChange={handleSearchChange}
|
||||
onSearch={handleSearch}
|
||||
onPageChange={handlePageChange}
|
||||
searchSuggestions={searchSuggestions}
|
||||
navItems={NavigationItems}
|
||||
/>
|
||||
);
|
||||
case Theme.CREATIVE:
|
||||
return (
|
||||
<CreativeHome
|
||||
searchQuery={searchQuery}
|
||||
services={services}
|
||||
currentPage={currentPage}
|
||||
total={total}
|
||||
pageSize={pageSize}
|
||||
loading={loading}
|
||||
error={error}
|
||||
onSearchChange={handleSearchChange}
|
||||
onSearch={handleSearch}
|
||||
onPageChange={handlePageChange}
|
||||
searchSuggestions={searchSuggestions}
|
||||
navItems={NavigationItems}
|
||||
/>
|
||||
);
|
||||
case Theme.TEMU:
|
||||
return (
|
||||
<TemuHome
|
||||
searchQuery={searchQuery}
|
||||
services={services}
|
||||
currentPage={currentPage}
|
||||
total={total}
|
||||
pageSize={pageSize}
|
||||
loading={loading}
|
||||
error={error}
|
||||
onSearchChange={handleSearchChange}
|
||||
onSearch={handleSearch}
|
||||
onPageChange={handlePageChange}
|
||||
searchSuggestions={searchSuggestions}
|
||||
navItems={NavigationItems}
|
||||
/>
|
||||
);
|
||||
case Theme.DEFAULT:
|
||||
default:
|
||||
return (
|
||||
<div className="min-h-screen bg-background flex flex-col justify-between">
|
||||
<Navigation items={NavigationItems} />
|
||||
<main className="flex-1">
|
||||
<MarketplaceMain
|
||||
initialServices={services}
|
||||
initialTotal={total}
|
||||
initialPage={currentPage}
|
||||
initialSearch={searchQuery}
|
||||
pageSize={pageSize}
|
||||
error={error}
|
||||
/>
|
||||
</main>
|
||||
<div>
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { Card, CardBody } from "@nextui-org/react";
|
||||
import { AboutContent } from "@/components/about/AboutContent";
|
||||
import { Navigation } from "./Navigation";
|
||||
import { Footer } from "./Footer";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
interface AboutProps {
|
||||
navItems?: NavigationItem[];
|
||||
}
|
||||
|
||||
export const About: React.FC<AboutProps> = ({ navItems = [] }) => {
|
||||
return (
|
||||
<div className="min-h-screen flex flex-col justify-between">
|
||||
<div className="bg-gradient-to-b from-gray-800 to-gray-900 text-white">
|
||||
<Navigation items={navItems} />
|
||||
</div>
|
||||
|
||||
<main className="flex-1 bg-gray-100 mt-20">
|
||||
<div className="max-w-7xl mx-auto px-6 py-12">
|
||||
<Card className="border border-gray-200 shadow-md rounded-md">
|
||||
<CardBody className="p-8">
|
||||
<AboutContent />
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,92 @@
|
||||
import React from "react";
|
||||
|
||||
const ClassicDemo: React.FC = () => {
|
||||
return (
|
||||
<div className="w-full h-full bg-gray-50 relative overflow-hidden">
|
||||
{/* Header */}
|
||||
<div className="bg-slate-800 text-white px-4 py-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center space-x-2">
|
||||
<div className="w-6 h-6 bg-red-600 rounded-sm"></div>
|
||||
<span className="text-sm font-bold">PLATFORM</span>
|
||||
</div>
|
||||
<div className="flex space-x-2">
|
||||
<div className="w-1.5 h-1.5 bg-white rounded-sm"></div>
|
||||
<div className="w-1.5 h-1.5 bg-white rounded-sm"></div>
|
||||
<div className="w-1.5 h-1.5 bg-white rounded-sm"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Navigation */}
|
||||
<div className="bg-gray-100 border-b border-gray-300 px-4 py-1">
|
||||
<div className="flex space-x-4">
|
||||
<div className="text-xs text-gray-700 font-medium">Home</div>
|
||||
<div className="text-xs text-gray-500">Services</div>
|
||||
<div className="text-xs text-gray-500">About</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Hero Section */}
|
||||
<div className="px-4 py-6 bg-white border-b border-gray-200">
|
||||
<div className="text-center">
|
||||
<h1 className="text-lg font-bold text-slate-800 mb-1">
|
||||
Professional Platform
|
||||
</h1>
|
||||
<p className="text-xs text-gray-600 mb-3">
|
||||
Traditional & Reliable Business Solution
|
||||
</p>
|
||||
|
||||
{/* CTA Button */}
|
||||
<div className="inline-block bg-red-600 text-white text-xs px-4 py-2 rounded-sm shadow-md font-medium">
|
||||
Learn More
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Content Section */}
|
||||
<div className="px-4 py-4 bg-gray-50">
|
||||
<div className="grid grid-cols-1 gap-3">
|
||||
{/* Service Item */}
|
||||
<div className="bg-white border border-gray-200 rounded-sm p-3 shadow-sm">
|
||||
<div className="flex items-start space-x-3">
|
||||
<div className="w-4 h-4 bg-slate-600 rounded-sm mt-0.5"></div>
|
||||
<div className="flex-1">
|
||||
<div className="text-xs font-semibold text-slate-800 mb-1">
|
||||
Business Service
|
||||
</div>
|
||||
<div className="text-xs text-gray-600">
|
||||
Professional solutions for enterprise
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Service Item */}
|
||||
<div className="bg-white border border-gray-200 rounded-sm p-3 shadow-sm">
|
||||
<div className="flex items-start space-x-3">
|
||||
<div className="w-4 h-4 bg-red-600 rounded-sm mt-0.5"></div>
|
||||
<div className="flex-1">
|
||||
<div className="text-xs font-semibold text-slate-800 mb-1">
|
||||
Consulting
|
||||
</div>
|
||||
<div className="text-xs text-gray-600">
|
||||
Expert guidance and support
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Footer */}
|
||||
<div className="absolute bottom-0 left-0 right-0 bg-slate-700 px-4 py-2">
|
||||
<div className="text-center">
|
||||
<div className="text-xs text-gray-300">© 2025 Platform</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ClassicDemo;
|
||||
@@ -0,0 +1,259 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import { Tabs, Tab, Chip, Card, CardBody } from "@nextui-org/react";
|
||||
import { ServiceData } from "@/shared/types/marketplace";
|
||||
import { ProductOverview } from "@/shared/components/marketplace/ProductOverview";
|
||||
import { ProductNotFound } from "@/shared/components/marketplace/ProductNotFound";
|
||||
import { FileText, Wrench, Cog } from "lucide-react";
|
||||
import { Navigation } from "./Navigation";
|
||||
import { Footer } from "./Footer";
|
||||
import Link from "next/link";
|
||||
import { Price } from "@/shared/components/marketplace/Price";
|
||||
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
interface DetailProps {
|
||||
product: ServiceData;
|
||||
breadcrumbs?: {
|
||||
link: string;
|
||||
name: string;
|
||||
}[];
|
||||
url?: string;
|
||||
|
||||
// navigation items
|
||||
navItems?: NavigationItem[];
|
||||
}
|
||||
|
||||
export const Detail: React.FC<DetailProps> = ({
|
||||
product,
|
||||
breadcrumbs,
|
||||
url,
|
||||
navItems = [],
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const [activeTab, setActiveTab] = useState("overview");
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
|
||||
if (!product) {
|
||||
return <ProductNotFound />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 top-0 left-0 right-0 bottom-0 flex flex-col justify-between">
|
||||
<Navigation items={navItems} />
|
||||
<div>
|
||||
{/* Classic Product Header */}
|
||||
<div className="bg-white border-b border-gray-200 shadow-sm pt-28 pb-6">
|
||||
<div className="mx-auto p-6 max-w-7xl">
|
||||
<div className="bg-gray-50 rounded-sm p-6 border border-gray-200">
|
||||
<Card shadow="none" className="bg-gray-50">
|
||||
<CardBody>
|
||||
{/* Breadcrumb */}
|
||||
<nav className="text-sm text-default-500 flex items-center gap-1 mb-10">
|
||||
<Link href="/" className="hover:underline">
|
||||
{t("Home")}
|
||||
</Link>
|
||||
<span>/</span>
|
||||
<b className="text-default-700">{t(product.name)}</b>
|
||||
</nav>
|
||||
|
||||
{/* Header with title and price */}
|
||||
<div className="flex items-start justify-between mb-4">
|
||||
<div className="flex-1">
|
||||
<h1 className="text-3xl font-bold mb-2">
|
||||
{product.name}
|
||||
</h1>
|
||||
|
||||
{/* Tags */}
|
||||
{product.tags && product.tags.length > 0 && (
|
||||
<div className="flex flex-wrap gap-2 my-3">
|
||||
{product.tags.map((tag, index) => (
|
||||
<Chip
|
||||
key={index}
|
||||
size="sm"
|
||||
variant="flat"
|
||||
color="primary"
|
||||
radius="sm"
|
||||
className="text-xs h-5"
|
||||
>
|
||||
{tag}
|
||||
</Chip>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<p className="text-lg mb-4">
|
||||
{product.short_description ||
|
||||
t("No description available")}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Price section */}
|
||||
{product.charge_type && (
|
||||
<div className="flex gap-2 items-center">
|
||||
<b className="text-xs">{t("Price")}:</b>
|
||||
<Price
|
||||
price={product.price}
|
||||
charge_type={product.charge_type}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Main Content */}
|
||||
<div className="mx-auto p-6 max-w-7xl">
|
||||
<div className="flex gap-6 mt-6">
|
||||
{/* Left side - Main content */}
|
||||
<div className="flex-1">
|
||||
<Card className="bg-white border border-gray-200 shadow-sm rounded-sm">
|
||||
<CardBody className="p-0">
|
||||
<Tabs
|
||||
selectedKey={activeTab}
|
||||
onSelectionChange={(key) => setActiveTab(key as string)}
|
||||
variant="underlined"
|
||||
color="primary"
|
||||
className="px-6 pt-6"
|
||||
classNames={{
|
||||
tabList:
|
||||
"gap-6 w-full relative rounded-none p-0 border-b border-gray-200",
|
||||
cursor: "w-full bg-red-600",
|
||||
tab: "max-w-fit px-0 h-12",
|
||||
tabContent:
|
||||
"group-data-[selected=true]:text-red-600 font-semibold text-gray-700",
|
||||
}}
|
||||
>
|
||||
<Tab
|
||||
key="overview"
|
||||
title={
|
||||
<div className="flex items-center gap-2">
|
||||
<FileText className="w-4 h-4" />
|
||||
<span>{t("Overview")}</span>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="p-6 pt-4">
|
||||
<ProductOverview product={product} />
|
||||
</div>
|
||||
</Tab>
|
||||
<Tab
|
||||
key="tools"
|
||||
title={
|
||||
<div className="flex gap-2 items-center">
|
||||
<Wrench className="w-4 h-4" />
|
||||
<span>{t("Tools")}</span>
|
||||
<Chip
|
||||
size="sm"
|
||||
className="h-4 text-xs bg-red-600 text-white rounded-sm"
|
||||
>
|
||||
{product.tools.length}
|
||||
</Chip>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="p-6 pt-4">
|
||||
<div className="space-y-4 px-3">
|
||||
{product.tools.length > 0 ? (
|
||||
product.tools.map((tool, index) => (
|
||||
<Card
|
||||
radius="sm"
|
||||
key={`${product.service_id}-tool-${index}`}
|
||||
shadow="none"
|
||||
className="border-1"
|
||||
>
|
||||
<CardBody>
|
||||
<h4 className="font-semibold text-sm mb-2 text-red-600">
|
||||
{tool.name}
|
||||
</h4>
|
||||
<p className="text-sm mb-3">
|
||||
{tool.description ||
|
||||
t("No description available")}
|
||||
</p>
|
||||
</CardBody>
|
||||
</Card>
|
||||
))
|
||||
) : (
|
||||
<Card>
|
||||
<CardBody>
|
||||
<p className="text-center">
|
||||
{t("No tools available in this service.")}
|
||||
</p>
|
||||
</CardBody>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* Right side - Server Config */}
|
||||
<div className="min-w-[400px] w-[40%] max-w-100 flex-shrink-0">
|
||||
<Card className="bg-white border border-gray-200 shadow-sm rounded-sm">
|
||||
<CardBody>
|
||||
<div className="flex items-center gap-3 mb-4">
|
||||
<div className="w-8 h-8 bg-red-600 rounded-sm flex items-center justify-center">
|
||||
<Cog className="w-5 h-5 text-white" />
|
||||
</div>
|
||||
<h3 className="font-semibold text-lg text-gray-900">
|
||||
{t("Configuration")}
|
||||
</h3>
|
||||
</div>
|
||||
{/* Code Snippet */}
|
||||
<Card className="w-full max-w-2xl bg-black text-white p-2 sm:p-4 rounded-lg relative z-10">
|
||||
<div className="text-left font-mono">
|
||||
<Chip
|
||||
className="mb-2 text-white"
|
||||
size="sm"
|
||||
variant="flat"
|
||||
>
|
||||
{platformConfig?.name} MCP
|
||||
</Chip>
|
||||
<pre className="p-2 sm:p-4 rounded-md text-xs overflow-x-auto">
|
||||
<code className="text-gray-300 whitespace-pre-wrap">
|
||||
{`{
|
||||
"mcpServers": {
|
||||
"xpack-mcp-market": {
|
||||
"type": "sse",
|
||||
"autoApprove"":"all",
|
||||
"url": "${url}?apikey=`}
|
||||
<span className="text-success">{`{Your-${platformConfig?.name}-API-Key}`}</span>
|
||||
{`"
|
||||
}
|
||||
}
|
||||
}`}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
</Card>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* SEO-friendly: Simple text content for search engines */}
|
||||
<div className="hidden" aria-hidden="true">
|
||||
<h2>Tools ({product.tools.length})</h2>
|
||||
{product.tools.length > 0 &&
|
||||
product.tools.map((tool, index) => (
|
||||
<div key={`seo-${product.service_id}-tool-${index}`}>
|
||||
<h4>{tool.name}</h4>
|
||||
<p>{tool.description || ""}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
|
||||
import Link from "next/link";
|
||||
|
||||
interface FooterProps {}
|
||||
|
||||
export const Footer: React.FC<FooterProps> = ({}) => {
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
return (
|
||||
<>
|
||||
{/* Classic Footer */}
|
||||
<footer className="bg-slate-700 text-white py-1">
|
||||
<div className="mx-auto px-6 max-w-7xl">
|
||||
<div className="text-center">
|
||||
<span className="text-gray-300 text-xs mr-2">
|
||||
© 2025 {platformConfig?.name}
|
||||
</span>
|
||||
|
||||
<Link
|
||||
className="text-xs text-primary-500 hover:text-primary-600 transition-colors"
|
||||
href="https://xpack.ai"
|
||||
>
|
||||
Powered By XPack.AI
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,254 @@
|
||||
"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";
|
||||
|
||||
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<HomeProps> = ({
|
||||
searchQuery,
|
||||
services,
|
||||
currentPage,
|
||||
total,
|
||||
pageSize,
|
||||
loading,
|
||||
error,
|
||||
onSearchChange,
|
||||
onSearch,
|
||||
onPageChange,
|
||||
searchSuggestions = [],
|
||||
navItems = [],
|
||||
}) => {
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
const { t } = useTranslation();
|
||||
const totalPages = Math.ceil(total / pageSize);
|
||||
|
||||
// 如果有错误,显示错误信息
|
||||
if (error) {
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50">
|
||||
<div className="mx-auto h-[100px] flex items-center justify-center">
|
||||
<div className="text-red-600 bg-white px-6 py-4 rounded-lg shadow-md border border-red-200">
|
||||
Error: {error}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 top-0 left-0 right-0 bottom-0 flex flex-col justify-between">
|
||||
<Navigation items={navItems} />
|
||||
<div>
|
||||
{/* Classic Hero Section */}
|
||||
<div className="bg-white border-b border-gray-200 pt-20">
|
||||
<div className="mx-auto px-6 py-16 max-w-6xl">
|
||||
<div className="text-center mb-12">
|
||||
{/* Classic Icon */}
|
||||
<div className="flex justify-center mb-6">
|
||||
<div className="w-12 h-12 bg-red-600 rounded-sm flex items-center justify-center">
|
||||
<Grid className="w-6 h-6 text-white" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Classic Title */}
|
||||
<h1 className="text-4xl lg:text-5xl font-bold mb-6 text-slate-800">
|
||||
{t(
|
||||
platformConfig.headline ||
|
||||
_DefaultPlatformConfig.headline ||
|
||||
""
|
||||
)}
|
||||
</h1>
|
||||
|
||||
{/* Classic Subtitle */}
|
||||
<p className="text-xl text-gray-600 max-w-3xl mx-auto leading-relaxed">
|
||||
{t(
|
||||
platformConfig.subheadline ||
|
||||
_DefaultPlatformConfig.subheadline ||
|
||||
""
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Classic Search Bar */}
|
||||
<div className="max-w-2xl mx-auto">
|
||||
<div className="bg-white border border-gray-300 rounded-sm shadow-md overflow-hidden">
|
||||
<div className="flex">
|
||||
<div className="flex-1">
|
||||
<Input
|
||||
size="lg"
|
||||
placeholder={
|
||||
searchSuggestions.length > 0
|
||||
? t(searchSuggestions[0])
|
||||
: t("Search services...")
|
||||
}
|
||||
value={searchQuery}
|
||||
onChange={(e) => onSearchChange(e.target.value)}
|
||||
onKeyDown={(e) => e.key === "Enter" && onSearch()}
|
||||
startContent={
|
||||
<Search className="w-5 h-5 text-gray-400" />
|
||||
}
|
||||
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"
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
onPress={onSearch}
|
||||
className="bg-red-600 text-white hover:bg-red-700 transition-colors duration-200 h-14 px-8 rounded-sm font-medium"
|
||||
size="lg"
|
||||
>
|
||||
{t("Search")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Service List Section */}
|
||||
{loading ? (
|
||||
<div className="mx-auto h-[200px] flex items-center justify-center">
|
||||
<div className="bg-white p-8 rounded-lg shadow-md">
|
||||
<Spinner size="lg" color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="bg-gray-50 py-16">
|
||||
<div className="mx-auto px-6 max-w-7xl">
|
||||
{/* Services Grid */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 mb-12">
|
||||
{services.map((service) => (
|
||||
<Link
|
||||
key={service.service_id}
|
||||
href={`/marketplace/${service.service_id}`}
|
||||
>
|
||||
<Card className="group h-[200px] hover:shadow-lg transition-shadow duration-200 cursor-pointer border border-gray-200 bg-white rounded-sm shadow-sm">
|
||||
<CardBody className="p-4">
|
||||
{/* Header */}
|
||||
<div className="flex items-start justify-between mb-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-8 h-8 bg-slate-600 rounded-sm flex items-center justify-center">
|
||||
<Star className="w-4 h-4 text-white" />
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<h3 className="font-semibold text-gray-900 text-base mb-1 truncate group-hover:text-slate-700 transition-colors">
|
||||
{service.name}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ArrowRight className="w-4 h-4 text-gray-400 group-hover:text-slate-600 transition-colors" />
|
||||
</div>
|
||||
|
||||
{/* Description */}
|
||||
<p className="text-gray-600 text-sm line-clamp-3 leading-relaxed mb-4">
|
||||
{service.short_description ||
|
||||
t("No description available")}
|
||||
</p>
|
||||
</CardBody>
|
||||
|
||||
{/* Footer */}
|
||||
<CardFooter className="pt-0 px-4 pb-4">
|
||||
<div className="flex items-center justify-between w-full">
|
||||
{/* Tools count */}
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-2 h-2 bg-slate-600 rounded-full"></div>
|
||||
<span className="text-sm font-medium text-gray-700">
|
||||
{t("{{count}} Tools", {
|
||||
count: service.tools.length,
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Price */}
|
||||
<div className="flex flex-col items-end">
|
||||
<Price
|
||||
price={service.price}
|
||||
charge_type={service.charge_type}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Classic Pagination */}
|
||||
{totalPages > 1 && (
|
||||
<div className="flex justify-center mt-8">
|
||||
<Pagination
|
||||
total={totalPages}
|
||||
page={currentPage}
|
||||
onChange={onPageChange}
|
||||
showControls
|
||||
classNames={{
|
||||
wrapper:
|
||||
"gap-0 overflow-visible h-8 border border-gray-300 bg-white shadow-sm rounded-none overflow-hidden",
|
||||
item: "w-8 h-8 text-small rounded-none bg-transparent text-gray-700 hover:bg-gray-50 rounded-none",
|
||||
cursor:
|
||||
"bg-red-600 border-red-600 text-white font-medium rounded-none",
|
||||
next: "rounded-none",
|
||||
prev: "rounded-none",
|
||||
}}
|
||||
size="sm"
|
||||
variant="light"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { Button } from "@nextui-org/react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { DynamicLogo } from "@/shared/components/DynamicLogo";
|
||||
import { useAuth } from "@/shared/lib/useAuth";
|
||||
import Link from "next/link";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
interface NavigationProps {
|
||||
items?: NavigationItem[];
|
||||
}
|
||||
|
||||
export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
const { t } = useTranslation();
|
||||
const { handleLogin } = useAuth();
|
||||
|
||||
return (
|
||||
<div className="fixed top-0 left-0 right-0 z-50">
|
||||
{/* Classic Header */}
|
||||
<div className="bg-slate-800 text-white px-4 py-2 ">
|
||||
<div className="flex items-center justify-between max-w-7xl mx-auto">
|
||||
<div className="flex items-center space-x-2">
|
||||
<DynamicLogo alt="Platform Logo" className="h-[20px] text-white" />
|
||||
</div>
|
||||
<div className="flex space-x-2">
|
||||
<Button
|
||||
color="primary"
|
||||
className="bg-red-600 hover:bg-red-700 text-white text-sm px-4 py-1 rounded-sm font-medium"
|
||||
size="sm"
|
||||
onPress={handleLogin}
|
||||
>
|
||||
{t("Get Started")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Classic Navigation */}
|
||||
<div className="bg-gray-100 border-b border-gray-300 px-4 py-2">
|
||||
<div className="flex items-center justify-between max-w-7xl mx-auto">
|
||||
<div className="flex space-x-6">
|
||||
{items?.map((item) => (
|
||||
<Link href={item.href} className="text-sm text-gray-500">
|
||||
{t(item.label)}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,41 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { Card, CardBody } from "@nextui-org/react";
|
||||
import { AboutContent } from "@/components/about/AboutContent";
|
||||
import { Navigation } from "./Navigation";
|
||||
import { Footer } from "./Footer";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
interface AboutProps {
|
||||
navItems?: NavigationItem[];
|
||||
}
|
||||
|
||||
export const About: React.FC<AboutProps> = ({ navItems = [] }) => {
|
||||
return (
|
||||
<div className="min-h-screen flex flex-col justify-between bg-gradient-to-br from-pink-50 via-white to-blue-50">
|
||||
<Navigation items={navItems} />
|
||||
|
||||
<main className="flex-1 relative mt-20">
|
||||
{/* Creative background elements */}
|
||||
<div className="absolute inset-0 overflow-hidden pointer-events-none">
|
||||
<div className="absolute -top-24 -right-24 w-96 h-96 bg-pink-200 rounded-full opacity-20 blur-3xl"></div>
|
||||
<div className="absolute top-1/3 -left-24 w-80 h-80 bg-blue-200 rounded-full opacity-20 blur-3xl"></div>
|
||||
<div className="absolute bottom-1/4 right-1/4 w-64 h-64 bg-purple-200 rounded-full opacity-20 blur-3xl"></div>
|
||||
</div>
|
||||
|
||||
<div className="max-w-7xl mx-auto px-6 py-12 relative z-10">
|
||||
<Card className="border-none shadow-xl rounded-3xl overflow-hidden bg-white/80 backdrop-blur-sm">
|
||||
<CardBody className="p-8">
|
||||
<AboutContent />
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<div>
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,69 @@
|
||||
import React from 'react';
|
||||
|
||||
const CreativeDemo: React.FC = () => {
|
||||
return (
|
||||
<div className="w-full h-full bg-gradient-to-br from-pink-50 via-orange-50 to-yellow-50 relative overflow-hidden">
|
||||
{/* Header */}
|
||||
<div className="bg-white/80 backdrop-blur-sm border-b border-pink-200 px-4 py-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center space-x-2">
|
||||
<div className="w-6 h-6 bg-gradient-to-r from-pink-500 via-red-500 to-orange-500 rounded-2xl transform rotate-12"></div>
|
||||
<span className="text-sm font-bold bg-gradient-to-r from-pink-600 to-orange-600 bg-clip-text text-transparent">Creative</span>
|
||||
</div>
|
||||
<div className="flex space-x-1">
|
||||
<div className="w-2 h-2 bg-pink-400 rounded-full"></div>
|
||||
<div className="w-2 h-2 bg-orange-400 rounded-full"></div>
|
||||
<div className="w-2 h-2 bg-yellow-400 rounded-full"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Hero Section */}
|
||||
<div className="px-4 py-6 text-center relative">
|
||||
<div className="mb-3">
|
||||
<h1 className="text-lg font-bold bg-gradient-to-r from-pink-600 via-red-500 to-orange-600 bg-clip-text text-transparent mb-1">
|
||||
Creative Platform
|
||||
</h1>
|
||||
<p className="text-xs text-gray-700">Bold & Artistic Design Experience</p>
|
||||
</div>
|
||||
|
||||
{/* CTA Button */}
|
||||
<div className="mb-4">
|
||||
<div className="inline-block bg-gradient-to-r from-pink-500 via-red-500 to-orange-500 text-white text-xs px-4 py-2 rounded-2xl shadow-lg transform hover:scale-105 transition-transform">
|
||||
Explore Now
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Feature Cards */}
|
||||
<div className="px-4 pb-4">
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
<div className="bg-white/70 backdrop-blur-sm rounded-2xl p-3 shadow-lg border border-pink-200/50 transform rotate-1">
|
||||
<div className="w-4 h-4 bg-gradient-to-r from-pink-400 to-red-400 rounded-xl mb-2 transform rotate-12"></div>
|
||||
<div className="text-xs font-bold text-gray-800 mb-1">Creative Tools</div>
|
||||
<div className="text-xs text-gray-600">Artistic Design</div>
|
||||
</div>
|
||||
<div className="bg-white/70 backdrop-blur-sm rounded-2xl p-3 shadow-lg border border-orange-200/50 transform -rotate-1">
|
||||
<div className="w-4 h-4 bg-gradient-to-r from-orange-400 to-yellow-400 rounded-xl mb-2 transform -rotate-12"></div>
|
||||
<div className="text-xs font-bold text-gray-800 mb-1">Innovation</div>
|
||||
<div className="text-xs text-gray-600">Bold Ideas</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Floating Elements */}
|
||||
<div className="absolute top-4 right-2 w-8 h-8 bg-gradient-to-r from-pink-400/30 to-red-400/30 rounded-full transform rotate-45"></div>
|
||||
<div className="absolute top-12 right-8 w-4 h-4 bg-gradient-to-r from-orange-400/40 to-yellow-400/40 rounded-full"></div>
|
||||
<div className="absolute bottom-8 left-2 w-6 h-6 bg-gradient-to-r from-red-400/30 to-pink-400/30 rounded-full transform -rotate-12"></div>
|
||||
<div className="absolute bottom-4 left-8 w-3 h-3 bg-gradient-to-r from-yellow-400/40 to-orange-400/40 rounded-full"></div>
|
||||
|
||||
{/* Decorative Shapes */}
|
||||
<div className="absolute top-0 left-1/2 w-16 h-16 bg-gradient-to-br from-pink-300/20 to-orange-300/20 rounded-full transform -translate-x-1/2 -translate-y-8 rotate-45"></div>
|
||||
<div className="absolute bottom-0 right-0 w-12 h-12 bg-gradient-to-tl from-orange-300/20 to-yellow-300/20 transform translate-x-6 translate-y-6 rotate-12">
|
||||
<div className="w-full h-full rounded-2xl"></div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CreativeDemo;
|
||||
@@ -0,0 +1,191 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import { Tabs, Tab, Chip, Card, CardBody } from "@nextui-org/react";
|
||||
import { ServiceData } from "@/shared/types/marketplace";
|
||||
import { ProductHeader } from "@/shared/components/marketplace/ProductHeader";
|
||||
import { ProductOverview } from "@/shared/components/marketplace/ProductOverview";
|
||||
import { ProductTools } from "@/shared/components/marketplace/ProductTools";
|
||||
import { ProductNotFound } from "@/shared/components/marketplace/ProductNotFound";
|
||||
import { Sparkles, Zap, Settings2 } from "lucide-react";
|
||||
import { Navigation } from "./Navigation";
|
||||
import { Footer } from "./Footer";
|
||||
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
interface DetailProps {
|
||||
product: ServiceData;
|
||||
breadcrumbs?: {
|
||||
link: string;
|
||||
name: string;
|
||||
}[];
|
||||
url?: string;
|
||||
|
||||
// navigation items
|
||||
navItems?: NavigationItem[];
|
||||
}
|
||||
|
||||
export const Detail: React.FC<DetailProps> = ({
|
||||
product,
|
||||
breadcrumbs,
|
||||
url,
|
||||
navItems = [],
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const [activeTab, setActiveTab] = useState("overview");
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
|
||||
if (!product) {
|
||||
return <ProductNotFound />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gradient-to-br from-pink-50 via-orange-50 to-yellow-50 relative overflow-hidden">
|
||||
<Navigation items={navItems} />
|
||||
{/* Creative Background */}
|
||||
<div className="absolute inset-0">
|
||||
{/* Artistic decorative elements */}
|
||||
<div className="absolute top-20 left-20 w-32 h-32 bg-gradient-to-br from-pink-200/30 to-orange-200/30 rounded-full blur-2xl" />
|
||||
<div className="absolute top-40 right-32 w-24 h-24 bg-gradient-to-br from-orange-200/40 to-yellow-200/40 rounded-2xl rotate-45 blur-xl" />
|
||||
<div className="absolute bottom-32 left-1/4 w-40 h-40 bg-gradient-to-br from-yellow-200/25 to-pink-200/25 rounded-full blur-3xl" />
|
||||
<div className="absolute bottom-20 right-20 w-28 h-28 bg-gradient-to-br from-pink-200/35 to-red-200/35 rounded-2xl rotate-12 blur-xl" />
|
||||
|
||||
{/* Additional artistic elements */}
|
||||
<div className="absolute top-1/3 left-1/3 w-20 h-20 bg-gradient-to-br from-orange-300/20 to-yellow-300/20 rounded-full blur-xl" />
|
||||
<div className="absolute top-2/3 right-1/3 w-16 h-16 bg-gradient-to-br from-pink-300/25 to-orange-300/25 rounded-lg rotate-45 blur-lg" />
|
||||
</div>
|
||||
|
||||
<div className="relative z-10">
|
||||
{/* Creative Product Header */}
|
||||
<div className="pt-24">
|
||||
<div className="mx-auto p-6 max-w-7xl">
|
||||
<div className="bg-white/90 backdrop-blur-sm rounded-2xl p-6 shadow-lg border border-pink-200/50">
|
||||
<ProductHeader product={product} breadcrumbs={breadcrumbs} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Main Content */}
|
||||
<div className="mx-auto p-6 max-w-7xl">
|
||||
<div className="flex gap-6 mt-6">
|
||||
{/* Left side - Main content */}
|
||||
<div className="flex-1">
|
||||
<Card className="bg-white/95 backdrop-blur-sm border border-pink-200/50 shadow-lg overflow-hidden rounded-2xl">
|
||||
<div className="absolute inset-0 bg-gradient-to-r from-pink-500/5 via-transparent to-orange-500/5" />
|
||||
<CardBody className="p-0 relative">
|
||||
<Tabs
|
||||
selectedKey={activeTab}
|
||||
onSelectionChange={(key) => setActiveTab(key as string)}
|
||||
variant="underlined"
|
||||
color="secondary"
|
||||
className="px-6 pt-6"
|
||||
classNames={{
|
||||
tabList:
|
||||
"gap-6 w-full relative rounded-none p-0 border-b border-pink-200/50",
|
||||
cursor:
|
||||
"w-full bg-gradient-to-r from-pink-500 via-red-500 to-orange-500",
|
||||
tab: "max-w-fit px-0 h-12",
|
||||
tabContent:
|
||||
"group-data-[selected=true]:text-pink-600 font-semibold",
|
||||
}}
|
||||
>
|
||||
<Tab
|
||||
key="overview"
|
||||
title={
|
||||
<div className="flex items-center gap-2">
|
||||
<Sparkles className="w-4 h-4" />
|
||||
<span>{t("Overview")}</span>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="p-6 pt-4">
|
||||
<ProductOverview product={product} />
|
||||
</div>
|
||||
</Tab>
|
||||
<Tab
|
||||
key="tools"
|
||||
title={
|
||||
<div className="flex gap-2 items-center">
|
||||
<Zap className="w-4 h-4" />
|
||||
<span>{t("Tools")}</span>
|
||||
<Chip
|
||||
size="sm"
|
||||
className="h-4 text-xs bg-gradient-to-r from-pink-500 via-red-500 to-orange-500 text-white shadow-lg"
|
||||
>
|
||||
{product.tools.length}
|
||||
</Chip>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="p-6 pt-4">
|
||||
<ProductTools product={product} />
|
||||
</div>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* Right side - Server Config */}
|
||||
<div className="min-w-[400px] w-[40%] max-w-100 flex-shrink-0">
|
||||
<Card className="bg-white/95 backdrop-blur-sm border border-pink-200/50 shadow-lg overflow-hidden rounded-2xl">
|
||||
<div className="absolute inset-0 bg-gradient-to-br from-orange-500/5 via-transparent to-pink-500/5" />
|
||||
<CardBody className="relative">
|
||||
<div className="flex items-center gap-3 mb-4">
|
||||
<div className="p-2 bg-gradient-to-r from-pink-500 via-red-500 to-orange-500 rounded-lg">
|
||||
<Settings2 className="w-5 h-5 text-white" />
|
||||
</div>
|
||||
<h3 className="font-semibold text-lg bg-gradient-to-r from-pink-600 to-orange-600 bg-clip-text text-transparent">
|
||||
{t("Configuration")}
|
||||
</h3>
|
||||
</div>
|
||||
{/* Code Snippet */}
|
||||
<Card className="w-full max-w-2xl bg-black text-white p-2 sm:p-4 rounded-lg relative z-10">
|
||||
<div className="text-left font-mono">
|
||||
<Chip
|
||||
className="mb-2 text-white"
|
||||
size="sm"
|
||||
variant="flat"
|
||||
>
|
||||
{platformConfig?.name} MCP
|
||||
</Chip>
|
||||
<pre className="p-2 sm:p-4 rounded-md text-xs overflow-x-auto">
|
||||
<code className="text-gray-300 whitespace-pre-wrap">
|
||||
{`{
|
||||
"mcpServers": {
|
||||
"xpack-mcp-market": {
|
||||
"type": "sse",
|
||||
"autoApprove"":"all",
|
||||
"url": "${url}?apikey=`}
|
||||
<span className="text-success">{`{Your-${platformConfig?.name}-API-Key}`}</span>
|
||||
{`"
|
||||
}
|
||||
}
|
||||
}`}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
</Card>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* SEO-friendly: Simple text content for search engines */}
|
||||
<div className="hidden" aria-hidden="true">
|
||||
<h2>Tools ({product.tools.length})</h2>
|
||||
{product.tools.length > 0 &&
|
||||
product.tools.map((tool, index) => (
|
||||
<div key={`seo-${product.service_id}-tool-${index}`}>
|
||||
<h4>{tool.name}</h4>
|
||||
<p>{tool.description || ""}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
|
||||
|
||||
interface FooterProps {}
|
||||
|
||||
export const Footer: React.FC<FooterProps> = ({}) => {
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
return (
|
||||
<>
|
||||
{/* Creative Footer */}
|
||||
<footer className="py-4 px-4 sm:px-6 text-center sm:text-end mx-auto text-xs max-w-7xl mx-auto">
|
||||
<span className="mr-1">
|
||||
© 2025 {platformConfig?.name}. All rights reserved.
|
||||
</span>
|
||||
<a className="text-xs text-primary-500 hover:text-primary-600 transition-colors" href="https://xpack.ai">
|
||||
Powered By XPack.AI
|
||||
</a>
|
||||
</footer>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,323 @@
|
||||
"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";
|
||||
|
||||
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<HomeProps> = ({
|
||||
searchQuery,
|
||||
services,
|
||||
currentPage,
|
||||
total,
|
||||
pageSize,
|
||||
loading,
|
||||
onSearchChange,
|
||||
onSearch,
|
||||
onPageChange,
|
||||
searchSuggestions = [],
|
||||
navItems = [],
|
||||
}) => {
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
const { t } = useTranslation();
|
||||
const totalPages = Math.ceil(total / pageSize);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen relative overflow-hidden bg-gradient-to-br from-pink-50 via-orange-50 to-yellow-50">
|
||||
<Navigation items={navItems} />
|
||||
|
||||
{/* Creative Background decorative elements */}
|
||||
<div className="absolute inset-0 overflow-hidden pointer-events-none z-50">
|
||||
{/* 主要装饰圆圈 */}
|
||||
<div className="absolute top-1/4 left-1/4 w-64 h-64 bg-gradient-to-r from-pink-400/15 to-orange-400/15 rounded-full blur-3xl animate-pulse"></div>
|
||||
<div className="absolute bottom-1/4 right-1/4 w-96 h-96 bg-gradient-to-r from-orange-400/10 to-yellow-400/10 rounded-full blur-3xl"></div>
|
||||
|
||||
{/* 小装饰圆圈 */}
|
||||
<div className="absolute top-10 right-20 w-16 h-16 bg-gradient-to-br from-pink-400/20 to-red-500/20 rounded-full transform rotate-12"></div>
|
||||
<div className="absolute top-32 left-16 w-12 h-12 bg-gradient-to-br from-orange-400/25 to-yellow-400/25 rounded-full transform -rotate-12"></div>
|
||||
<div className="absolute bottom-20 left-1/3 w-20 h-20 bg-gradient-to-br from-yellow-400/15 to-pink-400/15 rounded-full transform rotate-6"></div>
|
||||
<div className="absolute bottom-32 right-16 w-14 h-14 bg-gradient-to-br from-purple-400/20 to-pink-400/20 rounded-full transform -rotate-6"></div>
|
||||
|
||||
{/* 微小装饰点 */}
|
||||
<div className="absolute top-1/3 right-1/3 w-4 h-4 bg-pink-400/30 rounded-full"></div>
|
||||
<div className="absolute top-2/3 left-1/5 w-3 h-3 bg-orange-400/40 rounded-full"></div>
|
||||
<div className="absolute bottom-1/3 right-1/5 w-5 h-5 bg-yellow-400/25 rounded-full"></div>
|
||||
</div>
|
||||
|
||||
{/* Creative Hero Section */}
|
||||
<div className="relative z-10 pt-32">
|
||||
<div className="mx-auto px-6 py-12 max-w-6xl">
|
||||
<div className="text-center mb-12">
|
||||
{/* Creative Icon */}
|
||||
<div className="flex justify-center mb-6">
|
||||
<div className="bg-gradient-to-r from-pink-500 via-red-500 to-orange-500 p-4 rounded-2xl shadow-lg transform rotate-12">
|
||||
<Palette className="w-8 h-8 text-white" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Creative Title */}
|
||||
<h1 className="text-4xl lg:text-6xl font-black mb-6 leading-tight">
|
||||
<span className="bg-clip-text text-transparent bg-gradient-to-r from-pink-600 via-red-500 to-orange-600">
|
||||
{t(
|
||||
platformConfig.headline ||
|
||||
_DefaultPlatformConfig.headline ||
|
||||
""
|
||||
)}
|
||||
</span>
|
||||
</h1>
|
||||
|
||||
{/* Creative Subtitle */}
|
||||
<p className="text-lg font-medium max-w-3xl mx-auto leading-relaxed text-gray-700">
|
||||
{t(
|
||||
platformConfig.subheadline ||
|
||||
_DefaultPlatformConfig.subheadline ||
|
||||
""
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Creative Search Bar */}
|
||||
<div className="max-w-3xl mx-auto relative">
|
||||
<div className="relative">
|
||||
{/* Search container */}
|
||||
<div className="relative bg-white/70 backdrop-blur-sm p-2 rounded-2xl border border-pink-200/50 shadow-lg">
|
||||
<div className="flex gap-2">
|
||||
<div className="flex-1">
|
||||
<Input
|
||||
size="lg"
|
||||
placeholder={
|
||||
searchSuggestions.length > 0
|
||||
? t(searchSuggestions[0])
|
||||
: t("✨ 发现神奇的服务...")
|
||||
}
|
||||
value={searchQuery}
|
||||
onChange={(e) => onSearchChange(e.target.value)}
|
||||
onKeyDown={(e) => e.key === "Enter" && onSearch()}
|
||||
startContent={
|
||||
<div className="flex items-center gap-2 ml-2">
|
||||
<Sparkles className="w-5 h-5 text-pink-500" />
|
||||
</div>
|
||||
}
|
||||
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"
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
onPress={onSearch}
|
||||
className="bg-gradient-to-r from-pink-500 via-red-500 to-orange-500 text-white shadow-lg hover:shadow-xl transition-all duration-300 hover:scale-105 h-16 w-16 rounded-2xl"
|
||||
size="lg"
|
||||
isIconOnly
|
||||
>
|
||||
<SearchIcon size={32} />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Creative Service List Section */}
|
||||
{loading ? (
|
||||
<div className="relative z-10 mx-auto h-[200px] flex items-center justify-center">
|
||||
<div className="bg-white/90 backdrop-blur-xl p-8 rounded-2xl shadow-lg border border-pink-200/50">
|
||||
<div className="flex items-center gap-4">
|
||||
<Spinner size="lg" color="secondary" />
|
||||
<span className="text-gray-700 text-lg font-bold">
|
||||
✨ 加载魔法中...
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="relative z-10">
|
||||
<div className="relative mx-auto px-6 py-16 max-w-8xl">
|
||||
{/* Creative Services Grid */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 max-w-6xl mx-auto">
|
||||
{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 (
|
||||
<Link
|
||||
key={service.service_id}
|
||||
href={`/marketplace/${service.service_id}`}
|
||||
className="block group"
|
||||
>
|
||||
<Card
|
||||
className={`
|
||||
bg-white/80 backdrop-blur-sm shadow-lg
|
||||
border ${gradientBorders[index % 6]}
|
||||
hover:scale-105 hover:shadow-xl
|
||||
transition-all duration-300 ease-out
|
||||
group-hover:bg-white/90 relative
|
||||
h-[200px]
|
||||
`}
|
||||
>
|
||||
<CardBody className="p-6">
|
||||
{/* 创意图标 */}
|
||||
<div
|
||||
className={` absolute -top-2 -left-2
|
||||
w-8 h-8 ${iconGradients[index % 6]}
|
||||
rounded-2xl mb-4 ${iconRotations[index % 6]}
|
||||
group-hover:scale-110 transition-transform duration-300
|
||||
`}
|
||||
></div>
|
||||
|
||||
{/* 服务标题 */}
|
||||
<div className="text-lg font-bold text-gray-800 mb-2 group-hover:text-gray-900 transition-colors">
|
||||
{service.name}
|
||||
</div>
|
||||
|
||||
{/* 服务描述 */}
|
||||
<div className="text-sm text-gray-600 group-hover:text-gray-700 transition-colors flex-1">
|
||||
{service.short_description || "探索精彩服务"}
|
||||
</div>
|
||||
|
||||
{/* 装饰性元素 */}
|
||||
<div className="absolute top-2 right-2 w-3 h-3 bg-gradient-to-r from-pink-400/30 to-orange-400/30 rounded-full opacity-0 group-hover:opacity-100 transition-opacity duration-300"></div>
|
||||
</CardBody>
|
||||
|
||||
{/* Footer */}
|
||||
<CardFooter className="pt-0 px-4 pb-4">
|
||||
<div className="flex items-center justify-between w-full">
|
||||
{/* Tools count */}
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-2 h-2 bg-blue-600 rounded-full"></div>
|
||||
<span className="text-sm font-medium text-gray-700">
|
||||
{t("{{count}} Tools", {
|
||||
count: service.tools.length,
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Price */}
|
||||
<div className="flex flex-col items-end">
|
||||
<Price
|
||||
price={service.price}
|
||||
charge_type={service.charge_type}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
{/* Creative Pagination */}
|
||||
{totalPages > 1 && (
|
||||
<div className="flex justify-center mt-12">
|
||||
<div className="bg-white/90 backdrop-blur-xl p-4 rounded-2xl shadow-lg border border-pink-200/50">
|
||||
<Pagination
|
||||
total={totalPages}
|
||||
page={currentPage}
|
||||
onChange={onPageChange}
|
||||
showControls
|
||||
color="secondary"
|
||||
variant="light"
|
||||
size="lg"
|
||||
classNames={{
|
||||
wrapper: "gap-2",
|
||||
item: "w-10 h-10 text-sm font-bold text-gray-700 hover:bg-pink-100/50 transition-all duration-300",
|
||||
cursor:
|
||||
"bg-gradient-to-r from-pink-500 via-red-500 to-orange-500 shadow-lg text-white font-bold",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<style jsx>{`
|
||||
@keyframes fade-in-up {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(50px) scale(0.9);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0) scale(1);
|
||||
}
|
||||
}
|
||||
|
||||
.animate-fade-in-up {
|
||||
animation: fade-in-up 0.8s ease-out;
|
||||
}
|
||||
`}</style>
|
||||
</div>
|
||||
)}
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,119 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { Button } from "@nextui-org/react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
Navbar,
|
||||
NavbarContent,
|
||||
NavbarMenuToggle,
|
||||
NavbarMenu,
|
||||
NavbarMenuItem,
|
||||
} from "@nextui-org/react";
|
||||
import { ArrowRightIcon } from "lucide-react";
|
||||
import { DynamicLogo } from "@/shared/components/DynamicLogo";
|
||||
import { useAuth } from "@/shared/lib/useAuth";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
interface NavigationProps {
|
||||
items?: NavigationItem[];
|
||||
}
|
||||
|
||||
export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
const { t } = useTranslation();
|
||||
const { handleLogin } = useAuth();
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Creative Navigation */}
|
||||
<Navbar
|
||||
onMenuOpenChange={setIsMenuOpen}
|
||||
maxWidth="full"
|
||||
className="bg-white/95 backdrop-blur-[15px] border-b border-pink-200/50 shadow-sm fixed top-0 left-0 right-0 z-50 "
|
||||
height="66px"
|
||||
isBordered={false}
|
||||
position="static"
|
||||
classNames={{
|
||||
wrapper: "max-w-7xl mx-auto",
|
||||
}}
|
||||
>
|
||||
<NavbarContent>
|
||||
<NavbarMenuToggle
|
||||
aria-label={isMenuOpen ? "Close menu" : "Open menu"}
|
||||
className="sm:hidden text-gray-700"
|
||||
/>
|
||||
<div className="flex justify-start bg-transparent w-max">
|
||||
<Link href="/">
|
||||
<DynamicLogo alt="Platform Logo" className="h-[20px]" />
|
||||
</Link>
|
||||
</div>
|
||||
<div className="hidden lg:flex gap-6 justify-center">
|
||||
{items?.map((item) => (
|
||||
<Link href={item.href} className="text-sm text-gray-500">
|
||||
{t(item.label)}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</NavbarContent>
|
||||
<NavbarContent justify="end" className="items-center gap-2 sm:gap-4">
|
||||
<div className="hidden sm:block">
|
||||
<Button
|
||||
color="primary"
|
||||
className="bg-gradient-to-r from-pink-500 via-red-500 to-orange-500 hover:from-pink-600 hover:via-red-600 hover:to-orange-600 text-white shadow-lg hover:shadow-xl transition-all duration-300 hover:scale-105 flex items-center justify-center gap-4 pr-1 h-[45px]"
|
||||
radius="full"
|
||||
onPress={handleLogin}
|
||||
>
|
||||
<b className="text-md">{t("Get Started")}</b>
|
||||
<div className="w-8 h-8 bg-white/20 flex items-center justify-center rounded-full">
|
||||
<ArrowRightIcon
|
||||
size={16}
|
||||
className="transition-transform duration-200 ease-in-out group-hover:translate-x-[3px] text-white"
|
||||
/>
|
||||
</div>
|
||||
</Button>
|
||||
</div>
|
||||
<div className="sm:hidden">
|
||||
<Button
|
||||
className="bg-gradient-to-r from-pink-500 via-red-500 to-orange-500 text-white"
|
||||
onPress={handleLogin}
|
||||
size="sm"
|
||||
>
|
||||
<b className="text-md">{t("Get Started")}</b>
|
||||
</Button>
|
||||
</div>
|
||||
</NavbarContent>
|
||||
<NavbarMenu className="pt-6 pb-6 bg-white/95 backdrop-blur-sm border-l border-pink-200/50">
|
||||
<NavbarMenuItem className="mt-4">
|
||||
<Button
|
||||
color="primary"
|
||||
className="w-full bg-gradient-to-r from-pink-500 via-red-500 to-orange-500 text-white flex items-center justify-between gap-4 pr-1 h-[45px]"
|
||||
radius="full"
|
||||
onPress={handleLogin}
|
||||
>
|
||||
<b className="text-md">{t("Get Started")}</b>
|
||||
<div className="w-8 h-8 bg-white/20 flex items-center justify-center rounded-full">
|
||||
<ArrowRightIcon
|
||||
size={16}
|
||||
className="transition-transform duration-200 ease-in-out group-hover:translate-x-[3px]"
|
||||
/>
|
||||
</div>
|
||||
</Button>
|
||||
</NavbarMenuItem>
|
||||
</NavbarMenu>
|
||||
{/* Floating Elements - Demo Style */}
|
||||
<div className="absolute top-4 -right-12 w-8 h-8 bg-gradient-to-r from-pink-400/30 to-red-400/30 rounded-full transform rotate-45 z-50"></div>
|
||||
<div className="absolute top-12 -right-8 w-4 h-4 bg-gradient-to-r from-orange-400/40 to-yellow-400/40 rounded-full z-50"></div>
|
||||
<div className="absolute bottom-8 left-2 w-6 h-6 bg-gradient-to-r from-red-400/30 to-pink-400/30 rounded-full transform -rotate-12 z-50"></div>
|
||||
<div className="absolute bottom-4 left-8 w-3 h-3 bg-gradient-to-r from-yellow-400/40 to-orange-400/40 rounded-full z-50"></div>
|
||||
{/* Decorative Shapes - Demo Style */}
|
||||
<div className="absolute top-0 left-1/2 w-16 h-16 bg-gradient-to-br from-pink-300/20 to-orange-300/20 rounded-full transform -translate-x-1/2 -translate-y-8 rotate-45 z-50"></div>
|
||||
<div className="absolute bottom-0 -right-10 w-12 h-12 bg-gradient-to-tl from-orange-300/20 to-yellow-300/20 transform translate-x-6 translate-y-6 rotate-12 z-50">
|
||||
<div className="w-full h-full rounded-2xl"></div>
|
||||
</div>
|
||||
</Navbar>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,118 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { Search } from "lucide-react";
|
||||
|
||||
const DefaultDemo: React.FC = () => {
|
||||
return (
|
||||
<div className="w-full h-full bg-white relative overflow-hidden">
|
||||
{/* Header */}
|
||||
<div className="absolute top-0 left-0 right-0 bg-white px-4 py-2 border-b border-gray-100">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-6 h-6 bg-blue-600 rounded flex items-center justify-center">
|
||||
<span className="text-white text-xs font-bold">M</span>
|
||||
</div>
|
||||
<span className="text-gray-900 font-semibold text-sm">
|
||||
MCP Store
|
||||
</span>
|
||||
</div>
|
||||
<div className="bg-gray-900 text-white px-4 py-1 rounded-full text-sm">
|
||||
Get Started
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Main Content */}
|
||||
<div className="absolute top-10 left-0 right-0 bottom-0 px-6 py-8">
|
||||
{/* Hero Section */}
|
||||
<div className="text-center mb-4">
|
||||
<h1 className="text-lg font-bold text-blue-600 mb-2">
|
||||
Default Platform
|
||||
</h1>
|
||||
<p className="text-gray-700 mb-2 text-xs">Clean & Simple Design</p>
|
||||
|
||||
{/* Search Bar */}
|
||||
<div className="max-w-md mx-auto mb-8">
|
||||
<div className="relative">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Search services..."
|
||||
className="w-full px-4 py-3 border border-gray-300 rounded-full text-sm focus:outline-none focus:border-blue-500"
|
||||
/>
|
||||
<Search className="absolute right-4 top-1/2 transform -translate-y-1/2 w-4 h-4 text-gray-400" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Services Grid */}
|
||||
<div className="grid grid-cols-4 gap-4 max-w-4xl mx-auto">
|
||||
{/* Service Card 1 */}
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-4 hover:shadow-md transition-shadow">
|
||||
<h3 className="font-medium text-gray-900 mb-1 text-sm">测试1</h3>
|
||||
<p className="text-xs text-gray-600 mb-2">xpack-opensource-1</p>
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="bg-blue-100 text-blue-800 px-2 py-1 rounded text-xs">
|
||||
Beta
|
||||
</span>
|
||||
<span className="text-xs text-gray-500">Free</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Service Card 2 */}
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-4 hover:shadow-md transition-shadow">
|
||||
<h3 className="font-medium text-gray-900 mb-1 text-sm">
|
||||
xpack-opensource
|
||||
</h3>
|
||||
<p className="text-xs text-gray-600 mb-2">xpack-opensource-1</p>
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="bg-blue-100 text-blue-800 px-2 py-1 rounded text-xs">
|
||||
Beta
|
||||
</span>
|
||||
<span className="text-xs text-gray-500">$0.02 /Per Call</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Service Card 3 */}
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-4 hover:shadow-md transition-shadow">
|
||||
<h3 className="font-medium text-gray-900 mb-1 text-sm">
|
||||
xpack-opensource
|
||||
</h3>
|
||||
<p className="text-xs text-gray-600 mb-2">xpack-opensource</p>
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="bg-blue-100 text-blue-800 px-2 py-1 rounded text-xs">
|
||||
Beta
|
||||
</span>
|
||||
<span className="text-xs text-gray-500">$0.02 /Per Call</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Service Card 4 */}
|
||||
<div className="bg-white border border-gray-200 rounded-lg p-4 hover:shadow-md transition-shadow">
|
||||
<h3 className="font-medium text-gray-900 mb-1 text-sm">
|
||||
Pet Store API
|
||||
</h3>
|
||||
<p className="text-xs text-gray-600 mb-2">
|
||||
A comprehensive API for managing pet store...
|
||||
</p>
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="bg-blue-100 text-blue-800 px-2 py-1 rounded text-xs">
|
||||
Beta
|
||||
</span>
|
||||
<span className="text-xs text-gray-500">Free</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Footer */}
|
||||
<div className="absolute bottom-0 left-0 right-0 bg-white px-6 py-2 border-t border-gray-100">
|
||||
<div className="flex items-center justify-end text-xs text-gray-500">
|
||||
<span>© 2025 Platform</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default DefaultDemo;
|
||||
@@ -0,0 +1,43 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { Card, CardBody } from "@nextui-org/react";
|
||||
import { AboutContent } from "@/components/about/AboutContent";
|
||||
import { Navigation } from "./Navigation";
|
||||
import { Footer } from "./Footer";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
interface AboutProps {
|
||||
navItems?: NavigationItem[];
|
||||
}
|
||||
|
||||
export const About: React.FC<AboutProps> = ({ navItems = [] }) => {
|
||||
return (
|
||||
<div className="min-h-screen bg-gradient-to-br from-slate-50 to-blue-50 flex flex-col justify-between">
|
||||
<Navigation items={navItems} />
|
||||
<div className="relative z-10 mt-20">
|
||||
{/* Clean Background Pattern */}
|
||||
<div className="absolute inset-0 opacity-30">
|
||||
<div
|
||||
className="w-full h-full"
|
||||
style={{
|
||||
backgroundImage: `url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.05'%3E%3Ccircle cx='20' cy='20' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`,
|
||||
}}
|
||||
></div>
|
||||
</div>
|
||||
|
||||
{/* Main Content */}
|
||||
<main className="flex-1 relative z-10">
|
||||
<div className="max-w-7xl mx-auto px-6 py-12">
|
||||
<Card className="bg-white/90 backdrop-blur-sm border border-white/20 shadow-lg rounded-2xl">
|
||||
<CardBody className="p-8">
|
||||
<AboutContent />
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,59 @@
|
||||
import React from 'react';
|
||||
|
||||
const ModernDemo: React.FC = () => {
|
||||
return (
|
||||
<div className="w-full h-full bg-gradient-to-br from-blue-50 to-indigo-100 relative overflow-hidden">
|
||||
{/* Header */}
|
||||
<div className="bg-white shadow-sm border-b border-gray-100 px-4 py-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center space-x-2">
|
||||
<div className="w-6 h-6 bg-gradient-to-r from-blue-500 to-indigo-600 rounded-lg"></div>
|
||||
<span className="text-sm font-semibold text-gray-800">Platform</span>
|
||||
</div>
|
||||
<div className="flex space-x-1">
|
||||
<div className="w-2 h-2 bg-blue-500 rounded-full"></div>
|
||||
<div className="w-2 h-2 bg-gray-300 rounded-full"></div>
|
||||
<div className="w-2 h-2 bg-gray-300 rounded-full"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Hero Section */}
|
||||
<div className="px-4 py-6 text-center">
|
||||
<div className="mb-3">
|
||||
<h1 className="text-lg font-bold text-gray-900 mb-1">Modern Platform</h1>
|
||||
<p className="text-xs text-gray-600">Clean & Minimalist Design</p>
|
||||
</div>
|
||||
|
||||
{/* CTA Button */}
|
||||
<div className="mb-4">
|
||||
<div className="inline-block bg-gradient-to-r from-blue-500 to-indigo-600 text-white text-xs px-4 py-2 rounded-full shadow-lg">
|
||||
Get Started
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Feature Cards */}
|
||||
<div className="px-4 pb-4">
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
<div className="bg-white rounded-xl p-3 shadow-sm border border-gray-100">
|
||||
<div className="w-4 h-4 bg-blue-100 rounded-lg mb-2"></div>
|
||||
<div className="text-xs font-medium text-gray-800 mb-1">Feature 1</div>
|
||||
<div className="text-xs text-gray-500">Modern UI</div>
|
||||
</div>
|
||||
<div className="bg-white rounded-xl p-3 shadow-sm border border-gray-100">
|
||||
<div className="w-4 h-4 bg-indigo-100 rounded-lg mb-2"></div>
|
||||
<div className="text-xs font-medium text-gray-800 mb-1">Feature 2</div>
|
||||
<div className="text-xs text-gray-500">Clean Design</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Decorative Elements */}
|
||||
<div className="absolute top-0 right-0 w-16 h-16 bg-gradient-to-br from-blue-400/20 to-indigo-500/20 rounded-full -translate-y-8 translate-x-8"></div>
|
||||
<div className="absolute bottom-0 left-0 w-12 h-12 bg-gradient-to-tr from-indigo-400/20 to-blue-500/20 rounded-full translate-y-6 -translate-x-6"></div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ModernDemo;
|
||||
@@ -0,0 +1,188 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import { Tabs, Tab, Chip, Card, CardBody } from "@nextui-org/react";
|
||||
import { ServiceData } from "@/shared/types/marketplace";
|
||||
import { ProductHeader } from "@/shared/components/marketplace/ProductHeader";
|
||||
import { ProductOverview } from "@/shared/components/marketplace/ProductOverview";
|
||||
import { ProductTools } from "@/shared/components/marketplace/ProductTools";
|
||||
import { ProductNotFound } from "@/shared/components/marketplace/ProductNotFound";
|
||||
import { Monitor, Code, Settings } from "lucide-react";
|
||||
import { Navigation } from "./Navigation";
|
||||
import { Footer } from "./Footer";
|
||||
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
interface DetailProps {
|
||||
product: ServiceData;
|
||||
breadcrumbs?: {
|
||||
link: string;
|
||||
name: string;
|
||||
}[];
|
||||
url?: string;
|
||||
|
||||
// navigation items
|
||||
navItems?: NavigationItem[];
|
||||
}
|
||||
|
||||
export const Detail: React.FC<DetailProps> = ({
|
||||
product,
|
||||
breadcrumbs,
|
||||
url,
|
||||
navItems = [],
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const [activeTab, setActiveTab] = useState("overview");
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
if (!product) {
|
||||
return <ProductNotFound />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gradient-to-br from-slate-50 to-blue-50 flex flex-col justify-between">
|
||||
<Navigation items={navItems} />
|
||||
<div>
|
||||
{/* Clean Background */}
|
||||
<div className="absolute inset-0 opacity-30">
|
||||
<div
|
||||
className="w-full h-full"
|
||||
style={{
|
||||
backgroundImage: `url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.05'%3E%3Ccircle cx='20' cy='20' r='1'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")`,
|
||||
}}
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div className="relative z-10">
|
||||
{/* Modern Product Header */}
|
||||
<div className="pt-20">
|
||||
<div className="mx-auto pt-6 px-6 max-w-7xl">
|
||||
<div className="bg-white/80 backdrop-blur-sm rounded-2xl p-6 shadow-lg border border-white/20">
|
||||
<ProductHeader product={product} breadcrumbs={breadcrumbs} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Main Content */}
|
||||
<div className="mx-auto pb-6 px-6 max-w-7xl">
|
||||
<div className="flex gap-6 mt-6">
|
||||
{/* Left side - Main content */}
|
||||
<div className="flex-1">
|
||||
<Card className="bg-white/90 backdrop-blur-sm border border-gray-200/50 shadow-lg rounded-2xl">
|
||||
<CardBody className="p-0">
|
||||
<Tabs
|
||||
selectedKey={activeTab}
|
||||
onSelectionChange={(key) => setActiveTab(key as string)}
|
||||
variant="underlined"
|
||||
color="primary"
|
||||
className="px-6 pt-6"
|
||||
classNames={{
|
||||
tabList:
|
||||
"gap-6 w-full relative rounded-none p-0 border-b border-gray-200",
|
||||
cursor: "w-full bg-blue-600",
|
||||
tab: "max-w-fit px-0 h-12",
|
||||
tabContent:
|
||||
"group-data-[selected=true]:text-blue-600 font-semibold text-gray-600",
|
||||
}}
|
||||
>
|
||||
<Tab
|
||||
key="overview"
|
||||
title={
|
||||
<div className="flex items-center gap-2">
|
||||
<Monitor className="w-4 h-4" />
|
||||
<span>{t("Overview")}</span>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="p-6 pt-4">
|
||||
<ProductOverview product={product} />
|
||||
</div>
|
||||
</Tab>
|
||||
<Tab
|
||||
key="tools"
|
||||
title={
|
||||
<div className="flex gap-2 items-center">
|
||||
<Code className="w-4 h-4" />
|
||||
<span>{t("Tools")}</span>
|
||||
<Chip
|
||||
size="sm"
|
||||
className="h-4 text-xs bg-blue-600 text-white"
|
||||
>
|
||||
{product.tools.length}
|
||||
</Chip>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="p-6 pt-4">
|
||||
<ProductTools product={product} />
|
||||
</div>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* Right side - Server Config */}
|
||||
<div className="min-w-[400px] w-[40%] max-w-100 flex-shrink-0">
|
||||
<Card className="bg-white/90 backdrop-blur-sm border border-gray-200/50 shadow-lg rounded-2xl">
|
||||
<CardBody>
|
||||
<div className="flex items-center gap-3 mb-4">
|
||||
<div className="p-2 bg-blue-600 rounded-lg">
|
||||
<Settings className="w-5 h-5 text-white" />
|
||||
</div>
|
||||
<h3 className="font-semibold text-lg text-gray-900">
|
||||
{t("Configuration")}
|
||||
</h3>
|
||||
</div>
|
||||
{/* Code Snippet */}
|
||||
<Card className="w-full max-w-2xl bg-black text-white p-2 sm:p-4 rounded-lg relative z-10">
|
||||
<div className="text-left font-mono">
|
||||
<Chip
|
||||
className="mb-2 text-white"
|
||||
size="sm"
|
||||
variant="flat"
|
||||
>
|
||||
{platformConfig?.name} MCP
|
||||
</Chip>
|
||||
<pre className="p-2 sm:p-4 rounded-md text-xs overflow-x-auto">
|
||||
<code className="text-gray-300 whitespace-pre-wrap">
|
||||
{`{
|
||||
"mcpServers": {
|
||||
"xpack-mcp-market": {
|
||||
"type": "sse",
|
||||
"autoApprove"":"all",
|
||||
"url": "${url}?apikey=`}
|
||||
<span className="text-success">{`{Your-${platformConfig?.name}-API-Key}`}</span>
|
||||
{`"
|
||||
}
|
||||
}
|
||||
}`}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
</Card>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* SEO-friendly: Simple text content for search engines */}
|
||||
<div className="hidden" aria-hidden="true">
|
||||
<h2>Tools ({product.tools.length})</h2>
|
||||
{product.tools.length > 0 &&
|
||||
product.tools.map((tool, index) => (
|
||||
<div key={`seo-${product.service_id}-tool-${index}`}>
|
||||
<h4>{tool.name}</h4>
|
||||
<p>{tool.description || ""}</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
"use client";
|
||||
|
||||
import { Sparkles } from "lucide-react";
|
||||
import React from "react";
|
||||
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
|
||||
|
||||
interface FooterProps {}
|
||||
|
||||
export const Footer: React.FC<FooterProps> = ({}) => {
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
return (
|
||||
<>
|
||||
{/* Modern Footer */}
|
||||
<footer className="relative z-10">
|
||||
<div className="bg-gradient-to-r from-slate-800 via-gray-800 to-slate-900">
|
||||
<div className="mx-auto px-6 py-2 max-w-7xl">
|
||||
<div className=" flex justify-between items-center gap-2">
|
||||
<span className="text-gray-300 text-sm">
|
||||
© 2025 {platformConfig?.name}. All rights reserved.
|
||||
</span>
|
||||
|
||||
<a
|
||||
href="https://xpack.ai"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-2 text-primary-400 text-xs"
|
||||
>
|
||||
<span>Powered By XPack.AI</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,239 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { Spinner } from "@nextui-org/react";
|
||||
import { Search, Sparkles, Zap } from "lucide-react";
|
||||
import {
|
||||
Input,
|
||||
Button,
|
||||
Pagination,
|
||||
Card,
|
||||
CardBody,
|
||||
CardFooter,
|
||||
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 { ArrowRight } from "lucide-react";
|
||||
import {
|
||||
_DefaultPlatformConfig,
|
||||
usePlatformConfig,
|
||||
} from "@/shared/contexts/PlatformConfigContext";
|
||||
|
||||
import { Navigation } from "./Navigation";
|
||||
import { Footer } from "./Footer";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
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<HomeProps> = ({
|
||||
searchQuery,
|
||||
services,
|
||||
currentPage,
|
||||
total,
|
||||
pageSize,
|
||||
loading,
|
||||
onSearchChange,
|
||||
onSearch,
|
||||
onPageChange,
|
||||
searchSuggestions = [],
|
||||
navItems = [],
|
||||
}) => {
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
const { t } = useTranslation();
|
||||
const totalPages = Math.ceil(total / pageSize);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gradient-to-br from-blue-50 to-indigo-100 relative overflow-hidden">
|
||||
{/* Decorative Elements */}
|
||||
<div className="absolute top-20 right-10 w-16 h-16 bg-gradient-to-br from-blue-400/20 to-indigo-500/20 rounded-full animate-pulse"></div>
|
||||
<div className="absolute top-40 left-10 w-12 h-12 bg-gradient-to-tr from-indigo-400/20 to-blue-500/20 rounded-full animate-bounce"></div>
|
||||
<div className="absolute bottom-40 right-20 w-8 h-8 bg-gradient-to-bl from-blue-300/30 to-indigo-400/30 rounded-full animate-pulse"></div>
|
||||
<div className="absolute bottom-20 left-1/4 w-6 h-6 bg-gradient-to-tl from-indigo-300/30 to-blue-400/30 rounded-full animate-bounce"></div>
|
||||
|
||||
{/* Modern Navigation */}
|
||||
<Navigation items={navItems} />
|
||||
{/* Modern Hero Section */}
|
||||
<div className="pt-32">
|
||||
<div className="mx-auto px-6 py-20 max-w-6xl">
|
||||
<div className="text-center mb-16">
|
||||
{/* Modern Icon */}
|
||||
<div className="flex justify-center mb-8">
|
||||
<div className="w-12 h-12 bg-gradient-to-r from-blue-500 to-indigo-600 rounded-lg flex items-center justify-center">
|
||||
<Sparkles className="w-6 h-6 text-white" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Modern Title */}
|
||||
<h1 className="text-4xl lg:text-6xl font-bold mb-6 text-gray-900 leading-tight">
|
||||
{t(
|
||||
platformConfig.headline || _DefaultPlatformConfig.headline || ""
|
||||
)}
|
||||
</h1>
|
||||
|
||||
{/* Modern Subtitle */}
|
||||
<p className="text-lg text-gray-600 max-w-2xl mx-auto leading-relaxed">
|
||||
{t(
|
||||
platformConfig.subheadline ||
|
||||
_DefaultPlatformConfig.subheadline ||
|
||||
""
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* Modern Search Bar */}
|
||||
<div className="max-w-2xl mx-auto">
|
||||
<div className="bg-white p-1 rounded-xl shadow-sm border border-gray-100">
|
||||
<div className="flex">
|
||||
<div className="flex-1">
|
||||
<Input
|
||||
size="lg"
|
||||
placeholder={
|
||||
searchSuggestions.length > 0
|
||||
? t(searchSuggestions[0])
|
||||
: t("Search services...")
|
||||
}
|
||||
value={searchQuery}
|
||||
onChange={(e) => onSearchChange(e.target.value)}
|
||||
onKeyDown={(e) => e.key === "Enter" && onSearch()}
|
||||
startContent={<Search className="w-5 h-5 text-gray-400" />}
|
||||
className="w-full"
|
||||
classNames={{
|
||||
input:
|
||||
"text-base text-gray-900 placeholder:text-gray-500",
|
||||
inputWrapper: "h-12 shadow-none px-4 bg-white border-0",
|
||||
}}
|
||||
variant="flat"
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
onPress={onSearch}
|
||||
className="bg-gradient-to-r from-blue-500 to-indigo-600 text-white h-12 px-6 rounded-lg shadow-sm"
|
||||
size="lg"
|
||||
>
|
||||
{t("Search")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Service List Section */}
|
||||
{loading ? (
|
||||
<div className="mx-auto h-[200px] flex items-center justify-center">
|
||||
<div className="bg-white p-8 rounded-lg shadow-md">
|
||||
<Spinner size="lg" color="primary" />
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="py-16">
|
||||
<div className="mx-auto px-6 max-w-7xl">
|
||||
{/* Services Grid */}
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 mb-12">
|
||||
{services.map((service) => (
|
||||
<Link
|
||||
key={service.service_id}
|
||||
href={`/marketplace/${service.service_id}`}
|
||||
>
|
||||
<Card className="group h-[200px] hover:shadow-lg transition-all duration-200 cursor-pointer bg-white border border-gray-100 rounded-xl shadow-sm">
|
||||
<CardBody className="p-4">
|
||||
{/* Header */}
|
||||
<div className="flex items-start justify-between mb-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-8 h-8 bg-blue-100 rounded-lg flex items-center justify-center">
|
||||
<Zap className="w-4 h-4 text-blue-600" />
|
||||
</div>
|
||||
<div className="flex-1 min-w-0">
|
||||
<h3 className="font-semibold text-gray-900 text-base mb-1 truncate group-hover:text-blue-600 transition-colors">
|
||||
{service.name}
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<ArrowRight className="w-4 h-4 text-gray-400 group-hover:text-blue-600 transition-colors" />
|
||||
</div>
|
||||
|
||||
{/* Description */}
|
||||
<p className="text-gray-600 text-sm line-clamp-3 leading-relaxed mb-4">
|
||||
{service.short_description ||
|
||||
t("No description available")}
|
||||
</p>
|
||||
</CardBody>
|
||||
|
||||
{/* Footer */}
|
||||
<CardFooter className="pt-0 px-4 pb-4">
|
||||
<div className="flex items-center justify-between w-full">
|
||||
{/* Tools count */}
|
||||
<div className="flex items-center gap-2">
|
||||
<div className="w-2 h-2 bg-blue-600 rounded-full"></div>
|
||||
<span className="text-sm font-medium text-gray-700">
|
||||
{t("{{count}} Tools", {
|
||||
count: service.tools.length,
|
||||
})}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Price */}
|
||||
<div className="flex flex-col items-end">
|
||||
<Price
|
||||
price={service.price}
|
||||
charge_type={service.charge_type}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Pagination */}
|
||||
{totalPages > 1 && (
|
||||
<div className="flex justify-center">
|
||||
<Pagination
|
||||
total={totalPages}
|
||||
page={currentPage}
|
||||
onChange={onPageChange}
|
||||
showControls
|
||||
color="primary"
|
||||
variant="light"
|
||||
size="lg"
|
||||
classNames={{
|
||||
wrapper: "gap-2",
|
||||
item: "w-10 h-10 text-sm font-medium",
|
||||
cursor:
|
||||
"bg-gradient-to-r from-blue-500 to-indigo-600 shadow-sm",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,105 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { Button } from "@nextui-org/react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
Navbar,
|
||||
NavbarContent,
|
||||
NavbarMenuToggle,
|
||||
NavbarMenu,
|
||||
NavbarMenuItem,
|
||||
} from "@nextui-org/react";
|
||||
import { ArrowRightIcon } from "lucide-react";
|
||||
import { DynamicLogo } from "@/shared/components/DynamicLogo";
|
||||
import { useAuth } from "@/shared/lib/useAuth";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
interface NavigationProps {
|
||||
items?: NavigationItem[];
|
||||
}
|
||||
|
||||
export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
const { t } = useTranslation();
|
||||
const { handleLogin } = useAuth();
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Modern Navigation */}
|
||||
<Navbar
|
||||
onMenuOpenChange={setIsMenuOpen}
|
||||
maxWidth="full"
|
||||
className="mt-0 rounded-full bg-white/95 backdrop-blur-[10px] border-1 border-white/20 fixed top-2 sm:top-5 max-w-7xl mx-auto"
|
||||
height="66px"
|
||||
isBordered={false}
|
||||
>
|
||||
<NavbarContent>
|
||||
<NavbarMenuToggle
|
||||
aria-label={isMenuOpen ? "Close menu" : "Open menu"}
|
||||
className="sm:hidden text-gray-700"
|
||||
/>
|
||||
<div className="flex justify-start bg-transparent w-max">
|
||||
<Link href="/">
|
||||
<DynamicLogo alt="Platform Logo" className="h-[20px]" />
|
||||
</Link>
|
||||
</div>
|
||||
<div className="hidden lg:flex gap-6 justify-center">
|
||||
{items?.map((item) => (
|
||||
<Link href={item.href} className="text-sm text-gray-500">
|
||||
{t(item.label)}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</NavbarContent>
|
||||
<NavbarContent justify="end" className="items-center gap-2 sm:gap-4">
|
||||
<div className="hidden sm:block">
|
||||
<Button
|
||||
color="primary"
|
||||
className="bg-gradient-to-r from-blue-500 to-purple-600 text-white hover:from-blue-600 hover:to-purple-700 flex items-center justify-center gap-4 pr-1 h-[45px] shadow-lg"
|
||||
radius="full"
|
||||
onPress={handleLogin}
|
||||
>
|
||||
<b className="text-md">{t("Get Started")}</b>
|
||||
<div className="w-8 h-8 bg-white/20 flex items-center justify-center rounded-full">
|
||||
<ArrowRightIcon
|
||||
size={16}
|
||||
className="transition-transform duration-200 ease-in-out group-hover:translate-x-[3px] text-white"
|
||||
/>
|
||||
</div>
|
||||
</Button>
|
||||
</div>
|
||||
<div className="sm:hidden">
|
||||
<Button
|
||||
className="bg-gradient-to-r from-blue-500 to-purple-600 text-white hover:from-blue-600 hover:to-purple-700"
|
||||
onPress={handleLogin}
|
||||
size="sm"
|
||||
>
|
||||
<b className="text-md">{t("Get Started")}</b>
|
||||
</Button>
|
||||
</div>
|
||||
</NavbarContent>
|
||||
<NavbarMenu className="pt-6 pb-6 bg-white/95 backdrop-blur-sm">
|
||||
<NavbarMenuItem className="mt-4">
|
||||
<Button
|
||||
color="primary"
|
||||
className="w-full bg-gradient-to-r from-blue-500 to-purple-600 text-white flex items-center justify-between gap-4 pr-1 h-[45px]"
|
||||
radius="full"
|
||||
onPress={handleLogin}
|
||||
>
|
||||
<b className="text-md">{t("Get Started")}</b>
|
||||
<div className="w-8 h-8 bg-white/20 flex items-center justify-center rounded-full">
|
||||
<ArrowRightIcon
|
||||
size={16}
|
||||
className="transition-transform duration-200 ease-in-out group-hover:translate-x-[3px]"
|
||||
/>
|
||||
</div>
|
||||
</Button>
|
||||
</NavbarMenuItem>
|
||||
</NavbarMenu>
|
||||
</Navbar>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { AboutContent } from "@/components/about/AboutContent";
|
||||
import { Navigation } from "./Navigation";
|
||||
import { Footer } from "./Footer";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
interface AboutProps {
|
||||
navItems?: NavigationItem[];
|
||||
}
|
||||
|
||||
export const About: React.FC<AboutProps> = ({ navItems = [] }) => {
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 absolute top-0 left-0 right-0 bottom-0 flex flex-col justify-between bg-white">
|
||||
<Navigation items={navItems} />
|
||||
|
||||
<main className="flex-1 pt-32">
|
||||
<div className="max-w-7xl mx-auto px-6 pb-12">
|
||||
<AboutContent />
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,103 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { ShoppingBag, Search, Tag, Star } from "lucide-react";
|
||||
|
||||
const TemuDemo: React.FC = () => {
|
||||
return (
|
||||
<div className="w-full h-full bg-gradient-to-r from-orange-400 via-orange-500 to-red-500 relative overflow-hidden">
|
||||
{/* Header */}
|
||||
<div className="absolute top-0 left-0 right-0 bg-white/10 backdrop-blur-sm px-3 py-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<ShoppingBag className="w-4 h-4 text-white" />
|
||||
<span className="text-white font-bold text-sm">MCP Store</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<div className="w-2 h-2 bg-white/60 rounded-full"></div>
|
||||
<div className="w-2 h-2 bg-white/60 rounded-full"></div>
|
||||
<div className="w-2 h-2 bg-white/60 rounded-full"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Hero Section */}
|
||||
<div className="absolute top-8 left-0 right-0 px-3 py-4">
|
||||
<div className="text-center">
|
||||
{/* Title */}
|
||||
<h1 className="text-lg font-bold text-white mb-1">
|
||||
Discover Amazing Services
|
||||
</h1>
|
||||
|
||||
{/* Subtitle */}
|
||||
<p className="text-xs text-white/90 mb-3">
|
||||
Find the perfect MCP service for your needs
|
||||
</p>
|
||||
|
||||
{/* Search Bar */}
|
||||
<div className="flex gap-1 mb-3">
|
||||
<div className="flex-1 bg-white rounded-md px-2 py-1 flex items-center gap-1">
|
||||
<Search className="w-3 h-3 text-gray-400" />
|
||||
<span className="text-xs text-gray-500">Search...</span>
|
||||
</div>
|
||||
<div className="bg-white px-3 py-1 rounded-md">
|
||||
<span className="text-xs text-orange-500 font-medium">Go</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Products Section */}
|
||||
<div className="absolute top-[150px] left-0 right-0 bg-white rounded-t-lg px-3 py-3">
|
||||
{/* Section Header */}
|
||||
<div className="flex items-center gap-1 mb-2">
|
||||
<Tag className="w-3 h-3 text-orange-500" />
|
||||
<span className="text-sm font-bold text-gray-900">Featured</span>
|
||||
</div>
|
||||
|
||||
{/* Products Grid */}
|
||||
<div className="grid grid-cols-2 gap-2">
|
||||
{/* Product 1 */}
|
||||
<div className="bg-gray-50 rounded-lg p-2 border border-gray-100">
|
||||
<div className="mb-1">
|
||||
<h3 className="text-xs font-semibold text-gray-900 line-clamp-1">
|
||||
AI Assistant
|
||||
</h3>
|
||||
<p className="text-xs text-gray-600 line-clamp-1">
|
||||
Smart AI helper
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-xs font-bold text-orange-600">$9.99</span>
|
||||
<div className="flex items-center gap-1">
|
||||
<Star className="w-2 h-2 text-yellow-400 fill-current" />
|
||||
<span className="text-xs text-gray-500">4.8</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Product 2 */}
|
||||
<div className="bg-gray-50 rounded-lg p-2 border border-gray-100">
|
||||
<div className="mb-1">
|
||||
<h3 className="text-xs font-semibold text-gray-900 line-clamp-1">
|
||||
Data Analyzer
|
||||
</h3>
|
||||
<p className="text-xs text-gray-600 line-clamp-1">
|
||||
Powerful analytics
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-xs font-bold text-orange-600">$14.99</span>
|
||||
<div className="flex items-center gap-1">
|
||||
<Star className="w-2 h-2 text-yellow-400 fill-current" />
|
||||
<span className="text-xs text-gray-500">4.9</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default TemuDemo;
|
||||
@@ -0,0 +1,195 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import { Tabs, Tab, Chip, Card, CardBody } from "@nextui-org/react";
|
||||
import { ServiceData } from "@/shared/types/marketplace";
|
||||
import { ProductHeader } from "@/shared/components/marketplace/ProductHeader";
|
||||
import { ProductOverview } from "@/shared/components/marketplace/ProductOverview";
|
||||
import { ProductTools } from "@/shared/components/marketplace/ProductTools";
|
||||
import { ProductNotFound } from "@/shared/components/marketplace/ProductNotFound";
|
||||
import { FileText, Wrench, Cog } from "lucide-react";
|
||||
import { Navigation } from "./Navigation";
|
||||
import { Footer } from "./Footer";
|
||||
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
interface DetailProps {
|
||||
product: ServiceData;
|
||||
breadcrumbs?: {
|
||||
link: string;
|
||||
name: string;
|
||||
}[];
|
||||
url?: string;
|
||||
|
||||
// navigation items
|
||||
navItems?: NavigationItem[];
|
||||
}
|
||||
|
||||
export const Detail: React.FC<DetailProps> = ({
|
||||
product,
|
||||
breadcrumbs,
|
||||
url,
|
||||
navItems = [],
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const [activeTab, setActiveTab] = useState("overview");
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
if (!product) {
|
||||
return <ProductNotFound />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50 flex flex-col justify-between">
|
||||
<Navigation items={navItems} />
|
||||
<div>
|
||||
{/* Temu Style Product Header */}
|
||||
<div className="bg-white border-b border-gray-200 shadow-sm pt-20">
|
||||
<div className="mx-auto p-6 max-w-7xl">
|
||||
{/* Breadcrumbs */}
|
||||
{breadcrumbs && breadcrumbs.length > 0 && (
|
||||
<nav className="mb-4">
|
||||
<ol className="flex items-center space-x-2 text-sm text-gray-600">
|
||||
{breadcrumbs.map((crumb, index) => (
|
||||
<li key={index} className="flex items-center">
|
||||
{index > 0 && (
|
||||
<span className="mx-2 text-gray-400">/</span>
|
||||
)}
|
||||
<a
|
||||
href={crumb.link}
|
||||
className="hover:text-orange-500 transition-colors"
|
||||
>
|
||||
{crumb.name}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</nav>
|
||||
)}
|
||||
|
||||
<ProductHeader product={product} breadcrumbs={breadcrumbs} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Main Content */}
|
||||
<div className="mx-auto p-6 max-w-7xl mt-6">
|
||||
<Card className="bg-white border border-gray-200 shadow-sm">
|
||||
<CardBody className="p-0">
|
||||
<Tabs
|
||||
selectedKey={activeTab}
|
||||
onSelectionChange={(key) => setActiveTab(key as string)}
|
||||
variant="underlined"
|
||||
color="warning"
|
||||
className="px-6 pt-6"
|
||||
classNames={{
|
||||
tabList:
|
||||
"gap-6 w-full relative rounded-none p-0 border-b border-gray-200",
|
||||
cursor: "w-full bg-orange-500",
|
||||
tab: "max-w-fit px-0 h-12",
|
||||
tabContent:
|
||||
"group-data-[selected=true]:text-orange-600 font-medium text-gray-700",
|
||||
}}
|
||||
>
|
||||
<Tab
|
||||
key="overview"
|
||||
title={
|
||||
<div className="flex items-center gap-2">
|
||||
<FileText className="w-4 h-4" />
|
||||
<span>{t("Overview")}</span>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="p-6">
|
||||
<ProductOverview product={product} />
|
||||
</div>
|
||||
</Tab>
|
||||
<Tab
|
||||
key="tools"
|
||||
title={
|
||||
<div className="flex items-center gap-2">
|
||||
<Wrench className="w-4 h-4" />
|
||||
<span>{t("Tools")}</span>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="p-2">
|
||||
<div className="space-y-4 px-3">
|
||||
{product.tools.length > 0 ? (
|
||||
product.tools.map((tool, index) => (
|
||||
<Card
|
||||
radius="sm"
|
||||
key={`${product.service_id}-tool-${index}`}
|
||||
shadow="none"
|
||||
className="border-1"
|
||||
>
|
||||
<CardBody>
|
||||
<h4 className="font-semibold text-sm mb-2 text-orange-600">
|
||||
{tool.name}
|
||||
</h4>
|
||||
<p className="text-sm mb-3">
|
||||
{tool.description ||
|
||||
t("No description available")}
|
||||
</p>
|
||||
</CardBody>
|
||||
</Card>
|
||||
))
|
||||
) : (
|
||||
<Card>
|
||||
<CardBody>
|
||||
<p className="text-center">
|
||||
{t("No tools available in this service.")}
|
||||
</p>
|
||||
</CardBody>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</Tab>
|
||||
<Tab
|
||||
key="config"
|
||||
title={
|
||||
<div className="flex items-center gap-2">
|
||||
<Cog className="w-4 h-4" />
|
||||
<span>{t("Configuration")}</span>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<div className="p-6">
|
||||
{/* Code Snippet */}
|
||||
<Card className="w-full bg-black text-white p-2 sm:p-4 rounded-lg relative z-10">
|
||||
<div className="text-left font-mono">
|
||||
<Chip
|
||||
className="mb-2 text-white"
|
||||
size="sm"
|
||||
variant="flat"
|
||||
>
|
||||
{platformConfig?.name} MCP
|
||||
</Chip>
|
||||
<pre className="p-2 sm:p-4 rounded-md text-xs overflow-x-auto">
|
||||
<code className="text-gray-300 whitespace-pre-wrap">
|
||||
{`{
|
||||
"mcpServers": {
|
||||
"xpack-mcp-market": {
|
||||
"type": "sse",
|
||||
"autoApprove"":"all",
|
||||
"url": "${url}?apikey=`}
|
||||
<span className="text-success">{`{Your-${platformConfig?.name}-API-Key}`}</span>
|
||||
{`"
|
||||
}
|
||||
}
|
||||
}`}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</CardBody>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,68 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
|
||||
import { ShoppingBag, Star, Heart } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
interface FooterProps {}
|
||||
|
||||
export const Footer: React.FC<FooterProps> = ({}) => {
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<>
|
||||
{/* Temu Style Footer */}
|
||||
<footer className="bg-gray-50 border-t border-gray-200">
|
||||
<div className="mx-auto px-6 pt-12 pb-6 max-w-7xl">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-8 mb-8">
|
||||
{/* Company Info */}
|
||||
<div>
|
||||
<h3 className="text-lg font-bold text-gray-900 mb-4">
|
||||
{platformConfig?.name}
|
||||
</h3>
|
||||
<p className="text-gray-600 text-sm mb-4">
|
||||
{t(
|
||||
"A marketplace for AI tools and services. Discover and integrate powerful AI solutions for your projects."
|
||||
)}
|
||||
</p>
|
||||
<div className="flex items-center gap-2 text-orange-500">
|
||||
<ShoppingBag className="w-5 h-5" />
|
||||
<span className="text-sm font-medium">
|
||||
{t("AI Tools Marketplace")}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Bottom Section */}
|
||||
<div className="border-t border-gray-200 pt-8">
|
||||
<div className="flex flex-col md:flex-row justify-between items-center gap-4">
|
||||
{/* Copyright */}
|
||||
<div className="flex items-center gap-2 text-gray-600 text-sm">
|
||||
<span>
|
||||
© 2025 {platformConfig?.name}. All rights reserved.
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Powered By */}
|
||||
<div className="flex items-center gap-4">
|
||||
<a
|
||||
href="https://xpack.ai"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center gap-2 text-gray-600 hover:text-orange-500 transition-colors text-sm font-medium"
|
||||
>
|
||||
<div className="flex items-center gap-2 bg-white px-3 py-1 rounded-full border border-gray-200 hover:border-orange-200 transition-all duration-200">
|
||||
<Star className="w-4 h-4 text-orange-500" />
|
||||
<span>Powered By XPack.AI</span>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,220 @@
|
||||
"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";
|
||||
|
||||
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<HomeProps> = ({
|
||||
searchQuery,
|
||||
services,
|
||||
currentPage,
|
||||
total,
|
||||
pageSize,
|
||||
loading,
|
||||
error,
|
||||
onSearchChange,
|
||||
onSearch,
|
||||
onPageChange,
|
||||
navItems = [],
|
||||
}) => {
|
||||
const { platformConfig } = usePlatformConfig();
|
||||
const { t } = useTranslation();
|
||||
const totalPages = Math.ceil(total / pageSize);
|
||||
|
||||
// 如果有错误,显示错误信息
|
||||
if (error) {
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50">
|
||||
<div className="mx-auto h-[100px] flex items-center justify-center">
|
||||
<div className="text-red-600 bg-white px-6 py-4 rounded-lg shadow-md border border-red-200">
|
||||
Error: {error}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="min-h-screen absolute top-0 left-0 right-0 bottom-0">
|
||||
<Navigation items={navItems} />
|
||||
|
||||
{/* Temu Style Hero Section */}
|
||||
<div className="bg-gradient-to-r from-orange-400 via-orange-500 to-red-500 pt-20">
|
||||
<div className="mx-auto px-6 py-16 max-w-7xl">
|
||||
<div className="text-center mb-12">
|
||||
{/* Icon */}
|
||||
<div className="flex justify-center mb-6">
|
||||
<div className="bg-white/20 p-4 rounded-2xl backdrop-blur-sm">
|
||||
<ShoppingBag className="w-10 h-10 text-white" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Title */}
|
||||
<h1 className="text-4xl lg:text-6xl font-bold mb-6 text-white">
|
||||
{t(
|
||||
platformConfig.headline || _DefaultPlatformConfig.headline || ""
|
||||
)}
|
||||
</h1>
|
||||
|
||||
{/* Subtitle */}
|
||||
<p className="text-xl text-white/90 mb-8 max-w-2xl mx-auto">
|
||||
{t(
|
||||
platformConfig.subheadline ||
|
||||
_DefaultPlatformConfig.subheadline ||
|
||||
""
|
||||
)}
|
||||
</p>
|
||||
|
||||
{/* Search Bar */}
|
||||
<div className="max-w-2xl mx-auto mb-8">
|
||||
<div className="flex gap-3">
|
||||
<Input
|
||||
placeholder={t("Search services...")}
|
||||
value={searchQuery}
|
||||
onChange={(e) => onSearchChange(e.target.value)}
|
||||
onKeyDown={(e) => e.key === "Enter" && onSearch()}
|
||||
startContent={<Search className="w-5 h-5 text-gray-400" />}
|
||||
className="flex-1"
|
||||
classNames={{
|
||||
input: "text-lg",
|
||||
inputWrapper: "h-14 bg-white shadow-lg border-0",
|
||||
}}
|
||||
radius="lg"
|
||||
/>
|
||||
<Button
|
||||
onPress={onSearch}
|
||||
className="bg-white text-orange-500 hover:bg-gray-50 font-semibold px-8 h-14 shadow-lg"
|
||||
radius="lg"
|
||||
>
|
||||
{t("Search")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Products Section */}
|
||||
<div className="mx-auto px-6 py-12 max-w-7xl">
|
||||
{/* Section Header */}
|
||||
<div className="flex items-center justify-between mb-8">
|
||||
<div className="flex items-center gap-3">
|
||||
<Tag className="w-6 h-6 text-orange-500" />
|
||||
<h2 className="text-2xl font-bold text-gray-900">
|
||||
{searchQuery ? t("Search Results") : t("Featured Products")}
|
||||
</h2>
|
||||
{searchQuery && (
|
||||
<Chip color="warning" variant="flat">
|
||||
{total} {t("results")}
|
||||
</Chip>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Loading State */}
|
||||
{loading && (
|
||||
<div className="flex justify-center items-center py-20">
|
||||
<Spinner size="lg" color="warning" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Products Grid */}
|
||||
{!loading && (
|
||||
<>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6 mb-12">
|
||||
{services.map((service) => (
|
||||
<Link
|
||||
key={service.service_id}
|
||||
href={`/marketplace/${service.service_id}`}
|
||||
>
|
||||
<Card className="group hover:shadow-xl transition-all duration-300 hover:-translate-y-1 border border-gray-200 hover:border-orange-200 h-[200px]">
|
||||
<CardBody className="p-0">
|
||||
{/* Product Info */}
|
||||
<div className="p-4">
|
||||
<h3 className="font-semibold text-gray-900 mb-2 line-clamp-2 group-hover:text-orange-600 transition-colors">
|
||||
{service.name}
|
||||
</h3>
|
||||
<p className="text-gray-600 text-sm mb-3 line-clamp-2">
|
||||
{service.short_description ||
|
||||
service.long_description ||
|
||||
"No description available"}
|
||||
</p>
|
||||
</div>
|
||||
</CardBody>
|
||||
<CardFooter>
|
||||
{/* Price */}
|
||||
<div className="flex items-center gap-2">
|
||||
<Price
|
||||
price={service.price}
|
||||
charge_type={service.charge_type}
|
||||
/>
|
||||
</div>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{/* Pagination */}
|
||||
{totalPages > 1 && (
|
||||
<div className="flex justify-center">
|
||||
<Pagination
|
||||
total={totalPages}
|
||||
page={currentPage}
|
||||
onChange={onPageChange}
|
||||
color="warning"
|
||||
size="lg"
|
||||
showControls
|
||||
className="gap-2"
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Footer />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
@@ -0,0 +1,113 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { Button } from "@nextui-org/react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
import {
|
||||
Navbar,
|
||||
NavbarContent,
|
||||
NavbarMenuToggle,
|
||||
NavbarMenu,
|
||||
NavbarMenuItem,
|
||||
} from "@nextui-org/react";
|
||||
import { ArrowRightIcon, ShoppingCart } from "lucide-react";
|
||||
import { DynamicLogo } from "@/shared/components/DynamicLogo";
|
||||
import { useAuth } from "@/shared/lib/useAuth";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
|
||||
interface NavigationProps {
|
||||
items?: NavigationItem[];
|
||||
}
|
||||
|
||||
export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
const { t } = useTranslation();
|
||||
const { handleLogin } = useAuth();
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Temu Style Navigation */}
|
||||
<Navbar
|
||||
onMenuOpenChange={setIsMenuOpen}
|
||||
maxWidth="full"
|
||||
className="mt-0 bg-white border-b border-gray-200 shadow-sm fixed top-0 z-50"
|
||||
height="70px"
|
||||
isBordered={false}
|
||||
classNames={{
|
||||
wrapper: "max-w-7xl mx-auto",
|
||||
}}
|
||||
>
|
||||
<NavbarContent>
|
||||
<NavbarMenuToggle
|
||||
aria-label={isMenuOpen ? "Close menu" : "Open menu"}
|
||||
className="sm:hidden text-gray-700"
|
||||
/>
|
||||
<div className="flex justify-start bg-transparent w-max">
|
||||
<Link href="/">
|
||||
<DynamicLogo alt="Platform Logo" className="h-[24px]" />
|
||||
</Link>
|
||||
</div>
|
||||
<div className="hidden lg:flex gap-8 justify-center ml-8">
|
||||
{items?.map((item) => (
|
||||
<Link
|
||||
href={item.href}
|
||||
className="text-gray-700 hover:text-orange-500 font-medium transition-colors"
|
||||
>
|
||||
{t(item.label)}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</NavbarContent>
|
||||
<NavbarContent justify="end" className="items-center gap-2 sm:gap-4">
|
||||
<div className="hidden sm:flex items-center gap-3">
|
||||
<Button
|
||||
className="bg-orange-500 hover:bg-orange-600 text-white font-semibold px-6 h-[40px] transition-all duration-200"
|
||||
radius="md"
|
||||
onPress={handleLogin}
|
||||
>
|
||||
{t("Sign In")}
|
||||
</Button>
|
||||
</div>
|
||||
<div className="sm:hidden">
|
||||
<Button
|
||||
className="bg-orange-500 hover:bg-orange-600 text-white font-semibold"
|
||||
onPress={handleLogin}
|
||||
size="sm"
|
||||
>
|
||||
{t("Sign In")}
|
||||
</Button>
|
||||
</div>
|
||||
</NavbarContent>
|
||||
<NavbarMenu className="pt-6 pb-6 bg-white border-r border-gray-200">
|
||||
<NavbarMenuItem className="mb-4">
|
||||
<Link
|
||||
href="/"
|
||||
className="text-gray-700 hover:text-orange-500 font-medium text-lg"
|
||||
>
|
||||
Home
|
||||
</Link>
|
||||
</NavbarMenuItem>
|
||||
<NavbarMenuItem className="mb-4">
|
||||
<Link
|
||||
href="/marketplace"
|
||||
className="text-gray-700 hover:text-orange-500 font-medium text-lg"
|
||||
>
|
||||
Marketplace
|
||||
</Link>
|
||||
</NavbarMenuItem>
|
||||
<NavbarMenuItem className="mt-6">
|
||||
<Button
|
||||
className="w-full bg-orange-500 hover:bg-orange-600 text-white font-semibold h-[45px]"
|
||||
radius="md"
|
||||
onPress={handleLogin}
|
||||
>
|
||||
{t("Sign In")}
|
||||
</Button>
|
||||
</NavbarMenuItem>
|
||||
</NavbarMenu>
|
||||
</Navbar>
|
||||
</>
|
||||
);
|
||||
};
|
||||
Reference in new issue
Block a user