@@ -23,6 +23,7 @@ import {
2323 SelectTrigger ,
2424} from "@/components/ui/select" ;
2525import { useDashboardRouter } from "@/lib/DashboardRouter" ;
26+ import { cn } from "@/lib/utils" ;
2627import { LazyCreateAPIKeyDialog } from "components/settings/ApiKeys/Create/LazyCreateAPIKeyDialog" ;
2728import {
2829 ChevronDownIcon ,
@@ -47,8 +48,9 @@ export function TeamProjectsPage(props: {
4748 const [ isCreateProjectDialogOpen , setIsCreateProjectDialogOpen ] =
4849 useState ( false ) ;
4950 const router = useDashboardRouter ( ) ;
51+ const [ isExpanded , setIsExpanded ] = useState ( false ) ;
5052
51- const projectsToShow = useMemo ( ( ) => {
53+ const filteredProjects = useMemo ( ( ) => {
5254 let _projectsToShow = ! searchTerm
5355 ? projects
5456 : projects . filter (
@@ -77,6 +79,14 @@ export function TeamProjectsPage(props: {
7779 return _projectsToShow ;
7880 } , [ searchTerm , sortBy , projects ] ) ;
7981
82+ const maxProjectsToShow = 8 ;
83+
84+ const projectsToShow = isExpanded
85+ ? filteredProjects
86+ : filteredProjects . slice ( 0 , maxProjectsToShow ) ;
87+
88+ const showExpandCollapseButton = filteredProjects . length > maxProjectsToShow ;
89+
8090 return (
8191 < div className = "flex grow flex-col" >
8292 { /* Filters + Add New */ }
@@ -132,6 +142,27 @@ export function TeamProjectsPage(props: {
132142 </ div >
133143 ) }
134144
145+ { showExpandCollapseButton && (
146+ < div className = "mt-4 flex items-center justify-end" >
147+ < Button
148+ size = "sm"
149+ variant = "ghost"
150+ className = "gap-2"
151+ onClick = { ( ) => {
152+ setIsExpanded ( ( v ) => ! v ) ;
153+ } }
154+ >
155+ < ChevronDownIcon
156+ className = { cn (
157+ "size-4 transition-transform" ,
158+ isExpanded && "rotate-180" ,
159+ ) }
160+ />
161+ { isExpanded ? "Show less" : "Show more" }
162+ </ Button >
163+ </ div >
164+ ) }
165+
135166 < LazyCreateAPIKeyDialog
136167 open = { isCreateProjectDialogOpen }
137168 onOpenChange = { setIsCreateProjectDialogOpen }
@@ -160,7 +191,7 @@ function ProjectCard(props: {
160191 { /* TODO - set image */ }
161192 < ProjectAvatar className = "size-10 rounded-full" src = "" />
162193
163- < div className = "flex-grow flex-col gap-1.5 " >
194+ < div className = "flex flex -grow flex-col gap-1" >
164195 < Link
165196 className = "group static before:absolute before:top-0 before:right-0 before:bottom-0 before:left-0 before:z-0"
166197 // remove /connect when we have overview page
0 commit comments