feat: add MCP service tag filtering, transaction record viewing, and various optimizations
This commit is contained in:
1 parent
276817e624
commit
d6dea1f1e8
29 files changed
+1367
-87
No files matched your search
@@ -9,7 +9,7 @@ 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 { fetchServices, fetchTagsList } from "@/services/marketplaceService";
|
||||
import { Navigation } from "@/shared/components/Navigation";
|
||||
import { MarketplaceMain } from "../marketplace/Main";
|
||||
import { Footer } from "@/shared/components/Footer";
|
||||
@@ -53,18 +53,36 @@ export const ThemeSelector: React.FC<ThemeSelectorProps> = ({
|
||||
const [currentPage, setCurrentPage] = useState(initialPage);
|
||||
const [total, setTotal] = useState(initialTotal);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const isTagBarDisplay = platformConfig.tag_bar_display || false;
|
||||
// 可用的标签列表(这里可以从API获取或配置)
|
||||
const [availableTags, setAvailableTags] = useState<string[]>([]);
|
||||
const [selectedTag, setSelectedTag] = useState("ALL");
|
||||
// search suggestion
|
||||
const searchSuggestions = ["Search MCP servers"];
|
||||
|
||||
useEffect(() => {
|
||||
const loadTagsList = async () => {
|
||||
const tags = await fetchTagsList();
|
||||
setAvailableTags(tags);
|
||||
};
|
||||
loadTagsList();
|
||||
}, []);
|
||||
|
||||
// handle tag change
|
||||
const handleTagChange = (tag: string) => {
|
||||
setSelectedTag(tag);
|
||||
setCurrentPage(1);
|
||||
loadServices(1, searchQuery, tag);
|
||||
};
|
||||
// loading service data
|
||||
const loadServices = async (page: number, search: string) => {
|
||||
const loadServices = async (page: number, search: string, tag: string = "ALL") => {
|
||||
try {
|
||||
setLoading(true);
|
||||
const result = await fetchServices({
|
||||
page,
|
||||
page_size: pageSize,
|
||||
keyword: search,
|
||||
tag: tag !== "ALL" ? tag : undefined,
|
||||
});
|
||||
|
||||
setServices(result.data.services);
|
||||
@@ -103,13 +121,13 @@ export const ThemeSelector: React.FC<ThemeSelectorProps> = ({
|
||||
// page change handler
|
||||
const handlePageChange = (page: number) => {
|
||||
updateURL(page, searchQuery);
|
||||
loadServices(page, searchQuery);
|
||||
loadServices(page, searchQuery, selectedTag);
|
||||
};
|
||||
|
||||
// search submit handler
|
||||
const handleSearch = () => {
|
||||
updateURL(1, searchQuery);
|
||||
loadServices(1, searchQuery);
|
||||
loadServices(1, searchQuery, selectedTag);
|
||||
};
|
||||
|
||||
// search input change handler
|
||||
@@ -122,6 +140,11 @@ export const ThemeSelector: React.FC<ThemeSelectorProps> = ({
|
||||
case Theme.MODERN:
|
||||
return (
|
||||
<ModernHome
|
||||
currentTheme={currentTheme}
|
||||
selectedTag={selectedTag}
|
||||
handleTagChange={handleTagChange}
|
||||
isTagBarDisplay={isTagBarDisplay}
|
||||
availableTags={availableTags}
|
||||
searchQuery={searchQuery}
|
||||
services={services}
|
||||
currentPage={currentPage}
|
||||
@@ -139,6 +162,11 @@ export const ThemeSelector: React.FC<ThemeSelectorProps> = ({
|
||||
case Theme.CLASSIC:
|
||||
return (
|
||||
<ClassicHome
|
||||
currentTheme={currentTheme}
|
||||
selectedTag={selectedTag}
|
||||
handleTagChange={handleTagChange}
|
||||
isTagBarDisplay={isTagBarDisplay}
|
||||
availableTags={availableTags}
|
||||
searchQuery={searchQuery}
|
||||
services={services}
|
||||
currentPage={currentPage}
|
||||
@@ -156,6 +184,11 @@ export const ThemeSelector: React.FC<ThemeSelectorProps> = ({
|
||||
case Theme.CREATIVE:
|
||||
return (
|
||||
<CreativeHome
|
||||
currentTheme={currentTheme}
|
||||
selectedTag={selectedTag}
|
||||
handleTagChange={handleTagChange}
|
||||
isTagBarDisplay={isTagBarDisplay}
|
||||
availableTags={availableTags}
|
||||
searchQuery={searchQuery}
|
||||
services={services}
|
||||
currentPage={currentPage}
|
||||
@@ -173,6 +206,11 @@ export const ThemeSelector: React.FC<ThemeSelectorProps> = ({
|
||||
case Theme.TEMU:
|
||||
return (
|
||||
<TemuHome
|
||||
currentTheme={currentTheme}
|
||||
selectedTag={selectedTag}
|
||||
handleTagChange={handleTagChange}
|
||||
isTagBarDisplay={isTagBarDisplay}
|
||||
availableTags={availableTags}
|
||||
searchQuery={searchQuery}
|
||||
services={services}
|
||||
currentPage={currentPage}
|
||||
@@ -194,6 +232,11 @@ export const ThemeSelector: React.FC<ThemeSelectorProps> = ({
|
||||
<Navigation items={navigationItems} />
|
||||
<main className="flex-1">
|
||||
<MarketplaceMain
|
||||
currentTheme={currentTheme}
|
||||
selectedTag={selectedTag}
|
||||
setSelectedTag={setSelectedTag}
|
||||
isTagBarDisplay={isTagBarDisplay}
|
||||
availableTags={availableTags}
|
||||
initialServices={services}
|
||||
initialTotal={total}
|
||||
initialPage={currentPage}
|
||||
|
||||
@@ -24,11 +24,18 @@ import { Footer } from "./Footer";
|
||||
import { Navigation } from "./Navigation";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
import { Faq } from "@/components/marketplace/Faq";
|
||||
import { TagFilter } from "@/shared/components/marketplace/TagFilter";
|
||||
import { ThemeType } from "@/shared/types/system";
|
||||
|
||||
interface HomeProps {
|
||||
// 状态
|
||||
searchQuery: string;
|
||||
services: ServiceData[];
|
||||
isTagBarDisplay: boolean;
|
||||
availableTags: string[];
|
||||
selectedTag: string;
|
||||
handleTagChange: (tag: string) => void;
|
||||
currentTheme: ThemeType;
|
||||
currentPage: number;
|
||||
total: number;
|
||||
pageSize: number;
|
||||
@@ -50,6 +57,11 @@ interface HomeProps {
|
||||
export const Home: React.FC<HomeProps> = ({
|
||||
searchQuery,
|
||||
services,
|
||||
isTagBarDisplay,
|
||||
availableTags,
|
||||
selectedTag,
|
||||
handleTagChange,
|
||||
currentTheme,
|
||||
currentPage,
|
||||
total,
|
||||
pageSize,
|
||||
@@ -83,9 +95,9 @@ export const Home: React.FC<HomeProps> = ({
|
||||
<h1 className="text-4xl lg:text-5xl font-bold mb-6 text-slate-800">
|
||||
{t(
|
||||
platformConfig.headline ||
|
||||
platformConfig.name ||
|
||||
_DefaultPlatformConfig.headline ||
|
||||
""
|
||||
platformConfig.name ||
|
||||
_DefaultPlatformConfig.headline ||
|
||||
""
|
||||
)}
|
||||
</h1>
|
||||
|
||||
@@ -93,8 +105,8 @@ export const Home: React.FC<HomeProps> = ({
|
||||
<p className="text-xl text-gray-600 max-w-3xl mx-auto leading-relaxed">
|
||||
{t(
|
||||
platformConfig.subheadline ||
|
||||
_DefaultPlatformConfig.subheadline ||
|
||||
""
|
||||
_DefaultPlatformConfig.subheadline ||
|
||||
""
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
@@ -140,6 +152,21 @@ export const Home: React.FC<HomeProps> = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* filter section */}
|
||||
{
|
||||
isTagBarDisplay && (
|
||||
<div className="pt-10">
|
||||
<TagFilter
|
||||
theme={currentTheme}
|
||||
tags={availableTags}
|
||||
selectedTag={selectedTag}
|
||||
onTagChange={handleTagChange}
|
||||
maxWidthPercent={80}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
{/* Server List Section */}
|
||||
{loading ? (
|
||||
<div className="mx-auto h-[200px] flex items-center justify-center">
|
||||
@@ -148,7 +175,7 @@ export const Home: React.FC<HomeProps> = ({
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div className="bg-gray-50 py-16">
|
||||
<div className={`bg-gray-50 ${isTagBarDisplay ? 'py-10' : 'py-16'}`}>
|
||||
<div className="mx-auto px-6 max-w-7xl">
|
||||
{/* Server Grid */}
|
||||
<div className="flex flex-wrap justify-center gap-4 mb-12">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import React, { useState, useEffect } from "react";
|
||||
import { Button } from "@nextui-org/react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
@@ -8,6 +8,7 @@ import { DynamicLogo } from "@/shared/components/DynamicLogo";
|
||||
import { useAuth } from "@/shared/lib/useAuth";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
import Link from "next/link";
|
||||
import { useSharedStore } from "@/shared/store/share";
|
||||
|
||||
interface NavigationProps {
|
||||
items?: NavigationItem[];
|
||||
@@ -17,6 +18,13 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
const { t } = useTranslation();
|
||||
const { handleLogin } = useAuth();
|
||||
|
||||
const [userToken, setUserToken] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const userToken = useSharedStore?.getState?.().user_token
|
||||
setUserToken(userToken);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="fixed top-0 left-0 right-0 z-50">
|
||||
{/* Classic Header */}
|
||||
@@ -26,21 +34,27 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
<DynamicLogo alt="Platform Logo" className="h-[32px] text-white" />
|
||||
</div>
|
||||
<div className="flex space-x-2">
|
||||
<Button
|
||||
onPress={handleLogin}
|
||||
variant="light"
|
||||
className="hidden sm:block text-white text-sm px-4 py-1 rounded-sm font-medium"
|
||||
size="sm"
|
||||
>
|
||||
<b className="text-md"> {t("Sign In")}</b>
|
||||
</Button>
|
||||
{
|
||||
!userToken && (
|
||||
<>
|
||||
<Button
|
||||
onPress={handleLogin}
|
||||
variant="light"
|
||||
className="hidden sm:block text-white text-sm px-4 py-1 rounded-sm font-medium"
|
||||
size="sm"
|
||||
>
|
||||
<b className="text-md"> {t("Sign In")}</b>
|
||||
</Button>
|
||||
</>
|
||||
)
|
||||
}
|
||||
<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")}
|
||||
{userToken ? t("Dashboard") : t("Get Started")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -24,11 +24,18 @@ import { Footer } from "./Footer";
|
||||
import { Navigation } from "./Navigation";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
import { Faq } from "@/components/marketplace/Faq";
|
||||
import { TagFilter } from "@/shared/components/marketplace/TagFilter";
|
||||
import { ThemeType } from "@/shared/types/system";
|
||||
|
||||
interface HomeProps {
|
||||
// 状态
|
||||
searchQuery: string;
|
||||
services: ServiceData[];
|
||||
isTagBarDisplay: boolean;
|
||||
availableTags: string[];
|
||||
selectedTag: string;
|
||||
handleTagChange: (tag: string) => void;
|
||||
currentTheme: ThemeType;
|
||||
currentPage: number;
|
||||
total: number;
|
||||
pageSize: number;
|
||||
@@ -50,6 +57,11 @@ interface HomeProps {
|
||||
export const Home: React.FC<HomeProps> = ({
|
||||
searchQuery,
|
||||
services,
|
||||
isTagBarDisplay,
|
||||
availableTags,
|
||||
selectedTag,
|
||||
handleTagChange,
|
||||
currentTheme,
|
||||
currentPage,
|
||||
total,
|
||||
pageSize,
|
||||
@@ -102,9 +114,9 @@ export const Home: React.FC<HomeProps> = ({
|
||||
<span className="bg-clip-text text-transparent bg-gradient-to-r from-pink-600 via-red-500 to-orange-600">
|
||||
{t(
|
||||
platformConfig.headline ||
|
||||
platformConfig.name ||
|
||||
_DefaultPlatformConfig.headline ||
|
||||
""
|
||||
platformConfig.name ||
|
||||
_DefaultPlatformConfig.headline ||
|
||||
""
|
||||
)}
|
||||
</span>
|
||||
</h1>
|
||||
@@ -113,8 +125,8 @@ export const Home: React.FC<HomeProps> = ({
|
||||
<p className="text-lg font-medium max-w-3xl mx-auto leading-relaxed text-gray-700">
|
||||
{t(
|
||||
platformConfig.subheadline ||
|
||||
_DefaultPlatformConfig.subheadline ||
|
||||
""
|
||||
_DefaultPlatformConfig.subheadline ||
|
||||
""
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
@@ -166,6 +178,21 @@ export const Home: React.FC<HomeProps> = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* filter section */}
|
||||
{
|
||||
isTagBarDisplay && (
|
||||
<>
|
||||
<TagFilter
|
||||
theme={currentTheme}
|
||||
tags={availableTags}
|
||||
selectedTag={selectedTag}
|
||||
onTagChange={handleTagChange}
|
||||
maxWidthPercent={80}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
{/* Creative Server List Section */}
|
||||
{loading ? (
|
||||
<div className="relative z-10 mx-auto h-[200px] flex items-center justify-center">
|
||||
@@ -177,7 +204,7 @@ export const Home: React.FC<HomeProps> = ({
|
||||
</div>
|
||||
) : (
|
||||
<div className="relative z-10">
|
||||
<div className="relative mx-auto px-6 py-16 max-w-8xl">
|
||||
<div className={`relative mx-auto px-6 ${isTagBarDisplay ? 'py-12' : 'py-16'} max-w-8xl`}>
|
||||
{/* Creative Server Grid */}
|
||||
<div className="flex flex-wrap justify-center gap-4 mb-12">
|
||||
{services.map((service, index) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import { Button } from "@nextui-org/react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import Link from "next/link";
|
||||
@@ -16,6 +16,7 @@ import { ArrowRightIcon } from "lucide-react";
|
||||
import { DynamicLogo } from "@/shared/components/DynamicLogo";
|
||||
import { useAuth } from "@/shared/lib/useAuth";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
import { useSharedStore } from "@/shared/store/share";
|
||||
|
||||
interface NavigationProps {
|
||||
items?: NavigationItem[];
|
||||
@@ -26,6 +27,13 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
const { handleLogin } = useAuth();
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
|
||||
const [userToken, setUserToken] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const userToken = useSharedStore?.getState?.().user_token
|
||||
setUserToken(userToken);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Creative Navigation */}
|
||||
@@ -65,16 +73,22 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
</NavbarContent>
|
||||
<NavbarContent justify="end" className="items-center gap-2 sm:gap-4">
|
||||
<div className="hidden sm:flex gap-2">
|
||||
<Button onPress={handleLogin} variant="light">
|
||||
<b className="text-md"> {t("Sign In")}</b>
|
||||
</Button>
|
||||
{
|
||||
!userToken && (
|
||||
<>
|
||||
<Button onPress={handleLogin} variant="light">
|
||||
<b className="text-md"> {t("Sign In")}</b>
|
||||
</Button>
|
||||
</>
|
||||
)
|
||||
}
|
||||
<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>
|
||||
<b className="text-md">{userToken ? t("Dashboard") : t("Get Started")}</b>
|
||||
<div className="w-8 h-8 bg-white/20 flex items-center justify-center rounded-full">
|
||||
<ArrowRightIcon
|
||||
size={16}
|
||||
@@ -89,7 +103,7 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
onPress={handleLogin}
|
||||
size="sm"
|
||||
>
|
||||
<b className="text-md">{t("Get Started")}</b>
|
||||
<b className="text-md">{userToken ? t("Dashboard") : t("Get Started")}</b>
|
||||
</Button>
|
||||
</div>
|
||||
</NavbarContent>
|
||||
@@ -101,7 +115,7 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
radius="full"
|
||||
onPress={handleLogin}
|
||||
>
|
||||
<b className="text-md">{t("Get Started")}</b>
|
||||
<b className="text-md">{userToken ? t("Dashboard") : t("Get Started")}</b>
|
||||
<div className="w-8 h-8 bg-white/20 flex items-center justify-center rounded-full">
|
||||
<ArrowRightIcon
|
||||
size={16}
|
||||
|
||||
@@ -26,11 +26,18 @@ import { Navigation } from "./Navigation";
|
||||
import { Footer } from "./Footer";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
import { Faq } from "@/components/marketplace/Faq";
|
||||
import { TagFilter } from "@/shared/components/marketplace/TagFilter";
|
||||
import { ThemeType } from "@/shared/types/system";
|
||||
|
||||
interface HomeProps {
|
||||
// 状态
|
||||
searchQuery: string;
|
||||
services: ServiceData[];
|
||||
isTagBarDisplay: boolean;
|
||||
availableTags: string[];
|
||||
selectedTag: string;
|
||||
handleTagChange: (tag: string) => void;
|
||||
currentTheme: ThemeType;
|
||||
currentPage: number;
|
||||
total: number;
|
||||
pageSize: number;
|
||||
@@ -52,6 +59,11 @@ interface HomeProps {
|
||||
export const Home: React.FC<HomeProps> = ({
|
||||
searchQuery,
|
||||
services,
|
||||
isTagBarDisplay,
|
||||
availableTags,
|
||||
selectedTag,
|
||||
handleTagChange,
|
||||
currentTheme,
|
||||
currentPage,
|
||||
total,
|
||||
pageSize,
|
||||
@@ -78,7 +90,7 @@ export const Home: React.FC<HomeProps> = ({
|
||||
<Navigation items={navItems} />
|
||||
{/* Modern Hero Section */}
|
||||
<div className="pt-32">
|
||||
<div className="mx-auto px-6 py-20 max-w-6xl">
|
||||
<div className={`mx-auto px-6 max-w-6xl ${isTagBarDisplay ? 'py-16' : 'py-20'}`}>
|
||||
<div className="text-center mb-16">
|
||||
{/* Modern Icon */}
|
||||
<div className="flex justify-center mb-8">
|
||||
@@ -91,9 +103,9 @@ export const Home: React.FC<HomeProps> = ({
|
||||
<h1 className="text-4xl lg:text-6xl font-bold mb-6 text-gray-900 leading-tight">
|
||||
{t(
|
||||
platformConfig.headline ||
|
||||
platformConfig.name ||
|
||||
_DefaultPlatformConfig.headline ||
|
||||
""
|
||||
platformConfig.name ||
|
||||
_DefaultPlatformConfig.headline ||
|
||||
""
|
||||
)}
|
||||
</h1>
|
||||
|
||||
@@ -101,8 +113,8 @@ export const Home: React.FC<HomeProps> = ({
|
||||
<p className="text-lg text-gray-600 max-w-2xl mx-auto leading-relaxed">
|
||||
{t(
|
||||
platformConfig.subheadline ||
|
||||
_DefaultPlatformConfig.subheadline ||
|
||||
""
|
||||
_DefaultPlatformConfig.subheadline ||
|
||||
""
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
@@ -145,6 +157,21 @@ export const Home: React.FC<HomeProps> = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* filter section */}
|
||||
{
|
||||
isTagBarDisplay && (
|
||||
<>
|
||||
<TagFilter
|
||||
theme={currentTheme}
|
||||
tags={availableTags}
|
||||
selectedTag={selectedTag}
|
||||
onTagChange={handleTagChange}
|
||||
maxWidthPercent={80}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
<section>
|
||||
{/* Server List Section */}
|
||||
{loading ? (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import { Button } from "@nextui-org/react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import Link from "next/link";
|
||||
@@ -16,6 +16,7 @@ import { ArrowRightIcon } from "lucide-react";
|
||||
import { DynamicLogo } from "@/shared/components/DynamicLogo";
|
||||
import { useAuth } from "@/shared/lib/useAuth";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
import { useSharedStore } from "@/shared/store/share";
|
||||
|
||||
interface NavigationProps {
|
||||
items?: NavigationItem[];
|
||||
@@ -25,7 +26,12 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
const { t } = useTranslation();
|
||||
const { handleLogin } = useAuth();
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
const [userToken, setUserToken] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const userToken = useSharedStore?.getState?.().user_token
|
||||
setUserToken(userToken);
|
||||
}, []);
|
||||
return (
|
||||
<>
|
||||
{/* Modern Navigation */}
|
||||
@@ -61,16 +67,22 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
</NavbarContent>
|
||||
<NavbarContent justify="end" className="items-center gap-2 sm:gap-4">
|
||||
<div className="hidden sm:flex gap-2">
|
||||
<Button onPress={handleLogin} variant="light">
|
||||
<b className="text-md"> {t("Sign In")}</b>
|
||||
</Button>
|
||||
{
|
||||
!userToken && (
|
||||
<>
|
||||
<Button onPress={handleLogin} variant="light">
|
||||
<b className="text-md"> {t("Sign In")}</b>
|
||||
</Button>
|
||||
</>
|
||||
)
|
||||
}
|
||||
<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>
|
||||
<b className="text-md">{userToken ? t("Dashboard") : t("Get Started")}</b>
|
||||
<div className="w-8 h-8 bg-white/20 flex items-center justify-center rounded-full">
|
||||
<ArrowRightIcon
|
||||
size={16}
|
||||
@@ -85,7 +97,7 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
onPress={handleLogin}
|
||||
size="sm"
|
||||
>
|
||||
<b className="text-md">{t("Get Started")}</b>
|
||||
<b className="text-md">{userToken ? t("Dashboard") : t("Get Started")}</b>
|
||||
</Button>
|
||||
</div>
|
||||
</NavbarContent>
|
||||
@@ -97,7 +109,7 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
radius="full"
|
||||
onPress={handleLogin}
|
||||
>
|
||||
<b className="text-md">{t("Get Started")}</b>
|
||||
<b className="text-md">{userToken ? t("Dashboard") : t("Get Started")}</b>
|
||||
<div className="w-8 h-8 bg-white/20 flex items-center justify-center rounded-full">
|
||||
<ArrowRightIcon
|
||||
size={16}
|
||||
|
||||
@@ -23,11 +23,18 @@ import { Footer } from "./Footer";
|
||||
import { Navigation } from "./Navigation";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
import { Faq } from "@/components/marketplace/Faq";
|
||||
import { TagFilter } from "@/shared/components/marketplace/TagFilter";
|
||||
import { ThemeType } from "@/shared/types/system";
|
||||
|
||||
interface HomeProps {
|
||||
// 状态
|
||||
searchQuery: string;
|
||||
services: ServiceData[];
|
||||
isTagBarDisplay: boolean;
|
||||
availableTags: string[];
|
||||
selectedTag: string;
|
||||
handleTagChange: (tag: string) => void;
|
||||
currentTheme: ThemeType;
|
||||
currentPage: number;
|
||||
total: number;
|
||||
pageSize: number;
|
||||
@@ -49,6 +56,11 @@ interface HomeProps {
|
||||
export const Home: React.FC<HomeProps> = ({
|
||||
searchQuery,
|
||||
services,
|
||||
isTagBarDisplay,
|
||||
availableTags,
|
||||
selectedTag,
|
||||
handleTagChange,
|
||||
currentTheme,
|
||||
currentPage,
|
||||
total,
|
||||
pageSize,
|
||||
@@ -95,9 +107,9 @@ export const Home: React.FC<HomeProps> = ({
|
||||
<h1 className="text-4xl lg:text-6xl font-bold mb-6 text-white">
|
||||
{t(
|
||||
platformConfig.headline ||
|
||||
platformConfig.name ||
|
||||
_DefaultPlatformConfig.headline ||
|
||||
""
|
||||
platformConfig.name ||
|
||||
_DefaultPlatformConfig.headline ||
|
||||
""
|
||||
)}
|
||||
</h1>
|
||||
|
||||
@@ -105,8 +117,8 @@ export const Home: React.FC<HomeProps> = ({
|
||||
<p className="text-xl text-white/90 mb-8 max-w-2xl mx-auto">
|
||||
{t(
|
||||
platformConfig.subheadline ||
|
||||
_DefaultPlatformConfig.subheadline ||
|
||||
""
|
||||
_DefaultPlatformConfig.subheadline ||
|
||||
""
|
||||
)}
|
||||
</p>
|
||||
|
||||
@@ -139,6 +151,21 @@ export const Home: React.FC<HomeProps> = ({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* filter section */}
|
||||
{
|
||||
isTagBarDisplay && (
|
||||
<div className="pt-12">
|
||||
<TagFilter
|
||||
theme={currentTheme}
|
||||
tags={availableTags}
|
||||
selectedTag={selectedTag}
|
||||
onTagChange={handleTagChange}
|
||||
maxWidthPercent={80}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
{/* Products Section */}
|
||||
<div className="mx-auto px-6 py-12 max-w-7xl">
|
||||
{/* Section Header */}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import { Button } from "@nextui-org/react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import Link from "next/link";
|
||||
@@ -16,6 +16,7 @@ import { DynamicLogo } from "@/shared/components/DynamicLogo";
|
||||
import { useAuth } from "@/shared/lib/useAuth";
|
||||
import { NavigationItem } from "@/shared/components/Navigation";
|
||||
import { ArrowRightIcon } from "lucide-react";
|
||||
import { useSharedStore } from "@/shared/store/share";
|
||||
|
||||
interface NavigationProps {
|
||||
items?: NavigationItem[];
|
||||
@@ -26,6 +27,13 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
const { handleLogin } = useAuth();
|
||||
const [isMenuOpen, setIsMenuOpen] = useState(false);
|
||||
|
||||
const [userToken, setUserToken] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const userToken = useSharedStore?.getState?.().user_token
|
||||
setUserToken(userToken);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
{/* Temu Style Navigation */}
|
||||
@@ -64,15 +72,21 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
</NavbarContent>
|
||||
<NavbarContent justify="end" className="items-center gap-2 sm:gap-4">
|
||||
<div className="hidden sm:flex items-center gap-2">
|
||||
<Button onPress={handleLogin} variant="light">
|
||||
<b className="text-md"> {t("Sign In")}</b>
|
||||
</Button>
|
||||
{
|
||||
!userToken && (
|
||||
<>
|
||||
<Button onPress={handleLogin} variant="light">
|
||||
<b className="text-md"> {t("Sign In")}</b>
|
||||
</Button>
|
||||
</>
|
||||
)
|
||||
}
|
||||
<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("Get Started")}
|
||||
{userToken ? t("Dashboard") : t("Get Started")}
|
||||
</Button>
|
||||
</div>
|
||||
<div className="sm:hidden">
|
||||
@@ -81,7 +95,7 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
onPress={handleLogin}
|
||||
size="sm"
|
||||
>
|
||||
{t("Sign In")}
|
||||
{userToken ? t("Dashboard") : t("Sign In")}
|
||||
</Button>
|
||||
</div>
|
||||
</NavbarContent>
|
||||
@@ -100,7 +114,7 @@ export const Navigation: React.FC<NavigationProps> = ({ items }) => {
|
||||
radius="md"
|
||||
onPress={handleLogin}
|
||||
>
|
||||
{t("Sign In")}
|
||||
{userToken ? t("Dashboard") : t("Sign In")}
|
||||
</Button>
|
||||
</NavbarMenuItem>
|
||||
</NavbarMenu>
|
||||
|
||||
Reference in new issue
Block a user