From 1b1cc7769b59bdb8a4d3a807e8d421df210ddf45 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Tue, 31 Mar 2026 00:06:15 +0800 Subject: [PATCH] style(web): move adapter doc link to icon button beside selector with tooltip --- .../home/bots/components/bot-form/BotForm.tsx | 169 ++++++++++-------- 1 file changed, 92 insertions(+), 77 deletions(-) diff --git a/web/src/app/home/bots/components/bot-form/BotForm.tsx b/web/src/app/home/bots/components/bot-form/BotForm.tsx index 239e9b9d..922eb502 100644 --- a/web/src/app/home/bots/components/bot-form/BotForm.tsx +++ b/web/src/app/home/bots/components/bot-form/BotForm.tsx @@ -15,8 +15,13 @@ import DynamicFormComponent from '@/app/home/components/dynamic-form/DynamicForm import { httpClient } from '@/app/infra/http/HttpClient'; import { Bot } from '@/app/infra/entities/api'; import { getAdapterDocUrl } from '@/app/infra/entities/adapter-docs'; -import { ExternalLink } from 'lucide-react'; +import { FileText } from 'lucide-react'; import { Button } from '@/components/ui/button'; +import { + Tooltip, + TooltipContent, + TooltipTrigger, +} from '@/components/ui/tooltip'; import { zodResolver } from '@hookform/resolvers/zod'; import { useForm } from 'react-hook-form'; @@ -473,89 +478,99 @@ export default function BotForm({ * - { + field.onChange(value); + handleAdapterSelect(value); + }} + value={field.value} + > + + {field.value ? ( +
+ + + {adapterNameList.find( + (a) => a.value === field.value, + )?.label ?? field.value} + +
+ ) : ( + - - {adapterNameList.find( - (a) => a.value === field.value, - )?.label ?? field.value} - - - ) : ( - - )} -
- - {groupedAdapters.map((group) => ( - - {group.categoryId && ( - - {getCategoryLabel(t, group.categoryId)} - - )} - {group.items.map((item) => ( - -
- - {item.label} -
-
- ))} -
- ))} -
- + )} + + + {groupedAdapters.map((group) => ( + + {group.categoryId && ( + + {getCategoryLabel(t, group.categoryId)} + + )} + {group.items.map((item) => ( + +
+ + {item.label} +
+
+ ))} +
+ ))} +
+ + {currentAdapter && + (() => { + const docUrl = getAdapterDocUrl( + currentAdapter, + i18n.language, + ); + return docUrl ? ( + + + + + + {t('bots.viewAdapterDocs')} + + + ) : null; + })()} +
{currentAdapter && adapterDescriptionList[currentAdapter] && ( {adapterDescriptionList[currentAdapter]} )} - {currentAdapter && - (() => { - const docUrl = getAdapterDocUrl( - currentAdapter, - i18n.language, - ); - return docUrl ? ( - - ) : null; - })()} )}