ModelPricingTabs.jsx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. Copyright (C) 2025 QuantumNous
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU Affero General Public License as
  5. published by the Free Software Foundation, either version 3 of the
  6. License, or (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU Affero General Public License for more details.
  11. You should have received a copy of the GNU Affero General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>.
  13. For commercial licensing, please contact support@quantumnous.com
  14. */
  15. import React from 'react';
  16. import { Tabs, TabPane, Tag } from '@douyinfe/semi-ui';
  17. const ModelPricingTabs = ({
  18. activeKey,
  19. setActiveKey,
  20. modelCategories,
  21. categoryCounts,
  22. availableCategories,
  23. t
  24. }) => {
  25. return (
  26. <Tabs
  27. activeKey={activeKey}
  28. type="card"
  29. collapsible
  30. onChange={key => setActiveKey(key)}
  31. className="mt-2"
  32. >
  33. {Object.entries(modelCategories)
  34. .filter(([key]) => availableCategories.includes(key))
  35. .map(([key, category]) => {
  36. const modelCount = categoryCounts[key] || 0;
  37. return (
  38. <TabPane
  39. tab={
  40. <span className="flex items-center gap-2">
  41. {category.icon && <span className="w-4 h-4">{category.icon}</span>}
  42. {category.label}
  43. <Tag
  44. color={activeKey === key ? 'red' : 'grey'}
  45. shape='circle'
  46. >
  47. {modelCount}
  48. </Tag>
  49. </span>
  50. }
  51. itemKey={key}
  52. key={key}
  53. />
  54. );
  55. })}
  56. </Tabs>
  57. );
  58. };
  59. export default ModelPricingTabs;