Skip to content

Commit ab16543

Browse files
authored
feat: data sources support displaying customized icons (#432)
* feat: data sources support displaying customized icons * docs: update changelog
1 parent c095ad4 commit ab16543

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

docs/content.en/docs/release-notes/_index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ Information about release notes of Coco Server is provided here.
3030
- feat: web components assistant #422
3131
- feat: right-click menu support for search #423
3232
- feat: add chat mode launch page #424
33+
feat: ai assistant supports search and paging #431
34+
- feat: data sources support displaying customized icons #432
3335

3436
### Bug fix
3537

src/components/Cloud/DataSourceItem.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import source_default_img from "@/assets/images/source_default.png";
55
import source_default_dark_img from "@/assets/images/source_default_dark.png";
66
import { useConnectStore } from "@/stores/connectStore";
77
import { useThemeStore } from "@/stores/themeStore";
8+
import FontIcon from "../Common/Icons/FontIcon";
89

910
interface Account {
1011
email: string;
@@ -13,11 +14,12 @@ interface Account {
1314

1415
interface DataSourceItemProps {
1516
name: string;
17+
icon?: string;
1618
connector: any;
1719
accounts?: Account[];
1820
}
1921

20-
export function DataSourceItem({ name, connector }: DataSourceItemProps) {
22+
export function DataSourceItem({ name, icon, connector }: DataSourceItemProps) {
2123
// const isConnected = true;
2224

2325
const isDark = useThemeStore((state) => state.isDark);
@@ -56,7 +58,12 @@ export function DataSourceItem({ name, connector }: DataSourceItemProps) {
5658
<div className="border border-gray-200 dark:border-gray-700 rounded-lg p-4 bg-white dark:bg-gray-800">
5759
<div className="flex items-center justify-between mb-4">
5860
<div className="flex items-center space-x-3">
59-
<img src={getTypeIcon()} alt={name} className="w-6 h-6" />
61+
{icon?.startsWith("font_") ? (
62+
<FontIcon name={icon} className="size-6" />
63+
) : (
64+
<img src={getTypeIcon()} alt={name} className="size-6" />
65+
)}
66+
6067
<span className="font-medium text-gray-900 dark:text-white">
6168
{name}
6269
</span>

src/components/Search/SearchPopover.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { useShortcutsStore } from "@/stores/shortcutsStore";
2121
import VisibleKey from "@/components/Common/VisibleKey";
2222
import { useChatStore } from "@/stores/chatStore";
2323
import NoDataImage from "@/components/Common/NoDataImage";
24+
import FontIcon from "../Common/Icons/FontIcon";
2425

2526
interface SearchPopoverProps {
2627
isSearchActive: boolean;
@@ -288,8 +289,10 @@ export default function SearchPopover({
288289
<div className="flex items-center gap-2 overflow-hidden">
289290
{isAll ? (
290291
<Layers className="size-[16px] text-[#0287FF]" />
292+
) : item.icon?.startsWith("font_") ? (
293+
<FontIcon name={item.icon} className="size-4" />
291294
) : (
292-
<TypeIcon item={item} className="size-[16px]" />
295+
<TypeIcon item={item} className="size-4" />
293296
)}
294297

295298
<span className="truncate">

0 commit comments

Comments
 (0)