11"use client" ;
22
33import { Badge } from "@/components/ui/badge" ;
4+ import { Button } from "@/components/ui/button" ;
45import {
56 Table ,
67 TableBody ,
@@ -12,6 +13,9 @@ import {
1213import { useProjectTitleStore } from "@/store/useProjectTitleStore" ;
1314import { DashboardProjectsProps } from "@/types" ;
1415import Image from "next/image" ;
16+ import { useFilterStore } from "@/store/useFilterStore" ;
17+ import { usePathname } from "next/navigation" ;
18+ import { MagnifyingGlassIcon } from "@heroicons/react/24/outline" ;
1519
1620type ProjectsContainerProps = {
1721 projects : DashboardProjectsProps [ ] ;
@@ -62,95 +66,122 @@ const getColor = (color: string): string => {
6266 return _color ;
6367} ;
6468
69+ const tableColumns = [
70+ "Project" ,
71+ "Issues" ,
72+ "Language" ,
73+ "Popularity" ,
74+ "Stage" ,
75+ "Competition" ,
76+ "Activity" ,
77+ ] ;
78+
6579export default function ProjectsContainer ( {
6680 projects,
6781} : ProjectsContainerProps ) {
82+ const pathname = usePathname ( ) ;
83+ const { projectTitle } = useProjectTitleStore ( ) ;
84+ const { setShowFilters } = useFilterStore ( ) ;
85+
6886 const handleClick = ( link : string ) => {
6987 window . open ( link , "_blank" ) ;
7088 } ;
71- const { projectTitle } = useProjectTitleStore ( ) ;
72- const tableColums = [
73- "Project" ,
74- "Issues" ,
75- "Language" ,
76- "Popularity" ,
77- "Stage" ,
78- "Competition" ,
79- "Activity" ,
80- ] ;
89+
90+ const isProjectsPage = pathname === "/dashboard/projects" ;
91+
8192 return (
82- < div className = "w-full rounded-lg p-2 sm:p-4 " >
83- < div className = "flex items-center justify-between pb-1 " >
84- < h2 className = "text-xs sm:text-sm md:text-md font-semibold text-white" >
93+ < div className = "w-full p-6 sm:p-8 " >
94+ < div className = "flex items-center justify-between pb-6 " >
95+ < h2 className = "text-xl sm:text-2xl md:text-3xl font-semibold text-white tracking-tight " >
8596 { projectTitle }
8697 </ h2 >
98+ { isProjectsPage && (
99+ < Button
100+ className = "font-semibold text-white bg-ox-purple text-sm sm:text-base h-10 sm:h-11 px-5 sm:px-6 hover:bg-white-500 rounded-md"
101+ onClick = { ( ) => setShowFilters ( true ) }
102+ >
103+ Find projects
104+ </ Button >
105+ ) }
87106 </ div >
88- < div className = "rounded-lg border bg-ox-black-2 border-ox-gray border w-full overflow-x-auto" >
89- < Table className = "w-full" >
90- < TableHeader className = "w-full border" >
91- < TableRow className = "w-full border-ox-gray border-b" >
92- { tableColums . map ( ( name , index ) => (
93- < TableHead
94- key = { index }
95- className = { `flex-1 text-center text-zinc-400 font-semibold text-ox-purple
96- text-[12px] sm:text-sm` }
97- >
98- { name }
99- </ TableHead >
100- ) ) }
101- </ TableRow >
102- </ TableHeader >
103- < TableBody >
104- { projects . map ( ( project ) => (
105- < TableRow
106- key = { project . id }
107- className = "border-ox-gray border-y cursor-pointer"
108- onClick = { ( ) => {
109- handleClick ( project . url ) ;
110- } }
111- >
112- < TableCell className = "flex items-center gap-1 p-1 sm:p-2" >
113- < div className = "rounded-full overflow-hidden inline-block h-4 w-4 sm:h-6 sm:w-6 border" >
114- < Image
115- src = { project . avatarUrl }
116- className = "w-full h-full object-cover"
117- alt = { project . name }
118- width = { 10 }
119- height = { 10 }
120- />
121- </ div >
122- < TableCell className = "text-white text-[10px] sm:text-xs text-ox-white font-semibold" >
123- { project . name }
124- </ TableCell >
125- </ TableCell >
126- < TableCell className = "text-white text-[10px] sm:text-xs text-center text-ox-white p-1 sm:p-2" >
127- { project . totalIssueCount }
128- </ TableCell >
129- < TableCell className = "text-center p-1 sm:p-2" >
130- < Badge
131- variant = "secondary"
132- className = { `${ getColor ( project . primaryLanguage ) } text-[10px] sm:text-xs` }
107+ { projects && projects . length > 0 ? (
108+ < div className = "w-full overflow-x-auto bg-[#15161a] border border-[#1a1a1d] rounded-lg" >
109+ < Table className = "w-full" >
110+ < TableHeader className = "w-full border" >
111+ < TableRow className = "w-full border-[#1a1a1d] border-b" >
112+ { tableColumns . map ( ( name , index ) => (
113+ < TableHead
114+ key = { index }
115+ className = { `flex-1 text-center font-semibold text-ox-purple text-[12px] sm:text-sm` }
133116 >
134- { project . primaryLanguage }
135- </ Badge >
136- </ TableCell >
137- < TableCell className = "text-white text-[10px] sm:text-xs text-center text-ox-white font-semibold p-1 sm:p-2" >
138- { project . popularity }
139- </ TableCell >
140- < TableCell className = "text-white text-[10px] sm:text-xs text-center text-ox-white font-semibold md:table-cell p-1 sm:p-2" >
141- { project . stage }
142- </ TableCell >
143- < TableCell className = "text-white text-[10px] sm:text-xs text-center text-ox-white font-semibold md:table-cell p-1 sm:p-2" >
144- { project . competition }
145- </ TableCell >
146- < TableCell className = "text-white text-[10px] sm:text-xs text-center text-ox-white font-semibold md:table-cell p-1 sm:p-2" >
147- { project . activity }
148- </ TableCell >
117+ { name }
118+ </ TableHead >
119+ ) ) }
149120 </ TableRow >
150- ) ) }
151- </ TableBody >
152- </ Table >
153- </ div >
121+ </ TableHeader >
122+ < TableBody >
123+ { projects . map ( ( project ) => (
124+ < TableRow
125+ key = { project . id }
126+ className = "border-ox-gray border-y cursor-pointer"
127+ onClick = { ( ) => {
128+ handleClick ( project . url ) ;
129+ } }
130+ >
131+ < TableCell className = "flex items-center gap-1 p-1 sm:p-2" >
132+ < div className = "rounded-full overflow-hidden inline-block h-4 w-4 sm:h-6 sm:w-6 border" >
133+ < Image
134+ src = { project . avatarUrl }
135+ className = "w-full h-full object-cover"
136+ alt = { project . name }
137+ width = { 10 }
138+ height = { 10 }
139+ />
140+ </ div >
141+ < TableCell className = "text-white text-[10px] sm:text-xs text-ox-white font-semibold" >
142+ { project . name }
143+ </ TableCell >
144+ </ TableCell >
145+ < TableCell className = "text-white text-[10px] sm:text-xs text-center text-ox-white p-1 sm:p-2" >
146+ { project . totalIssueCount }
147+ </ TableCell >
148+ < TableCell className = "text-center p-1 sm:p-2" >
149+ < Badge
150+ variant = "secondary"
151+ className = { `${ getColor ( project . primaryLanguage ) } text-[10px] sm:text-xs` }
152+ >
153+ { project . primaryLanguage }
154+ </ Badge >
155+ </ TableCell >
156+ < TableCell className = "text-white text-[10px] sm:text-xs text-center text-ox-white font-semibold p-1 sm:p-2" >
157+ { project . popularity }
158+ </ TableCell >
159+ < TableCell className = "text-white text-[10px] sm:text-xs text-center text-ox-white font-semibold md:table-cell p-1 sm:p-2" >
160+ { project . stage }
161+ </ TableCell >
162+ < TableCell className = "text-white text-[10px] sm:text-xs text-center text-ox-white font-semibold md:table-cell p-1 sm:p-2" >
163+ { project . competition }
164+ </ TableCell >
165+ < TableCell className = "text-white text-[10px] sm:text-xs text-center text-ox-white font-semibold md:table-cell p-1 sm:p-2" >
166+ { project . activity }
167+ </ TableCell >
168+ </ TableRow >
169+ ) ) }
170+ </ TableBody >
171+ </ Table >
172+ </ div >
173+ ) : isProjectsPage ? (
174+ < div className = "flex flex-col justify-center items-center h-[calc(100vh-200px)] text-zinc-400 space-y-6" >
175+ < div className = "flex flex-col items-center gap-2" >
176+ < MagnifyingGlassIcon className = "size-12 text-ox-purple animate-pulse" />
177+ < p className = "text-xl font-medium" > Find Your Next Project</ p >
178+ </ div >
179+ < p className = "text-base text-center max-w-md" >
180+ Click the 'Find projects' button above to discover open
181+ source projects that match your interests
182+ </ p >
183+ </ div >
184+ ) : null }
154185 </ div >
155186 ) ;
156187}
0 commit comments