diff --git a/apps/dashboard/src/app/team/[team_slug]/(team)/~/projects/TeamProjectsPage.tsx b/apps/dashboard/src/app/team/[team_slug]/(team)/~/projects/TeamProjectsPage.tsx index 488c7f3c3f0..d25a6e24f75 100644 --- a/apps/dashboard/src/app/team/[team_slug]/(team)/~/projects/TeamProjectsPage.tsx +++ b/apps/dashboard/src/app/team/[team_slug]/(team)/~/projects/TeamProjectsPage.tsx @@ -23,6 +23,7 @@ import { SelectTrigger, } from "@/components/ui/select"; import { useDashboardRouter } from "@/lib/DashboardRouter"; +import { cn } from "@/lib/utils"; import { LazyCreateAPIKeyDialog } from "components/settings/ApiKeys/Create/LazyCreateAPIKeyDialog"; import { ChevronDownIcon, @@ -47,8 +48,9 @@ export function TeamProjectsPage(props: { const [isCreateProjectDialogOpen, setIsCreateProjectDialogOpen] = useState(false); const router = useDashboardRouter(); + const [isExpanded, setIsExpanded] = useState(false); - const projectsToShow = useMemo(() => { + const filteredProjects = useMemo(() => { let _projectsToShow = !searchTerm ? projects : projects.filter( @@ -77,6 +79,14 @@ export function TeamProjectsPage(props: { return _projectsToShow; }, [searchTerm, sortBy, projects]); + const maxProjectsToShow = 8; + + const projectsToShow = isExpanded + ? filteredProjects + : filteredProjects.slice(0, maxProjectsToShow); + + const showExpandCollapseButton = filteredProjects.length > maxProjectsToShow; + return (