refactor: streamline ToolsDropdownList by removing unnecessary props and enhancing button functionality

This commit is contained in:
ecwu
2025-01-05 23:26:35 +08:00
parent 0e1529a4d2
commit 78d40a8bf7

View File

@@ -137,19 +137,9 @@ function ToolsDropdownList() {
const { chatStore, setChatStore } = ctx; const { chatStore, setChatStore } = ctx;
return ( return (
<NavigationMenuItem className="p-3"> <NavigationMenuItem>
<NavigationMenuTrigger> <NavigationMenuTrigger>
<span>{Tr(`Tools`)}</span> <span>{Tr(`Tools`)}</span>
<Button
variant="link"
className="ml-2 text-sm"
onClick={() => {
chatStore.toolsString = "";
setChatStore({ ...chatStore });
}}
>
{Tr(`Clear`)}
</Button>
</NavigationMenuTrigger> </NavigationMenuTrigger>
<NavigationMenuContent> <NavigationMenuContent>
<ul className="grid w-[400px] gap-3 p-4 md:w-[500px] md:grid-cols-2 lg:w-[600px]"> <ul className="grid w-[400px] gap-3 p-4 md:w-[500px] md:grid-cols-2 lg:w-[600px]">
@@ -177,6 +167,16 @@ function ToolsDropdownList() {
</a> </a>
</NavigationMenuLink> </NavigationMenuLink>
<div className="mt-2 flex justify-between"> <div className="mt-2 flex justify-between">
<Button
variant="ghost"
size="sm"
onClick={() => {
chatStore.toolsString = "";
setChatStore({ ...chatStore });
}}
>
{Tr(`Clear`)}
</Button>
<Button <Button
variant="ghost" variant="ghost"
size="sm" size="sm"