Sidebar.tsx 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. 'use client';
  2. import { FileText, LifeBuoy, MessageSquare, Settings, LucideIcon, Mail } from 'lucide-react';
  3. import { useLanguage } from '@/lib/i18n/LanguageContext';
  4. const TelegramIcon = ({ className }: { className?: string }) => (
  5. <svg viewBox="0 0 24 24" fill="currentColor" className={className}>
  6. <path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 11.944 0zm4.925 8.531l-1.97 9.28c-.145.658-.537.818-1.084.508l-3-2.21-1.446 1.394c-.16.16-.295.295-.605.295l.213-3.054 5.56-5.022c.242-.213-.054-.333-.373-.121l-6.869 4.326-2.96-.924c-.643-.204-.657-.643.136-.953l11.57-4.458c.535-.196 1.006.128.832.941z"/>
  7. </svg>
  8. );
  9. const WhatsAppIcon = ({ className }: { className?: string }) => (
  10. <svg viewBox="0 0 24 24" fill="currentColor" className={className}>
  11. <path d="M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.008-.57-.008-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 0 1-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 0 1-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 0 1 2.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0 0 12.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 0 0 5.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 0 0-3.48-8.413z"/>
  12. </svg>
  13. );
  14. interface SidebarProps {
  15. activeTab: string;
  16. setActiveTab: (tab: string) => void;
  17. }
  18. interface MenuItem {
  19. id: string;
  20. label: string;
  21. icon: LucideIcon;
  22. }
  23. export default function Sidebar({ activeTab, setActiveTab }: SidebarProps) {
  24. const { t } = useLanguage();
  25. const TELEGRAM_USERNAME = "STRATA Support";
  26. const TELEGRAM_NUMBER = "+8617386033451";
  27. const WHATSAPP_NUMBER = "8617386033451";
  28. const menuItems: MenuItem[] = [
  29. { id: 'orders', label: t('sidebar.orders'), icon: FileText },
  30. { id: 'tickets', label: t('sidebar.tickets'), icon: LifeBuoy },
  31. { id: 'settings', label: t('sidebar.settings'), icon: Settings },
  32. ];
  33. return (
  34. <div className="space-y-4 font-mono">
  35. {/* 导航菜单实体按键组 */}
  36. <div className="space-y-2 select-none">
  37. {menuItems.map((item) => {
  38. const Icon = item.icon;
  39. const isActive = activeTab === item.id;
  40. return (
  41. <button
  42. key={item.id}
  43. onClick={() => setActiveTab(item.id)}
  44. className={`w-full flex items-center gap-2.5 px-4 py-3 border-2 border-black text-xs font-black uppercase transition active:translate-x-0.5 active:translate-y-0.5 active:shadow-none
  45. ${isActive
  46. ? 'bg-amber-300 text-black shadow-[4px_4px_0px_#000]'
  47. : 'bg-white text-neutral-800 shadow-[2px_2px_0px_#000] hover:bg-neutral-50'
  48. }`}
  49. >
  50. <Icon size={16} className="text-black shrink-0" />
  51. <span>[ {item.label} ]</span>
  52. </button>
  53. );
  54. })}
  55. </div>
  56. {/* 复古客服支持档案卡 */}
  57. <div className="bg-neutral-50 border-2 border-black p-4 shadow-[4px_4px_0px_#000] space-y-3">
  58. <div className="border-b-2 border-black pb-2 flex items-center justify-between text-xs font-black uppercase text-black">
  59. <span className="flex items-center gap-1.5">
  60. <MessageSquare size={14} className="text-black" />
  61. <span>[ {t('sidebar.contact_support')} ]</span>
  62. </span>
  63. <span className="text-[10px] bg-neutral-200 px-1 border border-black">24/7</span>
  64. </div>
  65. <p className="text-[11px] text-neutral-600 font-sans leading-relaxed">
  66. {t('sidebar.contact_desc')}
  67. </p>
  68. {/* 联系方式列表 */}
  69. <ul className="text-xs text-neutral-800 space-y-2 font-mono">
  70. {/* Email */}
  71. <li className="flex items-center gap-2 bg-white border border-black p-1.5 shadow-[1px_1px_0px_#000]">
  72. <Mail size={12} className="text-black shrink-0" />
  73. <a href="mailto:support@text.skin" className="hover:underline truncate text-[11px]">
  74. support@text.skin
  75. </a>
  76. </li>
  77. {/* Telegram */}
  78. <li className="flex items-center gap-2 bg-white border border-black p-1.5 shadow-[1px_1px_0px_#000]">
  79. <TelegramIcon className="w-3 h-3 text-black shrink-0" />
  80. <a
  81. href={`https://t.me/${TELEGRAM_NUMBER}`}
  82. target="_blank"
  83. rel="noopener noreferrer"
  84. className="hover:underline truncate text-[11px]"
  85. >
  86. @{TELEGRAM_USERNAME}
  87. </a>
  88. </li>
  89. {/* WhatsApp */}
  90. <li className="flex items-center gap-2 bg-white border border-black p-1.5 shadow-[1px_1px_0px_#000]">
  91. <WhatsAppIcon className="w-3 h-3 text-black shrink-0" />
  92. <a
  93. href={`https://wa.me/${WHATSAPP_NUMBER}`}
  94. target="_blank"
  95. rel="noopener noreferrer"
  96. className="hover:underline truncate text-[11px]"
  97. >
  98. WhatsApp
  99. </a>
  100. </li>
  101. </ul>
  102. </div>
  103. </div>
  104. );
  105. }