Files
laralog/resources/views/filament/pages/themes.blade.php
T

68 lines
3.9 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<x-filament-panels::page>
<x-filament::section heading="主题列表">
<div style="display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:1.25rem">
@forelse($this->themes as $theme)
<x-filament::section :compact="true" class="!p-0">
<div class="flex flex-col">
{{-- 主题预览图 --}}
<div style="position:relative;aspect-ratio:4/3;overflow:hidden;border-top-left-radius:0.75rem;border-top-right-radius:0.75rem;background:rgba(128,128,128,.08)">
@if($theme['screenshot'])
<img src="{{ theme('asset', $theme['screenshot'], $theme['name']) }}"
alt="{{ $theme['title'] }} 预览"
style="width:100%;height:100%;object-fit:cover;object-position:top;transition:transform .3s" onmouseover="this.style.transform='scale(1.05)'" onmouseout="this.style.transform='scale(1)'">
@else
<div class="flex h-full items-center justify-center text-gray-400">
<x-filament::icon icon="heroicon-o-photo" class="h-10 w-10" />
</div>
@endif
@if($theme['active'])
<div class="absolute left-3 top-3">
<x-filament::badge color="success">使用中</x-filament::badge>
</div>
@endif
</div>
<div class="flex flex-1 flex-col p-5">
<div class="flex items-center justify-between">
<h3 class="font-semibold">{{ $theme['title'] }}</h3>
<span class="text-xs text-gray-400">v{{ $theme['version'] }}</span>
</div>
<p class="mt-1 flex-1 text-sm text-gray-500 dark:text-gray-400">{{ $theme['description'] }}</p>
<p class="mt-1 text-xs text-gray-400">{{ $theme['author'] }}</p>
@if($theme['inject_points'])
<div class="mt-3 flex flex-wrap gap-1">
@foreach($theme['inject_points'] as $point)
<x-filament::badge color="gray" size="xs">{{ $point }}</x-filament::badge>
@endforeach
</div>
@endif
<div class="mt-4 flex gap-2">
@if(! $theme['active'])
<x-filament::button size="sm" color="primary" wire:click="activateTheme('{{ $theme['name'] }}')">启用</x-filament::button>
<x-filament::button size="sm" color="danger" wire:click="uninstallTheme('{{ $theme['name'] }}')" wire:confirm="确定删除该主题?">删除</x-filament::button>
@endif
</div>
</div>
</div>
</x-filament::section>
@empty
<p class="text-sm text-gray-500">暂无主题</p>
@endforelse
</div>
</x-filament::section>
<x-filament::section heading="安装主题(ZIP">
<form wire:submit="uploadThemeZip" class="flex items-end gap-3">
<div class="flex-1">
<x-filament::input.wrapper>
<x-filament::input type="file" wire:model="zip" accept=".zip" />
</x-filament::input.wrapper>
@error('zip') <p class="mt-1 text-sm text-danger-600">{{ $message }}</p> @enderror
</div>
<x-filament::button type="submit" color="primary">安装</x-filament::button>
</form>
</x-filament::section>
</x-filament-panels::page>