Files
AndyTranscribe/app/View/Components/DiskSpaceBar.php
T
ben b3fb74fb1b
CI / test (push) Failing after 31s
CI / build-and-push (push) Skipped
CI / deploy (push) Skipped
Make the disk space meter visible and show used percent.
Use an inline-colored full-width progress bar so the fill renders without relying on purged Tailwind classes.
2026-08-13 00:37:20 +02:00

44 lines
922 B
PHP

<?php
namespace App\View\Components;
use App\Services\DiskSpaceService;
use Closure;
use Illuminate\Contracts\View\View;
use Illuminate\View\Component;
class DiskSpaceBar extends Component
{
/**
* @var array{
* total_bytes: int,
* free_bytes: int,
* used_bytes: int,
* used_percent: float,
* free_percent: float,
* total_human: string,
* free_human: string,
* used_human: string
* }|null
*/
public readonly ?array $disk;
public function __construct(DiskSpaceService $diskSpace)
{
$this->disk = $diskSpace->snapshot();
}
public function shouldRender(): bool
{
return $this->disk !== null;
}
/**
* Get the view / contents that represent the component.
*/
public function render(): View|Closure|string
{
return view('components.disk-space-bar');
}
}