feature/ui:1.0 feature,like mcp price method support use token and set more config about home page
This commit is contained in:
1 parent
2262a7f49a
commit
8946be619d
69 files changed
+4189
-1021
No files matched your search
@@ -2,11 +2,11 @@
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { useTranslation } from "@/shared/lib/useTranslation";
|
||||
import { Tabs, Tab, Chip, Card, CardBody } from "@nextui-org/react";
|
||||
import { Tabs, Tab, Chip, Card, CardBody, Button } 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 { FileText, Wrench, Cog, Copy } from "lucide-react";
|
||||
import { Navigation } from "./Navigation";
|
||||
import { Footer } from "./Footer";
|
||||
import Link from "next/link";
|
||||
@@ -24,14 +24,15 @@ interface DetailProps {
|
||||
mcpName?: string;
|
||||
// navigation items
|
||||
navItems?: NavigationItem[];
|
||||
onCopy: () => void;
|
||||
}
|
||||
|
||||
export const Detail: React.FC<DetailProps> = ({
|
||||
product,
|
||||
breadcrumbs,
|
||||
url,
|
||||
mcpName,
|
||||
navItems = [],
|
||||
onCopy,
|
||||
}) => {
|
||||
const { t } = useTranslation();
|
||||
const [activeTab, setActiveTab] = useState("overview");
|
||||
@@ -98,6 +99,8 @@ export const Detail: React.FC<DetailProps> = ({
|
||||
<Price
|
||||
price={product.price}
|
||||
charge_type={product.charge_type}
|
||||
input_token_price={product.input_token_price}
|
||||
output_token_price={product.output_token_price}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
@@ -210,18 +213,26 @@ export const Detail: React.FC<DetailProps> = ({
|
||||
{/* 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>
|
||||
<div className="flex items-center gap-2 mb-2 justify-between">
|
||||
<Chip className="text-white" size="sm" variant="flat">
|
||||
{platformConfig?.name} MCP
|
||||
</Chip>
|
||||
<Button
|
||||
isIconOnly
|
||||
size="sm"
|
||||
variant="flat"
|
||||
className="min-w-6 w-6 h-6 p-0 text-white"
|
||||
onPress={onCopy}
|
||||
aria-label={t("Copy code")}
|
||||
>
|
||||
<Copy size={14} />
|
||||
</Button>
|
||||
</div>
|
||||
<pre className="p-2 sm:p-4 rounded-md text-xs overflow-x-auto">
|
||||
<code className="text-gray-300 whitespace-pre-wrap">
|
||||
{`{
|
||||
"mcpServers": {
|
||||
"${mcpName || "xpack-mcp-market"}": {
|
||||
"${mcpName}": {
|
||||
"type": "sse",
|
||||
"autoApprove":"all",
|
||||
"url": "${url}?apikey=`}
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
import { Footer } from "./Footer";
|
||||
import { Navigation } from "./Navigation";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
import { Faq } from "@/components/marketplace/Faq";
|
||||
|
||||
interface HomeProps {
|
||||
// 状态
|
||||
@@ -163,13 +164,14 @@ export const Home: React.FC<HomeProps> = ({
|
||||
<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">
|
||||
<div className="flex flex-wrap justify-center gap-4 mb-12">
|
||||
{services.map((service) => (
|
||||
<Link
|
||||
key={service.service_id}
|
||||
href={`/marketplace/${service.service_id}`}
|
||||
className="w-full md:w-[calc(50%-16px)] lg:w-[calc(33%-16px)] xl:w-[calc(25%-16px)]"
|
||||
>
|
||||
<Card className="group h-[200px] hover:shadow-lg transition-shadow duration-200 cursor-pointer border border-gray-200 bg-white rounded-sm shadow-sm">
|
||||
<Card className="group h-[200px] w-full 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">
|
||||
@@ -211,6 +213,8 @@ export const Home: React.FC<HomeProps> = ({
|
||||
<Price
|
||||
price={service.price}
|
||||
charge_type={service.charge_type}
|
||||
input_token_price={service.input_token_price}
|
||||
output_token_price={service.output_token_price}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -245,6 +249,7 @@ export const Home: React.FC<HomeProps> = ({
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
<Faq />
|
||||
</div>
|
||||
<div>
|
||||
<Footer />
|
||||
|
||||
@@ -43,7 +43,12 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
<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">
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
target={item.target}
|
||||
className="text-sm text-gray-500"
|
||||
>
|
||||
{t(item.label)}
|
||||
</Link>
|
||||
))}
|
||||
|
||||
Reference in new issue
Block a user