dify/web/app/components/plugins/plugin-detail-panel/app-selector/app-trigger.tsx
Jingyi 9b74df21d0
feat(web): refine onboarding UI (#37433)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
Co-authored-by: Joel <iamjoel007@gmail.com>
Co-authored-by: hjlarry <hjlarry@163.com>
Co-authored-by: fatelei <fatelei@gmail.com>
Co-authored-by: Asuka Minato <i@asukaminato.eu.org>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
Co-authored-by: gigglewang <gigglewang@dify.ai>
Co-authored-by: Yunlu Wen <yunlu.wen@dify.ai>
Co-authored-by: chariri <w@chariri.moe>
Co-authored-by: Evan <2869018789@qq.com>
Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com>
2026-06-15 08:47:15 +00:00

58 lines
1.5 KiB
TypeScript

'use client'
import type { App } from '@/types/app'
import { cn } from '@langgenius/dify-ui/cn'
import { useTranslation } from 'react-i18next'
import AppIcon from '@/app/components/base/app-icon'
type AppTriggerProps = {
open: boolean
appDetail?: App
}
export function AppTrigger({
open,
appDetail,
}: AppTriggerProps) {
const { t } = useTranslation()
return (
<span
className={cn(
'group flex cursor-pointer items-center rounded-lg bg-components-input-bg-normal p-2 pl-3 hover:bg-state-base-hover-alt',
open && 'bg-state-base-hover-alt',
appDetail && 'py-1.5 pl-1.5',
)}
>
{appDetail && (
<AppIcon
className="mr-2 shrink-0"
size="xs"
iconType={appDetail.icon_type}
icon={appDetail.icon}
background={appDetail.icon_background}
imageUrl={appDetail.icon_url}
/>
)}
{appDetail
? (
<span className="min-w-0 grow truncate system-sm-medium text-components-input-text-filled">
{appDetail.name}
</span>
)
: (
<span className="min-w-0 grow truncate system-sm-regular text-components-input-text-placeholder">
{t('appSelector.placeholder', { ns: 'app' })}
</span>
)}
<span
className={cn(
'ml-0.5 i-ri-arrow-down-s-line size-4 shrink-0 text-text-quaternary group-hover:text-text-secondary',
open && 'text-text-secondary',
)}
aria-hidden="true"
/>
</span>
)
}