Options.tsx 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { useState } from 'react';
  2. import '@src/Options.css';
  3. import { Button } from '@extension/ui';
  4. import { withErrorBoundary, withSuspense } from '@extension/shared';
  5. import { GeneralSettings } from './components/GeneralSettings';
  6. import { ModelSettings } from './components/ModelSettings';
  7. const Options = () => {
  8. const [activeTab, setActiveTab] = useState('models');
  9. const renderTabContent = () => {
  10. switch (activeTab) {
  11. case 'general':
  12. return <GeneralSettings />;
  13. case 'models':
  14. return <ModelSettings />;
  15. default:
  16. return null;
  17. }
  18. };
  19. return (
  20. <div className="min-h-screen min-w-[768px] flex bg-[url('/bg.jpg')] bg-cover bg-center text-gray-900">
  21. {/* Vertical Navigation Bar */}
  22. <nav className="w-48 border-r border-white/20 backdrop-blur-sm bg-[#0EA5E9]/10">
  23. <div className="p-4">
  24. <h1 className="text-xl font-bold mb-6 text-gray-800">Settings</h1>
  25. <ul className="space-y-2">
  26. {[
  27. { id: 'general', icon: '⚙️', label: 'General' },
  28. { id: 'models', icon: '📊', label: 'Models' },
  29. ].map(item => (
  30. <li key={item.id}>
  31. <Button
  32. onClick={() => setActiveTab(item.id)}
  33. className={`w-full text-left px-4 py-2 rounded-lg flex items-center space-x-2
  34. ${
  35. activeTab !== item.id
  36. ? 'bg-[#0EA5E9]/15 backdrop-blur-sm font-medium text-gray-700 hover:text-white'
  37. : 'backdrop-blur-sm text-white'
  38. }`}>
  39. <span>{item.icon}</span>
  40. <span>{item.label}</span>
  41. </Button>
  42. </li>
  43. ))}
  44. </ul>
  45. </div>
  46. </nav>
  47. {/* Main Content Area */}
  48. <main className="flex-1 p-8 backdrop-blur-sm bg-white/10">
  49. <div className="min-w-[512px] max-w-[1024px] mx-auto">{renderTabContent()}</div>
  50. </main>
  51. </div>
  52. );
  53. };
  54. export default withErrorBoundary(withSuspense(Options, <div>Loading...</div>), <div>Error Occurred</div>);