{userData.teams?.length && userData.teams?.length > 0 ? (
- userData.teams?.map((team, index) => (
-
- {team.team_alias || team.team_id}
-
- ))
+ <>
+ {userData.teams?.slice(0, isTeamsExpanded ? userData.teams.length : 20).map((team, index) => (
+
+ {team.team_alias || team.team_id}
+
+ ))}
+ {!isTeamsExpanded && userData.teams?.length > 20 && (
+
+
+ +{userData.teams.length - 20} more
+
+
+
+ {userData.teams?.slice(20).map((team, index) => (
+
+ {team.team_alias || team.team_id}
+
+ ))}
+
+
+
+
+ )}
+ >
) : (
No teams
)}
From 80970951c500ec1a61bfa8546d9fd3d472a08c9f Mon Sep 17 00:00:00 2001
From: tanjiro <56165694+NANDINI-star@users.noreply.github.com>
Date: Tue, 2 Sep 2025 19:36:06 +0900
Subject: [PATCH 3/3] fix ui for expandable badge
---
.../components/view_users/user_info_view.tsx | 90 +++++++------------
1 file changed, 33 insertions(+), 57 deletions(-)
diff --git a/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx b/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx
index 59d2b8e386..c36bde78a7 100644
--- a/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx
+++ b/ui/litellm-dashboard/src/components/view_users/user_info_view.tsx
@@ -1,6 +1,6 @@
import React, { useState } from "react"
import { Card, Text, Button, Grid, Col, Tab, TabList, TabGroup, TabPanel, TabPanels, Title, Badge } from "@tremor/react"
-import { ArrowLeftIcon, TrashIcon, RefreshIcon, ChevronDownIcon, ChevronUpIcon } from "@heroicons/react/outline"
+import { ArrowLeftIcon, TrashIcon, RefreshIcon } from "@heroicons/react/outline"
import {
userInfoCall,
userDeleteCall,
@@ -283,19 +283,7 @@ export default function UserInfoView({
-
- Teams
- {userData.teams?.length && userData.teams?.length > 20 && (
-
- )}
-
+ Teams
{userData.teams?.length && userData.teams?.length > 0 ? (
@@ -305,21 +293,22 @@ export default function UserInfoView({
))}
{!isTeamsExpanded && userData.teams?.length > 20 && (
-
-
- +{userData.teams.length - 20} more
-
-
-
- {userData.teams?.slice(20).map((team, index) => (
-
- {team.team_alias}
-
- ))}
-
-
-
-
+
setIsTeamsExpanded(true)}
+ >
+ +{userData.teams.length - 20} more
+
+ )}
+ {isTeamsExpanded && userData.teams?.length > 20 && (
+
setIsTeamsExpanded(false)}
+ >
+ Show Less
+
)}
) : (
@@ -421,19 +410,7 @@ export default function UserInfoView({
-
- Teams
- {userData.teams?.length && userData.teams?.length > 20 && (
-
- )}
-
+
Teams
{userData.teams?.length && userData.teams?.length > 0 ? (
<>
@@ -447,21 +424,20 @@ export default function UserInfoView({
))}
{!isTeamsExpanded && userData.teams?.length > 20 && (
-
-
- +{userData.teams.length - 20} more
-
-
-
- {userData.teams?.slice(20).map((team, index) => (
-
- {team.team_alias || team.team_id}
-
- ))}
-
-
-
-
+
setIsTeamsExpanded(true)}
+ >
+ +{userData.teams.length - 20} more
+
+ )}
+ {isTeamsExpanded && userData.teams?.length > 20 && (
+
setIsTeamsExpanded(false)}
+ >
+ Show Less
+
)}
>
) : (