Files
supabase/apps/studio/components/interfaces/UnifiedLogs/ServiceFlow/LogOverview.tsx
T
Joshen Lim 09a1f431bc Mass update for all lucide icon imports to use the component with Icon suffix (#51659)
## Context

This is largely just a mechanical change here:
Opting to use lucide icons with the `Icon` suffix across all icon
imports within `studio`
- so that it’s clearer which components are icons + reduces the
possibility of name collision with our own components
- e.g <User /> vs <UserIcon />

Also added a eslint rule for this:
<img width="1069" height="167" alt="image"
src="https://github.com/user-attachments/assets/7f36f443-5ca2-4bf6-8d22-86e774513bfc"
/>

And updated `AGENTS.md` as such:
```
Icons come from `lucide-react`, always imported with the `Icon` suffix (`import { CheckIcon, Trash2Icon } from 'lucide-react'`) — never the bare names (`Check`) or `Check as CheckIcon` aliases (lint-enforced).
```
2026-10-14 12:56:55 +02:00

90 lines
2.5 KiB
TypeScript

import { ClockIcon } from 'lucide-react'
import type { ComponentType, ReactNode } from 'react'
import { LogFields } from '../components/LogFields'
import type { ColumnSchema } from '../UnifiedLogs.schema'
import { getRowTimestampMs } from '../UnifiedLogs.utils'
import { PostgresFlowDetail } from './components/PostgresFlowDetail'
import {
MemoizedEdgeFunctionBlock,
MemoizedGoTrueBlock,
MemoizedNetworkBlock,
MemoizedPostgresBlock,
MemoizedPostgRESTBlock,
MemoizedStorageBlock,
} from './components/ServiceBlocks'
import type { ServiceFlowBlockProps } from './types'
import { DetailSectionHeader } from '@/components/ui/DataTable/DetailSectionHeader'
type LogOverviewProps = Omit<ServiceFlowBlockProps, 'data'> & {
data: ColumnSchema
rawData: unknown
}
function RequestOverview({ children, ...props }: LogOverviewProps & { children: ReactNode }) {
const timestamp = getRowTimestampMs(props.data)
return (
<>
<DetailSectionHeader
title="Request started"
className="border-b"
icon={ClockIcon}
summary={timestamp === null ? undefined : new Date(timestamp).toLocaleString()}
/>
<MemoizedNetworkBlock {...props} />
{children}
</>
)
}
function PostgrestOverview(props: LogOverviewProps) {
return (
<RequestOverview {...props}>
<MemoizedPostgRESTBlock {...props} />
<MemoizedPostgresBlock {...props} />
</RequestOverview>
)
}
function AuthOverview(props: LogOverviewProps) {
return (
<RequestOverview {...props}>
<MemoizedGoTrueBlock {...props} />
</RequestOverview>
)
}
function StorageOverview(props: LogOverviewProps) {
return (
<RequestOverview {...props}>
<MemoizedStorageBlock {...props} />
</RequestOverview>
)
}
function EdgeFunctionOverview(props: LogOverviewProps) {
return (
<RequestOverview {...props}>
<MemoizedEdgeFunctionBlock {...props} />
</RequestOverview>
)
}
// Renderers own the entire overview layout, independently of inspection-query support.
const LOG_OVERVIEW_RENDERERS: Partial<
Record<ColumnSchema['log_type'], ComponentType<LogOverviewProps>>
> = {
postgres: PostgresFlowDetail,
postgrest: PostgrestOverview,
auth: AuthOverview,
storage: StorageOverview,
'edge function': EdgeFunctionOverview,
}
export function LogOverview(props: LogOverviewProps) {
const Renderer = LOG_OVERVIEW_RENDERERS[props.data.log_type]
if (Renderer) return <Renderer {...props} />
return <LogFields data={props.rawData} table={props.table} filterFields={props.filterFields} />
}