Sidebar.jsx 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import React from 'react';
  2. import { Home, Clock, Settings, User, Radio, Cloud } from 'lucide-react';
  3. export const Sidebar = ({ activeTab, setActiveTab }) => {
  4. const menuItems = [
  5. { id: 'dashboard', label: '首页', icon: Home, subtitle: '新建与最近记录' },
  6. { id: 'records', label: '历史记录', icon: Clock, subtitle: '多模态时间轴' },
  7. { id: 'devices', label: '硬件设备', icon: Radio, subtitle: '微光 Spark BLE' },
  8. { id: 'sync', label: '云端同步', icon: Cloud, subtitle: '数据库隔离' },
  9. { id: 'profile', label: '个人中心', icon: User, subtitle: '账号与设置' },
  10. ];
  11. return (
  12. <aside className="w-56 bg-white border-r border-black/10 flex flex-col justify-between shrink-0 hidden md:flex min-h-[calc(100vh-61px)]">
  13. <div className="p-4 space-y-6">
  14. <div>
  15. <div className="px-3 mb-3 text-[10px] font-semibold text-slate-400 uppercase tracking-widest font-mono">
  16. 星痕导航
  17. </div>
  18. <nav className="space-y-1">
  19. {menuItems.map((item) => {
  20. const Icon = item.icon;
  21. const isActive = activeTab === item.id;
  22. return (
  23. <button
  24. key={item.id}
  25. onClick={() => setActiveTab(item.id)}
  26. className={`w-full flex items-center justify-between px-3.5 py-2.5 rounded-xl text-xs font-medium transition-all ${
  27. isActive
  28. ? 'bg-[#EAEAEA] text-[#1D1D1F] font-semibold shadow-2xs'
  29. : 'text-[#6E6E73] hover:text-[#1D1D1F] hover:bg-slate-100/60'
  30. }`}
  31. >
  32. <div className="flex items-center space-x-3">
  33. <Icon className={`w-4 h-4 ${isActive ? 'text-[#1D1D1F]' : 'text-slate-500'}`} />
  34. <span>{item.label}</span>
  35. </div>
  36. {isActive && (
  37. <span className="w-1.5 h-1.5 rounded-full bg-[#1D1D1F]"></span>
  38. )}
  39. </button>
  40. );
  41. })}
  42. </nav>
  43. </div>
  44. {/* Hardware Status Promo Card */}
  45. <div className="p-4 rounded-2xl bg-[#F8F9FA] border border-black/10 relative overflow-hidden">
  46. <div className="flex items-center space-x-2 text-[#1D1D1F] text-xs font-semibold mb-1">
  47. <Radio className="w-4 h-4 text-emerald-600" />
  48. <span>微光 Spark 录音硬件</span>
  49. </div>
  50. <p className="text-[11px] text-[#6E6E73] leading-relaxed mb-2">
  51. 手机 App 通过 BLE 蓝牙无缝连接“微光 Spark”,实时同步现场记录与事件标注。
  52. </p>
  53. <div className="text-[10px] font-mono text-slate-500 flex items-center space-x-1.5">
  54. <span className="w-1.5 h-1.5 rounded-full bg-emerald-500"></span>
  55. <span>服务器已隔离多账号数据</span>
  56. </div>
  57. </div>
  58. </div>
  59. {/* Footer Signature */}
  60. <div className="p-4 border-t border-black/10 text-[11px] text-slate-400 font-mono space-y-1">
  61. <div className="flex justify-between items-center">
  62. <span>CelestiaTrace Engine</span>
  63. <span className="text-slate-700 font-semibold">v2.0</span>
  64. </div>
  65. <div className="text-[10px] text-slate-400">
  66. 纯粹星辰 · 倾听,然后深刻。
  67. </div>
  68. </div>
  69. </aside>
  70. );
  71. };
  72. // Floating iOS Bottom TabBar component matching the screenshot exactly
  73. export const FloatingTabBar = ({ activeTab, setActiveTab }) => {
  74. const tabs = [
  75. { id: 'dashboard', label: '首页', icon: Home },
  76. { id: 'records', label: '历史记录', icon: Clock },
  77. { id: 'devices', label: '设置', icon: Settings },
  78. { id: 'profile', label: '个人中心', icon: User },
  79. ];
  80. return (
  81. <div className="fixed bottom-5 left-1/2 -translate-x-1/2 z-50 px-3 py-2 rounded-full bg-white/95 backdrop-blur-xl border border-black/10 shadow-[0_8px_30px_rgba(0,0,0,0.08)] flex items-center space-x-1 sm:space-x-2">
  82. {tabs.map((tab) => {
  83. const Icon = tab.icon;
  84. const isActive = activeTab === tab.id;
  85. return (
  86. <button
  87. key={tab.id}
  88. onClick={() => setActiveTab(tab.id)}
  89. className={`flex flex-col sm:flex-row items-center justify-center space-x-0 sm:space-x-2 px-5 py-2 rounded-full text-xs font-medium transition-all ${
  90. isActive
  91. ? 'bg-[#EAEAEA] text-[#1D1D1F] font-semibold scale-102'
  92. : 'text-[#6E6E73] hover:text-[#1D1D1F]'
  93. }`}
  94. >
  95. <Icon className={`w-4 h-4 ${isActive ? 'text-[#1D1D1F]' : 'text-[#6E6E73]'}`} />
  96. <span className="text-[12px] mt-0.5 sm:mt-0">{tab.label}</span>
  97. </button>
  98. );
  99. })}
  100. </div>
  101. );
  102. };