Files
Virtnet.bond/extensions/Servers/Proxmox/views/components/ui/progress.blade.php
Joseph.Rawlings e7b33a2f6c Refactor Proxmox server views for improved UI consistency and usability
- Updated server card component to use new UI elements and improved layout.
- Enhanced status display with badges and better status indicators.
- Refined quick info row for server details with consistent styling.
- Reorganized server configuration statistics into stat cards for clarity.
- Improved help modals for statistics and storage management sections.
- Streamlined alerts and warnings for better user experience.
- Updated storage management view to utilize new UI components and improve readability.
2025-12-17 11:24:17 -05:00

81 lines
2.3 KiB
PHP

{{--
Progress Bar Component - TailServer Theme
Usage:
<x-proxmox::ui.progress :value="75" />
<x-proxmox::ui.progress :value="90" color="danger" showLabel />
<x-proxmox::ui.progress :value="60" color="auto" />
--}}
@props([
'value' => 0,
'max' => 100,
'color' => 'primary',
'size' => 'md',
'showLabel' => false,
'label' => null,
'gradient' => null,
'animated' => false,
'striped' => false,
])
@php
$percent = $max > 0 ? min(100, ($value / $max) * 100) : 0;
$colorClasses = [
'primary' => 'bg-primary',
'secondary' => 'bg-secondary',
'success' => 'bg-success',
'warning' => 'bg-warning',
'danger' => 'bg-danger',
'info' => 'bg-info',
];
$sizeClasses = [
'xs' => 'h-1',
'sm' => 'h-1.5',
'md' => 'h-2',
'lg' => 'h-2.5',
'xl' => 'h-3',
];
$colorClass = $colorClasses[$color] ?? $colorClasses['primary'];
$sizeClass = $sizeClasses[$size] ?? $sizeClasses['md'];
// Auto-select color based on value if specified
if ($color === 'auto') {
if ($percent >= 90) {
$colorClass = $colorClasses['danger'];
} elseif ($percent >= 70) {
$colorClass = $colorClasses['warning'];
} else {
$colorClass = $colorClasses['success'];
}
}
@endphp
<div {{ $attributes->class(['w-full']) }}>
@if($showLabel || $label)
<div class="flex items-center justify-between text-xs mb-1.5">
<span class="text-base/50 font-medium">{{ $label ?? 'Usage' }}</span>
<span class="font-semibold text-base/70">{{ number_format($percent, 1) }}%</span>
</div>
@endif
<div class="{{ $sizeClass }} rounded-full bg-neutral/10 overflow-hidden">
<div
@class([
$sizeClass,
'rounded-full transition-all duration-500 ease-out',
$colorClass => !$gradient,
'animate-pulse' => $animated,
'bg-[length:1rem_1rem] bg-gradient-to-r from-white/20 via-transparent to-transparent' => $striped,
])
@if($gradient)
style="width: {{ $percent }}%; background-image: {{ $gradient }};"
@else
style="width: {{ $percent }}%;"
@endif
></div>
</div>
</div>