style: 插件卡片视觉层级重构(标题/元信息/描述/操作区分)

- 已安装插件卡片:图标块 + 标题 + vendor/版本元信息 + 状态徽章同一行(清晰层级),描述独立文本块,操作区与内容用分隔线隔开
- 插件市场卡片统一同款风格;全部关键布局用内联样式保证渲染稳定
This commit is contained in:
ak
2026-08-12 04:04:13 +08:00
parent 01861f8809
commit 4ff1848816
@@ -1,32 +1,41 @@
<x-filament-panels::page>
<x-filament::section heading="已安装插件">
<div style="display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:1rem">
<div style="display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:1rem">
@forelse($this->plugins as $plugin)
<x-filament::section :compact="true">
<div class="flex flex-col">
<div class="flex items-start justify-between gap-3">
<x-filament::icon icon="heroicon-o-puzzle-piece" class="h-8 w-8 text-primary-600" />
@if($plugin['enabled'])
<x-filament::badge color="success">已启用</x-filament::badge>
@else
<x-filament::badge color="gray">已停用</x-filament::badge>
@endif
<x-filament::section :compact="true" style="padding:0">
<div style="display:flex;flex-direction:column;height:100%">
{{-- 头部:图标 + 标题 + 元信息 + 状态 --}}
<div style="display:flex;align-items:flex-start;gap:12px;padding:16px 16px 0">
<div style="display:flex;align-items:center;justify-content:center;width:42px;height:42px;border-radius:10px;background:rgba(37,99,235,.1);flex-shrink:0">
<x-filament::icon icon="heroicon-o-puzzle-piece" class="h-5 w-5 text-primary-600" />
</div>
<div style="flex:1;min-width:0">
<h3 style="font-size:15px;font-weight:600;line-height:1.35;margin:0;color:inherit">{{ $plugin['title'] }}</h3>
<p style="font-size:12px;color:#6b7280;margin:3px 0 0">{{ $plugin['vendor'] }}.{{ $plugin['name'] }} · v{{ $plugin['version'] }}</p>
</div>
<div style="flex-shrink:0">
@if($plugin['enabled'])
<x-filament::badge color="success">已启用</x-filament::badge>
@else
<x-filament::badge color="gray">已停用</x-filament::badge>
@endif
</div>
</div>
<h3 class="mt-3 text-base font-semibold">{{ $plugin['title'] }}</h3>
<p class="mt-1 flex-1 text-sm text-gray-500 dark:text-gray-400">{{ $plugin['description'] }}</p>
<p class="mt-2 text-xs text-gray-400">v{{ $plugin['version'] }} · {{ $plugin['vendor'] }}.{{ $plugin['name'] }}</p>
{{-- 描述 --}}
<p style="flex:1;font-size:13px;color:#6b7280;line-height:1.6;margin:12px 16px 0;padding:0">{{ $plugin['description'] }}</p>
@if(! empty($plugin['usage']))
<details class="mt-2">
<summary class="cursor-pointer text-xs text-primary-600">使用说明</summary>
<div class="mt-1 whitespace-pre-wrap text-xs text-gray-500 dark:text-gray-400">{{ $plugin['usage'] }}</div>
<details style="margin:10px 16px 0">
<summary style="cursor:pointer;font-size:12px;color:#2563eb;list-style:none">使用说明</summary>
<div style="margin-top:6px;white-space:pre-wrap;font-size:12px;color:#6b7280;line-height:1.6">{{ $plugin['usage'] }}</div>
</details>
@endif
{{-- 依赖状态 --}}
@if(! empty($plugin['dependencies']))
<div class="mt-2 flex flex-wrap items-center gap-1">
<span class="text-xs text-gray-400">依赖:</span>
<div style="display:flex;flex-wrap:wrap;align-items:center;gap:4px;margin:10px 16px 0">
<span style="font-size:12px;color:#9ca3af">依赖:</span>
@foreach($plugin['dependencies'] as $dep)
<x-filament::badge :color="$dep['ok'] ? 'success' : 'danger'" size="xs">
{{ $dep['title'] }}@if(! $dep['ok']){{ $dep['reason'] }}@endif
@@ -35,7 +44,8 @@
</div>
@endif
<div class="mt-4 flex flex-wrap gap-2">
{{-- 操作区 --}}
<div style="display:flex;flex-wrap:wrap;gap:8px;padding:14px 16px 16px;margin-top:14px;border-top:1px solid rgba(128,128,128,.15)">
@if($plugin['enabled'])
<x-filament::button size="sm" color="gray" wire:click="disablePlugin('{{ $plugin['key'] }}')">停用</x-filament::button>
@elseif(empty($plugin['dependency_errors']))
@@ -50,7 +60,7 @@
</div>
</x-filament::section>
@empty
<p class="text-sm text-gray-500">暂无插件</p>
<p style="font-size:14px;color:#6b7280">暂无插件</p>
@endforelse
</div>
</x-filament::section>
@@ -71,23 +81,31 @@
<div class="mb-4">
<x-filament::button color="gray" wire:click="loadMarket">刷新市场</x-filament::button>
</div>
<div style="display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:1rem">
<div style="display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:1rem">
@forelse($marketItems as $index => $item)
@php $marketPaid = $item['price'] > 0; @endphp
<x-filament::section :compact="true">
<div class="flex flex-col">
<div class="flex items-start justify-between gap-3">
<x-filament::icon icon="heroicon-o-cloud-arrow-down" class="h-8 w-8 text-primary-600" />
@if($marketPaid)
<x-filament::badge color="warning">¥{{ number_format($item['price'] / 100, 2) }}</x-filament::badge>
@else
<x-filament::badge color="success">免费</x-filament::badge>
@endif
<x-filament::section :compact="true" style="padding:0">
<div style="display:flex;flex-direction:column;height:100%">
<div style="display:flex;align-items:flex-start;gap:12px;padding:16px 16px 0">
<div style="display:flex;align-items:center;justify-content:center;width:42px;height:42px;border-radius:10px;background:rgba(37,99,235,.1);flex-shrink:0">
<x-filament::icon icon="heroicon-o-cloud-arrow-down" class="h-5 w-5 text-primary-600" />
</div>
<div style="flex:1;min-width:0">
<h3 style="font-size:15px;font-weight:600;line-height:1.35;margin:0">{{ $item['title'] ?? $item['name'] }}</h3>
<p style="font-size:12px;color:#6b7280;margin:3px 0 0">{{ $item['version'] ?? '' }}@if(! empty($item['author'])) · {{ $item['author'] }}@endif</p>
</div>
<div style="flex-shrink:0">
@if($marketPaid)
<x-filament::badge color="warning">¥{{ number_format($item['price'] / 100, 2) }}</x-filament::badge>
@else
<x-filament::badge color="success">免费</x-filament::badge>
@endif
</div>
</div>
<h3 class="mt-3 text-base font-semibold">{{ $item['title'] ?? $item['name'] }}</h3>
<p class="mt-1 flex-1 text-sm text-gray-500 dark:text-gray-400">{{ $item['description'] ?? '' }}</p>
<p class="mt-2 text-xs text-gray-400">{{ $item['version'] ?? '' }} · {{ $item['author'] ?? '' }}</p>
<div class="mt-4 flex flex-wrap gap-2">
<p style="flex:1;font-size:13px;color:#6b7280;line-height:1.6;margin:12px 16px 0;padding:0">{{ $item['description'] ?? '' }}</p>
<div style="display:flex;flex-wrap:wrap;gap:8px;padding:14px 16px 16px;margin-top:14px;border-top:1px solid rgba(128,128,128,.15)">
@if($marketPaid && ! $this->isMarketPurchased($index))
<x-filament::button size="sm" color="primary" wire:click="purchaseMarketItem({{ $index }})">购买</x-filament::button>
@elseif($marketPaid)
@@ -98,7 +116,7 @@
</div>
</x-filament::section>
@empty
<p class="text-sm text-gray-500">点击「刷新市场」拉取可用插件</p>
<p style="font-size:14px;color:#6b7280">点击「刷新市场」拉取可用插件</p>
@endforelse
</div>
</x-filament::section>