'use client' import type { FC } from 'react' import React, { useState } from 'react' import type { MetadataItem } from './types' import SearchInput from '../../base/search-input' import { RiAddLine, RiArrowRightUpLine } from '@remixicon/react' import { useTranslation } from 'react-i18next' import { getIcon } from './utils/get-icon' const i18nPrefix = 'dataset.metadata.selectMetadata' type Props = { list: MetadataItem[] onSelect: (data: any) => void onNew: () => void onManage: () => void } const SelectMetadata: FC = ({ list, onSelect, onNew, onManage, }) => { const { t } = useTranslation() const [query, setQuery] = useState('') return (
{list.map((item) => { const Icon = getIcon(item.type) return (
onSelect(item)} >
{item.name}
{item.type}
) })}
{t(`${i18nPrefix}.newAction`)}
{t(`${i18nPrefix}.manageAction`)}
) } export default React.memo(SelectMetadata)