mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-13 13:19:08 +08:00
chore: remove useless frontend code file (#18532)
This commit is contained in:
parent
1ce2c7f3e8
commit
239e40c8d5
@ -1,83 +0,0 @@
|
||||
'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 (
|
||||
<div className={cn('group col-span-1 flex min-h-[160px] cursor-pointer flex-col rounded-xl border-2 border-solid border-transparent bg-white shadow-sm transition-all duration-200 ease-in-out hover:shadow-lg', active && '!border-primary-400')} onClick={onSelect}>
|
||||
<div className='flex h-[66px] shrink-0 grow-0 items-center gap-3 px-[14px] pb-3 pt-[14px]'>
|
||||
<div className='relative shrink-0'>
|
||||
{typeof collection.icon === 'string' && (
|
||||
<div className='h-10 w-10 rounded-md bg-cover bg-center bg-no-repeat' style={{ backgroundImage: `url(${collection.icon})` }} />
|
||||
)}
|
||||
{typeof collection.icon !== 'string' && (
|
||||
<AppIcon
|
||||
size='large'
|
||||
icon={collection.icon.content}
|
||||
background={collection.icon.background}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
<div className='w-0 grow py-[1px]'>
|
||||
<div className='flex items-center text-sm font-semibold leading-5 text-gray-800'>
|
||||
<div className='truncate' title={collection.label[language]}>{collection.label[language]}</div>
|
||||
</div>
|
||||
<div className='flex items-center text-[10px] font-medium leading-[18px] text-gray-500'>
|
||||
<div className='truncate'>{t('tools.author')} {collection.author}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className={cn(
|
||||
'mb-2 max-h-[72px] grow px-[14px] text-xs leading-normal text-gray-500',
|
||||
collection.labels?.length ? 'line-clamp-2' : 'line-clamp-4',
|
||||
collection.labels?.length > 0 && 'group-hover:line-clamp-2 group-hover:max-h-[36px]',
|
||||
)}
|
||||
title={collection.description[language]}
|
||||
>
|
||||
{collection.description[language]}
|
||||
</div>
|
||||
{collection.labels?.length > 0 && (
|
||||
<div className='mt-1 flex h-[42px] shrink-0 items-center pb-[6px] pl-[14px] pr-[6px] pt-1'>
|
||||
<div className='relative flex w-full items-center gap-1 rounded-md py-[7px] text-gray-500' title={labelContent}>
|
||||
<Tag01 className='h-3 w-3 shrink-0' />
|
||||
<div className='grow truncate text-start text-xs font-normal leading-[18px]'>{labelContent}</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
export default ProviderCard
|
@ -1,40 +0,0 @@
|
||||
'use client'
|
||||
import type { FC } from 'react'
|
||||
import React from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import {
|
||||
RiHammerFill,
|
||||
} from '@remixicon/react'
|
||||
import { Heart02 } from '@/app/components/base/icons/src/vender/solid/education'
|
||||
import { BookOpen01 } from '@/app/components/base/icons/src/vender/line/education'
|
||||
import { ArrowUpRight } from '@/app/components/base/icons/src/vender/line/arrows'
|
||||
|
||||
const Contribute: FC = () => {
|
||||
const { t } = useTranslation()
|
||||
|
||||
return (
|
||||
<a
|
||||
href='https://github.com/langgenius/dify/blob/main/api/core/tools/README.md'
|
||||
target='_blank'
|
||||
rel='noopener noreferrer'
|
||||
className="group col-span-1 flex min-h-[160px] cursor-pointer flex-col rounded-xl border-2 border-solid border-transparent bg-white bg-[url('~@/app/components/tools/provider/grid_bg.svg')] bg-cover bg-no-repeat shadow-sm transition-all duration-200 ease-in-out hover:shadow-lg"
|
||||
>
|
||||
<div className='flex h-[66px] shrink-0 grow-0 items-center gap-3 px-[14px] pb-3 pt-[14px]'>
|
||||
<div className='relative flex shrink-0 items-center'>
|
||||
<div className='z-10 flex rounded-[10px] border-[0.5px] border-primary-100 bg-white p-3 shadow-md'><RiHammerFill className='h-4 w-4 text-primary-600'/></div>
|
||||
<div className='flex -translate-x-2 rounded-[10px] border-[0.5px] border-[#FCE7F6] bg-[#FEF6FB] p-3 shadow-md'><Heart02 className='h-4 w-4 text-[#EE46BC]'/></div>
|
||||
</div>
|
||||
</div>
|
||||
<div className='mb-3 px-[14px] text-[15px] font-semibold leading-5'>
|
||||
<div className='text-gradient'>{t('tools.contribute.line1')}</div>
|
||||
<div className='text-gradient'>{t('tools.contribute.line2')}</div>
|
||||
</div>
|
||||
<div className='flex items-center space-x-1 border-t-[0.5px] border-black/5 px-4 py-3 text-[#155EEF]'>
|
||||
<BookOpen01 className='h-3 w-3' />
|
||||
<div className='grow text-xs font-normal leading-[18px]'>{t('tools.contribute.viewGuide')}</div>
|
||||
<ArrowUpRight className='h-3 w-3' />
|
||||
</div>
|
||||
</a>
|
||||
)
|
||||
}
|
||||
export default React.memo(Contribute)
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 13 KiB |
Loading…
x
Reference in New Issue
Block a user