'use client' import { useMemo } from 'react' import { useContext } from 'use-context-selector' import { useTranslation } from 'react-i18next' import type { Collection } from '../types' import cn from '@/utils/classnames' import AppIcon from '@/app/components/base/app-icon' import { Tag01 } from '@/app/components/base/icons/src/vender/line/financeAndECommerce' import I18n from '@/context/i18n' import { getLanguage } from '@/i18n/language' import { useStore as useLabelStore } from '@/app/components/tools/labels/store' type Props = { active: boolean collection: Collection onSelect: () => void } const ProviderCard = ({ active, collection, onSelect, }: Props) => { const { t } = useTranslation() const { locale } = useContext(I18n) const language = getLanguage(locale) const labelList = useLabelStore(s => s.labelList) const labelContent = useMemo(() => { if (!collection.labels) return '' return collection.labels.map((name) => { const label = labelList.find(item => item.name === name) return label?.label[language] }).filter(Boolean).join(', ') }, [collection.labels, labelList, language]) return (