Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
alissacrane-cb committed Nov 6, 2024
1 parent ba9b2df commit 8e48787
Showing 1 changed file with 43 additions and 26 deletions.
69 changes: 43 additions & 26 deletions app/components/AgentStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@ import { AGENT_WALLET_ADDRESS, notoSansThai } from '../constants';
import { translations } from '../translations';
import type { Language } from '../types';

type AgentStatsItemProps = {
currentLanguage: Language;
label: string;
value: string | number;
};

function AgentStatsItem({
currentLanguage,
label,
value,
}: AgentStatsItemProps) {
return (
<li className={currentLanguage === 'th' ? notoSansThai.className : ''}>
{`${label}: ${value}`}
</li>
);
}

type AgentStats = {
currentLanguage: Language;
};
Expand All @@ -26,32 +44,31 @@ export default function AgentStats({ currentLanguage }: AgentStats) {
</span>
{/* TODO: update with actual data */}
<ul className="space-y-1 pt-4">
<li
className={currentLanguage === 'th' ? notoSansThai.className : ''}
>
{translations[currentLanguage].profile.stats.earned}: $ N/A
</li>
<li
className={currentLanguage === 'th' ? notoSansThai.className : ''}
>
{translations[currentLanguage].profile.stats.spent}: $ N/A
</li>
<li
className={currentLanguage === 'th' ? notoSansThai.className : ''}
>
{translations[currentLanguage].profile.stats.nfts}: N/A
</li>
<li
className={currentLanguage === 'th' ? notoSansThai.className : ''}
>
{translations[currentLanguage].profile.stats.tokens}: N/A
</li>
<li
className={currentLanguage === 'th' ? notoSansThai.className : ''}
>
{translations[currentLanguage].profile.stats.transactions}:{' '}
{transactionCount}
</li>
<AgentStatsItem
currentLanguage={currentLanguage}
label={translations[currentLanguage].profile.stats.earned}
value="N/A"
/>
<AgentStatsItem
currentLanguage={currentLanguage}
label={translations[currentLanguage].profile.stats.spent}
value="N/A"
/>
<AgentStatsItem
currentLanguage={currentLanguage}
label={translations[currentLanguage].profile.stats.nfts}
value="N/A"
/>
<AgentStatsItem
currentLanguage={currentLanguage}
label={translations[currentLanguage].profile.stats.tokens}
value="N/A"
/>
<AgentStatsItem
currentLanguage={currentLanguage}
label={translations[currentLanguage].profile.stats.transactions}
value={transactionCount || 'N/A'}
/>
</ul>
</div>
</div>
Expand Down

0 comments on commit 8e48787

Please sign in to comment.