refactor: Simplify tag label retrieval in hooks and update related components

This commit is contained in:
WTW0313
2025-09-04 17:32:15 +08:00
parent 8d5f788f2b
commit a9b0b7a3b4
3 changed files with 12 additions and 5 deletions

View File

@ -27,7 +27,7 @@ const TagsFilter = ({
const { t } = useTranslation()
const [open, setOpen] = useState(false)
const [searchText, setSearchText] = useState('')
const { tags: options, tagsMap } = useTags()
const { tags: options, getTagLabel } = useTags()
const filteredOptions = options.filter(option => option.name.toLowerCase().includes(searchText.toLowerCase()))
const handleCheck = (id: string) => {
if (value.includes(id))
@ -59,7 +59,7 @@ const TagsFilter = ({
!selectedTagsLength && t('pluginTags.allTags')
}
{
!!selectedTagsLength && value.map(val => tagsMap[val].label).slice(0, 2).join(',')
!!selectedTagsLength && value.map(val => getTagLabel(val)).slice(0, 2).join(',')
}
{
selectedTagsLength > 2 && (