Files
supabase/apps/studio/components/interfaces/Realtime/Inspector/RealtimeMessageColumnRenderer.tsx
Ivan VasilovandJoshen Lim 05a542ccea chore: Migrate all feather icons to lucide icons (#29038)
* Add lucide-react to docs (to make the autocomplete work).

* Migrate the docs app icons.

* Migrate the ui-patterns.

* Remove the old icons from ui package.

* Migrate the www app from react-feather icons.

* Migrate all of studio icons.

* Migrate the only component in design-system.

* Fix an old import in ui package. Revert an import in docs app.

* Fix some pages in www.

* Remove unneeded files used in generation of icons.

* Fix a prettier error.

* Fix more issues in www.

* Fix an issue in Log Date picker.

* Replace all string sizes with number sizes because the icons grew in some cases.

* Fix more imports in security page.

* Fix an extra import.

* Remove the size prop from all icons if they're in a button and they match the button size.

* Minor fixes for docs and www.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-09-04 19:46:21 +08:00

46 lines
1.4 KiB
TypeScript

import { Column } from 'react-data-grid'
import { cn, IconBroadcast, IconDatabaseChanges, IconPresence } from 'ui'
import { AlertTriangle } from 'lucide-react'
import type { LogData, PreviewLogData } from './Messages.types'
import { RowLayout } from './MessagesFormatters'
import { isErrorLog } from './MessagesTable'
const ICONS = {
PRESENCE: <IconPresence size="xlarge" />,
BROADCAST: <IconBroadcast size="xlarge" />,
POSTGRES: <IconDatabaseChanges size="xlarge" />,
SYSTEM: <AlertTriangle size="20" strokeWidth={1} />,
}
export const ColumnRenderer: Column<LogData, unknown>[] = [
{
name: 'timestamp-with-truncated-text',
key: 'main-column',
renderCell: (data: { row: PreviewLogData }) => {
const type = data.row.message as keyof typeof ICONS
return (
<RowLayout>
<div
className={cn(
'flex justify-center items-center min-w-[24px]',
isErrorLog(data.row) ? 'text-warning-600' : 'text-green-900'
)}
>
{ICONS[type]}
</div>
<span className={cn('font-mono', isErrorLog(data.row) ? '!text-warning-600' : '')}>
{new Date(data.row.timestamp).toISOString()}
</span>
<span
className={cn('truncate font-mono', isErrorLog(data.row) ? '!text-warning-600' : '')}
>
{JSON.stringify(data.row.metadata)}
</span>
</RowLayout>
)
},
},
]