11"use client" ;
2- import React , { useState , useEffect } from 'react' ;
3- import { useQuery } from '@tanstack/react-query' ;
2+ import { fetchSubmission , type Submission } from "@/api/fetchIdeas" ;
3+ import { fetchTeams } from "@/api/fetchTeams" ;
44import { DataTable } from "@/components/table/data-table" ;
55import { DataTableColumnHeader } from "@/components/table/data-table-column-header" ;
66import { Card , CardContent , CardHeader , CardTitle } from "@/components/ui/card" ;
77import { Select , SelectContent , SelectItem , SelectTrigger , SelectValue } from "@/components/ui/select" ;
8- import { fetchTeams } from "@/api/fetchTeams" ;
9- import { fetchSubmission , type Submission } from "@/api/fetchIdeas" ;
108import { type Team } from "@/data/schema" ;
9+ import { useQuery } from '@tanstack/react-query' ;
1110import { type ColumnDef } from "@tanstack/react-table" ;
11+ import { useEffect , useState } from 'react' ;
1212
1313interface TeamData {
1414 id : string ;
@@ -77,8 +77,8 @@ export default function TeamsIdeasTable() {
7777
7878 const filtered = processedData . filter ( team => {
7979 const matchesSearch = searchTerm
80- ? ( team . name ?. toLowerCase ( ) . includes ( searchTerm . toLowerCase ( ) ) || false ) ||
81- ( team . submission ?. title ?. toLowerCase ( ) . includes ( searchTerm . toLowerCase ( ) ) || false )
80+ ? ( team . name ?. toLowerCase ( ) . includes ( searchTerm . toLowerCase ( ) ) ?? false ) ||
81+ ( team . submission ?. title ?. toLowerCase ( ) . includes ( searchTerm . toLowerCase ( ) ) ?? false )
8282 : true ;
8383
8484 const matchesTrack = selectedTrack
@@ -99,7 +99,7 @@ export default function TeamsIdeasTable() {
9999 ) ,
100100 cell : ( { row } ) => (
101101 < div className = "max-w-[200px] truncate font-medium" >
102- { row . getValue ( "name" ) || "Unnamed Team" }
102+ { row . getValue ( "name" ) ?? "Unnamed Team" }
103103 </ div >
104104 ) ,
105105 } ,
@@ -122,7 +122,7 @@ export default function TeamsIdeasTable() {
122122 ) ,
123123 cell : ( { row } ) => (
124124 < div className = "max-w-[200px] truncate" >
125- { row . original . submission ?. title || "No submission" }
125+ { row . original . submission ?. title ?? "No submission" }
126126 </ div >
127127 ) ,
128128 } ,
@@ -134,7 +134,7 @@ export default function TeamsIdeasTable() {
134134 ) ,
135135 cell : ( { row } ) => (
136136 < div className = "max-w-[300px] truncate" >
137- { row . original . submission ?. description || "No description" }
137+ { row . original . submission ?. description ?? "No description" }
138138 </ div >
139139 ) ,
140140 } ,
@@ -146,7 +146,7 @@ export default function TeamsIdeasTable() {
146146 ) ,
147147 cell : ( { row } ) => (
148148 < div className = "max-w-[200px] truncate" >
149- { row . original . submission ?. track || "Unassigned" }
149+ { row . original . submission ?. track ?? "Unassigned" }
150150 </ div >
151151 ) ,
152152 } ,
@@ -183,14 +183,14 @@ export default function TeamsIdeasTable() {
183183 onChange = { ( e ) => setSearchTerm ( e . target . value ) }
184184 />
185185 < Select
186- value = { selectedTrack || "all" }
186+ value = { selectedTrack ?? "all" }
187187 onValueChange = { ( value ) => setSelectedTrack ( value === "all" ? "" : value ) }
188188 >
189- < SelectTrigger className = "w-48" >
189+ < SelectTrigger className = "w-48 p-6 " >
190190 < SelectValue placeholder = "Filter by track" />
191191 </ SelectTrigger >
192- < SelectContent >
193- < SelectItem value = "all" > All Tracks</ SelectItem >
192+ < SelectContent >
193+ < SelectItem value = "all" > All Tracks</ SelectItem >
194194 { availableTracks . map ( ( track ) => (
195195 < SelectItem key = { track } value = { track } >
196196 { track }
0 commit comments