perf: frontend

This commit is contained in:
Junyan Qin
2025-08-16 23:23:24 +08:00
parent 28d4b1dd61
commit 0ea7609ff1
8 changed files with 88 additions and 65 deletions

View File

@@ -293,7 +293,12 @@ export default function PluginConfigPage() {
)}
{pluginInstallStatus === PluginInstallStatus.ASK_CONFIRM && (
<div className="mt-4">
<p className="mb-2">{t('plugins.askConfirm')}</p>
<p className="mb-2">
{t('plugins.askConfirm', {
name: installInfo.plugin_name,
version: installInfo.plugin_version,
})}
</p>
</div>
)}
{pluginInstallStatus === PluginInstallStatus.INSTALLING && (

View File

@@ -5,7 +5,7 @@ import { Badge } from '@/components/ui/badge';
import { Switch } from '@/components/ui/switch';
import { toast } from 'sonner';
import { useTranslation } from 'react-i18next';
import { ExternalLink } from 'lucide-react';
import { BugIcon, ExternalLink } from 'lucide-react';
import { getCloudServiceClientSync } from '@/app/infra/http';
export default function PluginCardComponent({
@@ -65,48 +65,53 @@ export default function PluginCardComponent({
variant="outline"
className="text-[0.7rem] border-orange-400 text-orange-400"
>
<BugIcon className="w-4 h-4" />
{t('plugins.debugging')}
</Badge>
)}
{cardVO.install_source === 'github' && (
<Badge
variant="outline"
className="text-[0.7rem] border-blue-400 text-blue-400"
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' && (
<Badge
variant="outline"
className="text-[0.7rem] border-green-400 text-green-400"
>
{t('plugins.fromLocal')}
</Badge>
)}
{cardVO.install_source === 'marketplace' && (
<Badge
variant="outline"
className="text-[0.7rem] border-purple-400 text-purple-400"
onClick={(e) => {
e.stopPropagation();
window.open(
getCloudServiceClientSync().getPluginMarketplaceURL(
cardVO.author,
cardVO.name,
),
'_blank',
);
}}
>
{t('plugins.fromMarketplace')}
<ExternalLink className="w-4 h-4" />
</Badge>
{!cardVO.debug && (
<>
{cardVO.install_source === 'github' && (
<Badge
variant="outline"
className="text-[0.7rem] border-blue-400 text-blue-400"
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' && (
<Badge
variant="outline"
className="text-[0.7rem] border-green-400 text-green-400"
>
{t('plugins.fromLocal')}
</Badge>
)}
{cardVO.install_source === 'marketplace' && (
<Badge
variant="outline"
className="text-[0.7rem] border-purple-400 text-purple-400"
onClick={(e) => {
e.stopPropagation();
window.open(
getCloudServiceClientSync().getPluginMarketplaceURL(
cardVO.author,
cardVO.name,
),
'_blank',
);
}}
>
{t('plugins.fromMarketplace')}
<ExternalLink className="w-4 h-4" />
</Badge>
)}
</>
)}
</div>
</div>

View File

@@ -13,7 +13,7 @@
padding-right: 0.8rem;
padding-top: 2rem;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(24rem, 1fr));
grid-template-columns: repeat(auto-fill, minmax(30rem, 1fr));
gap: 2rem;
justify-items: stretch;
align-items: start;

View File

@@ -21,7 +21,10 @@ export class CloudServiceClient extends BaseHttpClient {
sort_order?: string,
): Promise<ApiRespMarketplacePlugins> {
return this.get<ApiRespMarketplacePlugins>('/api/v1/marketplace/plugins', {
params: { page, page_size, sort_by, sort_order },
page,
page_size,
sort_by,
sort_order,
});
}