fix: plugin card source badge blocked by hover overlay (#1802)

* Initial plan

* Add View Source menu item and remove clickable source badges

- Add "viewSource" translation key to all language files
- Add View Source menu item to plugin card dropdown (only for GitHub/marketplace plugins)
- Remove onClick handlers and ExternalLink icons from source badges
- Keep the badges themselves for visual indication of plugin source

Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com>

* Fix prettier formatting issue in PluginCardComponent

Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com>
This commit is contained in:
Copilot
2025-11-25 09:46:37 +08:00
committed by GitHub
parent 2e1f16d7b4
commit 6b4c1a7dee
5 changed files with 29 additions and 19 deletions

View File

@@ -91,16 +91,8 @@ export default function PluginCardComponent({
<Badge
variant="outline"
className="text-[0.7rem] border-blue-400 text-blue-400 flex-shrink-0"
onClick={(e) => {
e.stopPropagation();
window.open(
cardVO.install_info.github_url,
'_blank',
);
}}
>
{t('plugins.fromGithub')}
<ExternalLink className="w-4 h-4" />
</Badge>
)}
{cardVO.install_source === 'local' && (
@@ -115,19 +107,8 @@ export default function PluginCardComponent({
<Badge
variant="outline"
className="text-[0.7rem] border-purple-400 text-purple-400 flex-shrink-0"
onClick={(e) => {
e.stopPropagation();
window.open(
getCloudServiceClientSync().getPluginMarketplaceURL(
cardVO.author,
cardVO.name,
),
'_blank',
);
}}
>
{t('plugins.fromMarketplace')}
<ExternalLink className="w-4 h-4" />
</Badge>
)}
</>
@@ -200,6 +181,31 @@ export default function PluginCardComponent({
<span>{t('plugins.update')}</span>
</DropdownMenuItem>
)}
{/**view source */}
{(cardVO.install_source === 'github' ||
cardVO.install_source === 'marketplace') && (
<DropdownMenuItem
className="flex flex-row items-center justify-start gap-[0.4rem] cursor-pointer"
onClick={(e) => {
e.stopPropagation();
if (cardVO.install_source === 'github') {
window.open(cardVO.install_info.github_url, '_blank');
} else if (cardVO.install_source === 'marketplace') {
window.open(
getCloudServiceClientSync().getPluginMarketplaceURL(
cardVO.author,
cardVO.name,
),
'_blank',
);
}
setDropdownOpen(false);
}}
>
<ExternalLink className="w-4 h-4" />
<span>{t('plugins.viewSource')}</span>
</DropdownMenuItem>
)}
<DropdownMenuItem
className="flex flex-row items-center justify-start gap-[0.4rem] cursor-pointer text-red-600 focus:text-red-600"
onClick={(e) => {