import React from 'react';
import { useAuth } from '@/client/home/hooks/AuthProvider';
import { useNavigate } from 'react-router-dom';

const HomePage: React.FC = () => {
  const { user } = useAuth();
  const navigate = useNavigate();

  return (
    <div className="min-h-screen bg-gradient-to-br from-blue-50 via-white to-purple-50 flex flex-col">
      {/* 顶部导航 */}
      <header className="bg-white shadow-sm border-b border-gray-100 fixed w-full z-10">
        <div className="container mx-auto px-4 py-4 flex justify-between items-center">
          <div className="flex items-center space-x-2">
             <img src='/20251212.jpg' alt="长愿青logo" style={{width: '40px', height: '40px', objectFit: 'cover', borderRadius: '8px'}}></img>
            <h1 className="text-xl font-bold text-gray-900">长愿青</h1>
          </div>
          
          {user ? (
            <div className="flex items-center space-x-4">
              <a
                href="/admin/files"
                className="text-sm text-gray-600 hover:text-blue-600 transition-colors"
              >
                文件管理
              </a>
              <div className="flex items-center cursor-pointer hover:bg-gray-50 rounded-lg px-3 py-2 transition-colors" onClick={() => navigate(`/member`)}>
                <div className="w-8 h-8 rounded-full bg-gradient-to-r from-blue-500 to-purple-500 flex items-center justify-center mr-2">
                  <span className="text-white text-sm font-medium">{user.username.charAt(0).toUpperCase()}</span>
                </div>
                <span className="hidden md:inline text-sm text-gray-700">{user.username}</span>
              </div>
            </div>
          ) : (
            <div className="flex space-x-3">
              <button 
                onClick={() => navigate('/login')}
                className="px-4 py-2 rounded-lg text-sm text-blue-600 hover:bg-blue-50 transition-colors"
              >
                登录
              </button>
              {/* <button 
                onClick={() => navigate('/register')}
                className="px-4 py-2 rounded-lg text-sm bg-gradient-to-r from-blue-600 to-purple-600 text-white hover:from-blue-700 hover:to-purple-700 transition-all shadow-sm hover:shadow-md"
              >
                免费注册
              </button> */}
            </div>
          )}
        </div>
      </header>
      
      {/* 主内容区 */}
      <main className="flex-grow">
        {/* 头部图片 */}
        <div className="relative h-96 overflow-hidden">
          <img
            src="https://images.unsplash.com/photo-1552664730-d307ca884978?ixlib=rb-4.0.3&auto=format&fit=crop&w=2070&q=80"
            alt="SaaS产品展示"
            className="w-full h-full object-cover"
          />
          <div className="absolute inset-0 bg-gradient-to-t from-black/60 to-transparent flex items-end">
            <div className="container mx-auto px-4 pb-12">
              <h1 className="text-4xl md:text-5xl font-bold text-white mb-4">
                企业数字化转型解决方案
              </h1>
              <p className="text-xl text-white/90 max-w-2xl">
                全场景全链路的SaaS产品，助力企业数字升级
              </p>
            </div>
          </div>
        </div>

        {/* 产品介绍区域 */}
        <div className="container mx-auto px-4 py-16">
          <div className="text-center mb-12">
            <h2 className="text-3xl md:text-4xl font-bold text-gray-900 mb-4">
              了解我们的SaaS产品
            </h2>
            <p className="text-lg text-gray-600 max-w-3xl mx-auto">
              全场景全链路的SaaS产品，助力企业数字升级
            </p>
          </div>

          {/* 产品展示 */}
          <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8">
            {/* 微商城 */}
            <div className="bg-white rounded-2xl p-8 shadow-lg border border-gray-100 hover:shadow-xl transition-all hover:-translate-y-1">
              <div className="w-16 h-16 bg-gradient-to-r from-blue-500 to-cyan-500 rounded-xl flex items-center justify-center mb-6 mx-auto">
                <svg xmlns="http://www.w3.org/2000/svg" className="h-8 w-8 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M16 11V7a4 4 0 00-8 0v4M5 9h14l1 12H4L5 9z" />
                </svg>
              </div>
              <h3 className="text-xl font-bold text-center mb-4">微商城</h3>
              <p className="text-gray-600 text-center mb-6">
                一站式电商解决方案，支持多店铺管理、营销活动、订单处理等功能
              </p>
              <div className="flex justify-center">
                <span className="px-4 py-1 bg-blue-100 text-blue-600 rounded-full text-sm font-medium">
                  电商解决方案
                </span>
              </div>
            </div>

            {/* 智慧零售 */}
            <div className="bg-white rounded-2xl p-8 shadow-lg border border-gray-100 hover:shadow-xl transition-all hover:-translate-y-1">
              <div className="w-16 h-16 bg-gradient-to-r from-green-500 to-emerald-500 rounded-xl flex items-center justify-center mb-6 mx-auto">
                <svg xmlns="http://www.w3.org/2000/svg" className="h-8 w-8 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z" />
                </svg>
              </div>
              <h3 className="text-xl font-bold text-center mb-4">智慧零售</h3>
              <p className="text-gray-600 text-center mb-6">
                智能门店管理系统，整合线上线下销售，提供数据分析与决策支持
              </p>
              <div className="flex justify-center">
                <span className="px-4 py-1 bg-green-100 text-green-600 rounded-full text-sm font-medium">
                  零售数字化
                </span>
              </div>
            </div>

            {/* OneCRM */}
            <div className="bg-white rounded-2xl p-8 shadow-lg border border-gray-100 hover:shadow-xl transition-all hover:-translate-y-1">
              <div className="w-16 h-16 bg-gradient-to-r from-purple-500 to-pink-500 rounded-xl flex items-center justify-center mb-6 mx-auto">
                <svg xmlns="http://www.w3.org/2000/svg" className="h-8 w-8 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
                </svg>
              </div>
              <h3 className="text-xl font-bold text-center mb-4">OneCRM</h3>
              <p className="text-gray-600 text-center mb-6">
                一体化客户关系管理，涵盖销售、营销、服务全流程，提升客户满意度
              </p>
              <div className="flex justify-center">
                <span className="px-4 py-1 bg-purple-100 text-purple-600 rounded-full text-sm font-medium">
                  客户管理
                </span>
              </div>
            </div>

            {/* 企微助手 */}
            <div className="bg-white rounded-2xl p-8 shadow-lg border border-gray-100 hover:shadow-xl transition-all hover:-translate-y-1">
              <div className="w-16 h-16 bg-gradient-to-r from-orange-500 to-red-500 rounded-xl flex items-center justify-center mb-6 mx-auto">
                <svg xmlns="http://www.w3.org/2000/svg" className="h-8 w-8 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 10h.01M12 10h.01M16 10h.01M9 16H5a2 2 0 01-2-2V6a2 2 0 012-2h14a2 2 0 012 2v8a2 2 0 01-2 2h-5l-5 5v-5z" />
                </svg>
              </div>
              <h3 className="text-xl font-bold text-center mb-4">企微助手</h3>
              <p className="text-gray-600 text-center mb-6">
                企业微信生态集成工具，实现客户沟通、社群运营、自动化营销等功能
              </p>
              <div className="flex justify-center">
                <span className="px-4 py-1 bg-orange-100 text-orange-600 rounded-full text-sm font-medium">
                  企业微信
                </span>
              </div>
            </div>
          </div>
        </div>

      </main>
      
      {/* 页脚 */}
      <footer className="bg-white border-t border-gray-100 py-12">
        <div className="container mx-auto px-4">
          <div className="text-center">
            <p className="text-gray-600 mb-6 text-lg">
              全场景全链路的SaaS产品，助力企业数字升级
            </p>
            <div className="flex justify-center space-x-8 text-sm mb-8">
              <a href="/admin" className="text-blue-600 hover:text-blue-700 transition-colors font-medium">产品介绍</a>
              <a href="/admin" className="text-blue-600 hover:text-blue-700 transition-colors font-medium">解决方案</a>
              <a href="/admin" className="text-blue-600 hover:text-blue-700 transition-colors font-medium">客户案例</a>
              <a href="/admin" className="text-blue-600 hover:text-blue-700 transition-colors font-medium">联系我们</a>
            </div>
            <div className="flex justify-center space-x-6 mb-8">
              <a href="#" className="text-gray-400 hover:text-blue-600 transition-colors">
                <svg className="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
                  <path fillRule="evenodd" d="M22 12c0-5.523-4.477-10-10-10S2 6.477 2 12c0 4.991 3.657 9.128 8.438 9.878v-6.987h-2.54V12h2.54V9.797c0-2.506 1.492-3.89 3.777-3.89 1.094 0 2.238.195 2.238.195v2.46h-1.26c-1.243 0-1.63.771-1.63 1.562V12h2.773l-.443 2.89h-2.33v6.988C18.343 21.128 22 16.991 22 12z" clipRule="evenodd" />
                </svg>
              </a>
              <a href="#" className="text-gray-400 hover:text-blue-600 transition-colors">
                <svg className="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
                  <path d="M8.29 20.251c7.547 0 11.675-6.253 11.675-11.675 0-.178 0-.355-.012-.53A8.348 8.348 0 0022 5.92a8.19 8.19 0 01-2.357.646 4.118 4.118 0 001.804-2.27 8.224 8.224 0 01-2.605.996 4.107 4.107 0 00-6.993 3.743 11.65 11.65 0 01-8.457-4.287 4.106 4.106 0 001.27 5.477A4.072 4.072 0 012.8 9.713v.052a4.105 4.105 0 003.292 4.022 4.095 4.095 0 01-1.853.07 4.108 4.108 0 003.834 2.85A8.233 8.233 0 012 18.407a11.616 11.616 0 006.29 1.84" />
                </svg>
              </a>
              <a href="#" className="text-gray-400 hover:text-blue-600 transition-colors">
                <svg className="w-6 h-6" fill="currentColor" viewBox="0 0 24 24" aria-hidden="true">
                  <path fillRule="evenodd" d="M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z" clipRule="evenodd" />
                </svg>
              </a>
            </div>
            <p className="text-gray-400 text-sm">
              © {new Date().getFullYear()} 企业数字化SaaS平台. 全场景全链路解决方案
            </p>
          </div>
        </div>
      </footer>
    </div>
  );
};

export default HomePage;