mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
chore: showInstallButton for package item
This commit is contained in:
parent
563b327007
commit
065c8af320
1 changed files with 11 additions and 19 deletions
|
|
@ -1,11 +1,6 @@
|
|||
import React, { useCallback, useMemo } from "react"
|
||||
import { Button } from "@/components/ui/button"
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu"
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu"
|
||||
import { MoreVertical, ExternalLink, Download } from "lucide-react"
|
||||
import { InstallMarketplaceItemOptions, MarketplaceItem } from "../../../../../src/services/marketplace/types"
|
||||
import { vscode } from "@/utils/vscode"
|
||||
|
|
@ -16,9 +11,7 @@ interface MarketplaceItemActionsMenuProps {
|
|||
item: MarketplaceItem
|
||||
}
|
||||
|
||||
export const MarketplaceItemActionsMenu: React.FC<MarketplaceItemActionsMenuProps> = ({
|
||||
item,
|
||||
}) => {
|
||||
export const MarketplaceItemActionsMenu: React.FC<MarketplaceItemActionsMenuProps> = ({ item }) => {
|
||||
const { t } = useAppTranslation()
|
||||
|
||||
const itemSourceUrl = useMemo(() => {
|
||||
|
|
@ -48,33 +41,32 @@ export const MarketplaceItemActionsMenu: React.FC<MarketplaceItemActionsMenuProp
|
|||
vscode.postMessage({
|
||||
type: "installMarketplaceItem",
|
||||
mpItem: item,
|
||||
mpInstallOptions: options
|
||||
mpInstallOptions: options,
|
||||
})
|
||||
}
|
||||
|
||||
// Don't show for `package` items for now
|
||||
const showInstallButton = item.type !== "package" // Don't show for package containers
|
||||
const showInstallButton = true
|
||||
|
||||
return (
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button variant="ghost" size="icon" aria-label={t("marketplace:items.card.actionsMenuLabel") || "Actions"}>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
aria-label={t("marketplace:items.card.actionsMenuLabel") || "Actions"}>
|
||||
<MoreVertical className="h-4 w-4" />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="start" side="bottom">
|
||||
{/* View Source / External Link Item */}
|
||||
<DropdownMenuItem
|
||||
aria-label={item.sourceName}
|
||||
onClick={handleOpenSourceUrl}
|
||||
>
|
||||
<DropdownMenuItem aria-label={item.sourceName} onClick={handleOpenSourceUrl}>
|
||||
<ExternalLink className="mr-2 h-4 w-4" />
|
||||
<span>{t("marketplace:items.card.viewSource")}</span>
|
||||
</DropdownMenuItem>
|
||||
|
||||
{/* Install (Project) */}
|
||||
{showInstallButton && (
|
||||
<DropdownMenuItem onClick={() => handleInstall({target: 'project'})}>
|
||||
<DropdownMenuItem onClick={() => handleInstall({ target: "project" })}>
|
||||
<Download className="mr-2 h-4 w-4" />
|
||||
<span>{t("marketplace:items.card.installProject")}</span>
|
||||
</DropdownMenuItem>
|
||||
|
|
@ -82,7 +74,7 @@ export const MarketplaceItemActionsMenu: React.FC<MarketplaceItemActionsMenuProp
|
|||
|
||||
{/* Install (Global) */}
|
||||
{showInstallButton && (
|
||||
<DropdownMenuItem onClick={() => handleInstall({target: 'global'})}>
|
||||
<DropdownMenuItem onClick={() => handleInstall({ target: "global" })}>
|
||||
<Download className="mr-2 h-4 w-4" />
|
||||
<span>{t("marketplace:items.card.installGlobal")}</span>
|
||||
</DropdownMenuItem>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue