@@ -11,7 +11,6 @@ import {
1111 MoreVertical ,
1212 Plus ,
1313 Search ,
14- Table2 ,
1514 Trash ,
1615 X ,
1716} from 'lucide-react'
@@ -24,6 +23,7 @@ import { LOAD_TAB_FROM_CACHE_PARAM } from 'components/grid/SupabaseGrid.utils'
2423import AlertError from 'components/ui/AlertError'
2524import { ButtonTooltip } from 'components/ui/ButtonTooltip'
2625import { DropdownMenuItemTooltip } from 'components/ui/DropdownMenuItemTooltip'
26+ import { EntityTypeIcon } from 'components/ui/EntityTypeIcon'
2727import SchemaSelector from 'components/ui/SchemaSelector'
2828import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
2929import { useDatabasePublicationsQuery } from 'data/database-publications/database-publications-query'
@@ -60,7 +60,6 @@ import {
6060 Tooltip ,
6161 TooltipContent ,
6262 TooltipTrigger ,
63- cn ,
6463} from 'ui'
6564import { ProtectedSchemaWarning } from '../ProtectedSchemaWarning'
6665import { formatAllEntities } from './Tables.utils'
@@ -206,11 +205,14 @@ export const TableList = ({
206205 isSuccessTables && isSuccessViews && isSuccessMaterializedViews && isSuccessForeignTables
207206
208207 const formatTooltipText = ( entityType : string ) => {
209- return Object . entries ( ENTITY_TYPE )
210- . find ( ( [ , value ] ) => value === entityType ) ?. [ 0 ]
211- ?. toLowerCase ( )
212- ?. split ( '_' )
213- ?. join ( ' ' )
208+ const text =
209+ Object . entries ( ENTITY_TYPE )
210+ . find ( ( [ , value ] ) => value === entityType ) ?. [ 0 ]
211+ ?. toLowerCase ( )
212+ ?. split ( '_' )
213+ ?. join ( ' ' ) || ''
214+ // Return sentence case (capitalize first letter only)
215+ return text . charAt ( 0 ) . toUpperCase ( ) + text . slice ( 1 )
214216 }
215217
216218 return (
@@ -383,40 +385,14 @@ export const TableList = ({
383385 < TableRow key = { x . id } >
384386 < TableCell className = "!pl-5 !pr-1" >
385387 < Tooltip >
386- < TooltipTrigger asChild >
387- { x . type === ENTITY_TYPE . TABLE ? (
388- < Table2
389- size = { 15 }
390- strokeWidth = { 1.5 }
391- className = "text-foreground-lighter"
392- />
393- ) : x . type === ENTITY_TYPE . VIEW ? (
394- < Eye
395- size = { 15 }
396- strokeWidth = { 1.5 }
397- className = "text-foreground-lighter"
398- />
399- ) : (
400- < div
401- className = { cn (
402- 'flex items-center justify-center text-xs h-4 w-4 rounded-[2px] font-bold' ,
403- x . type === ENTITY_TYPE . FOREIGN_TABLE &&
404- 'text-yellow-900 bg-yellow-500' ,
405- x . type === ENTITY_TYPE . MATERIALIZED_VIEW &&
406- 'text-purple-1000 bg-purple-500'
407- // [Alaister]: tables endpoint doesn't distinguish between tables and partitioned tables
408- // once we update the endpoint to include partitioned tables, we can uncomment this
409- // x.type === ENTITY_TYPE.PARTITIONED_TABLE &&
410- // 'text-foreground-light bg-border-stronger'
411- ) }
412- >
413- { Object . entries ( ENTITY_TYPE )
414- . find ( ( [ , value ] ) => value === x . type ) ?. [ 0 ] ?. [ 0 ]
415- ?. toUpperCase ( ) }
416- </ div >
417- ) }
388+ < TooltipTrigger className = "cursor-default" >
389+ { /* [Alaister]: EntityTypeIcon supports PARTITIONED_TABLE, but formatAllEntities
390+ doesn't distinguish between tables and partitioned tables yet.
391+ Once the endpoint/formatAllEntities is updated to include partitioned tables,
392+ EntityTypeIcon will automatically style them correctly. */ }
393+ < EntityTypeIcon type = { x . type } />
418394 </ TooltipTrigger >
419- < TooltipContent side = "bottom" className = "capitalize" >
395+ < TooltipContent side = "bottom" >
420396 { formatTooltipText ( x . type ) }
421397 </ TooltipContent >
422398 </ Tooltip >
0 commit comments