- Implemented page load animations using Alpine.js for smoother transitions in various views including firewall, help, index, network, overview, reinstall, server, statistics, storage, subdomain, and system. - Added opacity and translate effects to elements for improved visual feedback during loading. - Enhanced hover effects on cards and buttons for better user interaction. - Adjusted transition timings and delays for a more cohesive user experience.
124 lines
5.1 KiB
PHP
124 lines
5.1 KiB
PHP
{{--
|
|
Stat Card Component - AdminLTE Theme
|
|
Based on AdminLTE v4 Small Box / Info Box styling patterns
|
|
|
|
Usage:
|
|
<x-proxmox::ui.stat-card value="12" label="CPU %" />
|
|
<x-proxmox::ui.stat-card value="8.5" suffix="GB" label="Memory" icon="ri-database-2-line" />
|
|
<x-proxmox::ui.stat-card value="3" label="Servers" status="success" statusText="All active" />
|
|
--}}
|
|
|
|
@props([
|
|
'value',
|
|
'label',
|
|
'suffix' => null,
|
|
'prefix' => null,
|
|
'icon' => null,
|
|
'iconClass' => '',
|
|
'variant' => null, // primary, success, warning, danger, info
|
|
'status' => null,
|
|
'statusText' => null,
|
|
'href' => null,
|
|
'progress' => null,
|
|
'progressColor' => 'primary',
|
|
'clickable' => false,
|
|
'compact' => false,
|
|
'change' => null,
|
|
'changeLabel' => null,
|
|
])
|
|
|
|
@php
|
|
$tag = $href ? 'a' : 'div';
|
|
|
|
$variantConfig = [
|
|
'primary' => ['bg' => 'bg-primary', 'class' => 'lte-bg-primary'],
|
|
'success' => ['bg' => 'bg-success', 'class' => 'lte-bg-success'],
|
|
'warning' => ['bg' => 'bg-warning', 'class' => 'lte-bg-warning'],
|
|
'danger' => ['bg' => 'bg-danger', 'class' => 'lte-bg-danger'],
|
|
'info' => ['bg' => 'bg-info', 'class' => 'lte-bg-info'],
|
|
];
|
|
|
|
$progressColors = [
|
|
'primary' => 'lte-bg-primary',
|
|
'success' => 'lte-bg-success',
|
|
'warning' => 'lte-bg-warning',
|
|
'danger' => 'lte-bg-danger',
|
|
'info' => 'lte-bg-info',
|
|
];
|
|
|
|
$statusClasses = [
|
|
'success' => 'lte-text-success',
|
|
'warning' => 'lte-text-warning',
|
|
'danger' => 'lte-text-danger',
|
|
'info' => 'lte-text-info',
|
|
'muted' => 'lte-text-muted',
|
|
];
|
|
$statusClass = $statusClasses[$status] ?? '';
|
|
$progressBarColor = $progressColors[$progressColor] ?? $progressColors['primary'];
|
|
@endphp
|
|
|
|
@if($variant)
|
|
{{-- Small Box Style (colored background) --}}
|
|
<{{ $tag }}
|
|
@if($href) href="{{ $href }}" @endif
|
|
{{ $attributes->class([
|
|
'lte-small-box lte-fade-in transition-all duration-300 hover:shadow-lg hover:-translate-y-0.5 hover:scale-[1.01]',
|
|
$variantConfig[$variant]['class'] ?? 'lte-bg-primary',
|
|
]) }}
|
|
>
|
|
<div class="lte-inner">
|
|
<h3 class="transition-transform duration-200 group-hover:scale-105">{{ $prefix }}{{ $value }}@if($suffix)<sup style="font-size: 0.6em;">{{ $suffix }}</sup>@endif</h3>
|
|
<p class="transition-opacity duration-200 opacity-90 group-hover:opacity-100">{{ $label }}</p>
|
|
</div>
|
|
@if($icon)
|
|
<div class="lte-icon transition-transform duration-300 hover:scale-110 hover:rotate-3">
|
|
<x-dynamic-component :component="$icon" style="font-size: 70px; width: 70px; height: 70px;" />
|
|
</div>
|
|
@endif
|
|
@if($statusText)
|
|
<div class="lte-small-box-footer transition-colors duration-200 hover:bg-black/10">
|
|
{{ $statusText }} <x-ri-arrow-right-line class="inline size-4 transition-transform duration-200 group-hover:translate-x-1" />
|
|
</div>
|
|
@endif
|
|
</{{ $tag }}>
|
|
@else
|
|
{{-- Info Box Style (white background with icon accent) --}}
|
|
<{{ $tag }}
|
|
@if($href) href="{{ $href }}" @endif
|
|
{{ $attributes->class([
|
|
'lte-info-box lte-fade-in group transition-all duration-300 hover:shadow-md hover:-translate-y-0.5',
|
|
'cursor-pointer' => $href || $clickable,
|
|
]) }}
|
|
>
|
|
@if($icon)
|
|
<span class="lte-info-box-icon lte-bg-primary rounded transition-transform duration-300 group-hover:scale-110" style="color: #fff;">
|
|
<x-dynamic-component :component="$icon" class="size-6 {{ $iconClass }}" />
|
|
</span>
|
|
@endif
|
|
<div class="lte-info-box-content">
|
|
<span class="lte-info-box-text transition-opacity duration-200 opacity-80 group-hover:opacity-100">{{ $label }}</span>
|
|
<span class="lte-info-box-number transition-colors duration-200 group-hover:text-primary">
|
|
@if($prefix)<small class="lte-text-muted">{{ $prefix }}</small>@endif{{ $value }}@if($suffix)<small class="lte-text-muted">{{ $suffix }}</small>@endif
|
|
</span>
|
|
@if($change !== null || $changeLabel)
|
|
<div style="font-size: 0.8rem;" class="lte-text-muted">
|
|
@if($change !== null)
|
|
<span class="{{ $change >= 0 ? 'lte-text-success' : 'lte-text-danger' }}" style="font-weight: 600;">
|
|
{{ $change >= 0 ? '+' : '' }}{{ $change }}%
|
|
</span>
|
|
@endif
|
|
{{ $changeLabel ?? 'from last period' }}
|
|
</div>
|
|
@endif
|
|
@if($progress !== null)
|
|
<div class="lte-progress lte-progress-sm" style="margin-top: 0.5rem;">
|
|
<div class="lte-progress-bar {{ $progressBarColor }}" style="width: {{ min(100, $progress) }}%"></div>
|
|
</div>
|
|
@endif
|
|
@if($statusText)
|
|
<span class="lte-progress-description {{ $statusClass }}">{{ $statusText }}</span>
|
|
@endif
|
|
</div>
|
|
</{{ $tag }}>
|
|
@endif
|