perf:修改插件卡片样式
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "maibot-dashboard",
|
||||
"private": true,
|
||||
"version": "1.0.9",
|
||||
"version": "1.0.10",
|
||||
"type": "module",
|
||||
"main": "./out/main/index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* 修改此处的版本号后,所有展示版本的地方都会自动更新
|
||||
*/
|
||||
|
||||
export const APP_VERSION = '1.0.9'
|
||||
export const APP_VERSION = '1.0.10'
|
||||
export const APP_NAME = 'MaiBot Dashboard'
|
||||
export const APP_FULL_NAME = `${APP_NAME} v${APP_VERSION}`
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ export function InstalledTab({
|
||||
})
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-5">
|
||||
{filteredPlugins.map((plugin) => (
|
||||
<PluginCard
|
||||
key={plugin.id}
|
||||
|
||||
@@ -68,7 +68,7 @@ export function MarketplaceTab({
|
||||
})
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 gap-5">
|
||||
{filteredPlugins.map((plugin) => (
|
||||
<PluginCard
|
||||
key={plugin.id}
|
||||
|
||||
@@ -44,10 +44,10 @@ export function PluginCard({
|
||||
key={plugin.id}
|
||||
className="flex flex-col hover:shadow-lg transition-shadow h-full"
|
||||
>
|
||||
<CardHeader>
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
<CardTitle className="text-xl">{plugin.manifest?.name || plugin.id}</CardTitle>
|
||||
<div className="flex flex-col gap-1">
|
||||
<CardHeader className="p-5 pb-3">
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<CardTitle className="text-lg leading-snug">{plugin.manifest?.name || plugin.id}</CardTitle>
|
||||
<div className="flex flex-col items-end gap-1 shrink-0">
|
||||
{plugin.manifest?.categories && plugin.manifest.categories[0] && (
|
||||
<Badge variant="secondary" className="text-xs whitespace-nowrap">
|
||||
{CATEGORY_NAMES[plugin.manifest.categories[0]] || plugin.manifest.categories[0]}
|
||||
@@ -56,18 +56,18 @@ export function PluginCard({
|
||||
{getStatusBadge(plugin)}
|
||||
</div>
|
||||
</div>
|
||||
<CardDescription className="line-clamp-2">{plugin.manifest?.description || '无描述'}</CardDescription>
|
||||
<CardDescription className="line-clamp-2 text-sm leading-snug">{plugin.manifest?.description || '无描述'}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="flex-1">
|
||||
<div className="space-y-3">
|
||||
<CardContent className="px-5 pb-3">
|
||||
<div className="space-y-2.5">
|
||||
{/* 统计信息 */}
|
||||
<div className="flex items-center gap-4 text-sm text-muted-foreground">
|
||||
<div className="flex items-center gap-3 text-sm text-muted-foreground">
|
||||
<div className="flex items-center gap-1">
|
||||
<Download className="h-4 w-4" />
|
||||
<Download className="h-3.5 w-3.5" />
|
||||
<span>{(pluginStats[plugin.id]?.downloads ?? plugin.downloads ?? 0).toLocaleString()}</span>
|
||||
</div>
|
||||
<div className="flex items-center gap-1">
|
||||
<Star className="h-4 w-4 fill-yellow-400 text-yellow-400" />
|
||||
<Star className="h-3.5 w-3.5 fill-yellow-400 text-yellow-400" />
|
||||
<span>{(pluginStats[plugin.id]?.rating ?? plugin.rating ?? 0).toFixed(1)}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -85,7 +85,7 @@ export function PluginCard({
|
||||
)}
|
||||
</div>
|
||||
{/* 版本和作者 */}
|
||||
<div className="text-xs text-muted-foreground pt-2 border-t space-y-1">
|
||||
<div className="text-xs text-muted-foreground pt-2.5 border-t space-y-1">
|
||||
<div>v{plugin.manifest?.version || 'unknown'} · {plugin.manifest?.author?.name || 'Unknown'}</div>
|
||||
{/* 支持版本 */}
|
||||
{plugin.manifest?.host_application && (
|
||||
@@ -103,7 +103,7 @@ export function PluginCard({
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
<CardFooter className="pt-4">
|
||||
<CardFooter className="px-5 pt-2 pb-5">
|
||||
<div className="flex items-center justify-end gap-2 w-full">
|
||||
<Button
|
||||
variant="outline"
|
||||
@@ -169,7 +169,7 @@ export function PluginCard({
|
||||
(loadProgress.stage === 'loading' || loadProgress.stage === 'success' || loadProgress.stage === 'error') &&
|
||||
loadProgress.operation !== 'fetch' &&
|
||||
loadProgress.plugin_id === plugin.id && (
|
||||
<div className="px-6 pb-4 -mt-2">
|
||||
<div className="px-5 pb-5 -mt-1">
|
||||
<div className={`space-y-2 p-3 rounded-lg border ${
|
||||
loadProgress.stage === 'success'
|
||||
? 'bg-green-50 dark:bg-green-950/20 border-green-200 dark:border-green-900'
|
||||
|
||||
@@ -48,6 +48,9 @@ export function PluginsPage() {
|
||||
function PluginsPageContent() {
|
||||
const navigate = useNavigate()
|
||||
const { triggerRestart, isRestarting } = useRestart()
|
||||
const [restartNoticeVisible, setRestartNoticeVisible] = useState(
|
||||
() => localStorage.getItem('plugins-restart-notice-dismissed') !== 'true'
|
||||
)
|
||||
const [searchQuery, setSearchQuery] = useState('')
|
||||
const [categoryFilter, setCategoryFilter] = useState('all')
|
||||
const [activeTab, setActiveTab] = useState('all') // all | installed | updates
|
||||
@@ -67,6 +70,11 @@ function PluginsPageContent() {
|
||||
|
||||
const { toast } = useToast()
|
||||
|
||||
const dismissRestartNotice = () => {
|
||||
localStorage.setItem('plugins-restart-notice-dismissed', 'true')
|
||||
setRestartNoticeVisible(false)
|
||||
}
|
||||
|
||||
// 加载插件统计数据
|
||||
const loadPluginStats = async (pluginList: PluginInfo[]) => {
|
||||
const statsPromises = pluginList.map(async (plugin) => {
|
||||
@@ -705,16 +713,23 @@ function PluginsPageContent() {
|
||||
</div>
|
||||
|
||||
{/* 安装提示 */}
|
||||
<Card className="border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900">
|
||||
<CardContent className="py-3">
|
||||
<div className="flex items-center gap-2">
|
||||
<Info className="h-4 w-4 text-blue-600 flex-shrink-0" />
|
||||
<p className="text-sm text-blue-800 dark:text-blue-200">
|
||||
安装、卸载或更新插件后,需要<span className="font-semibold">重启麦麦</span>才能使更改生效
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
{restartNoticeVisible && (
|
||||
<Card className="border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900">
|
||||
<CardContent className="py-3">
|
||||
<div className="flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
<Info className="h-4 w-4 text-blue-600 flex-shrink-0" />
|
||||
<p className="text-sm text-blue-800 dark:text-blue-200">
|
||||
安装、卸载或更新插件后,部分插件需要<span className="font-semibold">重启麦麦</span>才能生效
|
||||
</p>
|
||||
</div>
|
||||
<Button type="button" variant="outline" size="sm" onClick={dismissRestartNotice}>
|
||||
我知道了
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{/* Git 状态警告 */}
|
||||
{gitStatus && !gitStatus.installed && (
|
||||
|
||||
Reference in New Issue
Block a user