Revert "Merge pull request #3380 from Roardom/livewire-types"

This reverts commit a4e1a1bc62, reversing
changes made to 10982c68bd.
This commit is contained in:
HDVinnie
2024-01-14 16:18:08 -05:00
parent d7d619869b
commit b4a9dfea8b
52 changed files with 1063 additions and 626 deletions
+12 -12
View File
@@ -15,13 +15,11 @@ namespace App\Http\Livewire;
use App\Models\History;
use App\Models\User;
use App\Traits\LivewireSort;
use Livewire\Component;
use Livewire\WithPagination;
class UserTorrents extends Component
{
use LivewireSort;
use WithPagination;
public ?User $user = null;
@@ -46,20 +44,14 @@ class UserTorrents extends Component
public string $downloaded = 'any';
/**
* @var string[]
*/
public array $status = [];
public string $sortField = 'created_at';
public string $sortDirection = 'desc';
public bool $showMorePrecision = false;
public $showMorePrecision = false;
/**
* @var array<mixed>
*/
protected $queryString = [
'perPage' => ['except' => ''],
'name' => ['except' => ''],
@@ -92,9 +84,6 @@ class UserTorrents extends Component
$this->resetPage();
}
/**
* @return \Illuminate\Contracts\Pagination\LengthAwarePaginator<History>
*/
final public function getHistoryProperty(): \Illuminate\Contracts\Pagination\LengthAwarePaginator
{
return History::query()
@@ -180,4 +169,15 @@ class UserTorrents extends Component
'histories' => $this->history,
]);
}
final public function sortBy($field): void
{
if ($this->sortField === $field) {
$this->sortDirection = $this->sortDirection === 'asc' ? 'desc' : 'asc';
} else {
$this->sortDirection = 'asc';
}
$this->sortField = $field;
}
}