feature/ui:1.0 feature,like mcp price method support use token and set more config about home page

This commit is contained in:
lethe committed 2025-07-30 15:59:10 +08:00
1 parent 2262a7f49a
commit 8946be619d
69 files changed
+4189 -1021

No files matched your search

+20 -11
View File
@@ -2,13 +2,12 @@
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 { 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 { FileText, Wrench, Cog, Copy } from "lucide-react";
import { Navigation } from "./Navigation";
import { Footer } from "./Footer";
import { usePlatformConfig } from "@/shared/contexts/PlatformConfigContext";
@@ -24,6 +23,7 @@ interface DetailProps {
mcpName?: string;
// navigation items
navItems?: NavigationItem[];
onCopy: () => void;
}
export const Detail: React.FC<DetailProps> = ({
@@ -32,6 +32,7 @@ export const Detail: React.FC<DetailProps> = ({
url,
mcpName,
navItems = [],
onCopy,
}) => {
const { t } = useTranslation();
const [activeTab, setActiveTab] = useState("overview");
@@ -159,18 +160,26 @@ export const Detail: React.FC<DetailProps> = ({
{/* 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>
<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=`}
@@ -22,6 +22,7 @@ import {
import { Footer } from "./Footer";
import { Navigation } from "./Navigation";
import { NavigationItem } from "@/shared/components/Navigation";
import { Faq } from "@/components/marketplace/Faq";
interface HomeProps {
// 状态
@@ -188,6 +189,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>
</CardFooter>
@@ -212,6 +215,7 @@ export const Home: React.FC<HomeProps> = ({
)}
</>
)}
<Faq />
</div>
<Footer />
@@ -52,7 +52,9 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
<div className="hidden lg:flex gap-8 justify-center ml-8">
{items?.map((item) => (
<Link
key={item.href}
href={item.href}
target={item.target}
className="text-gray-700 hover:text-orange-500 font-medium transition-colors"
>
{t(item.label)}