- 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.
137 lines
4.9 KiB
PHP
137 lines
4.9 KiB
PHP
@props([
|
|
'variant' => 'info',
|
|
'title' => null,
|
|
'icon' => null,
|
|
'dismissible' => false,
|
|
'collapsible' => false,
|
|
'collapsed' => false,
|
|
'storageKey' => null,
|
|
'border' => true,
|
|
])
|
|
|
|
@php
|
|
// Variant classes
|
|
$variantClasses = match($variant) {
|
|
'success' => 'bg-success/10 border-success/30 text-success',
|
|
'danger', 'error' => 'bg-danger/10 border-danger/30 text-danger',
|
|
'warning' => 'bg-warning/10 border-warning/30 text-warning',
|
|
'info' => 'bg-info/10 border-info/30 text-info',
|
|
'neutral' => 'bg-neutral/10 border-neutral/30 text-base/80',
|
|
default => 'bg-info/10 border-info/30 text-info',
|
|
};
|
|
|
|
// Default icons per variant
|
|
$defaultIcon = match($variant) {
|
|
'success' => 'ri-checkbox-circle-fill',
|
|
'danger', 'error' => 'ri-error-warning-fill',
|
|
'warning' => 'ri-alert-fill',
|
|
'info' => 'ri-information-line',
|
|
'neutral' => 'ri-information-line',
|
|
default => 'ri-information-line',
|
|
};
|
|
|
|
$alertIcon = $icon ?? $defaultIcon;
|
|
$borderClasses = $border ? 'border' : '';
|
|
$baseClasses = "$variantClasses $borderClasses rounded-lg p-4";
|
|
@endphp
|
|
|
|
<div
|
|
{{ $attributes->merge(['class' => $baseClasses]) }}
|
|
@if($dismissible || $collapsible)
|
|
x-data="{
|
|
show: true,
|
|
isCollapsed: {{ $collapsed ? 'true' : 'false' }},
|
|
init() {
|
|
@if($storageKey)
|
|
@if($dismissible)
|
|
this.show = localStorage.getItem('{{ $storageKey }}-dismissed') !== 'true';
|
|
@endif
|
|
@if($collapsible)
|
|
this.isCollapsed = localStorage.getItem('{{ $storageKey }}-collapsed') === 'true';
|
|
@endif
|
|
@endif
|
|
},
|
|
dismiss() {
|
|
this.show = false;
|
|
@if($storageKey)
|
|
localStorage.setItem('{{ $storageKey }}-dismissed', 'true');
|
|
@endif
|
|
},
|
|
toggle() {
|
|
this.isCollapsed = !this.isCollapsed;
|
|
@if($storageKey)
|
|
localStorage.setItem('{{ $storageKey }}-collapsed', this.isCollapsed);
|
|
@endif
|
|
}
|
|
}"
|
|
x-show="show"
|
|
x-transition:enter="transition ease-out duration-300"
|
|
x-transition:enter-start="opacity-0 transform -translate-y-2"
|
|
x-transition:enter-end="opacity-100 transform translate-y-0"
|
|
x-transition:leave="transition ease-in duration-200"
|
|
x-transition:leave-start="opacity-100"
|
|
x-transition:leave-end="opacity-0"
|
|
@endif
|
|
>
|
|
<div class="flex items-start gap-3">
|
|
{{-- Icon --}}
|
|
@if($alertIcon)
|
|
<x-dynamic-component :component="$alertIcon" class="size-5 flex-shrink-0 mt-0.5" />
|
|
@endif
|
|
|
|
{{-- Content --}}
|
|
<div class="flex-1 min-w-0">
|
|
{{-- Header with title and controls --}}
|
|
@if($title || $dismissible || $collapsible)
|
|
<div class="flex items-center justify-between gap-2 mb-1">
|
|
@if($title)
|
|
<h3 class="text-sm font-semibold">{{ $title }}</h3>
|
|
@endif
|
|
|
|
<div class="flex items-center gap-1">
|
|
@if($collapsible)
|
|
<button
|
|
@click="toggle()"
|
|
type="button"
|
|
class="opacity-60 hover:opacity-100 transition-opacity p-0.5"
|
|
>
|
|
<x-ri-arrow-down-s-line
|
|
x-bind:class="isCollapsed ? 'size-4 transition-transform duration-200 rotate-180' : 'size-4 transition-transform duration-200'"
|
|
/>
|
|
</button>
|
|
@endif
|
|
|
|
@if($dismissible)
|
|
<button
|
|
@click="dismiss()"
|
|
type="button"
|
|
class="opacity-60 hover:opacity-100 transition-opacity p-0.5"
|
|
>
|
|
<x-ri-close-line class="size-4" />
|
|
</button>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
@endif
|
|
|
|
{{-- Body --}}
|
|
@if($collapsible)
|
|
<div x-show="!isCollapsed" x-collapse x-cloak class="text-sm opacity-90">
|
|
{{ $slot }}
|
|
</div>
|
|
@else
|
|
<div class="text-sm opacity-90">
|
|
{{ $slot }}
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Actions slot --}}
|
|
@if(isset($actions))
|
|
<div class="mt-4 flex items-center gap-2">
|
|
{{ $actions }}
|
|
</div>
|
|
@endif
|
|
</div>
|