wip: pagination
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Twig\Components;
|
||||
|
||||
use App\Download\Framework\Repository\DownloadRepository;
|
||||
use App\Util\Paginator;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\UX\LiveComponent\Attribute\AsLiveComponent;
|
||||
use Symfony\UX\LiveComponent\DefaultActionTrait;
|
||||
@@ -13,12 +15,16 @@ final class DownloadList extends AbstractController
|
||||
|
||||
public string $type;
|
||||
|
||||
public function __construct(
|
||||
private readonly DownloadRepository $downloadRepository,
|
||||
) {}
|
||||
|
||||
public function getDownloads()
|
||||
{
|
||||
if ($this->type === "active") {
|
||||
return $this->getUser()->queryDownloads('in-progress', 5);
|
||||
return $this->downloadRepository->getActivePaginated();
|
||||
} elseif ($this->type === "complete") {
|
||||
return $this->getUser()->queryDownloads('complete', 5);
|
||||
return $this->downloadRepository->getCompletePaginated();
|
||||
}
|
||||
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user