import React from 'react'
import { ArrowLeft } from 'lucide-react'
import { Link } from 'react-router-dom'
import CloudflareKVDemo from '../components/CloudflareKVDemo'

const KVTestPage: React.FC = () => {
  return (
    <div className="min-h-screen bg-secondary-50">
      {/* Header */}
      <div className="bg-white border-b border-secondary-200 px-6 py-4">
        <div className="flex items-center space-x-4">
          <Link
            to="/"
            className="flex items-center space-x-2 text-secondary-600 hover:text-secondary-900 transition-colors"
          >
            <ArrowLeft size={20} />
            <span>返回首页</span>
          </Link>
          <div className="h-6 w-px bg-secondary-300" />
          <h1 className="text-2xl font-bold text-secondary-900">
            Cloudflare KV 测试
          </h1>
        </div>
      </div>

      {/* Content */}
      <div className="p-6">
        <div className="max-w-6xl mx-auto">
          {/* Description */}
          <div className="bg-white rounded-lg shadow-sm border border-secondary-200 p-6 mb-6">
            <h2 className="text-lg font-semibold text-secondary-900 mb-3">
              关于 Cloudflare KV 测试
            </h2>
            <p className="text-secondary-600 mb-4">
              这个页面演示了如何在 MixVideo V2 中使用 Cloudflare KV 存储。
              您可以测试键值对的存储、读取、删除和批量操作功能。
            </p>
            <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
              <div className="bg-blue-50 p-4 rounded-lg">
                <h3 className="font-medium text-blue-900 mb-2">存储数据</h3>
                <p className="text-sm text-blue-700">
                  将键值对数据存储到 Cloudflare KV
                </p>
              </div>
              <div className="bg-green-50 p-4 rounded-lg">
                <h3 className="font-medium text-green-900 mb-2">读取数据</h3>
                <p className="text-sm text-green-700">
                  根据键名获取存储的数据
                </p>
              </div>
              <div className="bg-purple-50 p-4 rounded-lg">
                <h3 className="font-medium text-purple-900 mb-2">列出键名</h3>
                <p className="text-sm text-purple-700">
                  按前缀搜索和列出所有键名
                </p>
              </div>
              <div className="bg-orange-50 p-4 rounded-lg">
                <h3 className="font-medium text-orange-900 mb-2">批量操作</h3>
                <p className="text-sm text-orange-700">
                  一次性处理多个键值对操作
                </p>
              </div>
            </div>
          </div>

          {/* KV Demo Component */}
          <CloudflareKVDemo />
        </div>
      </div>
    </div>
  )
}

export default KVTestPage
