mirror of
https://github.com/yyhuni/xingrin.git
synced 2026-01-31 19:53:11 +08:00
- Replace Chinese comments with English equivalents across auth, dashboard, and scan components - Update UI text labels and descriptions from Chinese to English in bulk-add-urls-dialog - Translate placeholder text and dialog titles in asset management components - Update column headers and data table labels to English in organization and engine modules - Standardize English documentation strings in auth-guard and auth-layout components - Improve code maintainability and accessibility for international users - Align with existing internationalization efforts across the frontend codebase
68 lines
1.8 KiB
TypeScript
68 lines
1.8 KiB
TypeScript
"use client"
|
|
|
|
import * as React from "react"
|
|
import type { ColumnDef } from "@tanstack/react-table"
|
|
import { useTranslations } from "next-intl"
|
|
import { Input } from "@/components/ui/input"
|
|
import { UnifiedDataTable } from "@/components/ui/data-table"
|
|
import type { ScanEngine } from "@/types/engine.types"
|
|
|
|
// Component props type definitions
|
|
interface EngineDataTableProps {
|
|
data: ScanEngine[]
|
|
columns: ColumnDef<ScanEngine>[]
|
|
onAddNew?: () => void
|
|
searchPlaceholder?: string
|
|
searchColumn?: string
|
|
addButtonText?: string
|
|
}
|
|
|
|
/**
|
|
* Scan engine data table component
|
|
* Uses UnifiedDataTable unified component
|
|
*/
|
|
export function EngineDataTable({
|
|
data = [],
|
|
columns,
|
|
onAddNew,
|
|
searchPlaceholder,
|
|
addButtonText,
|
|
}: EngineDataTableProps) {
|
|
const t = useTranslations("common.status")
|
|
const tEngine = useTranslations("scan.engine")
|
|
|
|
// Local search state
|
|
const [searchValue, setSearchValue] = React.useState("")
|
|
|
|
// Filter data (local filtering)
|
|
const filteredData = React.useMemo(() => {
|
|
if (!searchValue) return data
|
|
return data.filter((item) => {
|
|
const name = item.name || ""
|
|
return name.toLowerCase().includes(searchValue.toLowerCase())
|
|
})
|
|
}, [data, searchValue])
|
|
|
|
return (
|
|
<UnifiedDataTable
|
|
data={filteredData}
|
|
columns={columns}
|
|
getRowId={(row) => String(row.id)}
|
|
enableRowSelection={false}
|
|
onAddNew={onAddNew}
|
|
addButtonLabel={addButtonText || tEngine("createEngine")}
|
|
showBulkDelete={false}
|
|
emptyMessage={t("noData")}
|
|
toolbarLeft={
|
|
<Input
|
|
placeholder={searchPlaceholder || tEngine("searchPlaceholder")}
|
|
value={searchValue}
|
|
onChange={(e) => setSearchValue(e.target.value)}
|
|
className="max-w-sm h-8"
|
|
/>
|
|
}
|
|
/>
|
|
)
|
|
}
|
|
|