1
0

agent-tiers.tsx 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. import { Progress } from "./ui/progress"
  2. export const tiers = [
  3. { name: "None", requiredAIUS: 0 },
  4. { name: "Newborn", requiredAIUS: 100 },
  5. { name: "Baby", requiredAIUS: 500 },
  6. { name: "Child", requiredAIUS: 1000 },
  7. { name: "Teen", requiredAIUS: 5000 },
  8. { name: "Adult", requiredAIUS: 10000 },
  9. ]
  10. interface AgentTiersProps {
  11. currentTier: {
  12. name: "None" | "Newborn" | "Baby" | "Child" | "Teen" | "Adult"
  13. level: number
  14. stakedAIUS: number
  15. }
  16. }
  17. export function AgentTiers({ currentTier }: AgentTiersProps) {
  18. const currentTierIndex = tiers.findIndex((tier) => tier.name === currentTier.name)
  19. const currentTierRequired = tiers[currentTierIndex]?.requiredAIUS ?? 0
  20. const nextTier = tiers[currentTierIndex + 1]
  21. const progress = nextTier
  22. ? ((currentTier.stakedAIUS - currentTierRequired) /
  23. (nextTier.requiredAIUS - currentTierRequired)) *
  24. 100
  25. : 100
  26. return (
  27. <div className="bg-white p-6 rounded-lg border border-gray-200 shadow-sm">
  28. <h2 className="text-2xl font-orbitron mb-6 text-gray-800">Agent Level</h2>
  29. <div className="space-y-6">
  30. <div className="flex items-center">
  31. <TierIcon name={currentTier.name} className="w-12 h-12 mr-4" />
  32. <div className="flex-1">
  33. <div className="flex justify-between mb-2">
  34. <span className="font-roboto-mono text-gray-600 text-sm">{currentTier.name}</span>
  35. <span className="font-roboto-mono text-gray-500 text-sm">Level {currentTier.level}</span>
  36. </div>
  37. <Progress value={progress} className="h-2 bg-gray-200" />
  38. <div className="flex justify-between mt-1">
  39. <span className="font-roboto-mono text-gray-500 text-xs">{currentTier.stakedAIUS} AIUS</span>
  40. {nextTier && (
  41. <span className="font-roboto-mono text-gray-500 text-xs">
  42. {nextTier.requiredAIUS} AIUS
  43. </span>
  44. )}
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. )
  51. }
  52. function TierIcon({ name, className }: { name: string; className?: string }) {
  53. switch (name) {
  54. case "Newborn":
  55. return (
  56. <svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
  57. <circle cx="12" cy="12" r="10" stroke="#4F46E5" strokeWidth="2" />
  58. <circle cx="12" cy="12" r="5" fill="#4F46E5" />
  59. </svg>
  60. )
  61. case "Baby":
  62. return (
  63. <svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
  64. <circle cx="12" cy="12" r="10" stroke="#4F46E5" strokeWidth="2" />
  65. <path
  66. d="M8 14C9.10457 15.5 10.5 16 12 16C13.5 16 14.8954 15.5 16 14"
  67. stroke="#4F46E5"
  68. strokeWidth="2"
  69. strokeLinecap="round"
  70. />
  71. </svg>
  72. )
  73. case "Child":
  74. return (
  75. <svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
  76. <circle cx="12" cy="12" r="10" stroke="#4F46E5" strokeWidth="2" />
  77. <circle cx="9" cy="10" r="1" fill="#4F46E5" />
  78. <circle cx="15" cy="10" r="1" fill="#4F46E5" />
  79. <path
  80. d="M8 14C9.10457 15.5 10.5 16 12 16C13.5 16 14.8954 15.5 16 14"
  81. stroke="#4F46E5"
  82. strokeWidth="2"
  83. strokeLinecap="round"
  84. />
  85. </svg>
  86. )
  87. case "Teen":
  88. return (
  89. <svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
  90. <circle cx="12" cy="12" r="10" stroke="#4F46E5" strokeWidth="2" />
  91. <circle cx="9" cy="10" r="1" fill="#4F46E5" />
  92. <circle cx="15" cy="10" r="1" fill="#4F46E5" />
  93. <path
  94. d="M8 14C9.10457 15.5 10.5 16 12 16C13.5 16 14.8954 15.5 16 14"
  95. stroke="#4F46E5"
  96. strokeWidth="2"
  97. strokeLinecap="round"
  98. />
  99. <path d="M12 7V9" stroke="#4F46E5" strokeWidth="2" strokeLinecap="round" />
  100. </svg>
  101. )
  102. case "Adult":
  103. return (
  104. <svg className={className} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
  105. <circle cx="12" cy="12" r="10" stroke="#4F46E5" strokeWidth="2" />
  106. <circle cx="9" cy="10" r="1" fill="#4F46E5" />
  107. <circle cx="15" cy="10" r="1" fill="#4F46E5" />
  108. <path
  109. d="M8 14C9.10457 15.5 10.5 16 12 16C13.5 16 14.8954 15.5 16 14"
  110. stroke="#4F46E5"
  111. strokeWidth="2"
  112. strokeLinecap="round"
  113. />
  114. <path d="M12 7V9" stroke="#4F46E5" strokeWidth="2" strokeLinecap="round" />
  115. <path d="M7 12L9 12" stroke="#4F46E5" strokeWidth="2" strokeLinecap="round" />
  116. <path d="M15 12L17 12" stroke="#4F46E5" strokeWidth="2" strokeLinecap="round" />
  117. </svg>
  118. )
  119. default:
  120. return (
  121. <div className={className}>
  122. <svg viewBox="0 0 24 24" fill="none" className="w-full h-full" xmlns="http://www.w3.org/2000/svg">
  123. <circle cx="12" cy="12" r="10" stroke="#E5E7EB" strokeWidth="2" />
  124. <text x="12" y="16" textAnchor="middle" fill="#9CA3AF" fontSize="10">None</text>
  125. </svg>
  126. </div>
  127. )
  128. }
  129. }