mirror of
https://github.com/langgenius/dify.git
synced 2026-09-08 11:04:27 +08:00
feat: add localized empty text support to CollectionList component
This commit is contained in:
parent
61b6b838de
commit
237eead38c
@ -119,6 +119,7 @@ type CollectionListProps<TItem, TCollection extends BaseCollection> = {
|
|||||||
gridClassName?: string
|
gridClassName?: string
|
||||||
cardContainerClassName?: string
|
cardContainerClassName?: string
|
||||||
emptyClassName?: string
|
emptyClassName?: string
|
||||||
|
emptyText?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
function CollectionList<TItem, TCollection extends BaseCollection>({
|
function CollectionList<TItem, TCollection extends BaseCollection>({
|
||||||
@ -131,6 +132,7 @@ function CollectionList<TItem, TCollection extends BaseCollection>({
|
|||||||
gridClassName = GRID_CLASS,
|
gridClassName = GRID_CLASS,
|
||||||
cardContainerClassName,
|
cardContainerClassName,
|
||||||
emptyClassName,
|
emptyClassName,
|
||||||
|
emptyText,
|
||||||
}: CollectionListProps<TItem, TCollection>) {
|
}: CollectionListProps<TItem, TCollection>) {
|
||||||
const locale = useLocale()
|
const locale = useLocale()
|
||||||
|
|
||||||
@ -139,7 +141,7 @@ function CollectionList<TItem, TCollection extends BaseCollection>({
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (collectionsWithItems.length === 0) {
|
if (collectionsWithItems.length === 0) {
|
||||||
return <Empty className={emptyClassName} />
|
return <Empty className={emptyClassName} text={emptyText} />
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import type { PluginCollection, Template, TemplateCollection } from '../types'
|
import type { PluginCollection, Template, TemplateCollection } from '../types'
|
||||||
import type { Plugin } from '@/app/components/plugins/types'
|
import type { Plugin } from '@/app/components/plugins/types'
|
||||||
|
import { useTranslation } from '#i18n'
|
||||||
import CardWrapper from './card-wrapper'
|
import CardWrapper from './card-wrapper'
|
||||||
import { CAROUSEL_COLLECTION_NAMES } from './collection-constants'
|
import { CAROUSEL_COLLECTION_NAMES } from './collection-constants'
|
||||||
import CollectionList from './collection-list'
|
import CollectionList from './collection-list'
|
||||||
@ -29,6 +30,7 @@ type ListWithCollectionProps = PluginsVariant | TemplatesVariant
|
|||||||
|
|
||||||
const ListWithCollection = (props: ListWithCollectionProps) => {
|
const ListWithCollection = (props: ListWithCollectionProps) => {
|
||||||
const { variant, cardContainerClassName } = props
|
const { variant, cardContainerClassName } = props
|
||||||
|
const { t } = useTranslation()
|
||||||
|
|
||||||
if (variant === 'plugins') {
|
if (variant === 'plugins') {
|
||||||
const {
|
const {
|
||||||
@ -76,6 +78,7 @@ const ListWithCollection = (props: ListWithCollectionProps) => {
|
|||||||
renderCard={renderTemplateCard}
|
renderCard={renderTemplateCard}
|
||||||
carouselCollectionNames={[CAROUSEL_COLLECTION_NAMES.featured]}
|
carouselCollectionNames={[CAROUSEL_COLLECTION_NAMES.featured]}
|
||||||
cardContainerClassName={cardContainerClassName}
|
cardContainerClassName={cardContainerClassName}
|
||||||
|
emptyText={t('marketplace.noTemplateFound', { ns: 'plugin' })}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -75,8 +75,6 @@ const TemplateCardComponent = ({
|
|||||||
<div className="flex min-w-0 flex-1 flex-col justify-center gap-0.5">
|
<div className="flex min-w-0 flex-1 flex-col justify-center gap-0.5">
|
||||||
<a
|
<a
|
||||||
href={href}
|
href={href}
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="system-md-medium truncate text-text-primary after:absolute after:inset-0"
|
className="system-md-medium truncate text-text-primary after:absolute after:inset-0"
|
||||||
>
|
>
|
||||||
{template_name}
|
{template_name}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user