refactor(skill): remove React.FC type annotations from all components

Replace FC<Props> pattern with direct props typing in function parameters
for better TypeScript inference and modern React best practices.
This commit is contained in:
yyh
2026-01-28 23:34:08 +08:00
parent 999587fbdd
commit 8326b9e3e5
47 changed files with 88 additions and 120 deletions

View File

@ -1,4 +1,3 @@
import type { FC } from 'react'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
@ -7,7 +6,7 @@ type MediaFilePreviewProps = {
src: string
}
const MediaFilePreview: FC<MediaFilePreviewProps> = ({ type, src }) => {
const MediaFilePreview = ({ type, src }: MediaFilePreviewProps) => {
const { t } = useTranslation('workflow')
if (!src) {

View File

@ -1,5 +1,5 @@
import type { TFunction } from 'i18next'
import type { FC, RefObject } from 'react'
import type { RefObject } from 'react'
import type { SQLiteValue } from '../../hooks/use-sqlite-database'
import { useVirtualizer } from '@tanstack/react-virtual'
import * as React from 'react'
@ -32,7 +32,7 @@ const truncateValue = (value: string): string => {
return `${value.slice(0, MAX_CELL_LENGTH)}`
}
const DataTable: FC<DataTableProps> = ({ columns, values, scrollRef, isTruncated = false }) => {
const DataTable = ({ columns, values, scrollRef, isTruncated = false }: DataTableProps) => {
const { t } = useTranslation('workflow')
const keyColumnIndex = useMemo(() => {
const candidates = new Set(['id', 'rowid', 'uuid'])

View File

@ -1,4 +1,3 @@
import type { FC } from 'react'
import * as React from 'react'
import { useMemo, useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@ -13,9 +12,9 @@ type SQLiteFilePreviewProps = {
downloadUrl: string
}
const SQLiteFilePreview: FC<SQLiteFilePreviewProps> = ({
const SQLiteFilePreview = ({
downloadUrl,
}) => {
}: SQLiteFilePreviewProps) => {
const { t } = useTranslation('workflow')
const { tables, isLoading, error, queryTable } = useSQLiteDatabase(downloadUrl)
const [selectedTableId, setSelectedTableId] = useState<string>('')

View File

@ -1,4 +1,4 @@
import type { FC, RefObject } from 'react'
import type { RefObject } from 'react'
import type { SQLiteQueryResult } from '../../hooks/sqlite/types'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
@ -13,13 +13,13 @@ type TablePanelProps = {
isTruncated?: boolean
}
const TablePanel: FC<TablePanelProps> = ({
const TablePanel = ({
data,
isLoading,
error,
scrollRef,
isTruncated = false,
}) => {
}: TablePanelProps) => {
const { t } = useTranslation('workflow')
return (

View File

@ -1,4 +1,3 @@
import type { FC } from 'react'
import { RiArrowDownSLine } from '@remixicon/react'
import * as React from 'react'
import { useMemo, useState } from 'react'
@ -19,12 +18,12 @@ type TableSelectorProps = {
onTableChange: (tableName: string) => void
}
const TableSelector: FC<TableSelectorProps> = ({
const TableSelector = ({
tables,
selectedTable,
isLoading = false,
onTableChange,
}) => {
}: TableSelectorProps) => {
const { t } = useTranslation('workflow')
const [open, setOpen] = useState(false)
const items = useMemo(() => {

View File

@ -1,4 +1,3 @@
import type { FC } from 'react'
import * as React from 'react'
import { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
@ -13,7 +12,7 @@ type UnsupportedFileDownloadProps = {
downloadUrl?: string
}
const UnsupportedFileDownload: FC<UnsupportedFileDownloadProps> = ({ name, size, downloadUrl }) => {
const UnsupportedFileDownload = ({ name, size, downloadUrl }: UnsupportedFileDownloadProps) => {
const { t } = useTranslation('workflow')
const fileSize = size ? formatFileSize(size) : ''