mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-25 02:33:00 +08:00
feat: custom app icon (#7196)
Co-authored-by: crazywoola <427733928@qq.com>
This commit is contained in:
@@ -7,13 +7,16 @@ import s from './style.module.css'
|
||||
import cn from '@/utils/classnames'
|
||||
import ItemOperation from '@/app/components/explore/item-operation'
|
||||
import AppIcon from '@/app/components/base/app-icon'
|
||||
import type { AppIconType } from '@/types/app'
|
||||
|
||||
export type IAppNavItemProps = {
|
||||
isMobile: boolean
|
||||
name: string
|
||||
id: string
|
||||
icon_type: AppIconType | null
|
||||
icon: string
|
||||
icon_background: string
|
||||
icon_url: string
|
||||
isSelected: boolean
|
||||
isPinned: boolean
|
||||
togglePin: () => void
|
||||
@@ -25,8 +28,10 @@ export default function AppNavItem({
|
||||
isMobile,
|
||||
name,
|
||||
id,
|
||||
icon_type,
|
||||
icon,
|
||||
icon_background,
|
||||
icon_url,
|
||||
isSelected,
|
||||
isPinned,
|
||||
togglePin,
|
||||
@@ -50,11 +55,11 @@ export default function AppNavItem({
|
||||
router.push(url) // use Link causes popup item always trigger jump. Can not be solved by e.stopPropagation().
|
||||
}}
|
||||
>
|
||||
{isMobile && <AppIcon size='tiny' icon={icon} background={icon_background} />}
|
||||
{isMobile && <AppIcon size='tiny' iconType={icon_type} icon={icon} background={icon_background} imageUrl={icon_url} />}
|
||||
{!isMobile && (
|
||||
<>
|
||||
<div className='flex items-center space-x-2 w-0 grow'>
|
||||
<AppIcon size='tiny' icon={icon} background={icon_background} />
|
||||
<AppIcon size='tiny' iconType={icon_type} icon={icon} background={icon_background} imageUrl={icon_url} />
|
||||
<div className='overflow-hidden text-ellipsis whitespace-nowrap' title={name}>{name}</div>
|
||||
</div>
|
||||
<div className='shrink-0 h-6' onClick={e => e.stopPropagation()}>
|
||||
|
||||
@@ -109,14 +109,16 @@ const SideBar: FC<IExploreSideBarProps> = ({
|
||||
height: 'calc(100vh - 250px)',
|
||||
}}
|
||||
>
|
||||
{installedApps.map(({ id, is_pinned, uninstallable, app: { name, icon, icon_background } }) => {
|
||||
{installedApps.map(({ id, is_pinned, uninstallable, app: { name, icon_type, icon, icon_url, icon_background } }) => {
|
||||
return (
|
||||
<Item
|
||||
key={id}
|
||||
isMobile={isMobile}
|
||||
name={name}
|
||||
icon_type={icon_type}
|
||||
icon={icon}
|
||||
icon_background={icon_background}
|
||||
icon_url={icon_url}
|
||||
id={id}
|
||||
isSelected={lastSegment?.toLowerCase() === id}
|
||||
isPinned={is_pinned}
|
||||
|
||||
Reference in New Issue
Block a user