feat: optimize interface and database connection

Adjust MongoDB mock connector and update database structure.
Enhance sidebar, data platform, and AI analysis tools.
Clean up unnecessary code and update development docs.

#VERCEL_SKIP

Co-authored-by: null <4804959+fnvtk@users.noreply.github.com>
This commit is contained in:
v0
2025-07-21 00:11:52 +00:00
parent 892c5b4855
commit ecd8a48863
26 changed files with 1821 additions and 1024 deletions

View File

@@ -2,14 +2,13 @@
import Link from "next/link"
import { usePathname } from "next/navigation"
import { Home, Database, Search, Target, Brain } from "lucide-react"
import { Home, Database, Target, BrainCircuit } from "lucide-react" // 引入AI智能助手图标
const navItems = [
{ href: "/", icon: Home, label: "概览" },
{ href: "/data-platform", icon: Database, label: "数据中台" },
{ href: "/user-discovery", icon: Search, label: "用户发现" },
{ href: "/user-valuation", icon: Target, label: "用户估值" },
{ href: "/ai-analysis", icon: Brain, label: "AI分析" },
{ href: "/user-portrait", icon: Target, label: "用户画像" }, // 整合用户池功能
{ href: "/ai-assistant", icon: BrainCircuit, label: "AI助手" }, // 新增AI智能助手
]
export default function BottomNav() {

View File

@@ -18,7 +18,7 @@ export default function Header() {
<Search className="h-4 w-4 text-muted-foreground mr-2" />
<Input
type="text"
placeholder="搜索用户、标签、活动..."
placeholder="搜索用户、IMEI、手机号、标签..."
className="border-none focus-visible:ring-0 focus-visible:ring-offset-0"
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}

View File

@@ -10,7 +10,7 @@ interface MobileHeaderProps {
title?: string
}
export default function MobileHeader({ onMenuToggle, title = "数据资产中台" }: MobileHeaderProps) {
export default function MobileHeader({ onMenuToggle, title = "卡若数据资产中台" }: MobileHeaderProps) {
const [showSearch, setShowSearch] = useState(false)
const [searchQuery, setSearchQuery] = useState("")
@@ -46,7 +46,7 @@ export default function MobileHeader({ onMenuToggle, title = "数据资产中台
<div className="flex-1">
<Input
type="text"
placeholder="搜索用户、标签、活动..."
placeholder="搜索用户、IMEI、手机号..."
className="glass-input border-none focus-visible:ring-0 focus-visible:ring-offset-0"
value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)}

View File

@@ -7,16 +7,14 @@ import { cn } from "@/lib/utils"
import {
Database,
LayoutDashboard,
Users,
Target,
X,
ChevronDown,
ChevronRight,
Search,
BarChart3,
TrendingUp,
Brain,
HelpCircle,
UserCheck,
Layers,
Tag,
BrainCircuit,
} from "lucide-react"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
@@ -29,9 +27,7 @@ interface MobileSidebarProps {
export default function MobileSidebar({ isOpen, onClose }: MobileSidebarProps) {
const pathname = usePathname()
const [expandedSections, setExpandedSections] = useState({
"user-discovery": false,
"user-valuation": false,
"ai-analysis": false,
"user-portrait": false, // 用户画像默认不展开
})
const toggleSection = (section: string) => {
@@ -70,77 +66,40 @@ export default function MobileSidebar({ isOpen, onClose }: MobileSidebarProps) {
description: "多源数据整合中心",
},
{
title: "用户发现",
href: "/user-discovery",
icon: <Search className="h-4 w-4" />,
primary: true,
expandable: true,
section: "user-discovery",
description: "用户行为洞察分析",
children: [
{
title: "行为分析",
href: "/user-discovery/behavior",
icon: <BarChart3 className="h-3 w-3" />,
description: "用户行为模式分析",
},
{
title: "用户分群",
href: "/user-discovery/segmentation",
icon: <Users className="h-3 w-3" />,
description: "智能用户分群",
},
],
},
{
title: "用户估值",
href: "/user-valuation",
title: "用户画像", // 整合用户池功能
href: "/user-portrait",
icon: <Target className="h-4 w-4" />,
primary: true,
expandable: true,
section: "user-valuation",
description: "用户价值评估模型",
hasHelp: true,
section: "user-portrait",
description: "用户数据管理与画像分析",
children: [
{
title: "估值模型",
href: "/user-valuation/model",
icon: <BarChart3 className="h-3 w-3" />,
description: "RFM价值评估",
hasHelp: true,
title: "用户管理", // 原用户池的用户管理
href: "/user-portrait/management",
icon: <UserCheck className="h-3 w-3" />,
description: "IMEI、手机号管理",
},
{
title: "升级路径",
href: "/user-valuation/upgrade-paths",
icon: <TrendingUp className="h-3 w-3" />,
description: "用户价值提升策略",
hasHelp: true,
title: "用户分群", // 原用户池的用户分群
href: "/user-portrait/segmentation",
icon: <Layers className="h-3 w-3" />,
description: "智能用户分群",
},
{
title: "标签管理", // 原用户画像的标签管理
href: "/user-portrait/tags",
icon: <Tag className="h-3 w-3" />,
description: "用户标签体系",
},
],
},
{
title: "AI分析",
href: "/ai-analysis",
icon: <Brain className="h-4 w-4" />,
title: "AI智能助手", // 新增AI智能助手
href: "/ai-assistant",
icon: <BrainCircuit className="h-4 w-4" />,
primary: true,
expandable: true,
section: "ai-analysis",
description: "智能数据洞察",
tag: "AI",
children: [
{
title: "趋势识别",
href: "/ai-analysis/trends",
icon: <TrendingUp className="h-3 w-3" />,
description: "AI趋势预测",
},
{
title: "异常检测",
href: "/ai-analysis/anomaly",
icon: <Search className="h-3 w-3" />,
description: "智能异常监控",
},
],
description: "AI数据分析与营销策略",
},
]
@@ -148,8 +107,6 @@ export default function MobileSidebar({ isOpen, onClose }: MobileSidebarProps) {
switch (tag) {
case "核心":
return "bg-blue-100 text-blue-700 border-blue-200"
case "AI":
return "bg-purple-100 text-purple-700 border-purple-200"
default:
return "bg-gray-100 text-gray-700 border-gray-200"
}
@@ -180,7 +137,7 @@ export default function MobileSidebar({ isOpen, onClose }: MobileSidebarProps) {
<Database className="h-4 w-4 text-blue-600" />
</div>
<h1 className="text-sm font-semibold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent">
</h1>
</div>
<Button variant="ghost" size="icon" onClick={onClose} className="glass-light rounded-lg h-8 w-8">
@@ -196,7 +153,7 @@ export default function MobileSidebar({ isOpen, onClose }: MobileSidebarProps) {
<div
className={cn(
"flex items-center px-3 py-2 text-xs font-medium rounded-lg transition-all duration-300 group",
pathname === item.href
pathname === item.href || (item.children && pathname.startsWith(item.href))
? "glass-heavy text-blue-700 shadow-glass"
: "glass-light text-gray-700 hover:glass-heavy hover:text-blue-600",
)}
@@ -207,7 +164,6 @@ export default function MobileSidebar({ isOpen, onClose }: MobileSidebarProps) {
<div className="flex items-center justify-between">
<div className="flex items-center gap-1">
<span className="font-medium truncate">{item.title}</span>
{item.hasHelp && <HelpCircle className="h-3 w-3 text-gray-400 flex-shrink-0" />}
</div>
{item.tag && (
<Badge
@@ -253,10 +209,7 @@ export default function MobileSidebar({ isOpen, onClose }: MobileSidebarProps) {
{subItem.icon}
</div>
<div className="min-w-0 flex-1">
<div className="flex items-center gap-1">
<p className="font-medium truncate">{subItem.title}</p>
{subItem.hasHelp && <HelpCircle className="h-3 w-3 text-gray-400 flex-shrink-0" />}
</div>
<p className="font-medium truncate">{subItem.title}</p>
<p className="text-xs text-gray-500 truncate">{subItem.description}</p>
</div>
</Link>
@@ -272,15 +225,15 @@ export default function MobileSidebar({ isOpen, onClose }: MobileSidebarProps) {
<div className="border-t border-white/20 p-3">
<div className="glass-light rounded-lg p-2">
<div className="flex items-center justify-between text-xs">
<span className="text-gray-600">AI引擎状</span>
<span className="text-gray-600"></span>
<div className="flex items-center">
<div className="w-2 h-2 bg-green-500 rounded-full mr-1"></div>
<span className="text-green-600"></span>
<span className="text-green-600"></span>
</div>
</div>
<div className="flex items-center justify-between text-xs mt-1">
<span className="text-gray-600"></span>
<span className="text-gray-500"></span>
<span className="text-gray-600"></span>
<span className="text-gray-500">125,678</span>
</div>
</div>
</div>

View File

@@ -8,14 +8,15 @@ import {
Database,
LayoutDashboard,
Settings,
Users,
Target,
ChevronLeft,
ChevronDown,
ChevronRight,
Tag,
BarChart3,
TrendingUp,
UserCheck,
Layers,
BrainCircuit,
Smartphone,
} from "lucide-react"
import { Badge } from "@/components/ui/badge"
@@ -23,8 +24,7 @@ export default function Sidebar() {
const pathname = usePathname()
const [expanded, setExpanded] = useState(true)
const [expandedSections, setExpandedSections] = useState({
"user-portrait": true,
"user-value": false,
"user-portrait": true, // 用户画像默认展开
})
const toggleSidebar = () => {
@@ -38,60 +38,57 @@ export default function Sidebar() {
}))
}
// 重新设计的导航结构
// 重新设计的导航结构 - 遵循新规则
const navItems = [
{
title: "概览",
title: "数据概览",
href: "/",
icon: <LayoutDashboard className="h-5 w-5" />,
primary: true,
},
{
title: "数据集成",
href: "/data-integration",
title: "数据中台",
href: "/data-platform",
icon: <Database className="h-5 w-5" />,
primary: true,
tag: "核心",
},
{
title: "用户画像",
title: "用户画像", // 整合用户池功能
href: "/user-portrait",
icon: <Users className="h-5 w-5" />,
icon: <Target className="h-5 w-5" />,
primary: true,
expandable: true,
section: "user-portrait",
children: [
{
title: "用户",
href: "/user-portrait/user-keywords",
icon: <Tag className="h-4 w-4" />,
title: "用户管理", // 原用户池的用户管理
href: "/user-portrait/management",
icon: <UserCheck className="h-4 w-4" />,
},
{
title: "标签管理",
title: "用户分群", // 原用户池的用户分群
href: "/user-portrait/segmentation",
icon: <Layers className="h-4 w-4" />,
},
{
title: "标签管理", // 原用户画像的标签管理
href: "/user-portrait/tags",
icon: <Tag className="h-4 w-4" />,
},
],
},
{
title: "用户估值",
href: "/user-value",
icon: <Target className="h-5 w-5" />,
title: "设备管理", // 提升为一级菜单 [^2]
href: "/devices",
icon: <Smartphone className="h-5 w-5" />,
primary: true,
},
{
title: "AI智能助手", // 新增AI智能助手
href: "/ai-assistant",
icon: <BrainCircuit className="h-5 w-5" />,
primary: true,
expandable: true,
section: "user-value",
children: [
{
title: "估值模型",
href: "/user-value/model",
icon: <BarChart3 className="h-4 w-4" />,
},
{
title: "用户升级路径",
href: "/user-value/upgrade-paths",
icon: <TrendingUp className="h-4 w-4" />,
},
],
},
]
@@ -119,7 +116,7 @@ export default function Sidebar() {
<Database className="h-5 w-5 text-blue-600" />
</div>
<h1 className="text-lg font-semibold bg-gradient-to-r from-blue-600 to-purple-600 bg-clip-text text-transparent">
</h1>
</div>
) : (
@@ -139,7 +136,7 @@ export default function Sidebar() {
<div
className={cn(
"flex items-center px-4 py-3 text-sm font-medium rounded-xl transition-all duration-300 group",
pathname === item.href
pathname === item.href || (item.children && pathname.startsWith(item.href))
? "glass-heavy text-blue-700 shadow-glass"
: "glass-light text-gray-700 hover:glass-heavy hover:text-blue-600 hover:scale-105",
)}