diff --git a/src/App.tsx b/src/App.tsx index 542a5e5..feb85cb 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -7,6 +7,7 @@ import { News } from './pages/News' import { Contact } from './pages/Contact' import { Cases } from './pages/Cases' import { Learning } from './pages/Learning' +import { Assistant } from './pages/Assistant' // 页面切换动画配置 const pageVariants = { diff --git a/src/components/Breadcrumbs.tsx b/src/components/Breadcrumbs.tsx new file mode 100644 index 0000000..1eab47c --- /dev/null +++ b/src/components/Breadcrumbs.tsx @@ -0,0 +1,72 @@ +import React, { useMemo } from 'react' +import { Link, useLocation } from 'react-router-dom' +import { ChevronRight, Home as HomeIcon } from 'lucide-react' +import { getLocaleFromPathname, stripLocalePrefix, withLocalePath } from '../lib/i18n' + +export type BreadcrumbItem = { + label: string + href?: string +} + +type BreadcrumbsProps = { + items: BreadcrumbItem[] + className?: string +} + +export const Breadcrumbs: React.FC = ({ items, className }) => { + const location = useLocation() + const locale = useMemo(() => getLocaleFromPathname(location.pathname), [location.pathname]) + + const homeLabel = locale === 'en' ? 'Home' : '首页' + const homeHref = withLocalePath(locale, '/') + + const normalizedItems = useMemo(() => { + const prefix = stripLocalePrefix(location.pathname).startsWith('/') ? '' : '/' + void prefix + return items + }, [items, location.pathname]) + + return ( + + ) +} + +export default Breadcrumbs diff --git a/src/components/Header.tsx b/src/components/Header.tsx index c9eb61e..697da23 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -23,6 +23,7 @@ const navLabelMap: Record = { cases: { zh: '服务案例', en: 'Cases' }, news: { zh: '新闻中心', en: 'News' }, learning: { zh: '培训学习', en: 'Learning' }, + assistant: { zh: 'AI智能助手', en: 'AI Assistant' }, contact: { zh: '联系我们', en: 'Contact' }, } diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 392392a..2e75af2 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -26,6 +26,7 @@ export const NAVIGATION_MENU = [ { id: 'cases', label: '服务案例', path: '/cases' }, { id: 'news', label: '新闻中心', path: '/news' }, { id: 'learning', label: '培训学习', path: '/learning' }, + { id: 'assistant', label: 'AI智能助手', path: '/assistant' }, { id: 'contact', label: '联系我们', path: '/contact' }, ]; @@ -153,6 +154,10 @@ export const PAGE_META = { title: '联系我们', description: '联系信息与留言反馈(占位内容)', }, + assistant: { + title: 'AI智能助手', + description: '诚裕智能客服:基于知识库的智能问答与留资服务(占位内容)', + }, }; // 联系方式配置