Better UX

This commit is contained in:
Xin Wang
2026-02-04 18:36:40 +08:00
parent 47207dab19
commit b608c395c7
14 changed files with 877 additions and 403 deletions

View File

@@ -1,6 +1,6 @@
import React, { useState, useMemo } from 'react';
import { Phone, CheckCircle, Clock, UserCheck, Activity, Filter, ChevronDown, BarChart3, HelpCircle, Mail } from 'lucide-react';
import { Phone, CheckCircle, Clock, UserCheck, Activity, Filter, ChevronDown, BarChart3, HelpCircle, Mail, Sparkles, Terminal, Box, Zap, ShieldCheck } from 'lucide-react';
import { Card, Button } from '../components/UI';
import { mockAssistants, getDashboardStats } from '../services/mockData';
@@ -13,35 +13,37 @@ export const DashboardPage: React.FC = () => {
}, [timeRange, selectedAssistantId]);
return (
<div className="min-h-full flex flex-col justify-center animate-in fade-in py-1">
<div className="w-full max-w-5xl mx-auto space-y-4 px-2">
<div className="min-h-full flex flex-col animate-in fade-in py-1">
<div className="w-full max-w-[1600px] mx-auto space-y-4 px-2 lg:px-6">
{/* 1. Utility Row (Top Navigation Actions) */}
<div className="flex justify-end items-center gap-2 border-b border-white/[0.03] pb-2">
<Button variant="ghost" size="sm" className="h-7 px-2.5 text-[10px] font-bold border border-white/5 hover:bg-primary/10 hover:text-primary transition-all">
<Button variant="ghost" size="sm" className="h-7 px-2.5 text-[10px] font-bold border border-white/5 hover:bg-primary/10 hover:text-primary transition-all text-white/70">
<HelpCircle className="w-3 h-3 mr-1.5 opacity-70" />
</Button>
<Button variant="ghost" size="sm" className="h-7 px-2.5 text-[10px] font-bold border border-white/5 hover:bg-primary/10 hover:text-primary transition-all">
<Button variant="ghost" size="sm" className="h-7 px-2.5 text-[10px] font-bold border border-white/5 hover:bg-primary/10 hover:text-primary transition-all text-white/70">
<Mail className="w-3 h-3 mr-1.5 opacity-70" />
</Button>
</div>
{/* 2. Welcome Row */}
<div className="flex flex-col space-y-0.5 text-center md:text-left pt-1">
<h1 className="text-2xl font-bold tracking-tight text-white">
, <span className="text-primary">Admin User</span>
</h1>
<p className="text-muted-foreground flex items-center justify-center md:justify-start text-[11px]">
<span className="flex items-center ml-2 text-green-400 text-[10px] font-mono bg-green-400/10 px-1.5 py-0.5 rounded-full border border-green-400/20">
<span className="w-1 h-1 rounded-full bg-green-400 animate-pulse mr-1"></span>
HEALTHY
</span>
</p>
{/* 2. Welcome Header */}
<div className="flex flex-col space-y-4 text-center md:text-left pt-1">
<div className="space-y-0.5">
<h1 className="text-2xl font-bold tracking-tight text-white">
, <span className="text-primary">Admin User</span>
</h1>
<p className="text-muted-foreground flex items-center justify-center md:justify-start text-[11px]">
<span className="flex items-center ml-2 text-green-400 text-[10px] font-mono bg-green-400/10 px-1.5 py-0.5 rounded-full border border-green-400/20">
<span className="w-1 h-1 rounded-full bg-green-400 animate-pulse mr-1"></span>
HEALTHY
</span>
</p>
</div>
</div>
{/* 3. Section Header: Title + Filters aligned perfectly */}
<div className="flex flex-col md:flex-row items-center justify-between border-b border-white/5 pb-3 pt-1 gap-3">
{/* 3. Section Header: Title + Filters */}
<div className="flex flex-col md:flex-row items-center justify-between border-b border-white/5 pb-3 pt-2 gap-3">
<div className="flex items-center space-x-2.5">
<div className="p-1 bg-primary/10 rounded-lg">
<BarChart3 className="h-3.5 w-3.5 text-primary" />
@@ -52,9 +54,7 @@ export const DashboardPage: React.FC = () => {
</div>
</div>
{/* Filters Group (Aligned Right) */}
<div className="flex items-center gap-1.5 bg-black/20 p-0.5 rounded-lg border border-white/5 shadow-inner scale-95 origin-right">
{/* Assistant Selector */}
<div className="relative group min-w-[130px]">
<div className="absolute left-2.5 top-1/2 -translate-y-1/2 pointer-events-none text-muted-foreground group-focus-within:text-primary transition-colors">
<Filter className="h-2.5 w-2.5" />
@@ -74,7 +74,6 @@ export const DashboardPage: React.FC = () => {
<div className="h-3 w-px bg-white/10 mx-0.5"></div>
{/* Time Range Selector */}
<div className="flex gap-0.5">
{(['week', 'month', 'year'] as const).map((r) => (
<button
@@ -135,11 +134,73 @@ export const DashboardPage: React.FC = () => {
<span className="text-[9px] font-mono text-primary animate-pulse tracking-widest uppercase">Streaming</span>
</div>
</div>
<div className="h-[250px] w-full">
<div className="h-[300px] w-full">
<SimpleAreaChart data={stats.trend} />
</div>
</Card>
</div>
{/* 6. Platform Feature Intro - Moved to Bottom, Full Width */}
<div className="w-full bg-white/[0.02] border border-white/5 rounded-2xl p-6 animate-in slide-in-from-bottom-4 duration-700 shadow-2xl relative overflow-hidden group pb-10 mb-10">
<div className="absolute top-0 right-0 w-64 h-64 bg-primary/5 blur-[100px] -mr-32 -mt-32 rounded-full pointer-events-none group-hover:bg-primary/10 transition-colors"></div>
<div className="relative z-10">
<div className="flex items-center gap-2 mb-4">
<div className="p-1.5 bg-primary/20 rounded-lg">
<Sparkles className="w-4 h-4 text-primary" />
</div>
<h3 className="text-sm font-bold text-white tracking-wide"></h3>
</div>
<div className="mb-6">
<p className="text-sm text-white/80 leading-relaxed font-medium">
AI视频助手是一个领先的多模态智能体管理平台 AI 🚀
</p>
</div>
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
<div className="space-y-2 group/item">
<div className="flex items-center gap-2">
<span className="text-lg">🤖</span>
<h4 className="text-xs font-bold text-primary uppercase tracking-wider"></h4>
</div>
<p className="text-[11px] text-muted-foreground leading-relaxed group-hover:text-white/70 transition-colors">
7x24h
</p>
</div>
<div className="space-y-2 group/item">
<div className="flex items-center gap-2">
<span className="text-lg">📚</span>
<h4 className="text-xs font-bold text-primary uppercase tracking-wider"></h4>
</div>
<p className="text-[11px] text-muted-foreground leading-relaxed group-hover:text-white/70 transition-colors">
RAG PDF/DOCX
</p>
</div>
<div className="space-y-2 group/item">
<div className="flex items-center gap-2">
<span className="text-lg">🎙</span>
<h4 className="text-xs font-bold text-primary uppercase tracking-wider"></h4>
</div>
<p className="text-[11px] text-muted-foreground leading-relaxed group-hover:text-white/70 transition-colors">
TTS
</p>
</div>
<div className="space-y-2 group/item">
<div className="flex items-center gap-2">
<span className="text-lg">🛡</span>
<h4 className="text-xs font-bold text-primary uppercase tracking-wider"></h4>
</div>
<p className="text-[11px] text-muted-foreground leading-relaxed group-hover:text-white/70 transition-colors">
AI
</p>
</div>
</div>
</div>
</div>
</div>
</div>
);
@@ -169,9 +230,9 @@ const StatCard: React.FC<{ title: string; value: string; icon: React.ReactNode;
const SimpleAreaChart: React.FC<{ data: { label: string, value: number }[] }> = ({ data }) => {
if (!data || data.length === 0) return null;
const height = 250;
const width = 1000;
const padding = 20;
const height = 300;
const width = 1400;
const padding = 30;
const maxValue = Math.max(...data.map(d => d.value)) * 1.2;
const points = data.map((d, i) => {