diff --git a/client/src/pages/MyChatbots.tsx b/client/src/pages/MyChatbots.tsx index e0c3516..b11af04 100644 --- a/client/src/pages/MyChatbots.tsx +++ b/client/src/pages/MyChatbots.tsx @@ -47,12 +47,60 @@ export default function MyChatbotsPage() { ); } + // Calculate analytics + const totalLikes = + botsData?.my_bots?.reduce((sum, bot) => sum + bot.likes, 0) || 0; + const totalReports = + botsData?.my_bots?.reduce((sum, bot) => sum + bot.reports, 0) || 0; + const topRankedBot = (botsData?.my_bots || []).reduce( + (topBot, currentBot) => { + return currentBot.likes > (topBot?.likes || 0) ? currentBot : topBot; + }, + botsData?.my_bots?.[0] + ); return (
Top Ranked Bot
++ {topRankedBot.latest_version.name} +
++ Likes: {topRankedBot.likes} +
+